mezon-js 2.8.23 → 2.8.25

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -807,30 +807,6 @@ export interface ApiFriendList {
807
807
  friends?: Array<ApiFriend>;
808
808
  }
809
809
 
810
- /** */
811
- export interface ApiHashtagDmVoice {
812
- //The channel id.
813
- channel_id?: string;
814
- //
815
- channel_label?: string;
816
- //
817
- channel_private?: number;
818
- //
819
- clan_id?: string;
820
- //
821
- clan_name?: string;
822
- //
823
- meeting_code?: string;
824
- //
825
- type?: number;
826
- }
827
-
828
- /** */
829
- export interface ApiHashtagDmVoiceList {
830
- //A list of channel.
831
- hashtage_voice?: Array<ApiHashtagDmVoice>;
832
- }
833
-
834
810
  /** Add link invite users to. */
835
811
  export interface ApiInviteUserRes {
836
812
  //id channel to add link to.
@@ -3901,7 +3877,7 @@ export class MezonApi {
3901
3877
  }
3902
3878
 
3903
3879
  /** Delete a emoji by ID. */
3904
- deleteByIdClanEmoji(bearerToken: string,
3880
+ deleteClanEmojiById(bearerToken: string,
3905
3881
  id:string,
3906
3882
  clanId?:string,
3907
3883
  options: any = {}): Promise<any> {
@@ -3914,7 +3890,8 @@ export class MezonApi {
3914
3890
  const queryParams = new Map<string, any>();
3915
3891
  queryParams.set("clan_id", clanId);
3916
3892
 
3917
- let bodyJson : string = "";
3893
+ const body = {clan_id: clanId}
3894
+ let bodyJson = JSON.stringify(body || {});
3918
3895
 
3919
3896
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3920
3897
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -4487,41 +4464,6 @@ export class MezonApi {
4487
4464
  ]);
4488
4465
  }
4489
4466
 
4490
- /** List channelvoices */
4491
- hashtagDMVoiceList(bearerToken: string,
4492
- userId?:Array<string>,
4493
- limit?:number,
4494
- options: any = {}): Promise<ApiHashtagDmVoiceList> {
4495
-
4496
- const urlPath = "/v2/hashtagdmvoice";
4497
- const queryParams = new Map<string, any>();
4498
- queryParams.set("user_id", userId);
4499
- queryParams.set("limit", limit);
4500
-
4501
- let bodyJson : string = "";
4502
-
4503
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4504
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4505
- if (bearerToken) {
4506
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4507
- }
4508
-
4509
- return Promise.race([
4510
- fetch(fullUrl, fetchOptions).then((response) => {
4511
- if (response.status == 204) {
4512
- return response;
4513
- } else if (response.status >= 200 && response.status < 300) {
4514
- return response.json();
4515
- } else {
4516
- throw response;
4517
- }
4518
- }),
4519
- new Promise((_, reject) =>
4520
- setTimeout(reject, this.timeoutMs, "Request timed out.")
4521
- ),
4522
- ]);
4523
- }
4524
-
4525
4467
  /** Add users to a channel. */
4526
4468
  createLinkInviteUser(bearerToken: string,
4527
4469
  body:ApiLinkInviteUserRequest,
@@ -6010,201 +5952,6 @@ export class MezonApi {
6010
5952
  ]);
6011
5953
  }
6012
5954
 
6013
- /** Get storage objects. */
6014
- readStorageObjects(bearerToken: string,
6015
- body:ApiReadStorageObjectsRequest,
6016
- options: any = {}): Promise<ApiStorageObjects> {
6017
-
6018
- if (body === null || body === undefined) {
6019
- throw new Error("'body' is a required parameter but is null or undefined.");
6020
- }
6021
- const urlPath = "/v2/storage";
6022
- const queryParams = new Map<string, any>();
6023
-
6024
- let bodyJson : string = "";
6025
- bodyJson = JSON.stringify(body || {});
6026
-
6027
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6028
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
6029
- if (bearerToken) {
6030
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6031
- }
6032
-
6033
- return Promise.race([
6034
- fetch(fullUrl, fetchOptions).then((response) => {
6035
- if (response.status == 204) {
6036
- return response;
6037
- } else if (response.status >= 200 && response.status < 300) {
6038
- return response.json();
6039
- } else {
6040
- throw response;
6041
- }
6042
- }),
6043
- new Promise((_, reject) =>
6044
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6045
- ),
6046
- ]);
6047
- }
6048
-
6049
- /** Write objects into the storage engine. */
6050
- writeStorageObjects(bearerToken: string,
6051
- body:ApiWriteStorageObjectsRequest,
6052
- options: any = {}): Promise<ApiStorageObjectAcks> {
6053
-
6054
- if (body === null || body === undefined) {
6055
- throw new Error("'body' is a required parameter but is null or undefined.");
6056
- }
6057
- const urlPath = "/v2/storage";
6058
- const queryParams = new Map<string, any>();
6059
-
6060
- let bodyJson : string = "";
6061
- bodyJson = JSON.stringify(body || {});
6062
-
6063
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6064
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6065
- if (bearerToken) {
6066
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6067
- }
6068
-
6069
- return Promise.race([
6070
- fetch(fullUrl, fetchOptions).then((response) => {
6071
- if (response.status == 204) {
6072
- return response;
6073
- } else if (response.status >= 200 && response.status < 300) {
6074
- return response.json();
6075
- } else {
6076
- throw response;
6077
- }
6078
- }),
6079
- new Promise((_, reject) =>
6080
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6081
- ),
6082
- ]);
6083
- }
6084
-
6085
- /** Delete one or more objects by ID or username. */
6086
- deleteStorageObjects(bearerToken: string,
6087
- body:ApiDeleteStorageObjectsRequest,
6088
- options: any = {}): Promise<any> {
6089
-
6090
- if (body === null || body === undefined) {
6091
- throw new Error("'body' is a required parameter but is null or undefined.");
6092
- }
6093
- const urlPath = "/v2/storage/delete";
6094
- const queryParams = new Map<string, any>();
6095
-
6096
- let bodyJson : string = "";
6097
- bodyJson = JSON.stringify(body || {});
6098
-
6099
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6100
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6101
- if (bearerToken) {
6102
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6103
- }
6104
-
6105
- return Promise.race([
6106
- fetch(fullUrl, fetchOptions).then((response) => {
6107
- if (response.status == 204) {
6108
- return response;
6109
- } else if (response.status >= 200 && response.status < 300) {
6110
- return response.json();
6111
- } else {
6112
- throw response;
6113
- }
6114
- }),
6115
- new Promise((_, reject) =>
6116
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6117
- ),
6118
- ]);
6119
- }
6120
-
6121
- /** List publicly readable storage objects in a given collection. */
6122
- listStorageObjects(bearerToken: string,
6123
- collection:string,
6124
- userId?:string,
6125
- limit?:number,
6126
- cursor?:string,
6127
- options: any = {}): Promise<ApiStorageObjectList> {
6128
-
6129
- if (collection === null || collection === undefined) {
6130
- throw new Error("'collection' is a required parameter but is null or undefined.");
6131
- }
6132
- const urlPath = "/v2/storage/{collection}"
6133
- .replace("{collection}", encodeURIComponent(String(collection)));
6134
- const queryParams = new Map<string, any>();
6135
- queryParams.set("user_id", userId);
6136
- queryParams.set("limit", limit);
6137
- queryParams.set("cursor", cursor);
6138
-
6139
- let bodyJson : string = "";
6140
-
6141
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6142
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6143
- if (bearerToken) {
6144
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6145
- }
6146
-
6147
- return Promise.race([
6148
- fetch(fullUrl, fetchOptions).then((response) => {
6149
- if (response.status == 204) {
6150
- return response;
6151
- } else if (response.status >= 200 && response.status < 300) {
6152
- return response.json();
6153
- } else {
6154
- throw response;
6155
- }
6156
- }),
6157
- new Promise((_, reject) =>
6158
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6159
- ),
6160
- ]);
6161
- }
6162
-
6163
- /** List publicly readable storage objects in a given collection. */
6164
- listStorageObjects2(bearerToken: string,
6165
- collection:string,
6166
- userId:string,
6167
- limit?:number,
6168
- cursor?:string,
6169
- options: any = {}): Promise<ApiStorageObjectList> {
6170
-
6171
- if (collection === null || collection === undefined) {
6172
- throw new Error("'collection' is a required parameter but is null or undefined.");
6173
- }
6174
- if (userId === null || userId === undefined) {
6175
- throw new Error("'userId' is a required parameter but is null or undefined.");
6176
- }
6177
- const urlPath = "/v2/storage/{collection}/{userId}"
6178
- .replace("{collection}", encodeURIComponent(String(collection)))
6179
- .replace("{userId}", encodeURIComponent(String(userId)));
6180
- const queryParams = new Map<string, any>();
6181
- queryParams.set("limit", limit);
6182
- queryParams.set("cursor", cursor);
6183
-
6184
- let bodyJson : string = "";
6185
-
6186
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6187
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6188
- if (bearerToken) {
6189
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6190
- }
6191
-
6192
- return Promise.race([
6193
- fetch(fullUrl, fetchOptions).then((response) => {
6194
- if (response.status == 204) {
6195
- return response;
6196
- } else if (response.status >= 200 && response.status < 300) {
6197
- return response.json();
6198
- } else {
6199
- throw response;
6200
- }
6201
- }),
6202
- new Promise((_, reject) =>
6203
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6204
- ),
6205
- ]);
6206
- }
6207
-
6208
5955
  /** Update fields in a given category. */
6209
5956
  updateCategory(bearerToken: string,
6210
5957
  body:ApiUpdateCategoryDescRequest,
package/client.ts CHANGED
@@ -42,18 +42,12 @@ import {
42
42
  ApiAddRoleChannelDescRequest,
43
43
  ApiCreateCategoryDescRequest,
44
44
  ApiUpdateCategoryDescRequest,
45
- ApiDeleteStorageObjectsRequest,
46
45
  ApiEvent,
47
46
  ApiFriendList,
48
47
  ApiNotificationList,
49
- ApiReadStorageObjectsRequest,
50
48
  ApiRpc,
51
- ApiStorageObjectAcks,
52
- ApiStorageObjectList,
53
- ApiStorageObjects,
54
49
  ApiUpdateAccountRequest,
55
50
  ApiUsers,
56
- ApiWriteStorageObjectsRequest,
57
51
  MezonApi,
58
52
  ApiSession,
59
53
  ApiAccountApple,
@@ -102,7 +96,6 @@ import {
102
96
  ApiClanStickerAddRequest,
103
97
  MezonUpdateClanStickerByIdBody,
104
98
  MezonChangeChannelCategoryBody,
105
- ApiHashtagDmVoiceList,
106
99
  ApiPermissionRoleChannelList,
107
100
  ApiUpdateRoleChannelRequest,
108
101
  } from "./api.gen";
@@ -885,18 +878,6 @@ export class Client {
885
878
  });
886
879
  }
887
880
 
888
- /** Delete one or more storage objects */
889
- async deleteStorageObjects(session: Session, request: ApiDeleteStorageObjectsRequest): Promise<boolean> {
890
- if (this.autoRefreshSession && session.refresh_token &&
891
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
892
- await this.sessionRefresh(session);
893
- }
894
-
895
- return this.apiClient.deleteStorageObjects(session.token, request).then((response: any) => {
896
- return Promise.resolve(response != undefined);
897
- });
898
- }
899
-
900
881
  /** Delete a role by ID. */
901
882
  async deleteRole(session: Session, roleId: string): Promise<boolean> {
902
883
  if (this.autoRefreshSession && session.refresh_token &&
@@ -1654,71 +1635,6 @@ export class Client {
1654
1635
  });
1655
1636
  }
1656
1637
 
1657
- /** List storage objects. */
1658
- async listStorageObjects(session: Session, collection: string, userId?: string, limit?: number, cursor?: string): Promise<StorageObjectList> {
1659
- if (this.autoRefreshSession && session.refresh_token &&
1660
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1661
- await this.sessionRefresh(session);
1662
- }
1663
-
1664
- return this.apiClient.listStorageObjects(session.token, collection, userId, limit, cursor).then((response: ApiStorageObjectList) => {
1665
- var result: StorageObjectList = {
1666
- objects: [],
1667
- cursor: response.cursor
1668
- };
1669
-
1670
- if (response.objects == null) {
1671
- return Promise.resolve(result);
1672
- }
1673
-
1674
- response.objects!.forEach(o => {
1675
- result.objects.push({
1676
- collection: o.collection,
1677
- key: o.key,
1678
- permission_read: o.permission_read ? Number(o.permission_read) : 0,
1679
- permission_write: o.permission_write ? Number(o.permission_write) : 0,
1680
- value: o.value ? JSON.parse(o.value) : undefined,
1681
- version: o.version,
1682
- user_id: o.user_id,
1683
- create_time: o.create_time,
1684
- update_time: o.update_time
1685
- })
1686
- });
1687
- return Promise.resolve(result);
1688
- });
1689
- }
1690
-
1691
- /** Fetch storage objects. */
1692
- async readStorageObjects(session: Session, request: ApiReadStorageObjectsRequest): Promise<StorageObjects> {
1693
- if (this.autoRefreshSession && session.refresh_token &&
1694
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
1695
- await this.sessionRefresh(session);
1696
- }
1697
-
1698
- return this.apiClient.readStorageObjects(session.token, request).then((response: ApiStorageObjects) => {
1699
- var result: StorageObjects = {objects: []};
1700
-
1701
- if (response.objects == null) {
1702
- return Promise.resolve(result);
1703
- }
1704
-
1705
- response.objects!.forEach(o => {
1706
- result.objects.push({
1707
- collection: o.collection,
1708
- key: o.key,
1709
- permission_read: o.permission_read ? Number(o.permission_read) : 0,
1710
- permission_write: o.permission_write ? Number(o.permission_write) : 0,
1711
- value: o.value ? JSON.parse(o.value) : undefined,
1712
- version: o.version,
1713
- user_id: o.user_id,
1714
- create_time: o.create_time,
1715
- update_time: o.update_time
1716
- })
1717
- });
1718
- return Promise.resolve(result);
1719
- });
1720
- }
1721
-
1722
1638
  /** Execute an RPC function on the server. */
1723
1639
  async rpc(session: Session, basicAuthUsername: string,
1724
1640
  basicAuthPassword: string, id: string, input: object): Promise<RpcResponse> {
@@ -2036,29 +1952,8 @@ export class Client {
2036
1952
  });
2037
1953
  }
