mezon-js 2.8.42 → 2.8.44

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
@@ -123,6 +123,8 @@ export interface MezonUpdateClanEmojiByIdBody {
123
123
  //
124
124
  category?: string;
125
125
  //
126
+ clan_id?: string;
127
+ //
126
128
  shortname?: string;
127
129
  //
128
130
  source?: string;
@@ -1408,7 +1410,7 @@ export interface ApiSetMuteNotificationRequest {
1408
1410
  //
1409
1411
  active?: number;
1410
1412
  //
1411
- channel_id?: string;
1413
+ id?: string;
1412
1414
  //
1413
1415
  notification_type?: number;
1414
1416
  }
@@ -2989,6 +2991,47 @@ export class MezonApi {
2989
2991
  ]);
2990
2992
  }
2991
2993
 
2994
+ /** Add an app to clan. */
2995
+ addAppToClan(bearerToken: string,
2996
+ appId:string,
2997
+ clanId:string,
2998
+ options: any = {}): Promise<any> {
2999
+
3000
+ if (appId === null || appId === undefined) {
3001
+ throw new Error("'appId' is a required parameter but is null or undefined.");
3002
+ }
3003
+ if (clanId === null || clanId === undefined) {
3004
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
3005
+ }
3006
+ const urlPath = "/v2/apps/app/{appId}/clan/{clanId}"
3007
+ .replace("{appId}", encodeURIComponent(String(appId)))
3008
+ .replace("{clanId}", encodeURIComponent(String(clanId)));
3009
+ const queryParams = new Map<string, any>();
3010
+
3011
+ let bodyJson : string = "";
3012
+
3013
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3014
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3015
+ if (bearerToken) {
3016
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3017
+ }
3018
+
3019
+ return Promise.race([
3020
+ fetch(fullUrl, fetchOptions).then((response) => {
3021
+ if (response.status == 204) {
3022
+ return response;
3023
+ } else if (response.status >= 200 && response.status < 300) {
3024
+ return response.json();
3025
+ } else {
3026
+ throw response;
3027
+ }
3028
+ }),
3029
+ new Promise((_, reject) =>
3030
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3031
+ ),
3032
+ ]);
3033
+ }
3034
+
2992
3035
  /** Delete all information stored for an app. */
2993
3036
  deleteApp(bearerToken: string,
2994
3037
  id:string,
@@ -4911,6 +4954,42 @@ export class MezonApi {
4911
4954
  ]);
4912
4955
  }
4913
4956
 
4957
+ /** set mute notification user channel. */
4958
+ setMuteNotificationCategory(bearerToken: string,
4959
+ body:ApiSetMuteNotificationRequest,
4960
+ options: any = {}): Promise<any> {
4961
+
4962
+ if (body === null || body === undefined) {
4963
+ throw new Error("'body' is a required parameter but is null or undefined.");
4964
+ }
4965
+ const urlPath = "/v2/mutenotificationcategory/set";
4966
+ const queryParams = new Map<string, any>();
4967
+
4968
+ let bodyJson : string = "";
4969
+ bodyJson = JSON.stringify(body || {});
4970
+
4971
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4972
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4973
+ if (bearerToken) {
4974
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4975
+ }
4976
+
4977
+ return Promise.race([
4978
+ fetch(fullUrl, fetchOptions).then((response) => {
4979
+ if (response.status == 204) {
4980
+ return response;
4981
+ } else if (response.status >= 200 && response.status < 300) {
4982
+ return response.json();
4983
+ } else {
4984
+ throw response;
4985
+ }
4986
+ }),
4987
+ new Promise((_, reject) =>
4988
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4989
+ ),
4990
+ ]);
4991
+ }
4992
+
4914
4993
  /** set mute notification user channel. */
4915
4994
  setMuteNotificationChannel(bearerToken: string,
4916
4995
  body:ApiSetMuteNotificationRequest,
package/client.ts CHANGED
@@ -1932,6 +1932,18 @@ async setNotificationChannel(session: Session, request: ApiSetNotificationReques
1932
1932
  });
1933
1933
  }
1934
1934
 
