mezon-js 2.9.12 → 2.9.13

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
@@ -42,6 +42,10 @@ export interface MezonChangeChannelCategoryBody {
42
42
  channel_id?: string;
43
43
  }
44
44
 
45
+ /** */
46
+ export interface MezonDeleteWebhookByIdBody {
47
+ }
48
+
45
49
  /** Update app information. */
46
50
  export interface MezonUpdateAppBody {
47
51
  //about the app.
@@ -274,6 +278,18 @@ export interface ApiAccount {
274
278
  wallet?: string;
275
279
  }
276
280
 
281
+ /** Send a app token to the server. Used with authenticate/link/unlink. */
282
+ export interface ApiAccountApp {
283
+ //
284
+ appid?: string;
285
+ //
286
+ appname?: string;
287
+ //The account token when create apps to access their profile API.
288
+ token?: string;
289
+ //Extra information that will be bundled in the session token.
290
+ vars?: Record<string, string>;
291
+ }
292
+
277
293
  /** Send a Apple Sign In token to the server. Used with authenticate/link/unlink. */
278
294
  export interface ApiAccountApple {
279
295
  //The ID token received from Apple to validate.
@@ -368,6 +384,16 @@ export interface ApiAddRoleChannelDescRequest {
368
384
  role_ids?: Array<string>;
369
385
  }
370
386
 
387
+ /** */
388
+ export interface ApiAllUsersAddChannelResponse {
389
+ //
390
+ channel_id?: string;
391
+ //
392
+ limit?: number;
393
+ //
394
+ user_ids?: Array<string>;
395
+ }
396
+
371
397
  /** App information. */
372
398
  export interface ApiApp {
373
399
  //
@@ -400,6 +426,12 @@ export interface ApiAppList {
400
426
  total_count?: number;
401
427
  }
402
428
 
429
+ /** Authenticate against the server with a device ID. */
430
+ export interface ApiAuthenticateRequest {
431
+ //The App account details.
432
+ account?: ApiAccountApp;
433
+ }
434
+
403
435
  /** */
404
436
  export interface ApiCategoryDesc {
405
437
  //
@@ -691,6 +723,26 @@ export interface ApiClanDescProfile {
691
723
  profile_theme?: string;
692
724
  }
693
725
 
726
+ /** */
727
+ export interface ApiClanEmoji {
728
+ //
729
+ category?: string;
730
+ //
731
+ clan_id?: string;
732
+ //
733
+ clan_name?: string;
734
+ //
735
+ creator_id?: string;
736
+ //
737
+ id?: string;
738
+ //
739
+ logo?: string;
740
+ //
741
+ shortname?: string;
742
+ //
743
+ src?: string;
744
+ }
745
+
694
746
  /** */
695
747
  export interface ApiClanEmojiCreateRequest {
696
748
  //
@@ -717,6 +769,28 @@ export interface ApiClanProfile {
717
769
  user_id?: string;
718
770
  }
719
771
 
772
+ /** */
773
+ export interface ApiClanSticker {
774
+ //
775
+ category?: string;
776
+ //
777
+ clan_id?: string;
778
+ //
779
+ clan_name?: string;
780
+ //
781
+ create_time?: string;
782
+ //
783
+ creator_id?: string;
784
+ //
785
+ id?: string;
786
+ //
787
+ logo?: string;
788
+ //
789
+ shortname?: string;
790
+ //
791
+ source?: string;
792
+ }
793
+
720
794
  /** */
721
795
  export interface ApiClanStickerAddRequest {
722
796
  //
@@ -925,6 +999,11 @@ export interface ApiListStreamingChannelsResponse {
925
999
  streaming_channels?: Array<ApiStreamingChannelResponse>;
926
1000
  }
927
1001
 
1002
+ export interface ApiEmojiListedResponse {
1003
+ //
1004
+ emoji_list?: Array<ApiClanEmoji>;
1005
+ }
1006
+
928
1007
  /** */
929
1008
  export interface ApiEventList {
930
1009
  //A list of event.
@@ -1164,6 +1243,17 @@ export interface ApiMessageReaction {
1164
1243
  is_parent_public?: boolean;
1165
1244
  }
1166
1245
 
1246
+ export interface ApiListChannelAppsResponse {
1247
+ //
1248
+ channel_apps?: Array<ApiChannelAppResponse>;
1249
+ }
1250
+
1251
+ /** */
1252
+ export interface ApiListStreamingChannelsResponse {
1253
+ //
1254
+ streaming_channels?: Array<ApiStreamingChannelResponse>;
1255
+ }
1256
+
1167
1257
  /** */
1168
1258
  export interface ApiMessageRef {
1169
1259
  //
@@ -1254,6 +1344,43 @@ export interface ApiNotificationUserChannel {
1254
1344
  time_mute?: string;
1255
1345
  }
1256
1346
 
1347
+ /** */
1348
+ export interface ApiOssrsHttpCallbackRequest {
1349
+ //
1350
+ action?: string;
1351
+ //
1352
+ app?: string;
1353
+ //
1354
+ client_id?: string;
1355
+ //
1356
+ ip?: string;
1357
+ //
1358
+ page_url?: string;
1359
+ //
1360
+ param?: string;
1361
+ //
1362
+ server_id?: string;
1363
+ //
1364
+ service_id?: string;
1365
+ //
1366
+ stream?: string;
1367
+ //
1368
+ stream_id?: string;
1369
+ //
1370
+ stream_url?: string;
1371
+ //
1372
+ tc_url?: string;
1373
+ //
1374
+ vhost?: string;
1375
+ }
1376
+
1377
+ /** */
1378
+ export interface ApiOssrsHttpCallbackResponse {
1379
+ //
1380
+ code?: number;
1381
+ //
1382
+ msg?: string;
1383
+ }
1257
1384
  /** */
1258
1385
  export interface ApiPermission {
1259
1386
  //
@@ -1544,6 +1671,12 @@ export interface ApiSortParam {
1544
1671
  order?: string;
1545
1672
  }
1546
1673
 
1674
+ /** */
1675
+ export interface ApiStickerListedResponse {
1676
+ //
1677
+ stickers?: Array<ApiClanSticker>;
1678
+ }
1679
+
1547
1680
  /** */
1548
1681
  export interface ApiStreamingChannelResponse {
1549
1682
  //
@@ -1809,6 +1942,18 @@ export interface ApiWebhookListResponse {
1809
1942
  webhooks?: Array<ApiWebhook>;
1810
1943
  }
1811
1944
 
1945
+ /** Represents an event to be passed through the server to registered event handlers. */
1946
+ export interface MezonapiEvent {
1947
+ //True if the event came directly from a client call, false otherwise.
1948
+ external?: boolean;
1949
+ //An event name, type, category, or identifier.
1950
+ name?: string;
1951
+ //Arbitrary event property values.
1952
+ properties?: Record<string, string>;
1953
+ //The time when the event was triggered.
1954
+ timestamp?: string;
1955
+ }
1956
+
1812
1957
  /** */
1813
1958
  export interface ProtobufAny {
1814
1959
  //
@@ -3792,6 +3937,41 @@ export class MezonApi {
3792
3937
  ]);
3793
3938
  }
3794
3939
 
3940
+ /** list user add channel by channel ids */
3941
+ listUsersAddChannelByChannelId(bearerToken: string,
3942
+ channelId?:string,
3943
+ limit?:number,
3944
+ options: any = {}): Promise<ApiAllUsersAddChannelResponse> {
3945
+
3946
+ const urlPath = "/v2/channeldesc/users/add";
3947
+ const queryParams = new Map<string, any>();
3948
+ queryParams.set("channel_id", channelId);
3949
+ queryParams.set("limit", limit);
3950
+
3951
+ let bodyJson : string = "";
3952
+
3953
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3954
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
3955
+ if (bearerToken) {
3956
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3957
+ }
3958
+
3959
+ return Promise.race([
3960
+ fetch(fullUrl, fetchOptions).then((response) => {
3961
+ if (response.status == 204) {
3962
+ return response;
3963
+ } else if (response.status >= 200 && response.status < 300) {
3964
+ return response.json();
3965
+ } else {
3966
+ throw response;
3967
+ }
3968
+ }),
3969
+ new Promise((_, reject) =>
3970
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3971
+ ),
3972
+ ]);
3973
+ }
3974
+
3795
3975
  /** Delete a channel by ID. */
3796
3976
  deleteChannelDesc(bearerToken: string,
3797
3977
  channelId:string,
@@ -4587,6 +4767,37 @@ export class MezonApi {
4587
4767
  ]);
4588
4768
  }
4589
4769
 
4770
+ /** get list emoji by user id */
4771
+ getListEmojisByUserId(bearerToken: string,
4772
+ options: any = {}): Promise<ApiEmojiListedResponse> {
4773
+
4774
+ const urlPath = "/v2/emojis";
4775
+ const queryParams = new Map<string, any>();
4776
+
4777
+ let bodyJson : string = "";
4778
+
4779
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4780
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4781
+ if (bearerToken) {
4782
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4783
+ }
4784
+
4785
+ return Promise.race([
4786
+ fetch(fullUrl, fetchOptions).then((response) => {
4787
+ if (response.status == 204) {
4788
+ return response;
4789
+ } else if (response.status >= 200 && response.status < 300) {
4790
+ return response.json();
4791
+ } else {
4792
+ throw response;
4793
+ }
4794
+ }),
4795
+ new Promise((_, reject) =>
4796
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4797
+ ),
4798
+ ]);
4799
+ }
4800
+
4590
4801
  /** Search message from elasticsearch service. */
4591
4802
  searchMessage(bearerToken: string,
4592
4803
  body:ApiSearchMessageRequest,
@@ -5626,6 +5837,42 @@ export class MezonApi {
5626
5837
  ]);
5627
5838
  }
5628
5839
 
5840
+ /** Ossrs http callback. */
5841
+ streamingServerCallback(bearerToken: string,
5842
+ body:ApiOssrsHttpCallbackRequest,
5843
+ options: any = {}): Promise<ApiOssrsHttpCallbackResponse> {
5844
+
5845
+ if (body === null || body === undefined) {
5846
+ throw new Error("'body' is a required parameter but is null or undefined.");
5847
+ }
5848
+ const urlPath = "/v2/ossrs/callback";
5849
+ const queryParams = new Map<string, any>();
5850
+
5851
+ let bodyJson : string = "";
5852
+ bodyJson = JSON.stringify(body || {});
5853
+
5854
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
5855
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
5856
+ if (bearerToken) {
5857
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
5858
+ }
5859
+
5860
+ return Promise.race([
5861
+ fetch(fullUrl, fetchOptions).then((response) => {
5862
+ if (response.status == 204) {
5863
+ return response;
5864
+ } else if (response.status >= 200 && response.status < 300) {
5865
+ return response.json();
5866
+ } else {
5867
+ throw response;
5868
+ }
5869
+ }),
5870
+ new Promise((_, reject) =>
5871
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
5872
+ ),
5873
+ ]);
5874
+ }
5875
+
5629
5876
  /** set permission role channel. */
5630
5877
  setRoleChannelPermission(bearerToken: string,
5631
5878
  body:ApiUpdateRoleChannelRequest,
@@ -6422,6 +6669,37 @@ export class MezonApi {
6422
6669
  ]);
6423
6670
  }
6424
6671
 
6672
+ /** get list sticker by user id */
6673
+ getListStickersByUserId(bearerToken: string,
6674
+ options: any = {}): Promise<ApiStickerListedResponse> {
6675
+
6676
+ const urlPath = "/v2/stickers";
6677
+ const queryParams = new Map<string, any>();
6678
+
6679
+ let bodyJson : string = "";
6680
+
6681
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
6682
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
6683
+ if (bearerToken) {
6684
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6685
+ }
6686
+
6687
+ return Promise.race([
6688
+ fetch(fullUrl, fetchOptions).then((response) => {
6689
+ if (response.status == 204) {
6690
+ return response;
6691
+ } else if (response.status >= 200 && response.status < 300) {
6692
+ return response.json();
6693
+ } else {
6694
+ throw response;
6695
+ }
6696
+ }),
6697
+ new Promise((_, reject) =>
6698
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
6699
+ ),
6700
+ ]);
6701
+ }
6702
+
6425
6703
  /** List streaming channels. */
6426
6704
  listStreamingChannels(bearerToken: string,
6427
6705
  clanId?:string,
package/client.ts CHANGED
@@ -108,6 +108,9 @@ import {
108
108
  ApiRegisterStreamingChannelResponse,
109
109
  ApiRoleList,
110
110
  ApiListChannelAppsResponse,
111
+ ApiStickerListedResponse,
112
+ ApiEmojiListedResponse,
113
+ ApiAllUsersAddChannelResponse,
111
114
  } from "./api.gen";
112
115
 
113
116
  import { Session } from "./session";
@@ -3599,4 +3602,52 @@ export class Client {
3599
3602
  return Promise.resolve(result);
3600
3603
  });
3601
3604
  }
3605
+
3606
+ async getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse> {
3607
+ if (
3608
+ this.autoRefreshSession &&
3609
+ session.refresh_token &&
3610
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3611
+ ) {
3612
+ await this.sessionRefresh(session);
3613
+ }
3614
+
3615
+ return this.apiClient
3616
+ .getListStickersByUserId(session.token)
3617
+ .then((response: any) => {
3618
+ return Promise.resolve(response);
3619
+ });
3620
+ }
3621
+
3622
+ async getListEmojisByUserId(session: Session): Promise<ApiEmojiListedResponse> {
3623
+ if (
3624
+ this.autoRefreshSession &&
3625
+ session.refresh_token &&
3626
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3627
+ ) {
3628
+ await this.sessionRefresh(session);
3629
+ }
3630
+
3631
+ return this.apiClient
3632
+ .getListEmojisByUserId(session.token)
3633
+ .then((response: any) => {
3634
+ return Promise.resolve(response);
3635
+ });
3636
+ }
3637
+
3638
+ async listUsersAddChannelByChannelId(session: Session, channel_id : string, limit : number): Promise<ApiAllUsersAddChannelResponse> {
3639
+ if (
3640
+ this.autoRefreshSession &&
3641
+ session.refresh_token &&
3642
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
3643
+ ) {
3644
+ await this.sessionRefresh(session);
3645
+ }
3646
+
3647
+ return this.apiClient
3648
+ .listUsersAddChannelByChannelId(session.token, channel_id, limit)
3649
+ .then((response: any) => {
3650
+ return Promise.resolve(response);
3651
+ });
3652
+ }
3602
3653
  }
package/dist/api.gen.d.ts CHANGED
@@ -20,6 +20,9 @@ export interface ClanUserListClanUser {
20
20
  export interface MezonChangeChannelCategoryBody {
21
21
  channel_id?: string;
22
22
  }
23
+ /** */
24
+ export interface MezonDeleteWebhookByIdBody {
25
+ }
23
26
  /** Update app information. */
24
27
  export interface MezonUpdateAppBody {
25
28
  about?: string;
@@ -156,6 +159,13 @@ export interface ApiAccount {
156
159
  verify_time?: string;
157
160
  wallet?: string;
158
161
  }
162
+ /** Send a app token to the server. Used with authenticate/link/unlink. */
163
+ export interface ApiAccountApp {
164
+ appid?: string;
165
+ appname?: string;
166
+ token?: string;
167
+ vars?: Record<string, string>;
168
+ }
159
169
  /** Send a Apple Sign In token to the server. Used with authenticate/link/unlink. */
160
170
  export interface ApiAccountApple {
161
171
  token?: string;
@@ -214,6 +224,12 @@ export interface ApiAddRoleChannelDescRequest {
214
224
  channel_id?: string;
215
225
  role_ids?: Array<string>;
216
226
  }
227
+ /** */
228
+ export interface ApiAllUsersAddChannelResponse {
229
+ channel_id?: string;
230
+ limit?: number;
231
+ user_ids?: Array<string>;
232
+ }
217
233
  /** App information. */
218
234
  export interface ApiApp {
219
235
  about?: string;
@@ -232,6 +248,10 @@ export interface ApiAppList {
232
248
  next_cursor?: string;
233
249
  total_count?: number;
234
250
  }
251
+ /** Authenticate against the server with a device ID. */
252
+ export interface ApiAuthenticateRequest {
253
+ account?: ApiAccountApp;
254
+ }
235
255
  /** */
236
256
  export interface ApiCategoryDesc {
237
257
  category_id?: string;
@@ -396,6 +416,17 @@ export interface ApiClanDescProfile {
396
416
  profile_theme?: string;
397
417
  }
398
418
  /** */
419
+ export interface ApiClanEmoji {
420
+ category?: string;
421
+ clan_id?: string;
422
+ clan_name?: string;
423
+ creator_id?: string;
424
+ id?: string;
425
+ logo?: string;
426
+ shortname?: string;
427
+ src?: string;
428
+ }
429
+ /** */
399
430
  export interface ApiClanEmojiCreateRequest {
400
431
  category?: string;
401
432
  clan_id?: string;
@@ -411,6 +442,18 @@ export interface ApiClanProfile {
411
442
  user_id?: string;
412
443
  }
413
444
  /** */
445
+ export interface ApiClanSticker {
446
+ category?: string;
447
+ clan_id?: string;
448
+ clan_name?: string;
449
+ create_time?: string;
450
+ creator_id?: string;
451
+ id?: string;
452
+ logo?: string;
453
+ shortname?: string;
454
+ source?: string;
455
+ }
456
+ /** */
414
457
  export interface ApiClanStickerAddRequest {
415
458
  category?: string;
416
459
  clan_id?: string;
@@ -531,6 +574,9 @@ export interface ApiRegisterStreamingChannelResponse {
531
574
  export interface ApiListStreamingChannelsResponse {
532
575
  streaming_channels?: Array<ApiStreamingChannelResponse>;
533
576
  }
577
+ export interface ApiEmojiListedResponse {
578
+ emoji_list?: Array<ApiClanEmoji>;
579
+ }
534
580
  /** */
535
581
  export interface ApiEventList {
536
582
  events?: Array<ApiEventManagement>;
@@ -673,6 +719,13 @@ export interface ApiMessageReaction {
673
719
  parent_id?: string;
674
720
  is_parent_public?: boolean;
675
721
  }
722
+ export interface ApiListChannelAppsResponse {
723
+ channel_apps?: Array<ApiChannelAppResponse>;
724
+ }
725
+ /** */
726
+ export interface ApiListStreamingChannelsResponse {
727
+ streaming_channels?: Array<ApiStreamingChannelResponse>;
728
+ }
676
729
  /** */
677
730
  export interface ApiMessageRef {
678
731
  message_id?: string;
@@ -726,6 +779,27 @@ export interface ApiNotificationUserChannel {
726
779
  time_mute?: string;
727
780
  }
728
781
  /** */
782
+ export interface ApiOssrsHttpCallbackRequest {
783
+ action?: string;
784
+ app?: string;
785
+ client_id?: string;
786
+ ip?: string;
787
+ page_url?: string;
788
+ param?: string;
789
+ server_id?: string;
790
+ service_id?: string;
791
+ stream?: string;
792
+ stream_id?: string;
793
+ stream_url?: string;
794
+ tc_url?: string;
795
+ vhost?: string;
796
+ }
797
+ /** */
798
+ export interface ApiOssrsHttpCallbackResponse {
799
+ code?: number;
800
+ msg?: string;
801
+ }
802
+ /** */
729
803
  export interface ApiPermission {
730
804
  active?: number;
731
805
  description?: string;
@@ -894,6 +968,10 @@ export interface ApiSortParam {
894
968
  order?: string;
895
969
  }
896
970
  /** */
971
+ export interface ApiStickerListedResponse {
972
+ stickers?: Array<ApiClanSticker>;
973
+ }
974
+ /** */
897
975
  export interface ApiStreamingChannelResponse {
898
976
  channel_id?: string;
899
977
  clan_id?: string;
@@ -1047,6 +1125,13 @@ export interface ApiWebhookGenerateResponse {
1047
1125
  export interface ApiWebhookListResponse {
1048
1126
  webhooks?: Array<ApiWebhook>;
1049
1127
  }
1128
+ /** Represents an event to be passed through the server to registered event handlers. */
1129
+ export interface MezonapiEvent {
1130
+ external?: boolean;
1131
+ name?: string;
1132
+ properties?: Record<string, string>;
1133
+ timestamp?: string;
1134
+ }
1050
1135
  /** */
1051
1136
  export interface ProtobufAny {
1052
1137
  type_url?: string;
@@ -1167,6 +1252,8 @@ export declare class MezonApi {
1167
1252
  listChannelDescs(bearerToken: string, limit?: number, state?: number, cursor?: string, clanId?: string, channelType?: number, options?: any): Promise<ApiChannelDescList>;
1168
1253
  /** Create a new channel with the current user as the owner. */
1169
1254
  createChannelDesc(bearerToken: string, body: ApiCreateChannelDescRequest, options?: any): Promise<ApiChannelDescription>;
1255
+ /** list user add channel by channel ids */
1256
+ listUsersAddChannelByChannelId(bearerToken: string, channelId?: string, limit?: number, options?: any): Promise<ApiAllUsersAddChannelResponse>;
1170
1257
  /** Delete a channel by ID. */
1171
1258
  deleteChannelDesc(bearerToken: string, channelId: string, options?: any): Promise<any>;
1172
1259
  /** Update fields in a given channel. */
@@ -1209,6 +1296,8 @@ export declare class MezonApi {
1209
1296
  deleteClanEmojiById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1210
1297
  /** Update ClanEmoj By id */
1211
1298
  updateClanEmojiById(bearerToken: string, id: string, body: MezonUpdateClanEmojiByIdBody, options?: any): Promise<any>;
1299
+ /** get list emoji by user id */
1300
+ getListEmojisByUserId(bearerToken: string, options?: any): Promise<ApiEmojiListedResponse>;
1212
1301
  /** Search message from elasticsearch service. */
1213
1302
  searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
1214
1303
  /** Submit an event for processing in the server's registered runtime custom events handler. */
@@ -1267,6 +1356,8 @@ export declare class MezonApi {
1267
1356
  deleteNotiReactMessage(bearerToken: string, channelId?: string, options?: any): Promise<any>;
1268
1357
  /** */
1269
1358
  setNotificationReactMessage(bearerToken: string, body: ApiNotificationChannel, options?: any): Promise<any>;
1359
+ /** Ossrs http callback. */
1360
+ streamingServerCallback(bearerToken: string, body: ApiOssrsHttpCallbackRequest, options?: any): Promise<ApiOssrsHttpCallbackResponse>;
1270
1361
  /** set permission role channel. */
1271
1362
  setRoleChannelPermission(bearerToken: string, body: ApiUpdateRoleChannelRequest, options?: any): Promise<any>;
1272
1363
  /** Get permission list */
@@ -1309,6 +1400,8 @@ export declare class MezonApi {
1309
1400
  deleteClanStickerById(bearerToken: string, id: string, clanId?: string, options?: any): Promise<any>;
1310
1401
  /** Update a sticker by ID */
1311
1402
  updateClanStickerById(bearerToken: string, id: string, body: MezonUpdateClanStickerByIdBody, options?: any): Promise<any>;
1403
+ /** get list sticker by user id */
1404
+ getListStickersByUserId(bearerToken: string, options?: any): Promise<ApiStickerListedResponse>;
1312
1405
  /** List streaming channels. */
1313
1406
  listStreamingChannels(bearerToken: string, clanId?: string, options?: any): Promise<ApiListStreamingChannelsResponse>;
1314
1407
  /** Register streaming in channel ( for bot - get streaming key) */
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 } 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, ApiStickerListedResponse, ApiEmojiListedResponse, ApiAllUsersAddChannelResponse } from "./api.gen";
17
17
  import { Session } from "./session";
18
18
  import { Socket } from "./socket";
19
19
  import { WebSocketAdapter } from "./web_socket_adapter";
@@ -560,4 +560,7 @@ export declare class Client {
560
560
  registerStreamingChannel(session: Session, request: ApiRegisterStreamingChannelRequest): Promise<boolean>;
561
561
  /** List a channel's users. */
562
562
  listChannelApps(session: Session, clanId: string): Promise<ApiListChannelAppsResponse>;
563
+ getListStickersByUserId(session: Session): Promise<ApiStickerListedResponse>;
564
+ getListEmojisByUserId(session: Session): Promise<ApiEmojiListedResponse>;
565
+ listUsersAddChannelByChannelId(session: Session, channel_id: string, limit: number): Promise<ApiAllUsersAddChannelResponse>;
563
566
  }
@@ -2215,6 +2215,33 @@ var MezonApi = class {
2215
2215
  )
2216
2216
  ]);
2217
2217
  }
2218
+ /** list user add channel by channel ids */
2219
+ listUsersAddChannelByChannelId(bearerToken, channelId, limit, options = {}) {
2220
+ const urlPath = "/v2/channeldesc/users/add";
2221
+ const queryParams = /* @__PURE__ */ new Map();
2222
+ queryParams.set("channel_id", channelId);
2223
+ queryParams.set("limit", limit);
2224
+ let bodyJson = "";
2225
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2226
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2227
+ if (bearerToken) {
2228
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2229
+ }
2230
+ return Promise.race([
2231
+ fetch(fullUrl, fetchOptions).then((response) => {
2232
+ if (response.status == 204) {
2233
+ return response;
2234
+ } else if (response.status >= 200 && response.status < 300) {
2235
+ return response.json();
2236
+ } else {
2237
+ throw response;
2238
+ }
2239
+ }),
2240
+ new Promise(
2241
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2242
+ )
2243
+ ]);
2244
+ }
2218
2245
  /** Delete a channel by ID. */
2219
2246
  deleteChannelDesc(bearerToken, channelId, options = {}) {
2220
2247
  if (channelId === null || channelId === void 0) {
@@ -2833,6 +2860,31 @@ var MezonApi = class {
2833
2860
  )
2834
2861
  ]);
2835
2862
  }
2863
+ /** get list emoji by user id */
2864
+ getListEmojisByUserId(bearerToken, options = {}) {
2865
+ const urlPath = "/v2/emojis";
2866
+ const queryParams = /* @__PURE__ */ new Map();
2867
+ let bodyJson = "";
2868
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2869
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2870
+ if (bearerToken) {
2871
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2872
+ }
2873
+ return Promise.race([
2874
+ fetch(fullUrl, fetchOptions).then((response) => {
2875
+ if (response.status == 204) {
2876
+ return response;
2877
+ } else if (response.status >= 200 && response.status < 300) {
2878
+ return response.json();
2879
+ } else {
2880
+ throw response;
2881
+ }
2882
+ }),
2883
+ new Promise(
2884
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2885
+ )
2886
+ ]);
2887
+ }
2836
2888
  /** Search message from elasticsearch service. */
2837
2889
  searchMessage(bearerToken, body, options = {}) {
2838
2890
  if (body === null || body === void 0) {
@@ -3653,6 +3705,35 @@ var MezonApi = class {
3653
3705
  )
3654
3706
  ]);
3655
3707
  }
3708
+ /** Ossrs http callback. */
3709
+ streamingServerCallback(bearerToken, body, options = {}) {
3710
+ if (body === null || body === void 0) {
3711
+ throw new Error("'body' is a required parameter but is null or undefined.");
3712
+ }
3713
+ const urlPath = "/v2/ossrs/callback";
3714
+ const queryParams = /* @__PURE__ */ new Map();
3715
+ let bodyJson = "";
3716
+ bodyJson = JSON.stringify(body || {});
3717
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3718
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3719
+ if (bearerToken) {
3720
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3721
+ }
3722
+ return Promise.race([
3723
+ fetch(fullUrl, fetchOptions).then((response) => {
3724
+ if (response.status == 204) {
3725
+ return response;
3726
+ } else if (response.status >= 200 && response.status < 300) {
3727
+ return response.json();
3728
+ } else {
3729
+ throw response;
3730
+ }
3731
+ }),
3732
+ new Promise(
3733
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3734
+ )
3735
+ ]);
3736
+ }
3656
3737
  /** set permission role channel. */
3657
3738
  setRoleChannelPermission(bearerToken, body, options = {}) {
3658
3739
  if (body === null || body === void 0) {
@@ -4276,6 +4357,31 @@ var MezonApi = class {
4276
4357
  )
4277
4358
  ]);
4278
4359
  }
4360
+ /** get list sticker by user id */
4361
+ getListStickersByUserId(bearerToken, options = {}) {
4362
+ const urlPath = "/v2/stickers";
4363
+ const queryParams = /* @__PURE__ */ new Map();
4364
+ let bodyJson = "";
4365
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4366
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4367
+ if (bearerToken) {
4368
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4369
+ }
4370
+ return Promise.race([
4371
+ fetch(fullUrl, fetchOptions).then((response) => {
4372
+ if (response.status == 204) {
4373
+ return response;
4374
+ } else if (response.status >= 200 && response.status < 300) {
4375
+ return response.json();
4376
+ } else {
4377
+ throw response;
4378
+ }
4379
+ }),
4380
+ new Promise(
4381
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4382
+ )
4383
+ ]);
4384
+ }
4279
4385
  /** List streaming channels. */
4280
4386
  listStreamingChannels(bearerToken, clanId, options = {}) {
4281
4387
  const urlPath = "/v2/streaming-channels";
@@ -7559,4 +7665,34 @@ var Client = class {
7559
7665
  });
7560
7666
  });
7561
7667
  }
7668
+ getListStickersByUserId(session) {
7669
+ return __async(this, null, function* () {
7670
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7671
+ yield this.sessionRefresh(session);
7672
+ }
7673
+ return this.apiClient.getListStickersByUserId(session.token).then((response) => {
7674
+ return Promise.resolve(response);
7675
+ });
7676
+ });
7677
+ }
7678
+ getListEmojisByUserId(session) {
7679
+ return __async(this, null, function* () {
7680
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7681
+ yield this.sessionRefresh(session);
7682
+ }
7683
+ return this.apiClient.getListEmojisByUserId(session.token).then((response) => {
7684
+ return Promise.resolve(response);
7685
+ });
7686
+ });
7687
+ }
7688
+ listUsersAddChannelByChannelId(session, channel_id, limit) {
7689
+ return __async(this, null, function* () {
7690
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7691
+ yield this.sessionRefresh(session);
7692
+ }
7693
+ return this.apiClient.listUsersAddChannelByChannelId(session.token, channel_id, limit).then((response) => {
7694
+ return Promise.resolve(response);
7695
+ });
7696
+ });
7697
+ }
7562
7698
  };
@@ -2186,6 +2186,33 @@ var MezonApi = class {
2186
2186
  )
2187
2187
  ]);
2188
2188
  }
2189
+ /** list user add channel by channel ids */
2190
+ listUsersAddChannelByChannelId(bearerToken, channelId, limit, options = {}) {
2191
+ const urlPath = "/v2/channeldesc/users/add";
2192
+ const queryParams = /* @__PURE__ */ new Map();
2193
+ queryParams.set("channel_id", channelId);
2194
+ queryParams.set("limit", limit);
2195
+ let bodyJson = "";
2196
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2197
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2198
+ if (bearerToken) {
2199
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2200
+ }
2201
+ return Promise.race([
2202
+ fetch(fullUrl, fetchOptions).then((response) => {
2203
+ if (response.status == 204) {
2204
+ return response;
2205
+ } else if (response.status >= 200 && response.status < 300) {
2206
+ return response.json();
2207
+ } else {
2208
+ throw response;
2209
+ }
2210
+ }),
2211
+ new Promise(
2212
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2213
+ )
2214
+ ]);
2215
+ }
2189
2216
  /** Delete a channel by ID. */
2190
2217
  deleteChannelDesc(bearerToken, channelId, options = {}) {
2191
2218
  if (channelId === null || channelId === void 0) {
@@ -2804,6 +2831,31 @@ var MezonApi = class {
2804
2831
  )
2805
2832
  ]);
2806
2833
  }
2834
+ /** get list emoji by user id */
2835
+ getListEmojisByUserId(bearerToken, options = {}) {
2836
+ const urlPath = "/v2/emojis";
2837
+ const queryParams = /* @__PURE__ */ new Map();
2838
+ let bodyJson = "";
2839
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
2840
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
2841
+ if (bearerToken) {
2842
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
2843
+ }
2844
+ return Promise.race([
2845
+ fetch(fullUrl, fetchOptions).then((response) => {
2846
+ if (response.status == 204) {
2847
+ return response;
2848
+ } else if (response.status >= 200 && response.status < 300) {
2849
+ return response.json();
2850
+ } else {
2851
+ throw response;
2852
+ }
2853
+ }),
2854
+ new Promise(
2855
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
2856
+ )
2857
+ ]);
2858
+ }
2807
2859
  /** Search message from elasticsearch service. */
2808
2860
  searchMessage(bearerToken, body, options = {}) {
2809
2861
  if (body === null || body === void 0) {
@@ -3624,6 +3676,35 @@ var MezonApi = class {
3624
3676
  )
3625
3677
  ]);
3626
3678
  }
3679
+ /** Ossrs http callback. */
3680
+ streamingServerCallback(bearerToken, body, options = {}) {
3681
+ if (body === null || body === void 0) {
3682
+ throw new Error("'body' is a required parameter but is null or undefined.");
3683
+ }
3684
+ const urlPath = "/v2/ossrs/callback";
3685
+ const queryParams = /* @__PURE__ */ new Map();
3686
+ let bodyJson = "";
3687
+ bodyJson = JSON.stringify(body || {});
3688
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3689
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3690
+ if (bearerToken) {
3691
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3692
+ }
3693
+ return Promise.race([
3694
+ fetch(fullUrl, fetchOptions).then((response) => {
3695
+ if (response.status == 204) {
3696
+ return response;
3697
+ } else if (response.status >= 200 && response.status < 300) {
3698
+ return response.json();
3699
+ } else {
3700
+ throw response;
3701
+ }
3702
+ }),
3703
+ new Promise(
3704
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
3705
+ )
3706
+ ]);
3707
+ }
3627
3708
  /** set permission role channel. */
3628
3709
  setRoleChannelPermission(bearerToken, body, options = {}) {
3629
3710
  if (body === null || body === void 0) {
@@ -4247,6 +4328,31 @@ var MezonApi = class {
4247
4328
  )
4248
4329
  ]);
4249
4330
  }
4331
+ /** get list sticker by user id */
4332
+ getListStickersByUserId(bearerToken, options = {}) {
4333
+ const urlPath = "/v2/stickers";
4334
+ const queryParams = /* @__PURE__ */ new Map();
4335
+ let bodyJson = "";
4336
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4337
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
4338
+ if (bearerToken) {
4339
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4340
+ }
4341
+ return Promise.race([
4342
+ fetch(fullUrl, fetchOptions).then((response) => {
4343
+ if (response.status == 204) {
4344
+ return response;
4345
+ } else if (response.status >= 200 && response.status < 300) {
4346
+ return response.json();
4347
+ } else {
4348
+ throw response;
4349
+ }
4350
+ }),
4351
+ new Promise(
4352
+ (_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
4353
+ )
4354
+ ]);
4355
+ }
4250
4356
  /** List streaming channels. */
4251
4357
  listStreamingChannels(bearerToken, clanId, options = {}) {
4252
4358
  const urlPath = "/v2/streaming-channels";
@@ -7530,6 +7636,36 @@ var Client = class {
7530
7636
  });
7531
7637
  });
