mezon-js 2.10.87 → 2.10.89

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -358,14 +358,6 @@ export interface ApiAccountApple {
358
358
  vars?: Record<string, string>;
359
359
  }
360
360
 
361
- /** Send a custom ID to the server. Used with authenticate/link/unlink. */
362
- export interface ApiAccountCustom {
363
- //A custom identifier.
364
- id?: string;
365
- //Extra information that will be bundled in the session token.
366
- vars?: Record<string, string>;
367
- }
368
-
369
361
  /** Send a device to the server. Used with authenticate/link/unlink and user. */
370
362
  export interface ApiAccountDevice {
371
363
  //A device identifier. Should be obtained by a platform-specific device API.
@@ -428,6 +420,14 @@ export interface ApiAccountGoogle {
428
420
  vars?: Record<string, string>;
429
421
  }
430
422
 
423
+ /** Send a Mezon token to the server. Used with authenticate/link/unlink. */
424
+ export interface ApiAccountMezon {
425
+ //The OAuth token received from Google to access their profile API.
426
+ token?: string;
427
+ //Extra information that will be bundled in the session token.
428
+ vars?: Record<string, string>;
429
+ }
430
+
431
431
  /** Send a Steam token to the server. Used with authenticate/link/unlink. */
432
432
  export interface ApiAccountSteam {
433
433
  //The account token received from Steam to access their profile API.
@@ -1539,7 +1539,7 @@ export interface ApiLoginIDResponse {
1539
1539
  //
1540
1540
  user_id?: string;
1541
1541
  //
1542
- user_name?: string;
1542
+ username?: string;
1543
1543
  }
1544
1544
 
1545
1545
  /** */
@@ -1633,6 +1633,110 @@ export interface ApiListStreamingChannelsResponse {
1633
1633
  streaming_channels?: Array<ApiStreamingChannelResponse>;
1634
1634
  }
1635
1635
 
1636
+ /** */
1637
+ export interface ApiMezonOauthClient {
1638
+ //
1639
+ access_token_strategy?: string;
1640
+ //
1641
+ allowed_cors_origins?: Array<string>;
1642
+ //
1643
+ audience?: Array<string>;
1644
+ //
1645
+ authorization_code_grant_access_token_lifespan?: string;
1646
+ //
1647
+ authorization_code_grant_id_token_lifespan?: string;
1648
+ //
1649
+ authorization_code_grant_refresh_token_lifespan?: string;
1650
+ //
1651
+ backchannel_logout_session_required?: boolean;
1652
+ //
1653
+ backchannel_logout_uri?: string;
1654
+ //
1655
+ client_credentials_grant_access_token_lifespan?: string;
1656
+ //
1657
+ client_id?: string;
1658
+ //
1659
+ client_name?: string;
1660
+ //
1661
+ client_secret?: string;
1662
+ //
1663
+ client_secret_expires_at?: number;
1664
+ //
1665
+ client_uri?: string;
1666
+ //
1667
+ contacts?: Array<string>;
1668
+ //
1669
+ created_at?: string;
1670
+ //
1671
+ frontchannel_logout_session_required?: boolean;
1672
+ //
1673
+ frontchannel_logout_uri?: string;
1674
+ //
1675
+ grant_types?: Array<string>;
1676
+ //
1677
+ implicit_grant_access_token_lifespan?: string;
1678
+ //
1679
+ implicit_grant_id_token_lifespan?: string;
1680
+ //
1681
+ jwks?: Array<string>;
1682
+ //
1683
+ jwks_uri?: string;
1684
+ //
1685
+ jwt_bearer_grant_access_token_lifespan?: string;
1686
+ //
1687
+ logo_uri?: string;
1688
+ //
1689
+ owner?: string;
1690
+ //
1691
+ policy_uri?: string;
1692
+ //
1693
+ post_logout_redirect_uris?: Array<string>;
1694
+ //
1695
+ redirect_uris?: Array<string>;
1696
+ //
1697
+ refresh_token_grant_access_token_lifespan?: string;
1698
+ //
1699
+ refresh_token_grant_id_token_lifespan?: string;
1700
+ //
1701
+ refresh_token_grant_refresh_token_lifespan?: string;
1702
+ //
1703
+ registration_access_token?: string;
1704
+ //
1705
+ registration_client_uri?: string;
1706
+ //
1707
+ request_object_signing_alg?: string;
1708
+ //
1709
+ request_uris?: Array<string>;
1710
+ //
1711
+ response_types?: Array<string>;
1712
+ //
1713
+ scope?: string;
1714
+ //
1715
+ sector_identifier_uri?: string;
1716
+ //
1717
+ skip_consent?: boolean;
1718
+ //
1719
+ skip_logout_consent?: boolean;
1720
+ //
1721
+ subject_type?: string;
1722
+ //
1723
+ token_endpoint_auth_method?: string;
1724
+ //
1725
+ token_endpoint_auth_signing_alg?: string;
1726
+ //
1727
+ tos_uri?: string;
1728
+ //
1729
+ updated_at?: string;
1730
+ //
1731
+ userinfo_signed_response_alg?: string;
1732
+ }
1733
+
1734
+ /** */
1735
+ export interface ApiMezonOauthClientList {
1736
+ //
1737
+ list_mezon_oauth_client?: Array<ApiMezonOauthClient>;
1738
+ }
1739
+
1636
1740
  /** */
1637
1741
  export interface ApiMessageRef {
1638
1742
  //
@@ -3157,51 +3261,6 @@ export class MezonApi {
3157
3261
  ]);
3158
3262
  }
3159
3263
 
3160
- /** Authenticate a user with a custom id against the server. */
3161
- authenticateCustom(
3162
- basicAuthUsername: string,
3163
- basicAuthPassword: string,
3164
- account: ApiAccountCustom,
3165
- create?: boolean,
3166
- username?: string,
3167
- options: any = {}
3168
- ): Promise<ApiSession> {
3169
- if (account === null || account === undefined) {
3170
- throw new Error(
3171
- "'account' is a required parameter but is null or undefined."
3172
- );
3173
- }
3174
- const urlPath = "/v2/account/authenticate/custom";
3175
- const queryParams = new Map<string, any>();
3176
- queryParams.set("create", create);
3177
- queryParams.set("username", username);
3178
-
3179
- let bodyJson: string = "";
3180
- bodyJson = JSON.stringify(account || {});
3181
-
3182
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3183
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3184
- if (basicAuthUsername) {
3185
- fetchOptions.headers["Authorization"] =
3186
- "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3187
- }
3188
-
3189
- return Promise.race([
3190
- fetch(fullUrl, fetchOptions).then((response) => {
3191
- if (response.status == 204) {
3192
- return response;
3193
- } else if (response.status >= 200 && response.status < 300) {
3194
- return response.json();
3195
- } else {
3196
- throw response;
3197
- }
3198
- }),
3199
- new Promise((_, reject) =>
3200
- setTimeout(reject, this.timeoutMs, "Request timed out.")
3201
- ),
3202
- ]);
3203
- }
3204
-
3205
3264
  /** Authenticate a user with a device id against the server. */
3206
3265
  authenticateDevice(
3207
3266
  basicAuthUsername: string,
@@ -3472,6 +3531,47 @@ export class MezonApi {
3472
3531
  ]);
3473
3532
  }
