mezon-js 2.8.41 → 2.8.43

Sign up to get free protection for your applications and to get access to all the features.
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;
@@ -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,
package/client.ts CHANGED
@@ -2250,7 +2250,7 @@ async getApp(session: Session, id: string): Promise<ApiApp> {
2250
2250
  });
2251
2251
  }
2252
2252
 
2253
- async listApp(session: Session): Promise<ApiAppList> {
2253
+ async listApps(session: Session): Promise<ApiAppList> {
2254
2254
  if (this.autoRefreshSession && session.refresh_token &&
2255
2255
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2256
2256
  await this.sessionRefresh(session);
@@ -2261,4 +2261,15 @@ async listApp(session: Session): Promise<ApiAppList> {
2261
2261
  });
2262
2262
  }
2263
2263
 
2264
+ async addAppToClan(session: Session, appId: string, clanId: string) {
2265
+ if (this.autoRefreshSession && session.refresh_token &&
2266
+ session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2267
+ await this.sessionRefresh(session);
2268
+ }
2269
+
2270
+ return this.apiClient.addAppToClan(session.token, appId, clanId).then((response: ApiAppList) => {
2271
+ return response !== undefined;
2272
+ });
2273
+ }
2274
+
2264
2275
  };
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
  }
@@ -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. */
package/dist/client.d.ts CHANGED
@@ -540,5 +540,6 @@ export declare class Client {
540
540
  setRoleChannelPermission(session: Session, request: ApiUpdateRoleChannelRequest): Promise<boolean>;
541
541
  addApp(session: Session, request: ApiAddAppRequest): Promise<boolean>;
542
542
  getApp(session: Session, id: string): Promise<ApiApp>;
543
- listApp(session: Session): Promise<ApiAppList>;
543
+ listApps(session: Session): Promise<ApiAppList>;
544
+ addAppToClan(session: Session, appId: string, clanId: string): Promise<boolean>;
544
545
  }
@@ -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) {
@@ -4991,7 +5022,7 @@ var _DefaultSocket = class _DefaultSocket {
4991
5022
  }
4992
5023
  updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments, hideEditted) {
4993
5024
  return __async(this, null, function* () {
4994
- const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hideEditted } });
5025
+ const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hide_editted: hideEditted } });
4995
5026
  return response.channel_message_ack;
4996
5027
  });
4997
5028
  }
@@ -6774,7 +6805,7 @@ var Client = class {
6774
6805
  });
6775
6806
  });
6776
6807
  }
6777
- listApp(session) {
6808
+ listApps(session) {
6778
6809
  return __async(this, null, function* () {
6779
6810
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6780
6811
  yield this.sessionRefresh(session);
@@ -6784,4 +6815,14 @@ var Client = class {
6784
6815
  });
6785
6816
  });
6786
6817
  }
6818
+ addAppToClan(session, appId, clanId) {
6819
+ return __async(this, null, function* () {
6820
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6821
+ yield this.sessionRefresh(session);
6822
+ }
6823
+ return this.apiClient.addAppToClan(session.token, appId, clanId).then((response) => {
6824
+ return response !== void 0;
6825
+ });
6826
+ });
6827
+ }
6787
6828
  };
@@ -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) {
@@ -4962,7 +4993,7 @@ var _DefaultSocket = class _DefaultSocket {
4962
4993
  }
4963
4994
  updateChatMessage(clan_id, channel_id, mode, message_id, content, mentions, attachments, hideEditted) {
4964
4995
  return __async(this, null, function* () {
4965
- const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hideEditted } });
4996
+ const response = yield this.send({ channel_message_update: { clan_id, channel_id, message_id, content, mentions, attachments, mode, hide_editted: hideEditted } });
4966
4997
  return response.channel_message_ack;
4967
4998
  });
4968
4999
  }
@@ -6745,7 +6776,7 @@ var Client = class {
6745
6776
  });
6746
6777
  });
6747
6778
  }
6748
- listApp(session) {
6779
+ listApps(session) {
6749
6780
  return __async(this, null, function* () {
6750
6781
  if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6751
6782
  yield this.sessionRefresh(session);
@@ -6755,6 +6786,16 @@ var Client = class {
6755
6786
  });
6756
6787
  });
6757
6788
  }
6789
+ addAppToClan(session, appId, clanId) {
6790
+ return __async(this, null, function* () {
6791
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
6792
+ yield this.sessionRefresh(session);
6793
+ }
6794
+ return this.apiClient.addAppToClan(session.token, appId, clanId).then((response) => {
6795
+ return response !== void 0;
6796
+ });
6797
+ });
6798
+ }
6758
6799
  };
6759
6800
  export {
6760
6801
  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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.8.41",
3
+ "version": "2.8.43",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -697,7 +697,7 @@ export interface Socket {
697
697
  unfollowUsers(user_ids : string[]) : Promise<void>;
698
698
 
699
699
  /** Update a chat message on a chat channel in the server. */
700
- updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, showEditted?: boolean) : Promise<ChannelMessageAck>;
700
+ updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean) : Promise<ChannelMessageAck>;
701
701
 
702
702
  /** Update the status for the current user online. */
703
703
  updateStatus(status? : string) : Promise<void>;
@@ -1322,7 +1322,7 @@ export class DefaultSocket implements Socket {
1322
1322
  }
1323
1323
 
1324
1324
  async updateChatMessage(clan_id: string, channel_id: string, mode: number, message_id : string, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, hideEditted?: boolean): Promise<ChannelMessageAck> {
1325
- const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, attachments: attachments, mode: mode, hideEditted: hideEditted}});
1325
+ const response = await this.send({channel_message_update: {clan_id: clan_id, channel_id: channel_id, message_id: message_id, content: content, mentions: mentions, attachments: attachments, mode: mode, hide_editted: hideEditted}});
1326
1326
  return response.channel_message_ack;
1327
1327
  }
1328
1328