mezon-js 2.11.20 → 2.11.21

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
@@ -534,10 +534,14 @@ export interface ApiAuditLog {
534
534
  user_id?: string;
535
535
  }
536
536
 
537
- /** Authenticate against the server with a device ID. */
538
- export interface ApiAuthenticateRequest {
539
- //The App account details.
540
- account?: ApiAccountApp;
537
+ /** Authenticate against the server with email+password. */
538
+ export interface ApiAuthenticateEmailRequest {
539
+ //The email account details.
540
+ account?: ApiAccountEmail;
541
+ //Register the account if the user does not already exist.
542
+ create?: boolean;
543
+ //Set the username on the account at register. Must be unique.
544
+ username?: string;
541
545
  }
542
546
 
543
547
  /** */
@@ -3455,30 +3459,24 @@ export class MezonApi {
3455
3459
  }
3456
3460
 
3457
3461
  /** Authenticate a user with an email+password against the server. */
3458
- authenticateEmail(
3459
- basicAuthUsername: string,
3462
+ authenticateEmail(basicAuthUsername: string,
3460
3463
  basicAuthPassword: string,
3461
- account: ApiAccountEmail,
3462
- username?: string,
3463
- options: any = {}
3464
- ): Promise<ApiSession> {
3465
- if (account === null || account === undefined) {
3466
- throw new Error(
3467
- "'account' is a required parameter but is null or undefined."
3468
- );
3464
+ body:ApiAuthenticateEmailRequest,
3465
+ options: any = {}): Promise<ApiSession> {
3466
+
3467
+ if (body === null || body === undefined) {
3468
+ throw new Error("'body' is a required parameter but is null or undefined.");
3469
3469
  }
3470
3470
  const urlPath = "/v2/account/authenticate/email";
3471
3471
  const queryParams = new Map<string, any>();
3472
- queryParams.set("username", username);
3473
3472
 
3474
- let bodyJson: string = "";
3475
- bodyJson = JSON.stringify(account || {});
3473
+ let bodyJson : string = "";
3474
+ bodyJson = JSON.stringify(body || {});
3476
3475
 
3477
3476
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
3478
3477
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
3479
3478
  if (basicAuthUsername) {
3480
- fetchOptions.headers["Authorization"] =
3481
- "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3479
+ fetchOptions.headers["Authorization"] = "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
3482
3480
  }
3483
3481
 
3484
3482
  return Promise.race([
package/client.ts CHANGED
@@ -707,9 +707,12 @@ export class Client {
707
707
  vars?: Record<string, string>
708
708
  ): Promise<Session> {
709
709
  const request = {
710
- email: email,
711
- password: password,
712
- vars: vars,
710
+ username: username,
711
+ account: {
712
+ email: email,
713
+ password: password,
714
+ vars: vars,
715
+ }
713
716
  };
714
717
 
715
718
  return this.apiClient
package/dist/api.gen.d.ts CHANGED
@@ -310,9 +310,11 @@ export interface ApiAuditLog {
310
310
  time_log?: string;
311
311
  user_id?: string;
312
312
  }
313
- /** Authenticate against the server with a device ID. */
314
- export interface ApiAuthenticateRequest {
315
- account?: ApiAccountApp;
313
+ /** Authenticate against the server with email+password. */
314
+ export interface ApiAuthenticateEmailRequest {
315
+ account?: ApiAccountEmail;
316
+ create?: boolean;
317
+ username?: string;
316
318
  }
317
319
  /** */
318
320
  export interface ApiCategoryDesc {
@@ -1809,7 +1811,7 @@ export declare class MezonApi {
1809
1811
  /** Authenticate a user with a device id against the server. */
1810
1812
  authenticateDevice(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountDevice, create?: boolean, username?: string, options?: any): Promise<ApiSession>;
1811
1813
  /** Authenticate a user with an email+password against the server. */
1812
- authenticateEmail(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountEmail, username?: string, options?: any): Promise<ApiSession>;
1814
+ authenticateEmail(basicAuthUsername: string, basicAuthPassword: string, body: ApiAuthenticateEmailRequest, options?: any): Promise<ApiSession>;
1813
1815
  /** Authenticate a user with a Facebook OAuth token against the server. */
1814
1816
  authenticateFacebook(basicAuthUsername: string, basicAuthPassword: string, account: ApiAccountFacebook, create?: boolean, username?: string, sync?: boolean, options?: any): Promise<ApiSession>;
1815
1817
  /** Authenticate a user with a Facebook Instant Game token against the server. */
@@ -999,17 +999,14 @@ var MezonApi = class {
999
999
  ]);
1000
1000
  }
1001
1001
  /** Authenticate a user with an email+password against the server. */
1002
- authenticateEmail(basicAuthUsername, basicAuthPassword, account, username, options = {}) {
1003
- if (account === null || account === void 0) {
1004
- throw new Error(
1005
- "'account' is a required parameter but is null or undefined."
1006
- );
1002
+ authenticateEmail(basicAuthUsername, basicAuthPassword, body, options = {}) {
1003
+ if (body === null || body === void 0) {
1004
+ throw new Error("'body' is a required parameter but is null or undefined.");
1007
1005
  }
1008
1006
  const urlPath = "/v2/account/authenticate/email";
1009
1007
  const queryParams = /* @__PURE__ */ new Map();
1010
- queryParams.set("username", username);
1011
1008
  let bodyJson = "";
1012
- bodyJson = JSON.stringify(account || {});
1009
+ bodyJson = JSON.stringify(body || {});
1013
1010
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
1014
1011
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
1015
1012
  if (basicAuthUsername) {
@@ -8527,9 +8524,12 @@ var Client = class {
8527
8524
  /** Authenticate a user with an email+password against the server. */
8528
8525
  authenticateEmail(email, password, username, vars) {
8529
8526
  const request = {
8530
- email,
8531
- password,
8532
- vars
8527
+ username,
8528
+ account: {
8529
+ email,
8530
+ password,
8531
+ vars
8532
+ }
8533
8533
  };
8534
8534
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8535
8535
  return new Session(
@@ -965,17 +965,14 @@ var MezonApi = class {
965
965
  ]);
966
966
  }
967
967
  /** Authenticate a user with an email+password against the server. */
968
- authenticateEmail(basicAuthUsername, basicAuthPassword, account, username, options = {}) {
969
- if (account === null || account === void 0) {
970
- throw new Error(
971
- "'account' is a required parameter but is null or undefined."
972
- );
968
+ authenticateEmail(basicAuthUsername, basicAuthPassword, body, options = {}) {
969
+ if (body === null || body === void 0) {
970
+ throw new Error("'body' is a required parameter but is null or undefined.");
973
971
  }
974
972
  const urlPath = "/v2/account/authenticate/email";
975
973
  const queryParams = /* @__PURE__ */ new Map();
976
- queryParams.set("username", username);
977
974
  let bodyJson = "";
978
- bodyJson = JSON.stringify(account || {});
975
+ bodyJson = JSON.stringify(body || {});
979
976
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
980
977
  const fetchOptions = buildFetchOptions("POST", options, bodyJson);
981
978
  if (basicAuthUsername) {
@@ -8493,9 +8490,12 @@ var Client = class {
8493
8490
  /** Authenticate a user with an email+password against the server. */
8494
8491
  authenticateEmail(email, password, username, vars) {
8495
8492
  const request = {
8496
- email,
8497
- password,
8498
- vars
8493
+ username,
8494
+ account: {
8495
+ email,
8496
+ password,
8497
+ vars
8498
+ }
8499
8499
  };
8500
8500
  return this.apiClient.authenticateEmail(this.serverkey, "", request, username).then((apiSession) => {
8501
8501
  return new Session(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.11.20",
4
+ "version": "2.11.21",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"