3474
3533
 
3534
+ /** Authenticate a user with Mezon against the server. */
3535
+ authenticateMezon(basicAuthUsername: string,
3536
+ basicAuthPassword: string,
3537
+ account:ApiAccountMezon,
3538
+ create?:boolean,
3539
+ username?:string,
3540
+ options: any = {}): Promise<ApiSession> {
3541
+
3542
+ if (account === null || account === undefined) {
3543
+ throw new Error("'account' is a required parameter but is null or undefined.");
3544
+ }
3545
+ const urlPath = "/v2/account/authenticate/mezon";
3546
+ const queryParams = new Map<string, any>();
3547
+ queryParams.set("create", create);
3548
+ queryParams.set("username", username);
3549
+
3550
+ let bodyJson : string = "";
3551
+ bodyJson = JSON.stringify(account || {});
3552
+
3553
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3554
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3555
+ if (basicAuthUsername) {
3556
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3557
+ }
3558
+
3559
+ return Promise.race([
3560
+ fetch(fullUrl, fetchOptions).then((response) => {
3561
+ if (response.status == 204) {
3562
+ return response;
3563
+ } else if (response.status >= 200 && response.status < 300) {
3564
+ return response.json();
3565
+ } else {
3566
+ throw response;
3567
+ }
3568
+ }),
3569
+ new Promise((_, reject) =>
3570
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3571
+ ),
3572
+ ]);
3573
+ }
3574
+
3475
3575
  /** Authenticate a user with Steam against the server. */