2038
1954
 
2039
- /** Write storage objects. */
2040
- async writeStorageObjects(session: Session, objects: Array<WriteStorageObject>): Promise<ApiStorageObjectAcks> {
2041
- if (this.autoRefreshSession && session.refresh_token &&
2042
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2043
- await this.sessionRefresh(session);
2044
- }
2045
-
2046
- var request: ApiWriteStorageObjectsRequest = {objects: []};
2047
- objects.forEach(o => {
2048
- request.objects!.push({
2049
- collection: o.collection,
2050
- key: o.key,
2051
- permission_read: o.permission_read,
2052
- permission_write: o.permission_write,
2053
- value: JSON.stringify(o.value),
2054
- version: o.version
2055
- })
2056
- })
2057
-
2058
- return this.apiClient.writeStorageObjects(session.token, request);
2059
- }
2060
1955
  /** Set default notification clan*/
2061
- async setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
1956
+ async setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
2062
1957
  if (this.autoRefreshSession && session.refresh_token &&
2063
1958
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2064
1959
  await this.sessionRefresh(session);
@@ -2256,18 +2151,6 @@ async pinMessagesList(session: Session, channelId: string): Promise<ApiPinMessag
2256
2151
  });
2257
2152
  }
2258
2153
 
2259
- async hashtagDmVoiceList(session: Session, userId:Array<string>, limit?: number): Promise<ApiHashtagDmVoiceList> {
2260
- if (this.autoRefreshSession && session.refresh_token &&
2261
- session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2262
- await this.sessionRefresh(session);
2263
- }
2264
-
2265
- return this.apiClient.hashtagDMVoiceList(session.token, userId, limit).then((response: ApiHashtagDmVoiceList) => {
2266
- return Promise.resolve(response);
2267
- });
2268
- }
2269
-
2270
-
2271
2154
  //** */