1935
+ /** Set notification category*/
1936
+ async setMuteNotificationCategory(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean> {
1937
+ if (this.autoRefreshSession && session.refresh_token &&
1938
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1939
+ await this.sessionRefresh(session);
1940
+ }
1941
+
1942
+ return this.apiClient.setMuteNotificationCategory(session.token, request).then((response: any) => {
1943
+ return response !== undefined;
1944
+ });
1945
+ }
1946
+
1935
1947
  /** Set notification channel*/
1936
1948
  async setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean> {
1937
1949
  if (this.autoRefreshSession && session.refresh_token &&
@@ -2250,7 +2262,7 @@ async getApp(session: Session, id: string): Promise<ApiApp> {
2250
2262
  });
2251
2263
  }
2252
2264
 
2253
- async listApp(session: Session): Promise<ApiAppList> {
2265
+ async listApps(session: Session): Promise<ApiAppList> {
2254
2266
  if (this.autoRefreshSession && session.refresh_token &&
2255
2267
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2256
2268
  await this.sessionRefresh(session);
@@ -2261,4 +2273,15 @@ async listApp(session: Session): Promise<ApiAppList> {
2261
2273
  });
2262
2274
  }
2263
2275
 
2276
+ async addAppToClan(session: Session, appId: string, clanId: string) {
2277
+ if (this.autoRefreshSession && session.refresh_token &&
2278
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2279
+ await this.sessionRefresh(session);
2280
+ }
2281
+
2282
+ return this.apiClient.addAppToClan(session.token, appId, clanId).then((response: ApiAppList) => {
2283
+ return response !== undefined;
2284
+ });
2285
+ }
2286
+
2264
2287
  };
package/dist/api.gen.d.ts CHANGED
@@ -70,6 +70,7 @@ export interface MezonUpdateClanDescProfileBody {
70
70
  /** */
71
71
  export interface MezonUpdateClanEmojiByIdBody {
72
72
  category?: string;
73
+ clan_id?: string;
73
74
  shortname?: string;
74
75
  source?: string;
75
76
  }
@@ -816,7 +817,7 @@ export interface ApiSetDefaultNotificationRequest {
816
817
  /** */
817
818
  export interface ApiSetMuteNotificationRequest {
818
819
  active?: number;
819
- channel_id?: string;
820
+ id?: string;
820
821
  notification_type?: number;
821
822
  }
822
823
  /** */
@@ -1055,6 +1056,8 @@ export declare class MezonApi {
1055
1056
  addApp(bearerToken: string, body: ApiAddAppRequest, options?: any): Promise<any>;
1056
1057
  /** List (and optionally filter) accounts. */
1057
1058
  listApps(bearerToken: string, filter?: string, tombstones?: boolean, cursor?: string, options?: any): Promise<ApiAppList>;
1059
+ /** Add an app to clan. */
1060
+ addAppToClan(bearerToken: string, appId: string, clanId: string, options?: any): Promise<any>;
1058
1061
  /** Delete all information stored for an app. */
1059
1062
  deleteApp(bearerToken: string, id: string, recordDeletion?: boolean, options?: any): Promise<any>;
1060
1063
  /** Get detailed app information. */
@@ -1158,6 +1161,8 @@ export declare class MezonApi {
1158
1161
  /** Add users to a channel. */
1159
1162
  inviteUser(bearerToken: string, inviteId: string, options?: any): Promise<ApiInviteUserRes>;
1160
1163
  /** set mute notification user channel. */
1164
+ setMuteNotificationCategory(bearerToken: string, body: ApiSetMuteNotificationRequest, options?: any): Promise<any>;
1165
+ /** set mute notification user channel. */
1161
1166
  setMuteNotificationChannel(bearerToken: string, body: ApiSetMuteNotificationRequest, options?: any): Promise<any>;
1162
1167
  /** Delete one or more notifications for the current user. */
1163
1168
  deleteNotifications(bearerToken: string, ids?: Array<string>, options?: any): Promise<any>;
package/dist/client.d.ts CHANGED
@@ -505,6 +505,8 @@ export declare class Client {
505
505
  setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean>;
506
506
  /** Set notification channel*/
507
507
  setNotificationChannel(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
508
+ /** Set notification category*/
509
+ setMuteNotificationCategory(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean>;
508
510
  /** Set notification channel*/
509
511
  setMuteNotificationChannel(session: Session, request: ApiSetMuteNotificationRequest): Promise<boolean>;
510
512
  /** update channel private*/
@@ -540,5 +542,6 @@ export declare class Client {
540
542
  setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
541
543
  addApp(session: Session, request: ApiAddAppRequest): Promise<boolean>;
542
544
  getApp(session: Session, id: string): Promise<ApiApp>;
543
- listApp(session: Session): Promise<ApiAppList>;
545
+ listApps(session: Session): Promise<ApiAppList>;
546
+ addAppToClan(session: Session, appId: string, clanId: string): Promise<boolean>;
544
547
  }
@@ -1676,6 +1676,37 @@ var MezonApi = class {
1676
1676
  )
1677
1677
  ]);
1678
1678
  }
1679
+ /** Add an app to clan. */
1680
+ addAppToClan(bearerToken, appId, clanId, options = {}) {
1681
+ if (appId === null || appId === void 0) {
1682
+ throw new Error("'appId' is a required parameter but is null or undefined.");
1683
+ }
1684
+ if (clanId === null || clanId === void 0) {
1685
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
1686
+ }
1687
+ const urlPath = "/v2/apps/app/{appId}/clan/{clanId}".replace("{appId}", encodeURIComponent(String(appId))).replace("{clanId}", encodeURIComponent(String(clanId)));
1688
+ const queryParams = /* @__PURE__ */ new Map();
1689
+ let bodyJson = "";
1690
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1691
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1692
+ if (bearerToken) {
1693
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1694
+ }
1695
+ return Promise.race([
1696
+ fetch(fullUrl, fetchOptions).then((response) => {
1697
+ if (response.status == 204) {
1698
+ return response;
1699
+ } else if (response.status >= 200 && response.status < 300) {
1700
+ return response.json();
1701
+ } else {
1702
+ throw response;
1703
+ }
1704
+ }),
1705
+ new Promise(
1706
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1707
+ )
1708
+ ]);
1709
+ }
1679
1710
  /** Delete all information stored for an app. */
1680
1711
  deleteApp(bearerToken, id, recordDeletion, options = {}) {
1681
1712
  if (id === null || id === void 0) {
@@ -3166,6 +3197,35 @@ var MezonApi = class {
3166
3197
  ]);
3167
3198
  }
3168
3199
  /** set mute notification user channel. */
3200
+ setMuteNotificationCategory(bearerToken, body, options = {}) {
3201
+ if (body === null || body === void 0) {
3202
+ throw new Error("'body' is a required parameter but is null or undefined.");
3203
+ }
3204
+ const urlPath = "/v2/mutenotificationcategory/set";
3205
+ const queryParams = /* @__PURE__ */ new Map();
3206
+ let bodyJson = "";
3207
+ bodyJson = JSON.stringify(body || {});
3208
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3209
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3210
+ if (bearerToken) {
3211
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3212
+ }
3213
+ return Promise.race([
3214
+ fetch(fullUrl, fetchOptions).then((response) => {
3215
+ if (response.status == 204) {
3216
+ return response;
3217
+ } else if (response.status >= 200 && response.status < 300) {
3218
+ return response.json();
3219
+ } else {
3220
+ throw response;
3221
+ }
3222
+ }),
3223
+ new Promise(
3224
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3225
+ )
3226
+ ]);
3227
+ }
3228
+ /** set mute notification user channel. */
3169
3229
  setMuteNotificationChannel(bearerToken, body, options = {}) {
3170
3230
  if (body === null || body === void 0) {
3171
3231
  throw new Error("'body' is a required parameter but is null or undefined.");
@@ -6483,6 +6543,17 @@ var Client = class {
6483
6543
  });
6484
6544
  });
6485
6545
  }
6546
+ /** Set notification category*/
6547
+ setMuteNotificationCategory(session, request) {
6548
+ return __async(this, null, function* () {
6549
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6550
+ yield this.sessionRefresh(session);
6551
+ }
6552
+ return this.apiClient.setMuteNotificationCategory(session.token, request).then((response) => {
6553
+ return response !== void 0;
6554
+ });
6555
+ });
6556
+ }
6486
6557
  /** Set notification channel*/
6487
6558
  setMuteNotificationChannel(session, request) {
6488
6559
  return __async(this, null, function* () {
@@ -6774,7 +6845,7 @@ var Client = class {
6774
6845
  });
6775
6846
  });
6776
6847
  }
6777
- listApp(session) {
6848
+ listApps(session) {
6778
6849
  return __async(this, null, function* () {
6779
6850
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6780
6851
  yield this.sessionRefresh(session);
@@ -6784,4 +6855,14 @@ var Client = class {
6784
6855
  });
6785
6856
  });
6786
6857
  }
6858
+ addAppToClan(session, appId, clanId) {
6859
+ return __async(this, null, function* () {
6860
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6861
+ yield this.sessionRefresh(session);
6862
+ }
6863
+ return this.apiClient.addAppToClan(session.token, appId, clanId).then((response) => {
6864
+ return response !== void 0;
6865
+ });
6866
+ });
6867
+ }
6787
6868
  };
