mezon-js 2.7.80 → 2.7.82

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.
@@ -352,6 +354,8 @@ export interface ApiChannelDescription {
352
354
  //creator ID.
353
355
  creator_id?: string;
354
356
  //
357
+ creator_name?: string;
358
+ //
355
359
  last_pin_message?: string;
356
360
  //
357
361
  last_seen_message?: ApiChannelMessageHeader;
@@ -389,6 +393,8 @@ export interface ApiChannelMessage {
389
393
  clan_id?: string;
390
394
  //
391
395
  clan_logo?: string;
396
+ //
397
+ clan_nick?: string;
392
398
  //The code representing a message type or category.
393
399
  code: number;
394
400
  //The content payload.
@@ -457,6 +463,12 @@ export interface ApiChannelVoiceList {
457
463
  channelvoice?: Array<ApiDirectChannelVoice>;
458
464
  }
459
465
 
466
+ /** */
467
+ export interface ApiCheckDuplicateClanNameResponse {
468
+ //
469
+ is_duplicate?: boolean;
470
+ }
471
+
460
472
  /** */
461
473
  export interface ApiClanDesc {
462
474
  //
@@ -3509,6 +3521,42 @@ export class MezonApi {
3509
3521
  ]);
3510
3522
  }
3511
3523
 
3524
+ /** check duplicate clan name */
3525
+ checkDuplicateClanName(bearerToken: string,
3526
+ clanName:string,
3527
+ options: any = {}): Promise<ApiCheckDuplicateClanNameResponse> {
3528
+
3529
+ if (clanName === null || clanName === undefined) {
3530
+ throw new Error("'clanName' is a required parameter but is null or undefined.");
3531
+ }
3532
+ const urlPath = "/v2/clandesc/{clanName}"
3533
+ .replace("{clanName}", encodeURIComponent(String(clanName)));
3534
+ const queryParams = new Map<string, any>();
3535
+
3536
+ let bodyJson : string = "";
3537
+
3538
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3539
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3540
+ if (bearerToken) {
3541
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3542
+ }
3543
+
3544
+ return Promise.race([
3545
+ fetch(fullUrl, fetchOptions).then((response) => {
3546
+ if (response.status == 204) {
3547
+ return response;
3548
+ } else if (response.status >= 200 && response.status < 300) {
3549
+ return response.json();
3550
+ } else {
3551
+ throw response;
3552
+ }
3553
+ }),
3554
+ new Promise((_, reject) =>
3555
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3556
+ ),
3557
+ ]);
3558
+ }
3559
+
3512
3560
  /** Get a clan desc profile */
3513
3561
  getClanDescProfile(bearerToken: string,
3514
3562
  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,8 @@ 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;
238
241
  }
239
242
 
240
243
  /** A list of channel messages, usually a result of a list operation. */
@@ -1071,6 +1074,7 @@ export class Client {
1071
1074
  channel_label: m.channel_label,
1072
1075
  clan_logo: m.clan_logo,
1073
1076
  category_name: m.category_name,
1077
+ clan_nick: m.clan_nick,
1074
1078
  attachments: m.attachments ? JSON.parse(m.attachments) : [],
1075
1079
  mentions: m.mentions ? JSON.parse(m.mentions) : [],
1076
1080
  reactions: m.reactions ? JSON.parse(m.reactions) : [],
@@ -2335,4 +2339,16 @@ async deleteWebhookById(session: Session, id: string) {
2335
2339
  })
2336
2340
  }
2337
2341
 
