mezon-js 2.8.76 → 2.8.78

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -31,7 +31,7 @@ export interface ClanUserListClanUser {
31
31
  //from the `nick_name` field in the `clan_desc_profile` table.
32
32
  clan_nick?: string;
33
33
  //Their relationship to the role.
34
- role_id?: string;
34
+ role_id?: Array<string>;
35
35
  //User.
36
36
  user?: ApiUser;
37
37
  }
@@ -56,6 +56,14 @@ export interface MezonUpdateAppBody {
56
56
  token?: string;
57
57
  }
58
58
 
59
+ /** */
60
+ export interface MezonUpdateCategoryBody {
61
+ //The ID of the group to update.
62
+ category_id?: string;
63
+ //
64
+ category_name?: string;
65
+ }
66
+
59
67
  /** */
60
68
  export interface ApiAddAppRequest {
61
69
  //The appname.
@@ -1495,6 +1503,8 @@ export interface ApiUpdateCategoryDescRequest {
1495
1503
  category_id?: string;
1496
1504
  //
1497
1505
  category_name?: string;
1506
+ // clan ID
1507
+ ClanId: string;
1498
1508
  }
1499
1509
 
1500
1510
  /** */
@@ -6295,13 +6305,18 @@ export class MezonApi {
6295
6305
 
6296
6306
  /** Update fields in a given category. */
6297
6307
  updateCategory(bearerToken: string,
6298
- body:ApiUpdateCategoryDescRequest,
6308
+ clanId:string,
6309
+ body:MezonUpdateCategoryBody,
6299
6310
  options: any = {}): Promise<any> {
6300
6311
 
6312
+ if (clanId === null || clanId === undefined) {
6313
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
6314
+ }
6301
6315
  if (body === null || body === undefined) {
6302
6316
  throw new Error("'body' is a required parameter but is null or undefined.");
6303
6317
  }
6304
- const urlPath = "/v2/updatecategory";
6318
+ const urlPath = "/v2/updatecategory/{clanId}"
6319
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
6305
6320
  const queryParams = new Map<string, any>();
6306
6321
 
6307
6322
  let bodyJson : string = "";
package/client.ts CHANGED
@@ -2548,6 +2548,7 @@ export class Client {
2548
2548
  /** Update fields in a given category. */
2549
2549
  async updateCategory(
2550
2550
  session: Session,
2551
+ clanId: string,
2551
2552
  request: ApiUpdateCategoryDescRequest
2552
2553
  ): Promise<boolean> {
2553
2554
  if (
@@ -2559,7 +2560,7 @@ export class Client {
2559
2560
  }
2560
2561
 
2561
2562
  return this.apiClient
2562
- .updateCategory(session.token, request)
2563
+ .updateCategory(session.token, clanId, request)
2563
2564
  .then((response: any) => {
2564
2565
  return response !== undefined;
2565
2566
  });
package/dist/api.gen.d.ts CHANGED
@@ -13,7 +13,7 @@ export interface ClanUserListClanUser {
13
13
  clan_avatar?: string;
14
14
  clan_id?: string;
15
15
  clan_nick?: string;
16
- role_id?: string;
16
+ role_id?: Array<string>;
17
17
  user?: ApiUser;
18
18
  }
19
19
  /** */
@@ -29,6 +29,11 @@ export interface MezonUpdateAppBody {
29
29
  token?: string;
30
30
  }
31
31
  /** */
32
+ export interface MezonUpdateCategoryBody {
33
+ category_id?: string;
34
+ category_name?: string;
35
+ }
36
+ /** */
32
37
  export interface ApiAddAppRequest {
33
38
  appname?: string;
34
39
  creator_id?: string;
@@ -866,6 +871,7 @@ export interface ApiUpdateAccountRequest {
866
871
  export interface ApiUpdateCategoryDescRequest {
867
872
  category_id?: string;
868
873
  category_name?: string;
874
+ ClanId: string;
869
875
  }
870
876
  /** */
871
877
  export interface ApiUpdateRoleChannelRequest {
@@ -1222,7 +1228,7 @@ export declare class MezonApi {
1222
1228
  /** Update a system messages. */
1223
1229
  updateSystemMessage(bearerToken: string, clanId: string, body: MezonUpdateSystemMessageBody, options?: any): Promise<any>;
1224
1230
  /** Update fields in a given category. */
1225
- updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
1231
+ updateCategory(bearerToken: string, clanId: string, body: MezonUpdateCategoryBody, options?: any): Promise<any>;
1226
1232
  /** Update channel private. */
1227
1233
  updateChannelPrivate(bearerToken: string, body: ApiChangeChannelPrivateRequest, options?: any): Promise<any>;
1228
1234
  /** */
package/dist/client.d.ts CHANGED
@@ -483,7 +483,7 @@ export declare class Client {
483
483
  /** Update fields in a given clan. */
484
484
  updateClanDesc(session: Session, clanId: string, request: ApiUpdateClanDescRequest): Promise<boolean>;
485
485
  /** Update fields in a given category. */
486
- updateCategory(session: Session, request: ApiUpdateCategoryDescRequest): Promise<boolean>;
486
+ updateCategory(session: Session, clanId: string, request: ApiUpdateCategoryDescRequest): Promise<boolean>;
487
487
  /** Update fields in a given clan profile. */
488
488
  updateClanDescProfile(session: Session, clanId: string, request: ApiUpdateClanDescProfileRequest): Promise<boolean>;
489
489
  updateUserProfileByClan(session: Session, clanId: string, request: ApiUpdateClanProfileRequest): Promise<boolean>;
@@ -4267,11 +4267,14 @@ var MezonApi = class {
4267
4267
  ]);
4268
4268
  }
4269
4269
  /** Update fields in a given category. */
4270
- updateCategory(bearerToken, body, options = {}) {
4270
+ updateCategory(bearerToken, clanId, body, options = {}) {
4271
+ if (clanId === null || clanId === void 0) {
4272
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4273
+ }
4271
4274
  if (body === null || body === void 0) {
4272
4275
  throw new Error("'body' is a required parameter but is null or undefined.");
4273
4276
  }
4274
- const urlPath = "/v2/updatecategory";
4277
+ const urlPath = "/v2/updatecategory/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
4275
4278
  const queryParams = /* @__PURE__ */ new Map();
4276
4279
  let bodyJson = "";
4277
4280
  bodyJson = JSON.stringify(body || {});
@@ -5109,8 +5112,8 @@ var _DefaultSocket = class _DefaultSocket {
5109
5112
  return response.channel;
5110
5113
  });
5111
5114
  }
5112
- leaveChat(clan_id, channel_id, channel_type, is_public) {
5113
- return this.send({ channel_leave: { clan_id, channel_id, channel_type, is_public } });
5115
+ leaveChat(clan_id, parent_id, channel_id, channel_type, is_public, is_parent_public) {
5116
+ return this.send({ channel_leave: { clan_id, parent_id, channel_id, channel_type, is_public, is_parent_public } });
5114
5117
  }
5115
5118
  removeChatMessage(clan_id, parent_id, channel_id, mode, is_public, is_parent_public, message_id) {
5116
5119
  return __async(this, null, function* () {
@@ -5130,14 +5133,6 @@ var _DefaultSocket = class _DefaultSocket {
5130
5133
  return response.channel_message_ack;
5131
5134
  });
5132
5135
  }
5133
- removePartyMember(party_id, member) {
5134
- return __async(this, null, function* () {
5135
- return this.send({ party_remove: {
5136
- party_id,
5137
- presence: member
5138
- } });
5139
- });
5140
- }
5141
5136
  rpc(id, payload, http_key) {
5142
5137
  return __async(this, null, function* () {
5143
5138
  const response = yield this.send(
@@ -5152,9 +5147,6 @@ var _DefaultSocket = class _DefaultSocket {
5152
5147
  return response.rpc;
5153
5148
  });
5154
5149
  }
5155
- sendPartyData(party_id, op_code, data) {
5156
- return this.send({ party_data_send: { party_id, op_code, data } });
5157
- }
5158
5150
  unfollowUsers(user_ids) {
5159
5151
  return this.send({ status_unfollow: { user_ids } });
5160
5152
  }
@@ -6648,12 +6640,12 @@ var Client = class {
6648
6640
  });
6649
6641
  }
6650
6642
  /** Update fields in a given category. */
6651
- updateCategory(session, request) {
6643
+ updateCategory(session, clanId, request) {
6652
6644
  return __async(this, null, function* () {
6653
6645
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6654
6646
  yield this.sessionRefresh(session);
6655
6647
  }
6656
- return this.apiClient.updateCategory(session.token, request).then((response) => {
6648
+ return this.apiClient.updateCategory(session.token, clanId, request).then((response) => {
6657
6649
  return response !== void 0;
6658
6650
  });
6659
6651
  });
@@ -4238,11 +4238,14 @@ var MezonApi = class {
4238
4238
  ]);
4239
4239
  }
4240
4240
  /** Update fields in a given category. */
4241
- updateCategory(bearerToken, body, options = {}) {
4241
+ updateCategory(bearerToken, clanId, body, options = {}) {
4242
+ if (clanId === null || clanId === void 0) {
4243
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
4244
+ }
4242
4245
  if (body === null || body === void 0) {
4243
4246
  throw new Error("'body' is a required parameter but is null or undefined.");
4244
4247
  }
4245
- const urlPath = "/v2/updatecategory";
4248
+ const urlPath = "/v2/updatecategory/{clanId}".replace("{clanId}", encodeURIComponent(String(clanId)));
4246
4249
  const queryParams = /* @__PURE__ */ new Map();
4247
4250
  let bodyJson = "";
4248
4251
  bodyJson = JSON.stringify(body || {});
@@ -5080,8 +5083,8 @@ var _DefaultSocket = class _DefaultSocket {
5080
5083
  return response.channel;
5081
5084
  });
5082
5085
  }
5083
- leaveChat(clan_id, channel_id, channel_type, is_public) {
5084
- return this.send({ channel_leave: { clan_id, channel_id, channel_type, is_public } });
5086
+ leaveChat(clan_id, parent_id, channel_id, channel_type, is_public, is_parent_public) {
5087
+ return this.send({ channel_leave: { clan_id, parent_id, channel_id, channel_type, is_public, is_parent_public } });
5085
5088
  }
5086
5089
  removeChatMessage(clan_id, parent_id, channel_id, mode, is_public, is_parent_public, message_id) {
5087
5090
  return __async(this, null, function* () {
@@ -5101,14 +5104,6 @@ var _DefaultSocket = class _DefaultSocket {
5101
5104
  return response.channel_message_ack;
5102
5105
  });
5103
5106
  }
5104
- removePartyMember(party_id, member) {
5105
- return __async(this, null, function* () {
5106
- return this.send({ party_remove: {
5107
- party_id,
5108
- presence: member
5109
- } });
5110
- });
5111
- }
5112
5107
  rpc(id, payload, http_key) {
5113
5108
  return __async(this, null, function* () {
5114
5109
  const response = yield this.send(
@@ -5123,9 +5118,6 @@ var _DefaultSocket = class _DefaultSocket {
5123
5118
  return response.rpc;
5124
5119
  });
5125
5120
  }
5126
- sendPartyData(party_id, op_code, data) {
5127
- return this.send({ party_data_send: { party_id, op_code, data } });
5128
- }
5129
5121
  unfollowUsers(user_ids) {
5130
5122
  return this.send({ status_unfollow: { user_ids } });
5131
5123
  }
@@ -6619,12 +6611,12 @@ var Client = class {
6619
6611
  });
6620
6612
  }
6621
6613
  /** Update fields in a given category. */
6622
- updateCategory(session, request) {
6614
+ updateCategory(session, clanId, request) {
6623
6615
  return __async(this, null, function* () {
6624
6616
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6625
6617
  yield this.sessionRefresh(session);
6626
6618
  }
6627
- return this.apiClient.updateCategory(session.token, request).then((response) => {
6619
+ return this.apiClient.updateCategory(session.token, clanId, request).then((response) => {
6628
6620
  return response !== void 0;
6629
6621
  });
6630
6622
  });
package/dist/socket.d.ts CHANGED
@@ -73,6 +73,8 @@ interface ChannelLeave {
73
73
  mode: number;
74
74
  channel_label: string;
75
75
  is_public: boolean;
76
+ parent_id: string;
77
+ is_parent_public: boolean;
76
78
  };
77
79
  }
78
80
  export interface AddClanUserEvent {
@@ -117,6 +119,8 @@ export interface LastPinMessageEvent {
117
119
  /** operation */
118
120
  operation: number;
119
121
  is_public: boolean;
122
+ parent_id?: string;
123
+ is_parent_public?: string;
120
124
  }
121
125
  /** Last seen message by user */
122
126
  export interface LastSeenMessageEvent {
@@ -521,7 +525,7 @@ export interface Socket {
521
525
  /** Join a chat channel on the server. */
522
526
  joinChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean): Promise<Channel>;
523
527
  /** Leave a chat channel on the server. */
524
- leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void>;
528
+ leaveChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean): Promise<void>;
525
529
  /** Remove a chat message from a chat channel on the server. */
526
530
  removeChatMessage(clan_id: string, parent_id: string, channel_id: string, mode: number, is_public: boolean, is_parent_public: boolean, message_id: string): Promise<ChannelMessageAck>;
527
531
  /** Execute an RPC function to the server. */
@@ -675,11 +679,9 @@ export declare class DefaultSocket implements Socket {
675
679
  followUsers(userIds: string[]): Promise<Status>;
676
680
  joinClanChat(clan_id: string): Promise<ClanJoin>;
677
681
  joinChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean): Promise<Channel>;
678
- leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void>;
682
+ leaveChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean): Promise<void>;
679
683
  removeChatMessage(clan_id: string, parent_id: string, channel_id: string, mode: number, is_public: boolean, is_parent_public: boolean, message_id: string): Promise<ChannelMessageAck>;
680
- removePartyMember(party_id: string, member: Presence): Promise<void>;
681
684
  rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc>;
682
- sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void>;
683
685
  unfollowUsers(user_ids: string[]): Promise<void>;
684
686
  updateChatMessage(clan_id: string, parent_id: string, channel_id: string, mode: number, is_public: boolean, is_parent_public: boolean, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
685
687
  updateStatus(status?: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.76",
3
+ "version": "2.8.78",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -93,6 +93,10 @@ interface ChannelLeave {
93
93
  channel_label: string;
94
94
  // Is public
95
95
  is_public: boolean;
96
+ // parent id
97
+ parent_id: string;
98
+ // parent public
99
+ is_parent_public: boolean;
96
100
  };
97
101
  }
98
102
 
@@ -164,6 +168,10 @@ export interface LastPinMessageEvent {
164
168
  operation: number;
165
169
  // Is public
166
170
  is_public: boolean;
171
+ // The parent id to sent to.
172
+ parent_id?: string;
173
+ // is parent public
174
+ is_parent_public?: string;
167
175
  }
168
176
 
169
177
  /** Last seen message by user */
@@ -786,7 +794,7 @@ export interface Socket {
786
794
  joinChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean) : Promise<Channel>;
787
795
 
788
796
  /** Leave a chat channel on the server. */
789
- leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean) : Promise<void>;
797
+ leaveChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean) : Promise<void>;
790
798
 
791
799
  /** Remove a chat message from a chat channel on the server. */
792
800
  removeChatMessage(clan_id: string, parent_id: string, channel_id: string, mode: number, is_public: boolean, is_parent_public: boolean, message_id: string) : Promise<ChannelMessageAck>;
@@ -1408,8 +1416,8 @@ export class DefaultSocket implements Socket {
1408
1416
  return response.channel;
1409
1417
  }
1410
1418
 
1411
- leaveChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<void> {
1412
- return this.send({channel_leave: {clan_id: clan_id, channel_id: channel_id, channel_type: channel_type, is_public: is_public}});
1419
+ leaveChat(clan_id: string, parent_id: string, channel_id: string, channel_type: number, is_public: boolean, is_parent_public: boolean): Promise<void> {
1420
+ return this.send({channel_leave: {clan_id: clan_id, parent_id: parent_id, channel_id: channel_id, channel_type: channel_type, is_public: is_public, is_parent_public: is_parent_public}});
1413
1421
  }
1414
1422
 
1415
1423
  async removeChatMessage(clan_id: string, parent_id: string, channel_id: string, mode: number, is_public: boolean, is_parent_public: boolean, message_id: string): Promise<ChannelMessageAck> {
@@ -1430,13 +1438,6 @@ export class DefaultSocket implements Socket {
1430
1438
  return response.channel_message_ack;
1431
1439
  }
1432
1440
 
1433
- async removePartyMember(party_id: string, member: Presence): Promise<void> {
1434
- return this.send({party_remove: {
1435
- party_id: party_id,
1436
- presence: member
1437
- }});
1438
- }
1439
-
1440
1441
  async rpc(id?: string, payload?: string, http_key?: string): Promise<ApiRpc> {
1441
1442
  const response = await this.send(
1442
1443
  {
@@ -1450,10 +1451,6 @@ export class DefaultSocket implements Socket {
1450
1451
  return response.rpc;
1451
1452
  }
1452
1453
 
1453
- sendPartyData(party_id: string, op_code: number, data: string | Uint8Array): Promise<void> {
1454
- return this.send({party_data_send: {party_id: party_id, op_code: op_code, data: data}})
1455
- }
1456
-
1457
1454
  unfollowUsers(user_ids : string[]): Promise<void> {
1458
1455
  return this.send({status_unfollow: {user_ids: user_ids}});
1459
1456
  }