2272
2155
  async deletePinMessage(session: Session, message_id: string): Promise<boolean> {
2273
2156
  if (this.autoRefreshSession && session.refresh_token &&
@@ -2311,7 +2194,7 @@ async deleteByIdClanEmoji(session: Session, id: string, clan_id: string) {
2311
2194
  await this.sessionRefresh(session);
2312
2195
  }
2313
2196
 
2314
- return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response: any) => {
2197
+ return this.apiClient.deleteClanEmojiById(session.token, id, clan_id).then((response: any) => {
2315
2198
  return response !== undefined;
2316
2199
  });
2317
2200
  }
package/dist/api.gen.d.ts CHANGED
@@ -461,20 +461,6 @@ export interface ApiFriendList {
461
461
  cursor?: string;
462
462
  friends?: Array<ApiFriend>;
463
463
  }
464
- /** */
465
- export interface ApiHashtagDmVoice {
466
- channel_id?: string;
467
- channel_label?: string;
468
- channel_private?: number;
469
- clan_id?: string;
470
- clan_name?: string;
471
- meeting_code?: string;
472
- type?: number;
473
- }
474
- /** */
475
- export interface ApiHashtagDmVoiceList {
476
- hashtage_voice?: Array<ApiHashtagDmVoice>;
477
- }
478
464
  /** Add link invite users to. */
479
465
  export interface ApiInviteUserRes {
480
466
  channel_id?: string;
@@ -1067,7 +1053,7 @@ export declare class MezonApi {
1067
1053
  /** Post clan Emoji /v2/emoji/create */
1068
1054
  createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
1069
1055
  /** Delete a emoji by ID. */
1070
- deleteByIdClanEmoji(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1056
+ deleteClanEmojiById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1071
1057
  /** Update ClanEmoj By id */
1072
1058
  updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
1073
1059
  /** Search message from elasticsearch service. */
@@ -1098,8 +1084,6 @@ export declare class MezonApi {
1098
1084
  importSteamFriends(bearerToken: string, account: ApiAccountSteam, reset?: boolean, options?: any): Promise<any>;
1099
1085
  /** */
1100
1086
  getUserProfileOnClan(bearerToken: string, clanId: string, options?: any): Promise<ApiClanProfile>;
1101
- /** List channelvoices */
1102
- hashtagDMVoiceList(bearerToken: string, userId?: Array<string>, limit?: number, options?: any): Promise<ApiHashtagDmVoiceList>;
1103
1087
  /** Add users to a channel. */
1104
1088
  createLinkInviteUser(bearerToken: string, body: ApiLinkInviteUserRequest, options?: any): Promise<ApiLinkInviteUser>;
1105
1089
  /** Add users to a channel. */
@@ -1182,16 +1166,6 @@ export declare class MezonApi {
1182
1166
  deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1183
1167
  /** Update a sticker by ID */
1184
1168
  updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
1185
- /** Get storage objects. */
1186
- readStorageObjects(bearerToken: string, body: ApiReadStorageObjectsRequest, options?: any): Promise<ApiStorageObjects>;
1187
- /** Write objects into the storage engine. */
1188
- writeStorageObjects(bearerToken: string, body: ApiWriteStorageObjectsRequest, options?: any): Promise<ApiStorageObjectAcks>;
1189
- /** Delete one or more objects by ID or username. */
1190
- deleteStorageObjects(bearerToken: string, body: ApiDeleteStorageObjectsRequest, options?: any): Promise<any>;
1191
- /** List publicly readable storage objects in a given collection. */
1192
- listStorageObjects(bearerToken: string, collection: string, userId?: string, limit?: number, cursor?: string, options?: any): Promise<ApiStorageObjectList>;
1193
- /** List publicly readable storage objects in a given collection. */
1194
- listStorageObjects2(bearerToken: string, collection: string, userId: string, limit?: number, cursor?: string, options?: any): Promise<ApiStorageObjectList>;
1195
1169
  /** Update fields in a given category. */
1196
1170
  updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
1197
1171
  /** Update channel private. */