mezon-js 2.7.81 → 2.7.83

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -6,6 +6,8 @@ import { encode } from 'js-base64';
6
6
 
7
7
  /** A single user-role pair. */
8
8
  export interface ChannelUserListChannelUser {
9
+ //
10
+ clan_nick?: string;
9
11
  //
10
12
  id?: string;
11
13
  //Their relationship to the role.
@@ -391,6 +393,8 @@ export interface ApiChannelMessage {
391
393
  clan_id?: string;
392
394
  //
393
395
  clan_logo?: string;
396
+ //
397
+ clan_nick?: string;
394
398
  //The code representing a message type or category.
395
399
  code: number;
396
400
  //The content payload.
@@ -398,6 +402,8 @@ export interface ApiChannelMessage {
398
402
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created.
399
403
  create_time?: string;
400
404
  //
405
+ display_name?: string;
406
+ //
401
407
  mentions?: string;
402
408
  //The unique ID of this message.
403
409
  message_id: string;
@@ -459,6 +465,12 @@ export interface ApiChannelVoiceList {
459
465
  channelvoice?: Array<ApiDirectChannelVoice>;
460
466
  }
461
467
 
468
+ /** */
469
+ export interface ApiCheckDuplicateClanNameResponse {
470
+ //
471
+ is_duplicate?: boolean;
472
+ }
473
+
462
474
  /** */
463
475
  export interface ApiClanDesc {
464
476
  //
@@ -3511,6 +3523,42 @@ export class MezonApi {
3511
3523
  ]);
3512
3524
  }
3513
3525
 
3526
+ /** check duplicate clan name */
3527
+ checkDuplicateClanName(bearerToken: string,
3528
+ clanName:string,
3529
+ options: any = {}): Promise<ApiCheckDuplicateClanNameResponse> {
3530
+
3531
+ if (clanName === null || clanName === undefined) {
3532
+ throw new Error("'clanName' is a required parameter but is null or undefined.");
3533
+ }
3534
+ const urlPath = "/v2/clandesc/{clanName}"
3535
+ .replace("{clanName}", encodeURIComponent(String(clanName)));
3536
+ const queryParams = new Map<string, any>();
3537
+
3538
+ let bodyJson : string = "";
3539
+
3540
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3541
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3542
+ if (bearerToken) {
3543
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3544
+ }
3545
+
3546
+ return Promise.race([
3547
+ fetch(fullUrl, fetchOptions).then((response) => {
3548
+ if (response.status == 204) {
3549
+ return response;
3550
+ } else if (response.status >= 200 && response.status < 300) {
3551
+ return response.json();
3552
+ } else {
3553
+ throw response;
3554
+ }
3555
+ }),
3556
+ new Promise((_, reject) =>
3557
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3558
+ ),
3559
+ ]);
3560
+ }
3561
+
3514
3562
  /** Get a clan desc profile */
3515
3563
  getClanDescProfile(bearerToken: string,
3516
3564
  clanId:string,
package/client.ts CHANGED
@@ -102,6 +102,7 @@ import {
102
102
  ApiWebhookListResponse,
103
103
  MezonUpdateWebhookByIdBody,
104
104
  ApiWebhookGenerateResponse,
105
+ ApiCheckDuplicateClanNameResponse,
105
106
  } from "./api.gen";
106
107
 
107
108
  import { Session } from "./session";
@@ -235,6 +236,10 @@ export interface ChannelMessage {
235
236
  category_name?: string;
236
237
  //The username of the message sender, if any.
237
238
  username?: string;
239
+ // The clan nick name
240
+ clan_nick?: string;
241
+ //
242
+ display_name?: string;
238
243
  }
239
244
 
240
245
  /** A list of channel messages, usually a result of a list operation. */
@@ -1066,11 +1071,13 @@ export class Client {
1066
1071
  sender_id: m.sender_id,
1067
1072
  update_time: m.update_time,
1068
1073
  username: m.username,
1074
+ display_name: m.display_name,
1069
1075
  avatar: m.avatar,
1070
1076
  content: m.content ? JSON.parse(m.content) : undefined,
1071
1077
  channel_label: m.channel_label,
1072
1078
  clan_logo: m.clan_logo,
1073
1079
  category_name: m.category_name,
1080
+ clan_nick: m.clan_nick,
1074
1081
  attachments: m.attachments ? JSON.parse(m.attachments) : [],
1075
1082
  mentions: m.mentions ? JSON.parse(m.mentions) : [],
1076
1083
  reactions: m.reactions ? JSON.parse(m.reactions) : [],
@@ -2335,4 +2342,16 @@ async deleteWebhookById(session: Session, id: string) {
2335
2342
  })
2336
2343
  }
2337
2344
 
2345
+ //**check duplicate clan name */
2346
+ async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>{
2347
+ if (this.autoRefreshSession && session.refresh_token &&
2348
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2349
+ await this.sessionRefresh(session);
2350
+ }
2351
+
2352
+ return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response: any) => {
2353
+ return Promise.resolve(response);
2354
+ })
2355
+ }
2356
+
2338
2357
  };
