mezon-js 2.10.86 → 2.10.88

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
@@ -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,
@@ -7505,6 +7599,198 @@ export class MezonApi {
7505
7599
  ]);
7506
7600
  }
7507
7601
 
7602
+ /** Delete mezon OAuth client */
7603
+ deleteMezonOauthClient(bearerToken: string,
7604
+ accessTokenStrategy?:string,
7605
+ allowedCorsOrigins?:Array<string>,
7606
+ audience?:Array<string>,
7607
+ authorizationCodeGrantAccessTokenLifespan?:string,
7608
+ authorizationCodeGrantIdTokenLifespan?:string,
7609
+ authorizationCodeGrantRefreshTokenLifespan?:string,
7610
+ backchannelLogoutSessionRequired?:boolean,
7611
+ backchannelLogoutUri?:string,
7612
+ clientCredentialsGrantAccessTokenLifespan?:string,
7613
+ clientId?:string,
7614
+ clientName?:string,
7615
+ clientSecret?:string,
7616
+ clientSecretExpiresAt?:number,
7617
+ clientUri?:string,
7618
+ contacts?:Array<string>,
7619
+ createdAt?:string,
7620
+ frontchannelLogoutSessionRequired?:boolean,
7621
+ frontchannelLogoutUri?:string,
7622
+ grantTypes?:Array<string>,
7623
+ implicitGrantAccessTokenLifespan?:string,
7624
+ implicitGrantIdTokenLifespan?:string,
7625
+ jwks?:Array<string>,
7626
+ jwksUri?:string,
7627
+ jwtBearerGrantAccessTokenLifespan?:string,
7628
+ logoUri?:string,
7629
+ owner?:string,
7630
+ policyUri?:string,
7631
+ postLogoutRedirectUris?:Array<string>,
7632
+ redirectUris?:Array<string>,
7633
+ refreshTokenGrantAccessTokenLifespan?:string,
7634
+ refreshTokenGrantIdTokenLifespan?:string,
7635
+ refreshTokenGrantRefreshTokenLifespan?:string,
7636
+ registrationAccessToken?:string,
7637
+ registrationClientUri?:string,
7638
+ requestObjectSigningAlg?:string,
7639
+ requestUris?:Array<string>,
7640
+ responseTypes?:Array<string>,
7641
+ scope?:string,
7642
+ sectorIdentifierUri?:string,
7643
+ skipConsent?:boolean,
7644
+ skipLogoutConsent?:boolean,
7645
+ subjectType?:string,
7646
+ tokenEndpointAuthMethod?:string,
7647
+ tokenEndpointAuthSigningAlg?:string,
7648
+ tosUri?:string,
7649
+ updatedAt?:string,
7650
+ userinfoSignedResponseAlg?:string,
7651
+ options: any = {}): Promise<any> {
7652
+
7653
+ const urlPath = "/v2/mznoauthclient";
7654
+ const queryParams = new Map<string, any>();
7655
+ queryParams.set("access_token_strategy", accessTokenStrategy);
7656
+ queryParams.set("allowed_cors_origins", allowedCorsOrigins);
7657
+ queryParams.set("audience", audience);
7658
+ queryParams.set("authorization_code_grant_access_token_lifespan", authorizationCodeGrantAccessTokenLifespan);
7659
+ queryParams.set("authorization_code_grant_id_token_lifespan", authorizationCodeGrantIdTokenLifespan);
7660
+ queryParams.set("authorization_code_grant_refresh_token_lifespan", authorizationCodeGrantRefreshTokenLifespan);
7661
+ queryParams.set("backchannel_logout_session_required", backchannelLogoutSessionRequired);
7662
+ queryParams.set("backchannel_logout_uri", backchannelLogoutUri);
7663
+ queryParams.set("client_credentials_grant_access_token_lifespan", clientCredentialsGrantAccessTokenLifespan);
7664
+ queryParams.set("client_id", clientId);
7665
+ queryParams.set("client_name", clientName);
7666
+ queryParams.set("client_secret", clientSecret);
7667
+ queryParams.set("client_secret_expires_at", clientSecretExpiresAt);
7668
+ queryParams.set("client_uri", clientUri);
7669
+ queryParams.set("contacts", contacts);
7670
+ queryParams.set("created_at", createdAt);
7671
+ queryParams.set("frontchannel_logout_session_required", frontchannelLogoutSessionRequired);
7672
+ queryParams.set("frontchannel_logout_uri", frontchannelLogoutUri);
7673
+ queryParams.set("grant_types", grantTypes);
7674
+ queryParams.set("implicit_grant_access_token_lifespan", implicitGrantAccessTokenLifespan);
7675
+ queryParams.set("implicit_grant_id_token_lifespan", implicitGrantIdTokenLifespan);
7676
+ queryParams.set("jwks", jwks);
7677
+ queryParams.set("jwks_uri", jwksUri);
7678
+ queryParams.set("jwt_bearer_grant_access_token_lifespan", jwtBearerGrantAccessTokenLifespan);
7679
+ queryParams.set("logo_uri", logoUri);
7680
+ queryParams.set("owner", owner);
7681
+ queryParams.set("policy_uri", policyUri);
7682
+ queryParams.set("post_logout_redirect_uris", postLogoutRedirectUris);
7683
+ queryParams.set("redirect_uris", redirectUris);
7684
+ queryParams.set("refresh_token_grant_access_token_lifespan", refreshTokenGrantAccessTokenLifespan);
7685
+ queryParams.set("refresh_token_grant_id_token_lifespan", refreshTokenGrantIdTokenLifespan);
7686
+ queryParams.set("refresh_token_grant_refresh_token_lifespan", refreshTokenGrantRefreshTokenLifespan);
7687
+ queryParams.set("registration_access_token", registrationAccessToken);
7688
+ queryParams.set("registration_client_uri", registrationClientUri);
7689
+ queryParams.set("request_object_signing_alg", requestObjectSigningAlg);
7690
+ queryParams.set("request_uris", requestUris);
7691
+ queryParams.set("response_types", responseTypes);
7692
+ queryParams.set("scope", scope);
7693
+ queryParams.set("sector_identifier_uri", sectorIdentifierUri);
7694
+ queryParams.set("skip_consent", skipConsent);
7695
+ queryParams.set("skip_logout_consent", skipLogoutConsent);
7696
+ queryParams.set("subject_type", subjectType);
7697
+ queryParams.set("token_endpoint_auth_method", tokenEndpointAuthMethod);
7698
+ queryParams.set("token_endpoint_auth_signing_alg", tokenEndpointAuthSigningAlg);
7699
+ queryParams.set("tos_uri", tosUri);
7700
+ queryParams.set("updated_at", updatedAt);
7701
+ queryParams.set("userinfo_signed_response_alg", userinfoSignedResponseAlg);
7702
+
7703
+ let bodyJson : string = "";
7704
+
7705
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7706
+ const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
7707
+ if (bearerToken) {
7708
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7709
+ }
7710
+
7711
+ return Promise.race([
7712
+ fetch(fullUrl, fetchOptions).then((response) => {
7713
+ if (response.status == 204) {
7714
+ return response;
7715
+ } else if (response.status >= 200 && response.status < 300) {
7716
+ return response.json();
7717
+ } else {
7718
+ throw response;
7719
+ }
7720
+ }),
7721
+ new Promise((_, reject) =>
7722
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
7723
+ ),
7724
+ ]);
7725
+ }
7726
+
7727
+ /** List mezon OAuth client */
7728
+ listMezonOauthClient(bearerToken: string,
7729
+ options: any = {}): Promise<ApiMezonOauthClientList> {
7730
+
7731
+ const urlPath = "/v2/mznoauthclient";
7732
+ const queryParams = new Map<string, any>();
7733
+
7734
+ let bodyJson : string = "";
7735
+
7736
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7737
+ const fetchOptions = buildFetchOptions("GET", options, bodyJson);
7738
+ if (bearerToken) {
7739
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7740
+ }
7741
+
7742
+ return Promise.race([
7743
+ fetch(fullUrl, fetchOptions).then((response) => {
7744
+ if (response.status == 204) {
7745
+ return response;
7746
+ } else if (response.status >= 200 && response.status < 300) {
7747
+ return response.json();
7748
+ } else {
7749
+ throw response;
7750
+ }
7751
+ }),
7752
+ new Promise((_, reject) =>
7753
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
7754
+ ),
7755
+ ]);
7756
+ }
7757
+
7758
+ /** Create mezon OAuth client */
7759
+ createMezonOauthClient(bearerToken: string,
7760
+ body:ApiMezonOauthClient,
7761
+ options: any = {}): Promise<ApiMezonOauthClient> {
7762
+
7763
+ if (body === null || body === undefined) {
7764
+ throw new Error("'body' is a required parameter but is null or undefined.");
7765
+ }
7766
+ const urlPath = "/v2/mznoauthclient";
7767
+ const queryParams = new Map<string, any>();
7768
+
7769
+ let bodyJson : string = "";
7770
+ bodyJson = JSON.stringify(body || {});
7771
+
7772
+ const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
7773
+ const fetchOptions = buildFetchOptions("POST", options, bodyJson);
7774
+ if (bearerToken) {
7775
+ fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
7776
+ }
7777
+
7778
+ return Promise.race([
7779
+ fetch(fullUrl, fetchOptions).then((response) => {
7780
+ if (response.status == 204) {
7781
+ return response;
7782
+ } else if (response.status >= 200 && response.status < 300) {
7783
+ return response.json();
7784
+ } else {
7785
+ throw response;
7786
+ }
7787
+ }),
7788
+ new Promise((_, reject) =>
7789
+ setTimeout(reject, this.timeoutMs, "Request timed out.")
7790
+ ),
7791
+ ]);
7792
+ }
7793
+
7508
7794
  /** set mute notification user channel. */
