mezon-js 2.7.62 → 2.7.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api.gen.ts CHANGED
@@ -438,6 +438,12 @@ export interface ApiChannelUserList {
438
438
  cursor?: string;
439
439
  }
440
440
 
441
+ /** */
442
+ export interface ApiChannelVoiceList {
443
+ //A list of channel.
444
+ channelvoice?: Array<ApiDirectChannelVoice>;
445
+ }
446
+
441
447
  /** */
442
448
  export interface ApiClanDesc {
443
449
  //
@@ -674,6 +680,20 @@ export interface ApiDeleteStorageObjectsRequest {
674
680
  object_ids?: Array<ApiDeleteStorageObjectId>;
675
681
  }
676
682
 
683
+ /** */
684
+ export interface ApiDirectChannelVoice {
685
+ //The channel id.
686
+ channel_id?: string;
687
+ //
688
+ channel_label?: string;
689
+ //
690
+ clan_id?: string;
691
+ //
692
+ clan_name?: string;
693
+ //
694
+ meeting_code?: string;
695
+ }
696
+
677
697
  /** Represents an event to be passed through the server to registered event handlers. */
678
698
  export interface ApiEvent {
679
699
  //True if the event came directly from a client call, false otherwise.
@@ -1387,10 +1407,10 @@ export interface ApiUsers {
1387
1407
 
1388
1408
  /** A list of users belonging to a channel, along with their role. */
1389
1409
  export interface ApiVoiceChannelUser {
1390
- //
1391
- channel_id?: string;
1392
1410
  //Cursor for the next page of results, if any.
1393
- jid?: string;
1411
+ id?: string;
1412
+ //
1413
+ channel_id?: string;
1394
1414
  //
1395
1415
  participant?: string;
1396
1416
  //User for a channel.
@@ -3165,6 +3185,41 @@ export class MezonApi {
3165
3185
  ]);
3166
3186
  }
3167
3187
 
3188
+ /** List channelvoices */
3189
+ directChannelVoiceList(bearerToken: string,
3190
+ userId?:Array<string>,
3191
+ limit?:number,
3192
+ options: any = {}): Promise<ApiChannelVoiceList> {
3193
+
3194
+ const urlPath = "/v2/channelvoices";
3195
+ const queryParams = new Map<string, any>();
3196
+ queryParams.set("user_id", userId);
3197
+ queryParams.set("limit", limit);
3198
+
3199
+ let bodyJson : string = "";
3200
+
3201
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3202
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3203
+ if (bearerToken) {
3204
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3205
+ }
3206
+
3207
+ return Promise.race([
3208
+ fetch(fullUrl, fetchOptions).then((response) => {
3209
+ if (response.status == 204) {
3210
+ return response;
3211
+ } else if (response.status >= 200 && response.status < 300) {
3212
+ return response.json();
3213
+ } else {
3214
+ throw response;
3215
+ }
3216
+ }),
3217
+ new Promise((_, reject) =>
3218
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3219
+ ),
3220
+ ]);
3221
+ }
3222
+
3168
3223
  /** List clans */
3169
3224
  listClanDescs(bearerToken: string,
3170
3225
  limit?:number,
@@ -3647,7 +3702,38 @@ export class MezonApi {
3647
3702
  ]);
3648
3703
  }
3649
3704
 
3650
- /** Post clan Emoji /v2/emoji/create */
3705
+ /** Get permission list */
3706
+ listClanEmoji(bearerToken: string,
3707
+ options: any = {}): Promise<ApiClanEmojiList> {
3708
+
3709
+ const urlPath = "/v2/emoji";
3710
+ const queryParams = new Map<string, any>();
3711
+
3712
+ let bodyJson : string = "";
3713
+
3714
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3715
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3716
+ if (bearerToken) {
3717
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3718
+ }
3719
+
3720
+ return Promise.race([
3721
+ fetch(fullUrl, fetchOptions).then((response) => {
3722
+ if (response.status == 204) {
3723
+ return response;
3724
+ } else if (response.status >= 200 && response.status < 300) {
3725
+ return response.json();
3726
+ } else {
3727
+ throw response;
3728
+ }
3729
+ }),
3730
+ new Promise((_, reject) =>
3731
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3732
+ ),
3733
+ ]);
3734
+ }
3735
+
3736
+ /** Post permission Emoji /v2/emoji/create */
3651
3737
  createClanEmoji(bearerToken: string,
3652
3738
  body:ApiClanEmojiCreateRequest,
3653
3739
  options: any = {}): Promise<any> {
package/client.ts CHANGED
@@ -95,7 +95,8 @@ import {
95
95
  ApiDeleteChannelDescRequest,
96
96
  ApiChangeChannelPrivateRequest,
97
97
  ApiClanEmojiList,
98
- ApiClanEmojiCreateRequest
98
+ ApiClanEmojiCreateRequest,
99
+ ApiChannelVoiceList
99
100
  } from "./api.gen";
100
101
 
101
102
  import { Session } from "./session";
@@ -1093,7 +1094,7 @@ export class Client {
1093
1094
 
1094
1095
  response.voice_channel_users!.forEach(gu => {
1095
1096
  result.voice_channel_users!.push({
1096
- jid: gu.jid,
1097
+ id: gu.id,
1097
1098
  channel_id: gu.channel_id,
1098
1099
  user_id: gu.user_id,
1099
1100
  participant: gu.participant
@@ -2209,6 +2210,18 @@ async getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMes
2209
2210
  });
2210
2211
  }
2211
2212
 
2213
+ async directChannelVoiceList(session: Session, userId:Array<string>, limit?: number): Promise<ApiChannelVoiceList> {
2214
+ if (this.autoRefreshSession && session.refresh_token &&
2215
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2216
+ await this.sessionRefresh(session);
2217
+ }
2218
+
2219
+ return this.apiClient.directChannelVoiceList(session.token, userId, limit).then((response: ApiChannelVoiceList) => {
2220
+ return Promise.resolve(response);
2221
+ });
2222
+ }
2223
+
2224
+
2212
2225
  //** */
2213
2226
  async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
2214
2227
  if (this.autoRefreshSession && session.refresh_token &&
package/dist/api.gen.d.ts CHANGED
@@ -250,6 +250,10 @@ export interface ApiChannelUserList {
250
250
  cursor?: string;
251
251
  }
252
252
  /** */
253
+ export interface ApiChannelVoiceList {
254
+ channelvoice?: Array<ApiDirectChannelVoice>;
255
+ }
256
+ /** */
253
257
  export interface ApiClanDesc {
254
258
  banner?: string;
255
259
  clan_id?: string;
@@ -387,6 +391,14 @@ export interface ApiDeleteStorageObjectId {
387
391
  export interface ApiDeleteStorageObjectsRequest {
388
392
  object_ids?: Array<ApiDeleteStorageObjectId>;
389
393
  }
394
+ /** */
395
+ export interface ApiDirectChannelVoice {
396
+ channel_id?: string;
397
+ channel_label?: string;
398
+ clan_id?: string;
399
+ clan_name?: string;
400
+ meeting_code?: string;
401
+ }
390
402
  /** Represents an event to be passed through the server to registered event handlers. */
391
403
  export interface ApiEvent {
392
404
  external?: boolean;
@@ -801,8 +813,8 @@ export interface ApiUsers {
801
813
  }
802
814
  /** A list of users belonging to a channel, along with their role. */
803
815
  export interface ApiVoiceChannelUser {
816
+ id?: string;
804
817
  channel_id?: string;
805
- jid?: string;
806
818
  participant?: string;
807
819
  user_id?: string;
808
820
  }
@@ -935,6 +947,8 @@ export declare class MezonApi {
935
947
  updateChannelDesc(bearerToken: string, channelId: string, body: {}, options?: any): Promise<any>;
936
948
  /** List all users that are part of a channel. */
937
949
  listChannelVoiceUsers(bearerToken: string, clanId?: string, channelId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiVoiceChannelUserList>;
950
+ /** List channelvoices */
951
+ directChannelVoiceList(bearerToken: string, userId?: Array<string>, limit?: number, options?: any): Promise<ApiChannelVoiceList>;
938
952
  /** List clans */
939
953
  listClanDescs(bearerToken: string, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiClanDescList>;
940
954
  /** Create a clan */
@@ -961,7 +975,9 @@ export declare class MezonApi {
961
975
  closeDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
962
976
  /** open direct message. */
963
977
  openDirectMess(bearerToken: string, body: ApiDeleteChannelDescRequest, options?: any): Promise<any>;
964
- /** Post clan Emoji /v2/emoji/create */
978
+ /** Get permission list */
979
+ listClanEmoji(bearerToken: string, options?: any): Promise<ApiClanEmojiList>;
980
+ /** Post permission Emoji /v2/emoji/create */
965
981
  createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
966
982
  /** Get emoji list by clan id */
967
983
  listClanEmojiByClanId(bearerToken: string, clanId: string, options?: any): Promise<ApiClanEmojiList>;
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 } 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 } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -576,6 +576,7 @@ export declare class Client {
576
576
  /** */
577
577
  createPinMessage(session: Session, request: ApiPinMessageRequest): Promise<boolean>;
578
578
  getPinMessagesList(session: Session, channelId: string): Promise<ApiPinMessagesList>;
579
+ directChannelVoiceList(session: Session, userId: Array<string>, limit?: number): Promise<ApiChannelVoiceList>;
579
580
  deletePinMessage(session: Session, message_id: string): Promise<boolean>;
580
581
  /** List clan emoji. */
581
582
  listClanEmoji(session: Session, clan_id: string): Promise<ApiClanEmojiList>;
@@ -1983,6 +1983,33 @@ var MezonApi = class {
1983
1983
  )
1984
1984
  ]);
1985
1985
  }
1986
+ /** List channelvoices */
1987
+ directChannelVoiceList(bearerToken, userId, limit, options = {}) {
1988
+ const urlPath = "/v2/channelvoices";
1989
+ const queryParams = /* @__PURE__ */ new Map();
1990
+ queryParams.set("user_id", userId);
1991
+ queryParams.set("limit", limit);
1992
+ let bodyJson = "";
1993
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1994
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1995
+ if (bearerToken) {
1996
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1997
+ }
1998
+ return Promise.race([
1999
+ fetch(fullUrl, fetchOptions).then((response) => {
2000
+ if (response.status == 204) {
2001
+ return response;
2002
+ } else if (response.status >= 200 && response.status < 300) {
2003
+ return response.json();
2004
+ } else {
2005
+ throw response;
2006
+ }
2007
+ }),
2008
+ new Promise(
2009
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2010
+ )
2011
+ ]);
2012
+ }
1986
2013
  /** List clans */
1987
2014
  listClanDescs(bearerToken, limit, state, cursor, options = {}) {
1988
2015
  const urlPath = "/v2/clandesc";
@@ -2360,7 +2387,32 @@ var MezonApi = class {
2360
2387
  )
2361
2388
  ]);
2362
2389
  }
2363
- /** Post clan Emoji /v2/emoji/create */
2390
+ /** Get permission list */
2391
+ listClanEmoji(bearerToken, options = {}) {
2392
+ const urlPath = "/v2/emoji";
2393
+ const queryParams = /* @__PURE__ */ new Map();
2394
+ let bodyJson = "";
2395
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2396
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2397
+ if (bearerToken) {
2398
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2399
+ }
2400
+ return Promise.race([
2401
+ fetch(fullUrl, fetchOptions).then((response) => {
2402
+ if (response.status == 204) {
2403
+ return response;
2404
+ } else if (response.status >= 200 && response.status < 300) {
2405
+ return response.json();
2406
+ } else {
2407
+ throw response;
2408
+ }
2409
+ }),
2410
+ new Promise(
2411
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2412
+ )
2413
+ ]);
2414
+ }
2415
+ /** Post permission Emoji /v2/emoji/create */
2364
2416
  createClanEmoji(bearerToken, body, options = {}) {
2365
2417
  if (body === null || body === void 0) {
2366
2418
  throw new Error("'body' is a required parameter but is null or undefined.");
@@ -5355,7 +5407,7 @@ var Client = class {
5355
5407
  }
5356
5408
  response.voice_channel_users.forEach((gu) => {
5357
5409
  result.voice_channel_users.push({
5358
- jid: gu.jid,
5410
+ id: gu.id,
5359
5411
  channel_id: gu.channel_id,
5360
5412
  user_id: gu.user_id,
5361
5413
  participant: gu.participant
@@ -6374,6 +6426,16 @@ var Client = class {
6374
6426
  });
6375
6427
  });
6376
6428
  }
6429
+ directChannelVoiceList(session, userId, limit) {
6430
+ return __async(this, null, function* () {
6431
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6432
+ yield this.sessionRefresh(session);
6433
+ }
6434
+ return this.apiClient.directChannelVoiceList(session.token, userId, limit).then((response) => {
6435
+ return Promise.resolve(response);
6436
+ });
6437
+ });
6438
+ }
6377
6439
  //** */
6378
6440
  deletePinMessage(session, message_id) {
6379
6441
  return __async(this, null, function* () {
@@ -1954,6 +1954,33 @@ var MezonApi = class {
1954
1954
  )
1955
1955
  ]);
1956
1956
  }
1957
+ /** List channelvoices */
1958
+ directChannelVoiceList(bearerToken, userId, limit, options = {}) {
1959
+ const urlPath = "/v2/channelvoices";
1960
+ const queryParams = /* @__PURE__ */ new Map();
1961
+ queryParams.set("user_id", userId);
1962
+ queryParams.set("limit", limit);
1963
+ let bodyJson = "";
1964
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1965
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1966
+ if (bearerToken) {
1967
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1968
+ }
1969
+ return Promise.race([
1970
+ fetch(fullUrl, fetchOptions).then((response) => {
1971
+ if (response.status == 204) {
1972
+ return response;
1973
+ } else if (response.status >= 200 && response.status < 300) {
1974
+ return response.json();
1975
+ } else {
1976
+ throw response;
1977
+ }
1978
+ }),
1979
+ new Promise(
1980
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1981
+ )
1982
+ ]);
1983
+ }
1957
1984
  /** List clans */
1958
1985
  listClanDescs(bearerToken, limit, state, cursor, options = {}) {
1959
1986
  const urlPath = "/v2/clandesc";
@@ -2331,7 +2358,32 @@ var MezonApi = class {
2331
2358
  )
2332
2359
  ]);
2333
2360
  }
2334
- /** Post clan Emoji /v2/emoji/create */
2361
+ /** Get permission list */
2362
+ listClanEmoji(bearerToken, options = {}) {
2363
+ const urlPath = "/v2/emoji";
2364
+ const queryParams = /* @__PURE__ */ new Map();
2365
+ let bodyJson = "";
2366
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2367
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2368
+ if (bearerToken) {
2369
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2370
+ }
2371
+ return Promise.race([
2372
+ fetch(fullUrl, fetchOptions).then((response) => {
2373
+ if (response.status == 204) {
2374
+ return response;
2375
+ } else if (response.status >= 200 && response.status < 300) {
2376
+ return response.json();
2377
+ } else {
2378
+ throw response;
2379
+ }
2380
+ }),
2381
+ new Promise(
2382
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2383
+ )
2384
+ ]);
2385
+ }
2386
+ /** Post permission Emoji /v2/emoji/create */
2335
2387
  createClanEmoji(bearerToken, body, options = {}) {
2336
2388
  if (body === null || body === void 0) {
2337
2389
  throw new Error("'body' is a required parameter but is null or undefined.");
@@ -5326,7 +5378,7 @@ var Client = class {
5326
5378
  }
5327
5379
  response.voice_channel_users.forEach((gu) => {
5328
5380
  result.voice_channel_users.push({
5329
- jid: gu.jid,
5381
+ id: gu.id,
5330
5382
  channel_id: gu.channel_id,
5331
5383
  user_id: gu.user_id,
5332
5384
  participant: gu.participant
@@ -6345,6 +6397,16 @@ var Client = class {
6345
6397
  });
6346
6398
  });
6347
6399
  }
6400
+ directChannelVoiceList(session, userId, limit) {
6401
+ return __async(this, null, function* () {
6402
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6403
+ yield this.sessionRefresh(session);
6404
+ }
6405
+ return this.apiClient.directChannelVoiceList(session.token, userId, limit).then((response) => {
6406
+ return Promise.resolve(response);
6407
+ });
6408
+ });
6409
+ }
6348
6410
  //** */
6349
6411
  deletePinMessage(session, message_id) {
6350
6412
  return __async(this, null, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.62",
3
+ "version": "2.7.64",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },