mezon-js 2.9.5 → 2.9.6

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -428,6 +428,11 @@ export interface ApiCategoryOrderUpdate {
428
428
  order?: number;
429
429
  }
430
430
 
431
+ export interface ApiListChannelAppsResponse {
432
+ //
433
+ channel_apps?: Array<ApiChannelAppResponse>;
434
+ }
435
+
431
436
  /** Update fields in a given channel. */
432
437
  export interface ApiChangeChannelPrivateRequest {
433
438
  //The ID of the channel to update.
@@ -440,6 +445,20 @@ export interface ApiChangeChannelPrivateRequest {
440
445
  user_ids?: Array<string>;
441
446
  }
442
447
 
448
+ /** */
449
+ export interface ApiChannelAppResponse {
450
+ //
451
+ app_id?: string;
452
+ //
453
+ channel_id?: string;
454
+ //
455
+ clan_id?: string;
456
+ //
457
+ id?: string;
458
+ //
459
+ url?: string;
460
+ }
461
+
443
462
  /** */
444
463
  export interface ApiChannelAttachment {
445
464
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the group was created.
@@ -732,6 +751,8 @@ export interface ApiCreateCategoryDescRequest {
732
751
 
733
752
  /** Create a channel within clan. */
734
753
  export interface ApiCreateChannelDescRequest {
754
+ //
755
+ app_url?: string;
735
756
  //
736
757
  category_id?: string;
737
758
  //The channel this message belongs to.
@@ -3413,6 +3434,39 @@ export class MezonApi {
3413
3434
  ]);
3414
3435
  }
3415
3436
 
3437
+ /** List channel apps. */
3438
+ listChannelApps(bearerToken: string,
3439
+ clanId?:string,
3440
+ options: any = {}): Promise<ApiListChannelAppsResponse> {
3441
+
3442
+ const urlPath = "/v2/channel-apps";
3443
+ const queryParams = new Map<string, any>();
3444
+ queryParams.set("clan_id", clanId);
3445
+
3446
+ let bodyJson : string = "";
3447
+
3448
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3449
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3450
+ if (bearerToken) {
3451
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3452
+ }
3453
+
3454
+ return Promise.race([
3455
+ fetch(fullUrl, fetchOptions).then((response) => {
3456
+ if (response.status == 204) {
3457
+ return response;
3458
+ } else if (response.status >= 200 && response.status < 300) {
3459
+ return response.json();
3460
+ } else {
3461
+ throw response;
3462
+ }
3463
+ }),
3464
+ new Promise((_, reject) =>
3465
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3466
+ ),
3467
+ ]);
3468
+ }
3469
+
3416
3470
  /** List a channel's message history. */
3417
3471
  listChannelMessages(bearerToken: string,
3418
3472
  channelId:string,
package/client.ts CHANGED
@@ -107,6 +107,7 @@ import {
107
107
  ApiRegisterStreamingChannelRequest,
108
108
  ApiRegisterStreamingChannelResponse,
109
109
  ApiRoleList,
110
+ ApiListChannelAppsResponse,
110
111
  } from "./api.gen";
111
112
 
112
113
  import { Session } from "./session";
@@ -3555,4 +3556,44 @@ export class Client {
3555
3556
  return response !== undefined;
3556
3557
  });
3557
3558
  }
3559
+
3560
+ /** List a channel's users. */
3561
+ async listChannelApps(
3562
+ session: Session,
3563
+ clanId: string,
3564
+ ): Promise<ApiListChannelAppsResponse> {
3565
+ if (
3566
+ this.autoRefreshSession &&
3567
+ session.refresh_token &&
3568
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3569
+ ) {
3570
+ await this.sessionRefresh(session);
3571
+ }
3572
+
3573
+ return this.apiClient
3574
+ .listChannelApps(
3575
+ session.token,
3576
+ clanId,
3577
+ )
3578
+ .then((response: ApiListChannelAppsResponse) => {
3579
+ var result: ApiListChannelAppsResponse = {
3580
+ channel_apps: [],
3581
+ };
3582
+
3583
+ if (response.channel_apps == null) {
3584
+ return Promise.resolve(result);
3585
+ }
3586
+
3587
+ response.channel_apps!.forEach((gu) => {
3588
+ result.channel_apps!.push({
3589
+ id: gu.id,
3590
+ channel_id: gu.channel_id,
3591
+ app_id: gu.app_id,
3592
+ clan_id: gu.clan_id,
3593
+ url: gu.url,
3594
+ });
3595
+ });
3596
+ return Promise.resolve(result);
3597
+ });
3598
+ }
3558
3599
  }