package/dist/api.gen.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** A single user-role pair. */
2
2
  export interface ChannelUserListChannelUser {
3
+ clan_nick?: string;
3
4
  id?: string;
4
5
  role_id?: Array<string>;
5
6
  thread_id?: string;
@@ -223,9 +224,11 @@ export interface ApiChannelMessage {
223
224
  channel_label: string;
224
225
  clan_id?: string;
225
226
  clan_logo?: string;
227
+ clan_nick?: string;
226
228
  code: number;
227
229
  content: string;
228
230
  create_time?: string;
231
+ display_name?: string;
229
232
  mentions?: string;
230
233
  message_id: string;
231
234
  reactions?: string;
@@ -262,6 +265,10 @@ export interface ApiChannelVoiceList {
262
265
  channelvoice?: Array<ApiDirectChannelVoice>;
263
266
  }
264
267
  /** */
268
+ export interface ApiCheckDuplicateClanNameResponse {
269
+ is_duplicate?: boolean;
270
+ }
271
+ /** */
265
272
  export interface ApiClanDesc {
266
273
  banner?: string;
267
274
  clan_id?: string;
@@ -999,6 +1006,8 @@ export declare class MezonApi {
999
1006
  removeClanUsers(bearerToken: string, clanId: string, userIds?: Array<string>, options?: any): Promise<any>;
1000
1007
  /** List all users that are part of a clan. */
1001
1008
  listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
1009
+ /** check duplicate clan name */
1010
+ checkDuplicateClanName(bearerToken: string, clanName: string, options?: any): Promise<ApiCheckDuplicateClanNameResponse>;
1002
1011
  /** Get a clan desc profile */
1003
1012
  getClanDescProfile(bearerToken: string, clanId: string, options?: any): Promise<ApiClanDescProfile>;
1004
1013
  /** Update fields in a given clan profile. */
package/dist/client.d.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiCreateWebhookRequest, ApiWebhookResponse, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiList, ApiClanEmojiCreateRequest, ApiChannelVoiceList, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -111,6 +111,8 @@ export interface ChannelMessage {
111
111
  clan_logo?: string;
112
112
  category_name?: string;
113
113
  username?: string;
114
+ clan_nick?: string;
115
+ display_name?: string;
114
116
  }
115
117
  /** A list of channel messages, usually a result of a list operation. */
116
118
  export interface ChannelMessageList {
@@ -588,4 +590,5 @@ export declare class Client {
588
590
  listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse>;
589
591
  updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
590
592
  deleteWebhookById(session: Session, id: string): Promise<boolean>;
593
+ checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
591
594
  }
@@ -2184,6 +2184,34 @@ var MezonApi = class {
2184
2184
  )
2185
2185
  ]);
2186
2186
  }
2187
+ /** check duplicate clan name */
2188
+ checkDuplicateClanName(bearerToken, clanName, options = {}) {
2189
+ if (clanName === null || clanName === void 0) {
2190
+ throw new Error("'clanName' is a required parameter but is null or undefined.");
2191
+ }
2192
+ const urlPath = "/v2/clandesc/{clanName}".replace("{clanName}", encodeURIComponent(String(clanName)));
2193
+ const queryParams = /* @__PURE__ */ new Map();
2194
+ let bodyJson = "";
2195
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2196
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2197
+ if (bearerToken) {
2198
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2199
+ }
2200
+ return Promise.race([
2201
+ fetch(fullUrl, fetchOptions).then((response) => {
2202
+ if (response.status == 204) {
2203
+ return response;
2204
+ } else if (response.status >= 200 && response.status < 300) {
2205
+ return response.json();
2206
+ } else {
2207
+ throw response;
2208
+ }
2209
+ }),
2210
+ new Promise(
2211
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2212
+ )
2213
+ ]);
2214
+ }
2187
2215
  /** Get a clan desc profile */
2188
2216
  getClanDescProfile(bearerToken, clanId, options = {}) {
2189
2217
  if (clanId === null || clanId === void 0) {
@@ -4618,6 +4646,8 @@ var _DefaultSocket = class _DefaultSocket {
4618
4646
  clan_logo: message.channel_message.clan_logo,
4619
4647
  category_name: message.channel_message.category_name,
4620
4648
  username: message.channel_message.username,
4649
+ clan_nick: message.clan_nick,
4650
+ display_name: message.display_name,
4621
4651
  content,
4622
4652
  reactions,
4623
4653
  mentions,
@@ -5507,11 +5537,13 @@ var Client = class {
5507
5537
  sender_id: m.sender_id,
5508
5538
  update_time: m.update_time,
5509
5539
  username: m.username,
5540
+ display_name: m.display_name,
5510
5541
  avatar: m.avatar,
5511
5542
  content: m.content ? JSON.parse(m.content) : void 0,
5512
5543
  channel_label: m.channel_label,
5513
5544
  clan_logo: m.clan_logo,
5514
5545
  category_name: m.category_name,
5546
+ clan_nick: m.clan_nick,
5515
5547
  attachments: m.attachments ? JSON.parse(m.attachments) : [],
5516
5548
  mentions: m.mentions ? JSON.parse(m.mentions) : [],
5517
5549
  reactions: m.reactions ? JSON.parse(m.reactions) : [],
@@ -6665,4 +6697,15 @@ var Client = class {
6665
6697
  });
6666
6698
  });
6667
6699
  }
6700
+ //**check duplicate clan name */
6701
+ checkDuplicateClanName(session, clan_name) {
6702
+ return __async(this, null, function* () {
6703
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6704
+ yield this.sessionRefresh(session);
6705
+ }
6706
+ return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response) => {
6707
+ return Promise.resolve(response);
6708
+ });
6709
+ });
6710
+ }
6668
6711
  };