7532
7638
  }
7639
+ getListStickersByUserId(session) {
7640
+ return __async(this, null, function* () {
7641
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7642
+ yield this.sessionRefresh(session);
7643
+ }
7644
+ return this.apiClient.getListStickersByUserId(session.token).then((response) => {
7645
+ return Promise.resolve(response);
7646
+ });
7647
+ });
7648
+ }
7649
+ getListEmojisByUserId(session) {
7650
+ return __async(this, null, function* () {
7651
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7652
+ yield this.sessionRefresh(session);
7653
+ }
7654
+ return this.apiClient.getListEmojisByUserId(session.token).then((response) => {
7655
+ return Promise.resolve(response);
7656
+ });
7657
+ });
7658
+ }
7659
+ listUsersAddChannelByChannelId(session, channel_id, limit) {
7660
+ return __async(this, null, function* () {
7661
+ if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
7662
+ yield this.sessionRefresh(session);
7663
+ }
7664
+ return this.apiClient.listUsersAddChannelByChannelId(session.token, channel_id, limit).then((response) => {
7665
+ return Promise.resolve(response);
7666
+ });
7667
+ });
7668
+ }
7533
7669
  };
7534
7670
  export {
7535
7671
  ChannelStreamMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.12",
4
+ "version": "2.9.13",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"