package/dist/api.gen.d.ts CHANGED
@@ -249,6 +249,9 @@ export interface ApiCategoryOrderUpdate {
249
249
  category_id?: string;
250
250
  order?: number;
251
251
  }
252
+ export interface ApiListChannelAppsResponse {
253
+ channel_apps?: Array<ApiChannelAppResponse>;
254
+ }
252
255
  /** Update fields in a given channel. */
253
256
  export interface ApiChangeChannelPrivateRequest {
254
257
  channel_id?: string;
@@ -257,6 +260,14 @@ export interface ApiChangeChannelPrivateRequest {
257
260
  user_ids?: Array<string>;
258
261
  }
259
262
  /** */
263
+ export interface ApiChannelAppResponse {
264
+ app_id?: string;
265
+ channel_id?: string;
266
+ clan_id?: string;
267
+ id?: string;
268
+ url?: string;
269
+ }
270
+ /** */
260
271
  export interface ApiChannelAttachment {
261
272
  create_time?: string;
262
273
  filename?: string;
@@ -420,6 +431,7 @@ export interface ApiCreateCategoryDescRequest {
420
431
  }
421
432
  /** Create a channel within clan. */
422
433
  export interface ApiCreateChannelDescRequest {
434
+ app_url?: string;
423
435
  category_id?: string;
424
436
  channel_id?: string;
425
437
  channel_label?: string;
@@ -1137,6 +1149,8 @@ export declare class MezonApi {
1137
1149
  updateCategoryOrder(bearerToken: string, body: ApiUpdateCategoryOrderRequest, options?: any): Promise<any>;
1138
1150
  /** */
1139
1151
  listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, categoryOrder?: number, options?: any): Promise<ApiCategoryDescList>;
1152
+ /** List channel apps. */
1153
+ listChannelApps(bearerToken: string, clanId?: string, options?: any): Promise<ApiListChannelAppsResponse>;
1140
1154
  /** List a channel's message history. */
1141
1155
  listChannelMessages(bearerToken: string, channelId: string, messageId?: string, direction?: number, limit?: number, options?: any): Promise<ApiChannelMessageList>;
1142
1156
  /** Add users to a channel. */
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, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList } from "./api.gen";
16
+ import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiEvent, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiSetDefaultNotificationRequest, ApiSetNotificationRequest, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse, ApiPinMessageRequest, ApiPinMessagesList, ApiDeleteChannelDescRequest, ApiChangeChannelPrivateRequest, ApiClanEmojiCreateRequest, MezonUpdateClanEmojiByIdBody, ApiWebhookCreateRequest, ApiWebhookListResponse, MezonUpdateWebhookByIdBody, ApiWebhookGenerateResponse, ApiCheckDuplicateClanNameResponse, ApiClanStickerAddRequest, MezonUpdateClanStickerByIdBody, MezonChangeChannelCategoryBody, ApiUpdateRoleChannelRequest, ApiAddAppRequest, ApiAppList, ApiApp, MezonUpdateAppBody, ApiSystemMessagesList, ApiSystemMessage, ApiSystemMessageRequest, MezonUpdateSystemMessageBody, ApiUpdateCategoryOrderRequest, ApiGiveCoffeeEvent, ApiListStreamingChannelsResponse, ApiStreamingChannelUserList, ApiRegisterStreamingChannelRequest, ApiRoleList, ApiListChannelAppsResponse } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -557,4 +557,6 @@ export declare class Client {
557
557
  /** List a channel's users. */
558
558
  listStreamingChannelUsers(session: Session, clanId: string, channelId: string, channelType: number, state?: number, limit?: number, cursor?: string): Promise<ApiStreamingChannelUserList>;
559
559
  registerStreamingChannel(session: Session, request: ApiRegisterStreamingChannelRequest): Promise<boolean>;
560
+ /** List a channel's users. */
561
+ listChannelApps(session: Session, clanId: string): Promise<ApiListChannelAppsResponse>;
560
562
  }
@@ -1946,6 +1946,32 @@ var MezonApi = class {
1946
1946
  )
1947
1947
  ]);
1948
1948
  }