3476
3576
  authenticateSteam(
3477
3577
  basicAuthUsername: string,
@@ -3558,45 +3658,6 @@ export class MezonApi {
3558
3658
  ]);
3559
3659
  }
3560
3660
 
3561
- /** Add a custom ID to the social profiles on the current user's account. */
3562
- linkCustom(
3563
- bearerToken: string,
3564
- body: ApiAccountCustom,
3565
- options: any = {}
3566
- ): Promise<any> {
3567
- if (body === null || body === undefined) {
3568
- throw new Error(
3569
- "'body' is a required parameter but is null or undefined."
3570
- );
3571
- }
3572
- const urlPath = "/v2/account/link/custom";
3573
- const queryParams = new Map<string, any>();
3574
-
3575
- let bodyJson: string = "";
3576
- bodyJson = JSON.stringify(body || {});
3577
-
3578
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3579
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3580
- if (bearerToken) {
3581
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3582
- }
3583
-
3584
- return Promise.race([
3585
- fetch(fullUrl, fetchOptions).then((response) => {
3586
- if (response.status == 204) {
3587
- return response;
3588
- } else if (response.status >= 200 && response.status < 300) {
3589
- return response.json();
3590
- } else {
3591
- throw response;
3592
- }
3593
- }),
3594
- new Promise((_, reject) =>
3595
- setTimeout(reject, this.timeoutMs, "Request timed out.")
3596
- ),
3597
- ]);
3598
- }
3599
-
3600
3661
  /** Add a device ID to the social profiles on the current user's account. */
3601
3662
  linkDevice(
3602
3663
  bearerToken: string,
@@ -3794,6 +3855,42 @@ export class MezonApi {
3794
3855
  ]);
3795
3856
  }
3796
3857
 
3858
+ /** Add a mezon ID to the social profiles on the current user's account. */
3859
+ linkMezon(bearerToken: string,
3860
+ body:ApiAccountMezon,
3861
+ options: any = {}): Promise<any> {
3862
+
3863
+ if (body === null || body === undefined) {
3864
+ throw new Error("'body' is a required parameter but is null or undefined.");
3865
+ }
3866
+ const urlPath = "/v2/account/link/mezon";
3867
+ const queryParams = new Map<string, any>();
3868
+
3869
+ let bodyJson : string = "";
3870
+ bodyJson = JSON.stringify(body || {});
3871
+
3872
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3873
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3874
+ if (bearerToken) {
3875
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
3876
+ }
3877
+
3878
+ return Promise.race([
3879
+ fetch(fullUrl, fetchOptions).then((response) => {
3880
+ if (response.status == 204) {
3881
+ return response;
3882
+ } else if (response.status >= 200 && response.status < 300) {
3883
+ return response.json();
3884
+ } else {
3885
+ throw response;
3886
+ }
3887
+ }),
3888
+ new Promise((_, reject) =>
3889
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
3890
+ ),
3891
+ ]);
3892
+ }
3893
+
3797
3894
  /** Add Google to the social profiles on the current user's account. */
3798
3895
  linkGoogle(
3799
3896
  bearerToken: string,
@@ -3991,45 +4088,6 @@ export class MezonApi {
3991
4088
  ]);