@@ -2155,6 +2155,34 @@ var MezonApi = class {
2155
2155
  )
2156
2156
  ]);
2157
2157
  }
2158
+ /** check duplicate clan name */
2159
+ checkDuplicateClanName(bearerToken, clanName, options = {}) {
2160
+ if (clanName === null || clanName === void 0) {
2161
+ throw new Error("'clanName' is a required parameter but is null or undefined.");
2162
+ }
2163
+ const urlPath = "/v2/clandesc/{clanName}".replace("{clanName}", encodeURIComponent(String(clanName)));
2164
+ const queryParams = /* @__PURE__ */ new Map();
2165
+ let bodyJson = "";
2166
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2167
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2168
+ if (bearerToken) {
2169
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2170
+ }
2171
+ return Promise.race([
2172
+ fetch(fullUrl, fetchOptions).then((response) => {
2173
+ if (response.status == 204) {
2174
+ return response;
2175
+ } else if (response.status >= 200 && response.status < 300) {
2176
+ return response.json();
2177
+ } else {
2178
+ throw response;
2179
+ }
2180
+ }),
2181
+ new Promise(
2182
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2183
+ )
2184
+ ]);
2185
+ }
2158
2186
  /** Get a clan desc profile */
2159
2187
  getClanDescProfile(bearerToken, clanId, options = {}) {
2160
2188
  if (clanId === null || clanId === void 0) {
@@ -4589,6 +4617,8 @@ var _DefaultSocket = class _DefaultSocket {
4589
4617
  clan_logo: message.channel_message.clan_logo,
4590
4618
  category_name: message.channel_message.category_name,
4591
4619
  username: message.channel_message.username,
4620
+ clan_nick: message.clan_nick,
4621
+ display_name: message.display_name,
4592
4622
  content,
4593
4623
  reactions,
4594
4624
  mentions,
@@ -5478,11 +5508,13 @@ var Client = class {
5478
5508
  sender_id: m.sender_id,
5479
5509
  update_time: m.update_time,
5480
5510
  username: m.username,
5511
+ display_name: m.display_name,
5481
5512
  avatar: m.avatar,
5482
5513
  content: m.content ? JSON.parse(m.content) : void 0,
5483
5514
  channel_label: m.channel_label,
5484
5515
  clan_logo: m.clan_logo,
5485
5516
  category_name: m.category_name,
5517
+ clan_nick: m.clan_nick,
5486
5518
  attachments: m.attachments ? JSON.parse(m.attachments) : [],
5487
5519
  mentions: m.mentions ? JSON.parse(m.mentions) : [],
5488
5520
  reactions: m.reactions ? JSON.parse(m.reactions) : [],
@@ -6636,6 +6668,17 @@ var Client = class {
6636
6668
  });
6637
6669
  });
6638
6670
  }
6671
+ //**check duplicate clan name */
6672
+ checkDuplicateClanName(session, clan_name) {
6673
+ return __async(this, null, function* () {
6674
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6675
+ yield this.sessionRefresh(session);
6676
+ }
6677
+ return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response) => {
6678
+ return Promise.resolve(response);
6679
+ });
6680
+ });
6681
+ }
6639
6682
  };
6640
6683
  export {
6641
6684
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -188,6 +188,8 @@ export interface ChannelMessageEvent {
188
188
  clan_logo: string;
189
189
  category_name: string;
190
190
  username: string;
191
+ clan_nick: string;
192
+ display_name: string;
191
193
  reactions?: Array<ApiMessageReaction>;
192
194
  mentions?: Array<ApiMessageMention>;
193
195
  attachments?: Array<ApiMessageAttachment>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.81",
3
+ "version": "2.7.83",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -259,6 +259,10 @@ export interface ChannelMessageEvent {
259
259
  category_name: string;
260
260
  //The username of the message sender, if any.
261
261
  username: string;
262
+ // The clan nick name
263
+ clan_nick: string;
264
+ // The display name
265
+ display_name: string;
262
266
  //
263
267
  reactions?: Array<ApiMessageReaction>;
264
268
  //
@@ -798,6 +802,8 @@ export class DefaultSocket implements Socket {
798
802
  clan_logo: message.channel_message.clan_logo,
799
803
  category_name: message.channel_message.category_name,
800
804
  username: message.channel_message.username,
805
+ clan_nick: message.clan_nick,
806
+ display_name: message.display_name,
801
807
  content: content,
802
808
  reactions: reactions,
803
809
  mentions: mentions,