mezon-js 2.8.22 → 2.8.24

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
@@ -557,26 +557,6 @@ export interface ApiClanEmojiCreateRequest {
557
557
  source?: string;
558
558
  }
559
559
 
560
- /** */
561
- export interface ApiClanEmojiList {
562
- //
563
- emoji_list?: Array<ApiClanEmojiListResponse>;
564
- }
565
-
566
- /** */
567
- export interface ApiClanEmojiListResponse {
568
- //
569
- category?: string;
570
- //
571
- creator_id?: string;
572
- //
573
- id?: string;
574
- //
575
- shortname?: string;
576
- //
577
- src?: string;
578
- }
579
-
580
560
  /** Get clan profile. */
581
561
  export interface ApiClanProfile {
582
562
  //
@@ -589,24 +569,6 @@ export interface ApiClanProfile {
589
569
  user_id?: string;
590
570
  }
591
571
 
592
- /** */
593
- export interface ApiClanSticker {
594
- //
595
- category?: string;
596
- //
597
- clan_id?: string;
598
- //
599
- create_time?: string;
600
- //
601
- creator_id?: string;
602
- //
603
- id?: string;
604
- //
605
- shortname?: string;
606
- //
607
- source?: string;
608
- }
609
-
610
572
  /** */
611
573
  export interface ApiClanStickerAddRequest {
612
574
  //
@@ -621,12 +583,6 @@ export interface ApiClanStickerAddRequest {
621
583
  source?: string;
622
584
  }
623
585
 
624
- /** */
625
- export interface ApiClanStickerListByClanIdResponse {
626
- //
627
- stickers?: Array<ApiClanSticker>;
628
- }
629
-
630
586
  /** A list of users belonging to a clan, along with their role. */
631
587
  export interface ApiClanUserList {
632
588
  //
@@ -3945,7 +3901,7 @@ export class MezonApi {
3945
3901
  }
3946
3902
 
3947
3903
  /** Delete a emoji by ID. */
3948
- deleteByIdClanEmoji(bearerToken: string,
3904
+ deleteClanEmojiById(bearerToken: string,
3949
3905
  id:string,
3950
3906
  clanId?:string,
3951
3907
  options: any = {}): Promise<any> {
@@ -3958,7 +3914,8 @@ export class MezonApi {
3958
3914
  const queryParams = new Map<string, any>();
3959
3915
  queryParams.set("clan_id", clanId);
3960
3916
 
3961
- let bodyJson : string = "";
3917
+ const body = {clan_id: clanId}
3918
+ let bodyJson = JSON.stringify(body || {});
3962
3919
 
3963
3920
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3964
3921
  const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
@@ -6054,201 +6011,6 @@ export class MezonApi {
6054
6011
  ]);
6055
6012
  }
6056
6013
 
6057
- /** Get storage objects. */
6058
- readStorageObjects(bearerToken: string,
6059
- body:ApiReadStorageObjectsRequest,
6060
- options: any = {}): Promise<ApiStorageObjects> {
6061
-
6062
- if (body === null || body === undefined) {
6063
- throw new Error("'body' is a required parameter but is null or undefined.");
6064
- }
6065
- const urlPath = "/v2/storage";
6066
- const queryParams = new Map<string, any>();
6067
-
6068
- let bodyJson : string = "";
6069
- bodyJson = JSON.stringify(body || {});
6070
-
6071
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6072
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
6073
- if (bearerToken) {
6074
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6075
- }
6076
-
6077
- return Promise.race([
6078
- fetch(fullUrl, fetchOptions).then((response) => {
6079
- if (response.status == 204) {
6080
- return response;
6081
- } else if (response.status >= 200 && response.status < 300) {
6082
- return response.json();
6083
- } else {
6084
- throw response;
6085
- }
6086
- }),
6087
- new Promise((_, reject) =>
6088
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6089
- ),
6090
- ]);
6091
- }
6092
-
6093
- /** Write objects into the storage engine. */
6094
- writeStorageObjects(bearerToken: string,
6095
- body:ApiWriteStorageObjectsRequest,
6096
- options: any = {}): Promise<ApiStorageObjectAcks> {
6097
-
6098
- if (body === null || body === undefined) {
6099
- throw new Error("'body' is a required parameter but is null or undefined.");
6100
- }
6101
- const urlPath = "/v2/storage";
6102
- const queryParams = new Map<string, any>();
6103
-
6104
- let bodyJson : string = "";
6105
- bodyJson = JSON.stringify(body || {});
6106
-
6107
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6108
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6109
- if (bearerToken) {
6110
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6111
- }
6112
-
6113
- return Promise.race([
6114
- fetch(fullUrl, fetchOptions).then((response) => {
6115
- if (response.status == 204) {
6116
- return response;
6117
- } else if (response.status >= 200 && response.status < 300) {
6118
- return response.json();
6119
- } else {
6120
- throw response;
6121
- }
6122
- }),
6123
- new Promise((_, reject) =>
6124
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6125
- ),
6126
- ]);
6127
- }
6128
-
6129
- /** Delete one or more objects by ID or username. */
6130
- deleteStorageObjects(bearerToken: string,
6131
- body:ApiDeleteStorageObjectsRequest,
6132
- options: any = {}): Promise<any> {
6133
-
6134
- if (body === null || body === undefined) {
6135
- throw new Error("'body' is a required parameter but is null or undefined.");
6136
- }
6137
- const urlPath = "/v2/storage/delete";
6138
- const queryParams = new Map<string, any>();
6139
-
6140
- let bodyJson : string = "";
6141
- bodyJson = JSON.stringify(body || {});
6142
-
6143
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6144
- const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
6145
- if (bearerToken) {
6146
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6147
- }
6148
-
6149
- return Promise.race([
6150
- fetch(fullUrl, fetchOptions).then((response) => {
6151
- if (response.status == 204) {
6152
- return response;
6153
- } else if (response.status >= 200 && response.status < 300) {
6154
- return response.json();
6155
- } else {
6156
- throw response;
6157
- }
6158
- }),
6159
- new Promise((_, reject) =>
6160
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6161
- ),
6162
- ]);
6163
- }
6164
-
6165
- /** List publicly readable storage objects in a given collection. */
6166
- listStorageObjects(bearerToken: string,
6167
- collection:string,
6168
- userId?:string,
6169
- limit?:number,
6170
- cursor?:string,
6171
- options: any = {}): Promise<ApiStorageObjectList> {
6172
-
6173
- if (collection === null || collection === undefined) {
6174
- throw new Error("'collection' is a required parameter but is null or undefined.");
6175
- }
6176
- const urlPath = "/v2/storage/{collection}"
6177
- .replace("{collection}", encodeURIComponent(String(collection)));
6178
- const queryParams = new Map<string, any>();
6179
- queryParams.set("user_id", userId);
6180
- queryParams.set("limit", limit);
6181
- queryParams.set("cursor", cursor);
6182
-
6183
- let bodyJson : string = "";
6184
-
6185
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6186
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6187
- if (bearerToken) {
6188
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6189
- }
6190
-
6191
- return Promise.race([
6192
- fetch(fullUrl, fetchOptions).then((response) => {
6193
- if (response.status == 204) {
6194
- return response;
6195
- } else if (response.status >= 200 && response.status < 300) {
6196
- return response.json();
6197
- } else {
6198
- throw response;
6199
- }
6200
- }),
6201
- new Promise((_, reject) =>
6202
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6203
- ),
6204
- ]);
6205
- }
6206
-
6207
- /** List publicly readable storage objects in a given collection. */
6208
- listStorageObjects2(bearerToken: string,
6209
- collection:string,
6210
- userId:string,
6211
- limit?:number,
6212
- cursor?:string,
6213
- options: any = {}): Promise<ApiStorageObjectList> {
6214
-
6215
- if (collection === null || collection === undefined) {
6216
- throw new Error("'collection' is a required parameter but is null or undefined.");
6217
- }
6218
- if (userId === null || userId === undefined) {
6219
- throw new Error("'userId' is a required parameter but is null or undefined.");
6220
- }
6221
- const urlPath = "/v2/storage/{collection}/{userId}"
6222
- .replace("{collection}", encodeURIComponent(String(collection)))
6223
- .replace("{userId}", encodeURIComponent(String(userId)));
6224
- const queryParams = new Map<string, any>();
6225
- queryParams.set("limit", limit);
6226
- queryParams.set("cursor", cursor);
6227
-
6228
- let bodyJson : string = "";
6229
-
6230
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6231
- const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6232
- if (bearerToken) {
6233
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6234
- }
6235
-
6236
- return Promise.race([
6237
- fetch(fullUrl, fetchOptions).then((response) => {
6238
- if (response.status == 204) {
6239
- return response;
6240
- } else if (response.status >= 200 && response.status < 300) {
6241
- return response.json();
6242
- } else {
6243
- throw response;
6244
- }
6245
- }),
6246
- new Promise((_, reject) =>
6247
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6248
- ),
6249
- ]);
6250
- }
6251
-
6252
6014
  /** Update fields in a given category. */
6253
6015
  updateCategory(bearerToken: string,
6254
6016
  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,
@@ -885,18 +879,6 @@ export class Client {
885
879
  });
886
880
  }
887
881
 
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
882
  /** Delete a role by ID. */
901
883
  async deleteRole(session: Session, roleId: string): Promise<boolean> {
902
884
  if (this.autoRefreshSession && session.refresh_token &&
@@ -1654,71 +1636,6 @@ export class Client {
1654
1636
  });
1655
1637
  }
1656
1638
 
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
1639
  /** Execute an RPC function on the server. */
1723
1640
  async rpc(session: Session, basicAuthUsername: string,
1724
1641
  basicAuthPassword: string, id: string, input: object): Promise<RpcResponse> {
@@ -2036,29 +1953,8 @@ export class Client {
2036
1953
  });
2037
1954
  }
2038
1955
 
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
1956
  /** Set default notification clan*/
2061
- async setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
1957
+ async setNotificationClan(session: Session, request: ApiSetDefaultNotificationRequest): Promise<boolean> {
2062
1958
  if (this.autoRefreshSession && session.refresh_token &&
2063
1959
  session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
2064
1960
  await this.sessionRefresh(session);
@@ -2311,7 +2207,7 @@ async deleteByIdClanEmoji(session: Session, id: string, clan_id: string) {
2311
2207
  await this.sessionRefresh(session);
2312
2208
  }
2313
2209
 
2314
- return this.apiClient.deleteByIdClanEmoji(session.token, id, clan_id).then((response: any) => {
2210
+ return this.apiClient.deleteClanEmojiById(session.token, id, clan_id).then((response: any) => {
2315
2211
  return response !== undefined;
2316
2212
  });
2317
2213
  }
package/dist/api.gen.d.ts CHANGED
@@ -316,18 +316,6 @@ export interface ApiClanEmojiCreateRequest {
316
316
  shortname?: string;
317
317
  source?: string;
318
318
  }
319
- /** */
320
- export interface ApiClanEmojiList {
321
- emoji_list?: Array<ApiClanEmojiListResponse>;
322
- }
323
- /** */
324
- export interface ApiClanEmojiListResponse {
325
- category?: string;
326
- creator_id?: string;
327
- id?: string;
328
- shortname?: string;
329
- src?: string;
330
- }
331
319
  /** Get clan profile. */
332
320
  export interface ApiClanProfile {
333
321
  avartar?: string;
@@ -336,16 +324,6 @@ export interface ApiClanProfile {
336
324
  user_id?: string;
337
325
  }
338
326
  /** */
339
- export interface ApiClanSticker {
340
- category?: string;
341
- clan_id?: string;
342
- create_time?: string;
343
- creator_id?: string;
344
- id?: string;
345
- shortname?: string;
346
- source?: string;
347
- }
348
- /** */
349
327
  export interface ApiClanStickerAddRequest {
350
328
  category?: string;
351
329
  clan_id?: string;
@@ -353,10 +331,6 @@ export interface ApiClanStickerAddRequest {
353
331
  shortname?: string;
354
332
  source?: string;
355
333
  }
356
- /** */
357
- export interface ApiClanStickerListByClanIdResponse {
358
- stickers?: Array<ApiClanSticker>;
359
- }
360
334
  /** A list of users belonging to a clan, along with their role. */
361
335
  export interface ApiClanUserList {
362
336
  clan_id?: string;
@@ -1093,7 +1067,7 @@ export declare class MezonApi {
1093
1067
  /** Post clan Emoji /v2/emoji/create */
1094
1068
  createClanEmoji(bearerToken: string, body: ApiClanEmojiCreateRequest, options?: any): Promise<any>;
1095
1069
  /** Delete a emoji by ID. */
1096
- deleteByIdClanEmoji(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1070
+ deleteClanEmojiById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1097
1071
  /** Update ClanEmoj By id */
1098
1072
  updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
1099
1073
  /** Search message from elasticsearch service. */
@@ -1208,16 +1182,6 @@ export declare class MezonApi {
1208
1182
  deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1209
1183
  /** Update a sticker by ID */
1210
1184
  updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
1211
- /** Get storage objects. */
1212
- readStorageObjects(bearerToken: string, body: ApiReadStorageObjectsRequest, options?: any): Promise<ApiStorageObjects>;
1213
- /** Write objects into the storage engine. */
1214
- writeStorageObjects(bearerToken: string, body: ApiWriteStorageObjectsRequest, options?: any): Promise<ApiStorageObjectAcks>;
1215
- /** Delete one or more objects by ID or username. */
1216
- deleteStorageObjects(bearerToken: string, body: ApiDeleteStorageObjectsRequest, options?: any): Promise<any>;
1217
- /** List publicly readable storage objects in a given collection. */
1218
- listStorageObjects(bearerToken: string, collection: string, userId?: string, limit?: number, cursor?: string, options?: any): Promise<ApiStorageObjectList>;
1219
- /** List publicly readable storage objects in a given collection. */
1220
- listStorageObjects2(bearerToken: string, collection: string, userId: string, limit?: number, cursor?: string, options?: any): Promise<ApiStorageObjectList>;
1221
1185
  /** Update fields in a given category. */
1222
1186
  updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
1223
1187
  /** Update channel private. */