|
1 | 1 | using Newtonsoft.Json; |
2 | 2 | using Newtonsoft.Json.Linq; |
| 3 | +using System.Text.Json.Serialization; |
3 | 4 |
|
4 | 5 | namespace Amino.Objects |
5 | 6 | { |
6 | 7 |
|
7 | | - [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] |
| 8 | + // ROOT JSON ELEMENT: o/chatMessage |
8 | 9 | public class SpecialChatEvent |
9 | 10 | { |
10 | | - |
11 | | - public int _type { get; } |
12 | | - public int communityId { get; } |
13 | | - public int alertOption { get; } |
14 | | - public int membershipStatus { get; } |
15 | | - |
16 | | - public string chatId { get; } |
17 | | - public int mediaType { get; } |
18 | | - public int clientRefId { get; } |
19 | | - public string messageId { get; } |
20 | | - public string userId { get; } |
21 | | - public string createdTime { get; } |
22 | | - public int type { get; } |
23 | | - public bool isHidden { get; } |
24 | | - public bool includedInSummary { get; } |
25 | | - public string json { get; } |
26 | | - public _Author Author { get; } |
27 | | - |
28 | | - public SpecialChatEvent(JObject _json) |
29 | | - { |
30 | | - dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); |
31 | | - _type = (int)jsonObj["t"]; |
32 | | - communityId = (int)jsonObj["o"]["ndcId"]; |
33 | | - alertOption = (int)jsonObj["o"]["alertOption"]; |
34 | | - membershipStatus = (int)jsonObj["o"]["membershipStatus"]; |
35 | | - |
36 | | - chatId = (string)jsonObj["o"]["chatMessage"]["threadId"]; |
37 | | - mediaType = (int)jsonObj["o"]["chatMessage"]["mediaType"]; |
38 | | - clientRefId = (int)jsonObj["o"]["chatMessage"]["clientRefId"]; |
39 | | - messageId = (string)jsonObj["o"]["chatMessage"]["messageId"]; |
40 | | - userId = (string)jsonObj["o"]["chatMessage"]["uid"]; |
41 | | - createdTime = (string)jsonObj["o"]["chatMessage"]["createdTime"]; |
42 | | - type = (int)jsonObj["o"]["chatMessage"]["type"]; |
43 | | - isHidden = (bool)jsonObj["o"]["chatMessage"]["isHidden"]; |
44 | | - includedInSummary = (bool)jsonObj["o"]["chatMessage"]["includedInSummary"]; |
45 | | - json = _json.ToString(); |
46 | | - Author = new _Author(_json); |
47 | | - } |
48 | | - |
49 | | - |
50 | | - [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] |
51 | | - public class _Author |
52 | | - { |
53 | | - public string userId { get; } |
54 | | - public int status { get; } |
55 | | - public string iconUrl { get; } |
56 | | - public int reputation { get; } |
57 | | - public int role { get; } |
58 | | - public string nickname { get; } |
59 | | - public int level { get; } |
60 | | - public int accountMembershipStatus { get; } |
61 | | - public _AvatarFrame AvatarFrame { get; } |
62 | | - public _InfluencerInfo InfluencerInfo { get; } |
63 | | - |
64 | | - public _Author(JObject _json) |
65 | | - { |
66 | | - dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); |
67 | | - userId = (string)jsonObj["o"]["chatMessage"]["author"]["uid"]; |
68 | | - status = (int)jsonObj["o"]["chatMessage"]["author"]["status"]; |
69 | | - if (jsonObj["o"]["chatMessage"]["author"]["icon"] != null) { iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["icon"]; } |
70 | | - reputation = (int)jsonObj["o"]["chatMessage"]["author"]["reputation"]; |
71 | | - role = (int)jsonObj["o"]["chatMessage"]["author"]["role"]; |
72 | | - nickname = (string)jsonObj["o"]["chatMessage"]["author"]["nickname"]; |
73 | | - level = (int)jsonObj["o"]["chatMessage"]["author"]["level"]; |
74 | | - accountMembershipStatus = (int)jsonObj["o"]["chatMessage"]["author"]["accountMembershipStatus"]; |
75 | | - if (jsonObj["o"]["chatMessage"]["author"]["avatarFrame"] != null) { AvatarFrame = new _AvatarFrame(_json); } |
76 | | - if (jsonObj["o"]["chatMessage"]["author"]["influencerInfo"] != null) { InfluencerInfo = new _InfluencerInfo(_json); } |
77 | | - |
78 | | - |
79 | | - } |
80 | | - |
81 | | - |
82 | | - [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] |
83 | | - public class _AvatarFrame |
84 | | - { |
85 | | - public int status { get; } |
86 | | - public int version { get; } |
87 | | - public string resourceUrl { get; } |
88 | | - public string name { get; } |
89 | | - public string iconUrl { get; } |
90 | | - public int frameType { get; } |
91 | | - public string frameId { get; } |
92 | | - |
93 | | - public _AvatarFrame(JObject _json) |
94 | | - { |
95 | | - dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); |
96 | | - status = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["status"]; |
97 | | - version = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["version"]; |
98 | | - resourceUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["resourceUrl"]; |
99 | | - name = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["name"]; |
100 | | - iconUrl = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["icon"]; |
101 | | - frameType = (int)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameType"]; |
102 | | - frameId = (string)jsonObj["o"]["chatMessage"]["author"]["avatarFrame"]["frameId"]; |
103 | | - } |
104 | | - } |
105 | | - |
106 | | - |
107 | | - [JsonObject(ItemNullValueHandling = NullValueHandling.Ignore)] |
108 | | - public class _InfluencerInfo |
109 | | - { |
110 | | - public int fansCount { get; } |
111 | | - public int monthlyFee { get; } |
112 | | - |
113 | | - public _InfluencerInfo(JObject _json) |
114 | | - { |
115 | | - dynamic jsonObj = (JObject)JsonConvert.DeserializeObject(_json.ToString()); |
116 | | - fansCount = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["fansCount"]; |
117 | | - monthlyFee = (int)jsonObj["o"]["chatMessage"]["author"]["influencerInfo"]["monthlyFee"]; |
118 | | - } |
119 | | - } |
120 | | - } |
121 | | - |
| 11 | + public SocketBase SocketBase { get; set; } |
| 12 | + public string Json { get; set; } |
| 13 | + |
| 14 | + [JsonPropertyName("threadId")]public string ChatId { get; set; } |
| 15 | + [JsonPropertyName("mediaType")]public int MediaType { get; set; } |
| 16 | + [JsonPropertyName("clientRefId")]public int ClientRefId { get; set; } |
| 17 | + [JsonPropertyName("messageId")]public string MessageId { get; set; } |
| 18 | + [JsonPropertyName("uid")]public string ObjectId { get; set; } |
| 19 | + [JsonPropertyName("createdTime")]public string CreatedTime { get; set; } |
| 20 | + [JsonPropertyName("type")]public int Type { get; set; } |
| 21 | + [JsonPropertyName("isHidden")]public bool IsHidden { get; set; } |
| 22 | + [JsonPropertyName("includedInSummary")]public bool IncludedInSummary { get; set; } |
| 23 | + [JsonPropertyName("author")]public GenericProfile Author { get; set; } |
122 | 24 |
|
123 | 25 |
|
124 | 26 | } |
|
0 commit comments