@@ -1647,6 +1647,37 @@ var MezonApi = class {
1647
1647
  )
1648
1648
  ]);
1649
1649
  }
1650
+ /** Add an app to clan. */
1651
+ addAppToClan(bearerToken, appId, clanId, options = {}) {
1652
+ if (appId === null || appId === void 0) {
1653
+ throw new Error("'appId' is a required parameter but is null or undefined.");
1654
+ }
1655
+ if (clanId === null || clanId === void 0) {
1656
+ throw new Error("'clanId' is a required parameter but is null or undefined.");
1657
+ }
1658
+ const urlPath = "/v2/apps/app/{appId}/clan/{clanId}".replace("{appId}", encodeURIComponent(String(appId))).replace("{clanId}", encodeURIComponent(String(clanId)));
1659
+ const queryParams = /* @__PURE__ */ new Map();
1660
+ let bodyJson = "";
1661
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1662
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1663
+ if (bearerToken) {
1664
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
1665
+ }
1666
+ return Promise.race([
1667
+ fetch(fullUrl, fetchOptions).then((response) => {
1668
+ if (response.status == 204) {
1669
+ return response;
1670
+ } else if (response.status >= 200 && response.status < 300) {
1671
+ return response.json();
1672
+ } else {
1673
+ throw response;
1674
+ }
1675
+ }),
1676
+ new Promise(
1677
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
1678
+ )
1679
+ ]);
1680
+ }
1650
1681
  /** Delete all information stored for an app. */