7509
7795
  setMuteNotificationCategory(
7510
7796
  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,
@@ -639,19 +639,19 @@ export class Client {
639
639
  }
640
640
 
641
641
  /** Authenticate a user with a custom id against the server. */
642
- authenticateCustom(
643
- id: string,
642
+ authenticateMezon(
643
+ token: string,
644
644
  create?: boolean,
645
645
  username?: string,
646
646
  vars: Record<string, string> = {},
647
647
  options: any = {}
648
648
  ): Promise<Session> {
649
649
  const request = {
650
- id: id,
650
+ token: token,
651
651
  vars: vars,
652
652
  };
653
653
  return this.apiClient
654
- .authenticateCustom(
654
+ .authenticateMezon(
655
655
  this.serverkey,
656
656
  "",
657
657
  request,
@@ -2030,9 +2030,9 @@ export class Client {
2030
2030
  }
2031
2031
 
2032
2032
  /** Add a custom ID to the social profiles on the current user's account. */
2033
- async linkCustom(
2033
+ async linkMezon(
2034
2034
  session: Session,
2035
- request: ApiAccountCustom
2035
+ request: ApiAccountMezon
2036
2036
  ): Promise<boolean> {
2037
2037
  if (
2038
2038
  this.autoRefreshSession &&
@@ -2043,7 +2043,7 @@ export class Client {
2043
2043
  }
2044
2044
 
2045
2045
  return this.apiClient
2046
- .linkCustom(session.token, request)
2046
+ .linkMezon(session.token, request)
2047
2047
  .then((response: any) => {
2048
2048
  return response !== undefined;
2049
2049
  });
@@ -2432,7 +2432,7 @@ export class Client {
2432
2432
  /** Remove custom ID from the social profiles on the current user's account. */
2433
2433
  async unlinkCustom(
2434
2434
  session: Session,
2435
- request: ApiAccountCustom
2435
+ request: ApiAccountMezon
2436
2436
  ): Promise<boolean> {
2437
2437
  if (
2438
2438
  this.autoRefreshSession &&
@@ -2443,7 +2443,7 @@ export class Client {
2443
2443
  }
2444
2444
 
2445
2445
  return this.apiClient
2446
- .unlinkCustom(session.token, request)
2446
+ .unlinkMezon(session.token, request)
2447
2447
  .then((response: any) => {
2448
2448
  return response !== undefined;
2449
2449
  });