mezon-js 2.9.18 → 2.9.20

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -36,6 +36,14 @@ export interface ClanUserListClanUser {
36
36
  user?: ApiUser;
37
37
  }
38
38
 
39
+ /** */
40
+ export interface CountClanBadgeResponseBadge {
41
+ //
42
+ clan_id?: string;
43
+ //
44
+ count?: number;
45
+ }
46
+
39
47
  /** */
40
48
  export interface MezonChangeChannelCategoryBody {
41
49
  //
@@ -823,6 +831,12 @@ export interface ApiClanUserList {
823
831
  cursor?: string;
824
832
  }
825
833
 
834
+ /** */
835
+ export interface ApiCountClanBadgeResponse {
836
+ //
837
+ badges?: Array<CountClanBadgeResponseBadge>;
838
+ }
839
+
826
840
  /** */
827
841
  export interface ApiCreateCategoryDescRequest {
828
842
  //
@@ -3570,6 +3584,37 @@ export class MezonApi {
3570
3584
  setTimeout(reject, this.timeoutMs, "Request timed out.")
3571
3585
  ),
3572
3586
  ]);
3587
+ }
3588
+
3589
+ /** count clan badge */
3590
+ countClanBadge(bearerToken: string,
3591
+ options: any = {}): Promise<ApiCountClanBadgeResponse> {
3592
+
3593
+ const urlPath = "/v2/badges";
3594
+ const queryParams = new Map<string, any>();
3595
+
3596
+ let bodyJson : string = "";
3597
+
3598
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3599
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3600
+ if (bearerToken) {
3601
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3602
+ }
3603
+
3604
+ return Promise.race([
3605
+ fetch(fullUrl, fetchOptions).then((response) => {
3606
+ if (response.status == 204) {
3607
+ return response;
3608
+ } else if (response.status >= 200 && response.status < 300) {
3609
+ return response.json();
3610
+ } else {
3611
+ throw response;
3612
+ }
3613
+ }),
3614
+ new Promise((_, reject) =>
3615
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3616
+ ),
3617
+ ]);
3573
3618
  }
3574
3619
  /** */
3575
3620
  updateCategoryOrder(bearerToken: string,
package/client.ts CHANGED
@@ -118,6 +118,7 @@ import {
118
118
  ApiAllUsersAddChannelResponse,
119
119
  ApiRoleListEventResponse,
120
120
  ApiAllUserClans,
121
+ ApiCountClanBadgeResponse,
121
122
  } from "./api.gen";
122
123
 
123
124
  import { Session } from "./session";
@@ -3841,4 +3842,21 @@ export class Client {
3841
3842
  return Promise.resolve(result);
3842
3843
  });
3843
3844
  }
3845
+
3846
+ async countClanBadge(session: Session): Promise<ApiCountClanBadgeResponse> {
3847
+ if (
3848
+ this.autoRefreshSession &&
3849
+ session.refresh_token &&
3850
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3851
+ ) {
3852
+ await this.sessionRefresh(session);
3853
+ }
3854
+
3855
+ return this.apiClient
3856
+ .countClanBadge(session.token)
3857
+ .then((response: ApiCountClanBadgeResponse) => {
3858
+ return Promise.resolve(response);
3859
+ });
3860
+ }
3861
+
3844
3862
  }
package/dist/api.gen.d.ts CHANGED
@@ -17,6 +17,11 @@ export interface ClanUserListClanUser {
17
17
  user?: ApiUser;
18
18
  }
19
19
  /** */
20
+ export interface CountClanBadgeResponseBadge {
21
+ clan_id?: string;
22
+ count?: number;
23
+ }
24
+ /** */
20
25
  export interface MezonChangeChannelCategoryBody {
21
26
  channel_id?: string;
22
27
  }
@@ -473,6 +478,10 @@ export interface ApiClanUserList {
473
478
  cursor?: string;
474
479
  }
475
480
  /** */