1651
1682
  deleteApp(bearerToken, id, recordDeletion, options = {}) {
1652
1683
  if (id === null || id === void 0) {
@@ -3137,6 +3168,35 @@ var MezonApi = class {
3137
3168
  ]);
3138
3169
  }
3139
3170
  /** set mute notification user channel. */
3171
+ setMuteNotificationCategory(bearerToken, body, options = {}) {
3172
+ if (body === null || body === void 0) {
3173
+ throw new Error("'body' is a required parameter but is null or undefined.");
3174
+ }
3175
+ const urlPath = "/v2/mutenotificationcategory/set";
3176
+ const queryParams = /* @__PURE__ */ new Map();
3177
+ let bodyJson = "";
3178
+ bodyJson = JSON.stringify(body || {});
3179
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3180
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3181
+ if (bearerToken) {
3182
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3183
+ }
3184
+ return Promise.race([
3185
+ fetch(fullUrl, fetchOptions).then((response) => {
3186
+ if (response.status == 204) {
3187
+ return response;
3188
+ } else if (response.status >= 200 && response.status < 300) {
3189
+ return response.json();
3190
+ } else {
3191
+ throw response;
3192
+ }
3193
+ }),
3194
+ new Promise(
3195
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3196
+ )
3197
+ ]);
3198
+ }
3199
+ /** set mute notification user channel. */
3140
3200
  setMuteNotificationChannel(bearerToken, body, options = {}) {
3141
3201
  if (body === null || body === void 0) {
3142
3202
  throw new Error("'body' is a required parameter but is null or undefined.");
@@ -6454,6 +6514,17 @@ var Client = class {
6454
6514
  });
6455
6515
  });
6456
6516
  }
6517
+ /** Set notification category*/
6518
+ setMuteNotificationCategory(session, request) {
6519
+ return __async(this, null, function* () {
6520
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6521
+ yield this.sessionRefresh(session);
6522
+ }
6523
+ return this.apiClient.setMuteNotificationCategory(session.token, request).then((response) => {
6524
+ return response !== void 0;
6525
+ });
6526
+ });
6527
+ }
6457
6528
  /** Set notification channel*/
6458
6529
  setMuteNotificationChannel(session, request) {
6459
6530
  return __async(this, null, function* () {
@@ -6745,7 +6816,7 @@ var Client = class {
6745
6816
  });
6746
6817
  });
6747
6818
  }
6748
- listApp(session) {
6819
+ listApps(session) {
6749
6820
  return __async(this, null, function* () {
6750
6821
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6751
6822
  yield this.sessionRefresh(session);
@@ -6755,6 +6826,16 @@ var Client = class {
6755
6826
  });
6756
6827
  });
6757
6828
  }
6829
+ addAppToClan(session, appId, clanId) {
6830
+ return __async(this, null, function* () {
6831
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6832
+ yield this.sessionRefresh(session);
6833
+ }
6834
+ return this.apiClient.addAppToClan(session.token, appId, clanId).then((response) => {
6835
+ return response !== void 0;
6836
+ });
6837
+ });
6838
+ }
6758
6839
  };
6759
6840
  export {
6760
6841
  ChannelStreamMode,
package/dist/socket.d.ts CHANGED
@@ -474,7 +474,7 @@ export interface Socket {
474
474
  /** Unfollow one or more users from their status updates. */
475
475
  unfollowUsers(user_ids: string[]): Promise<void>;
476
476
  /** Update a chat message on a chat channel in the server. */
477
- updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, showEditted?: boolean): Promise<ChannelMessageAck>;
477
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id: string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck>;
478
478
  /** Update the status for the current user online. */
479
479
  updateStatus(status?: string): Promise<void>;
480
480
  /** Send a chat message to a chat channel on the server. */