2342
+ //**check duplicate clan name */
2343
+ async checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>{
2344
+ if (this.autoRefreshSession && session.refresh_token &&
2345
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2346
+ await this.sessionRefresh(session);
2347
+ }
2348
+
2349
+ return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response: any) => {
2350
+ return Promise.resolve(response);
2351
+ })
2352
+ }
2353
+
2338
2354
  };
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;
@@ -202,6 +203,7 @@ export interface ApiChannelDescription {
202
203
  clan_id?: string;
203
204
  count_mess_unread?: number;
204
205
  creator_id?: string;
206
+ creator_name?: string;
205
207
  last_pin_message?: string;
206
208
  last_seen_message?: ApiChannelMessageHeader;
207
209
  last_sent_message?: ApiChannelMessageHeader;
@@ -222,6 +224,7 @@ export interface ApiChannelMessage {
222
224
  channel_label: string;
223
225
  clan_id?: string;
224
226
  clan_logo?: string;
227
+ clan_nick?: string;
225
228
  code: number;
226
229
  content: string;
227
230
  create_time?: string;
@@ -261,6 +264,10 @@ export interface ApiChannelVoiceList {
261
264
  channelvoice?: Array<ApiDirectChannelVoice>;
262
265
  }
263
266
  /** */
267
+ export interface ApiCheckDuplicateClanNameResponse {
268
+ is_duplicate?: boolean;
269
+ }
270
+ /** */
264
271
  export interface ApiClanDesc {
265
272
  banner?: string;
266
273
  clan_id?: string;
@@ -998,6 +1005,8 @@ export declare class MezonApi {
998
1005
  removeClanUsers(bearerToken: string, clanId: string, userIds?: Array<string>, options?: any): Promise<any>;
999
1006
  /** List all users that are part of a clan. */
1000
1007
  listClanUsers(bearerToken: string, clanId: string, options?: any): Promise<ApiClanUserList>;
1008
+ /** check duplicate clan name */
1009
+ checkDuplicateClanName(bearerToken: string, clanName: string, options?: any): Promise<ApiCheckDuplicateClanNameResponse>;
1001
1010
  /** Get a clan desc profile */
1002
1011
  getClanDescProfile(bearerToken: string, clanId: string, options?: any): Promise<ApiClanDescProfile>;
1003
1012
  /** 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,7 @@ export interface ChannelMessage {
111
111
  clan_logo?: string;
112
112
  category_name?: string;
113
113
  username?: string;
114
+ clan_nick?: string;
114
115
  }
115
116
  /** A list of channel messages, usually a result of a list operation. */
116
117
  export interface ChannelMessageList {
@@ -588,4 +589,5 @@ export declare class Client {
588
589
  listWebhookByChannelId(session: Session, channel_id: string): Promise<ApiWebhookListResponse>;
589
590
  updateWebhookById(session: Session, id: string, request: MezonUpdateWebhookByIdBody): Promise<boolean>;
590
591
  deleteWebhookById(session: Session, id: string): Promise<boolean>;
592
+ checkDuplicateClanName(session: Session, clan_name: string): Promise<ApiCheckDuplicateClanNameResponse>;
591
593
  }
@@ -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,7 @@ 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,
4621
4650
  content,
4622
4651
  reactions,
4623
4652
  mentions,
@@ -5512,6 +5541,7 @@ var Client = class {
5512
5541
  channel_label: m.channel_label,
5513
5542
  clan_logo: m.clan_logo,
5514
5543
  category_name: m.category_name,
5544
+ clan_nick: m.clan_nick,
5515
5545
  attachments: m.attachments ? JSON.parse(m.attachments) : [],
5516
5546
  mentions: m.mentions ? JSON.parse(m.mentions) : [],
5517
5547
  reactions: m.reactions ? JSON.parse(m.reactions) : [],
@@ -6665,4 +6695,15 @@ var Client = class {
6665
6695
  });
6666
6696
  });
6667
6697
  }
6698
+ //**check duplicate clan name */
6699
+ checkDuplicateClanName(session, clan_name) {
6700
+ return __async(this, null, function* () {
6701
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6702
+ yield this.sessionRefresh(session);
6703
+ }
6704
+ return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response) => {
6705
+ return Promise.resolve(response);
6706
+ });
6707
+ });
6708
+ }
6668
6709
  };
@@ -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,7 @@ 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,
4592
4621
  content,
4593
4622
  reactions,
4594
4623
  mentions,
@@ -5483,6 +5512,7 @@ var Client = class {
5483
5512
  channel_label: m.channel_label,
5484
5513
  clan_logo: m.clan_logo,
5485
5514
  category_name: m.category_name,
5515
+ clan_nick: m.clan_nick,
5486
5516
  attachments: m.attachments ? JSON.parse(m.attachments) : [],
5487
5517
  mentions: m.mentions ? JSON.parse(m.mentions) : [],
5488
5518
  reactions: m.reactions ? JSON.parse(m.reactions) : [],
@@ -6636,6 +6666,17 @@ var Client = class {
6636
6666
  });
6637
6667
  });
6638
6668
  }
6669
+ //**check duplicate clan name */
6670
+ checkDuplicateClanName(session, clan_name) {
6671
+ return __async(this, null, function* () {
6672
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6673
+ yield this.sessionRefresh(session);
6674
+ }
6675
+ return this.apiClient.checkDuplicateClanName(session.token, clan_name).then((response) => {
6676
+ return Promise.resolve(response);
6677
+ });
6678
+ });
6679
+ }
6639
6680
  };
6640
6681
  export {
6641
6682
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -188,6 +188,7 @@ export interface ChannelMessageEvent {
188
188
  clan_logo: string;
189
189
  category_name: string;
190
190
  username: string;
191
+ clan_nick: string;
191
192
  reactions?: Array<ApiMessageReaction>;
192
193
  mentions?: Array<ApiMessageMention>;
193
194
  attachments?: Array<ApiMessageAttachment>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.80",
3
+ "version": "2.7.82",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -259,6 +259,8 @@ 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;
262
264
  //
263
265
  reactions?: Array<ApiMessageReaction>;
264
266
  //
@@ -798,6 +800,7 @@ export class DefaultSocket implements Socket {
798
800
  clan_logo: message.channel_message.clan_logo,
799
801
  category_name: message.channel_message.category_name,
800
802
  username: message.channel_message.username,
803
+ clan_nick: message.clan_nick,
801
804
  content: content,
802
805
  reactions: reactions,
803
806
  mentions: mentions,