481
+ export interface ApiCountClanBadgeResponse {
482
+ badges?: Array<CountClanBadgeResponseBadge>;
483
+ }
484
+ /** */
476
485
  export interface ApiCreateCategoryDescRequest {
477
486
  category_name?: string;
478
487
  clan_id?: string;
@@ -1272,6 +1281,8 @@ export declare class MezonApi {
1272
1281
  banApp(bearerToken: string, id: string, options?: any): Promise<any>;
1273
1282
  /** Unban an app. */
1274
1283
  unbanApp(bearerToken: string, id: string, options?: any): Promise<any>;
1284
+ /** count clan badge */
1285
+ countClanBadge(bearerToken: string, options?: any): Promise<ApiCountClanBadgeResponse>;
1275
1286
  /** */
1276
1287
  updateCategoryOrder(bearerToken: string, body: ApiUpdateCategoryOrderRequest, options?: any): Promise<any>;
1277
1288
  /** */
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, ApiListChannelAppsResponse, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans } 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, ApiNotificationChannelCategorySettingList, ApiNotificationUserChannel, ApiNotificationSetting, ApiNotifiReactMessage, ApiHashtagDmList, ApiEmojiListedResponse, ApiStickerListedResponse, ApiAllUsersAddChannelResponse, ApiRoleListEventResponse, ApiAllUserClans, ApiCountClanBadgeResponse } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -572,4 +572,5 @@ export declare class Client {
572
572
  getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse>;
573
573
  listUserClansByUserId(session: Session): Promise<ApiAllUserClans>;
574
574
  listRoles(session: Session, clanId?: string, limit?: string, state?: string, cursor?: string): Promise<ApiRoleListEventResponse>;
575
+ countClanBadge(session: Session): Promise<ApiCountClanBadgeResponse>;
575
576
  }
@@ -1885,6 +1885,31 @@ var MezonApi = class {
1885
1885
  )
1886
1886
  ]);
1887
1887
  }
1888
+ /** count clan badge */
1889
+ countClanBadge(bearerToken, options = {}) {
1890
+ const urlPath = "/v2/badges";
1891
+ const queryParams = /* @__PURE__ */ new Map();
1892
+ let bodyJson = "";
1893
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1894
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1895
+ if (bearerToken) {
1896
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1897
+ }
1898
+ return Promise.race([
1899
+ fetch(fullUrl, fetchOptions).then((response) => {
1900
+ if (response.status == 204) {
1901
+ return response;
1902
+ } else if (response.status >= 200 && response.status < 300) {
1903
+ return response.json();
1904
+ } else {
1905
+ throw response;
1906
+ }
1907
+ }),
1908
+ new Promise(
1909
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1910
+ )
1911
+ ]);
1912
+ }
1888
1913
  /** */
1889
1914
  updateCategoryOrder(bearerToken, body, options = {}) {
1890
1915
  if (body === null || body === void 0) {
@@ -8041,4 +8066,14 @@ var Client = class {
8041
8066
  });
8042
8067
  });
8043
8068
  }
8069
+ countClanBadge(session) {
8070
+ return __async(this, null, function* () {
8071
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8072
+ yield this.sessionRefresh(session);
8073
+ }
8074
+ return this.apiClient.countClanBadge(session.token).then((response) => {
8075
+ return Promise.resolve(response);
8076
+ });
8077
+ });
8078
+ }
8044
8079
  };
@@ -1856,6 +1856,31 @@ var MezonApi = class {
1856
1856
  )
1857
1857
  ]);
1858
1858
  }
1859
+ /** count clan badge */
1860
+ countClanBadge(bearerToken, options = {}) {
1861
+ const urlPath = "/v2/badges";
1862
+ const queryParams = /* @__PURE__ */ new Map();
1863
+ let bodyJson = "";
1864
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1865
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
1866
+ if (bearerToken) {
1867
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1868
+ }
1869
+ return Promise.race([
1870
+ fetch(fullUrl, fetchOptions).then((response) => {
1871
+ if (response.status == 204) {
1872
+ return response;
1873
+ } else if (response.status >= 200 && response.status < 300) {
1874
+ return response.json();
1875
+ } else {
1876
+ throw response;
1877
+ }
1878
+ }),
1879
+ new Promise(
1880
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1881
+ )
1882
+ ]);
1883
+ }
1859
1884
  /** */
1860
1885
  updateCategoryOrder(bearerToken, body, options = {}) {
1861
1886
  if (body === null || body === void 0) {
@@ -8012,6 +8037,16 @@ var Client = class {
8012
8037
  });
8013
8038
  });
8014
8039
  }
8040
+ countClanBadge(session) {
8041
+ return __async(this, null, function* () {
8042
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
8043
+ yield this.sessionRefresh(session);
8044
+ }
8045
+ return this.apiClient.countClanBadge(session.token).then((response) => {
8046
+ return Promise.resolve(response);
8047
+ });
8048
+ });
8049
+ }
8015
8050
  };
8016
8051
  export {
8017
8052
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.18",
4
+ "version": "2.9.20",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"