3992
4089
  }
3993
4090
 
3994
- /** Remove the custom ID from the social profiles on the current user's account. */
3995
- unlinkCustom(
3996
- bearerToken: string,
3997
- body: ApiAccountCustom,
3998
- options: any = {}
3999
- ): Promise<any> {
4000
- if (body === null || body === undefined) {
4001
- throw new Error(
4002
- "'body' is a required parameter but is null or undefined."
4003
- );
4004
- }
4005
- const urlPath = "/v2/account/unlink/custom";
4006
- const queryParams = new Map<string, any>();
4007
-
4008
- let bodyJson: string = "";
4009
- bodyJson = JSON.stringify(body || {});
4010
-
4011
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4012
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4013
- if (bearerToken) {
4014
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4015
- }
4016
-
4017
- return Promise.race([
4018
- fetch(fullUrl, fetchOptions).then((response) => {
4019
- if (response.status == 204) {
4020
- return response;
4021
- } else if (response.status >= 200 && response.status < 300) {
4022
- return response.json();
4023
- } else {
4024
- throw response;
4025
- }
4026
- }),
4027
- new Promise((_, reject) =>
4028
- setTimeout(reject, this.timeoutMs, "Request timed out.")
4029
- ),
4030
- ]);
4031
- }
4032
-
4033
4091
  /** Remove the device ID from the social profiles on the current user's account. */
4034
4092
  unlinkDevice(
4035
4093
  bearerToken: string,
@@ -4264,6 +4322,42 @@ export class MezonApi {
4264
4322
  ]);
4265
4323
  }
4266
4324
 
4325
+ /** Remove the mezon ID from the social profiles on the current user's account. */
4326
+ unlinkMezon(bearerToken: string,
4327
+ body:ApiAccountMezon,
4328
+ options: any = {}): Promise<any> {
4329
+
4330
+ if (body === null || body === undefined) {
4331
+ throw new Error("'body' is a required parameter but is null or undefined.");
4332
+ }
4333
+ const urlPath = "/v2/account/unlink/mezon";
4334
+ const queryParams = new Map<string, any>();
4335
+
4336
+ let bodyJson : string = "";
4337
+ bodyJson = JSON.stringify(body || {});
4338
+
4339
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4340
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4341
+ if (bearerToken) {
4342
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
4343
+ }
4344
+
4345
+ return Promise.race([
4346
+ fetch(fullUrl, fetchOptions).then((response) => {
4347
+ if (response.status == 204) {
4348
+ return response;
4349
+ } else if (response.status >= 200 && response.status < 300) {
4350
+ return response.json();
4351
+ } else {
4352
+ throw response;
4353
+ }
4354
+ }),
4355
+ new Promise((_, reject) =>
4356
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
4357
+ ),
4358
+ ]);
4359
+ }
4360
+
4267
4361
  /** Remove Steam from the social profiles on the current user's account. */
4268
4362
  unlinkSteam(
4269
4363
  bearerToken: string,
@@ -7504,7 +7598,38 @@ export class MezonApi {
7504
7598
  ),
7505
7599
  ]);
7506
7600
  }
7601
+
7602
+ /** List mezon OAuth client */
7603
+ listMezonOauthClient(bearerToken: string,
7604
+ options: any = {}): Promise<ApiMezonOauthClientList> {
7605
+
7606
+ const urlPath = "/v2/mznoauthclient";
7607
+ const queryParams = new Map<string, any>();
7608
+
7609
+ let bodyJson : string = "";
7610
+
7611
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7612
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
7613
+ if (bearerToken) {
7614
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7615
+ }
7507
7616
 
7617
+ return Promise.race([
7618
+ fetch(fullUrl, fetchOptions).then((response) => {
7619
+ if (response.status == 204) {
7620
+ return response;
7621
+ } else if (response.status >= 200 && response.status < 300) {
7622
+ return response.json();
7623
+ } else {
7624
+ throw response;
7625
+ }
7626
+ }),
7627
+ new Promise((_, reject) =>
7628
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
7629
+ ),
7630
+ ]);
7631
+ }
7632
+
7508
7633
  /** set mute notification user channel. */