1949
+ /** List channel apps. */
1950
+ listChannelApps(bearerToken, clanId, options = {}) {
1951
+ const urlPath = "/v2/channel-apps";
1952
+ const queryParams = /* @__PURE__ */ new Map();
1953
+ queryParams.set("clan_id", clanId);
1954
+ let bodyJson = "";
1955
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1956
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1957
+ if (bearerToken) {
1958
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1959
+ }
1960
+ return Promise.race([
1961
+ fetch(fullUrl, fetchOptions).then((response) => {
1962
+ if (response.status == 204) {
1963
+ return response;
1964
+ } else if (response.status >= 200 && response.status < 300) {
1965
+ return response.json();
1966
+ } else {
1967
+ throw response;
1968
+ }
1969
+ }),
1970
+ new Promise(
1971
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1972
+ )
1973
+ ]);
1974
+ }
1949
1975
  /** List a channel's message history. */
1950
1976
  listChannelMessages(bearerToken, channelId, messageId, direction, limit, options = {}) {
1951
1977
  if (channelId === null || channelId === void 0) {
@@ -7504,4 +7530,33 @@ var Client = class {
7504
7530
  });
7505
7531
  });
7506
7532
  }
7533
+ /** List a channel's users. */
7534
+ listChannelApps(session, clanId) {
7535
+ return __async(this, null, function* () {
7536
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7537
+ yield this.sessionRefresh(session);
7538
+ }
7539
+ return this.apiClient.listChannelApps(
7540
+ session.token,
7541
+ clanId
7542
+ ).then((response) => {
7543
+ var result = {
7544
+ channel_apps: []
7545
+ };
7546
+ if (response.channel_apps == null) {
7547
+ return Promise.resolve(result);
7548
+ }
7549
+ response.channel_apps.forEach((gu) => {
7550
+ result.channel_apps.push({
7551
+ id: gu.id,
7552
+ channel_id: gu.channel_id,
7553
+ app_id: gu.app_id,
7554
+ clan_id: gu.clan_id,
7555
+ url: gu.url
7556
+ });
7557
+ });
7558
+ return Promise.resolve(result);
7559
+ });
7560
+ });
7561
+ }
7507
7562
  };
@@ -1917,6 +1917,32 @@ var MezonApi = class {
1917
1917
  )
1918
1918
  ]);
1919
1919
  }
1920
+ /** List channel apps. */
1921
+ listChannelApps(bearerToken, clanId, options = {}) {
1922
+ const urlPath = "/v2/channel-apps";
1923
+ const queryParams = /* @__PURE__ */ new Map();
1924
+ queryParams.set("clan_id", clanId);
1925
+ let bodyJson = "";
1926
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1927
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1928
+ if (bearerToken) {
1929
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1930
+ }
1931
+ return Promise.race([
1932
+ fetch(fullUrl, fetchOptions).then((response) => {
1933
+ if (response.status == 204) {
1934
+ return response;
1935
+ } else if (response.status >= 200 && response.status < 300) {
1936
+ return response.json();
1937
+ } else {
1938
+ throw response;
1939
+ }
1940
+ }),
1941
+ new Promise(
1942
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1943
+ )
1944
+ ]);
1945
+ }
1920
1946
  /** List a channel's message history. */
1921
1947
  listChannelMessages(bearerToken, channelId, messageId, direction, limit, options = {}) {
1922
1948
  if (channelId === null || channelId === void 0) {
@@ -7475,6 +7501,35 @@ var Client = class {
7475
7501
  });
7476
7502
  });
7477
7503
  }
7504
+ /** List a channel's users. */
7505
+ listChannelApps(session, clanId) {
7506
+ return __async(this, null, function* () {
7507
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7508
+ yield this.sessionRefresh(session);
7509
+ }
7510
+ return this.apiClient.listChannelApps(
7511
+ session.token,
7512
+ clanId
7513
+ ).then((response) => {
7514
+ var result = {
7515
+ channel_apps: []
7516
+ };
7517
+ if (response.channel_apps == null) {
7518
+ return Promise.resolve(result);
7519
+ }
7520
+ response.channel_apps.forEach((gu) => {
7521
+ result.channel_apps.push({
7522
+ id: gu.id,
7523
+ channel_id: gu.channel_id,
7524
+ app_id: gu.app_id,
7525
+ clan_id: gu.clan_id,
7526
+ url: gu.url
7527
+ });
7528
+ });
7529
+ return Promise.resolve(result);
7530
+ });
7531
+ });
7532
+ }
7478
7533
  };
7479
7534
  export {
7480
7535
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.5",
4
+ "version": "2.9.6",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"