7509
7634
  setMuteNotificationCategory(
7510
7635
  bearerToken: string,
package/client.ts CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  import {
18
18
  ApiAccount,
19
- ApiAccountCustom,
19
+ ApiAccountMezon,
20
20
  ApiAccountDevice,
21
21
  ApiAccountEmail,
22
22
  ApiAccountFacebook,
@@ -162,6 +162,7 @@ import {
162
162
  ApiGenerateMeetTokenRequest,
163
163
  ApiGenerateMeetTokenResponse,
164
164
  ApiHandleParticipantMeetStateRequest,
165
+ ApiMezonOauthClientList,
165
166
  } from "./api.gen";
166
167
 
167
168
  import { Session } from "./session";
@@ -639,19 +640,19 @@ export class Client {
639
640
  }
640
641
 
641
642
  /** Authenticate a user with a custom id against the server. */
642
- authenticateCustom(
643
- id: string,
643
+ authenticateMezon(
644
+ token: string,
644
645
  create?: boolean,
645
646
  username?: string,
646
647
  vars: Record<string, string> = {},
647
648
  options: any = {}
648
649
  ): Promise<Session> {
649
650
  const request = {
650
- id: id,
651
+ token: token,
651
652
  vars: vars,
652
653
  };
653
654
  return this.apiClient
654
- .authenticateCustom(
655
+ .authenticateMezon(
655
656
  this.serverkey,
656
657
  "",
657
658
  request,
@@ -2030,9 +2031,9 @@ export class Client {
2030
2031
  }
2031
2032
 
2032
2033
  /** Add a custom ID to the social profiles on the current user's account. */
2033
- async linkCustom(
2034
+ async linkMezon(
2034
2035
  session: Session,
2035
- request: ApiAccountCustom
2036
+ request: ApiAccountMezon
2036
2037
  ): Promise<boolean> {
2037
2038
  if (
2038
2039
  this.autoRefreshSession &&
@@ -2043,7 +2044,7 @@ export class Client {
2043
2044
  }
2044
2045
 
2045
2046
  return this.apiClient
2046
- .linkCustom(session.token, request)
2047
+ .linkMezon(session.token, request)
2047
2048
  .then((response: any) => {
2048
2049
  return response !== undefined;
2049
2050
  });
@@ -2432,7 +2433,7 @@ export class Client {
2432
2433
  /** Remove custom ID from the social profiles on the current user's account. */
2433
2434
  async unlinkCustom(
2434
2435
  session: Session,
2435
- request: ApiAccountCustom
2436
+ request: ApiAccountMezon
2436
2437
  ): Promise<boolean> {
2437
2438
  if (
2438
2439
  this.autoRefreshSession &&
@@ -2443,7 +2444,7 @@ export class Client {
2443
2444
  }
2444
2445
 
2445
2446
  return this.apiClient
2446
- .unlinkCustom(session.token, request)
2447
+ .unlinkMezon(session.token, request)
2447
2448
  .then((response: any) => {
2448
2449
  return response !== undefined;
2449
2450
  });
@@ -4931,4 +4932,23 @@ export class Client {
4931
4932
  return Promise.resolve(response);
4932
4933
  });
4933
4934
  }
4935
+
4936
+ //**list webhook belong to the clan */
4937
+ async listMezonOauthClient(
4938
+ session: Session
4939
+ ): Promise<ApiMezonOauthClientList> {
4940
+ if (
4941
+ this.autoRefreshSession &&
4942
+ session.refresh_token &&
4943
+ session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
4944
+ ) {
4945
+ await this.sessionRefresh(session);
4946
+ }
4947
+
4948
+ return this.apiClient
4949
+ .listMezonOauthClient(session.token)
4950
+ .then((response: ApiMezonOauthClientList) => {
4951
+ return Promise.resolve(response);
4952
+ });
4953
+ }
4934
4954
  }