@bzbs/react-api-client 1.2.5 → 1.3.0

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/dist/index.mjs CHANGED
@@ -428,6 +428,164 @@ var AuthenticateApi = class extends BaseService {
428
428
  );
429
429
  });
430
430
  }
431
+ /**
432
+ * Connect with LINE. If authorization token is provided, it will connect current user with given LINE credentials.
433
+ * Otherwise, it tries to login with those credentials.
434
+ *
435
+ * @param params - The parameters.
436
+ * @param params.idToken - The LINE id token.
437
+ * @param params.lineAccessToken - The LINE access token.
438
+ * @param params.authorizationCode - The LINE authorization code.
439
+ * @param params.appId - Your application id.
440
+ * @param params.uuid - The unique device identifier.
441
+ * @param params.options - (Optional) Additional params for the request.
442
+ * @param requestOptions - Optional request options.
443
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
444
+ */
445
+ connectLine(params, requestOptions) {
446
+ return __async(this, null, function* () {
447
+ return yield this.post(
448
+ "auth/line_login",
449
+ __spreadValues({
450
+ id_token: params.idToken,
451
+ line_access_token: params.lineAccessToken,
452
+ authorization_code: params.authorizationCode,
453
+ app_id: params.appId,
454
+ uuid: params.uuid,
455
+ device_locale: params.deviceLocale,
456
+ os: params.os,
457
+ platform: params.platform,
458
+ mac_address: params.macAddress,
459
+ device_noti_enable: true,
460
+ client_version: params.clientVersion,
461
+ device_token: params.deviceToken
462
+ }, params.options),
463
+ {
464
+ headers: __spreadValues({
465
+ "Content-Type": "application/x-www-form-urlencoded"
466
+ }, requestOptions == null ? void 0 : requestOptions.headers),
467
+ data: requestOptions == null ? void 0 : requestOptions.data,
468
+ params: requestOptions == null ? void 0 : requestOptions.params
469
+ }
470
+ );
471
+ });
472
+ }
473
+ /**
474
+ * Connect with Facebook. If authorization token is provided, it will connect current user with given Facebook access token.
475
+ * Otherwise, it tries to login with that access token.
476
+ *
477
+ * @param params - The parameters.
478
+ * @param params.accessToken - The Facebook access token.
479
+ * @param params.appId - Your application id.
480
+ * @param params.uuid - The unique device identifier.
481
+ * @param params.options - (Optional) Additional params for the request.
482
+ * @param requestOptions - Optional request options.
483
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
484
+ */
485
+ connectFacebook(params, requestOptions) {
486
+ return __async(this, null, function* () {
487
+ return yield this.post(
488
+ "auth/login",
489
+ __spreadValues({
490
+ access_token: params.accessToken,
491
+ app_id: params.appId,
492
+ uuid: params.uuid,
493
+ device_locale: params.deviceLocale,
494
+ os: params.os,
495
+ platform: params.platform,
496
+ mac_address: params.macAddress,
497
+ device_noti_enable: true,
498
+ client_version: params.clientVersion,
499
+ device_token: params.deviceToken
500
+ }, params.options),
501
+ {
502
+ headers: __spreadValues({
503
+ "Content-Type": "application/x-www-form-urlencoded"
504
+ }, requestOptions == null ? void 0 : requestOptions.headers),
505
+ data: requestOptions == null ? void 0 : requestOptions.data,
506
+ params: requestOptions == null ? void 0 : requestOptions.params
507
+ }
508
+ );
509
+ });
510
+ }
511
+ /**
512
+ * Connect with Google. If authorization token is provided, it will connect current user with given Google id token.
513
+ * Otherwise, it tries to login with that id token.
514
+ *
515
+ * @param params - The parameters.
516
+ * @param params.idToken - The Google id token.
517
+ * @param params.appId - Your application id.
518
+ * @param params.uuid - The unique device identifier.
519
+ * @param params.options - (Optional) Additional params for the request.
520
+ * @param requestOptions - Optional request options.
521
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
522
+ */
523
+ connectGoogle(params, requestOptions) {
524
+ return __async(this, null, function* () {
525
+ return yield this.post(
526
+ "auth/google_login",
527
+ __spreadValues({
528
+ id_token: params.idToken,
529
+ app_id: params.appId,
530
+ uuid: params.uuid,
531
+ device_locale: params.deviceLocale,
532
+ os: params.os,
533
+ platform: params.platform,
534
+ mac_address: params.macAddress,
535
+ device_noti_enable: true,
536
+ client_version: params.clientVersion,
537
+ device_token: params.deviceToken
538
+ }, params.options),
539
+ {
540
+ headers: __spreadValues({
541
+ "Content-Type": "application/x-www-form-urlencoded"
542
+ }, requestOptions == null ? void 0 : requestOptions.headers),
543
+ data: requestOptions == null ? void 0 : requestOptions.data,
544
+ params: requestOptions == null ? void 0 : requestOptions.params
545
+ }
546
+ );
547
+ });
548
+ }
549
+ /**
550
+ * Connect with Apple. If authorization token is provided, it will connect current user with given Apple credentials.
551
+ * Otherwise, it tries to login with those credentials.
552
+ *
553
+ * @param params - The parameters.
554
+ * @param params.idToken - The Apple id token.
555
+ * @param params.refreshToken - The Apple refresh token from appleToken().
556
+ * @param params.appId - Your application id.
557
+ * @param params.uuid - The unique device identifier.
558
+ * @param params.options - (Optional) Additional params for the request.
559
+ * @param requestOptions - Optional request options.
560
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
561
+ */
562
+ connectApple(params, requestOptions) {
563
+ return __async(this, null, function* () {
564
+ return yield this.post(
565
+ "auth/apple_login",
566
+ __spreadValues({
567
+ id_token: params.idToken,
568
+ refresh_token: params.refreshToken,
569
+ app_id: params.appId,
570
+ uuid: params.uuid,
571
+ device_locale: params.deviceLocale,
572
+ os: params.os,
573
+ platform: params.platform,
574
+ mac_address: params.macAddress,
575
+ device_noti_enable: true,
576
+ client_version: params.clientVersion,
577
+ device_token: params.deviceToken
578
+ }, params.options),
579
+ {
580
+ headers: __spreadValues({
581
+ "Content-Type": "application/x-www-form-urlencoded"
582
+ }, requestOptions == null ? void 0 : requestOptions.headers),
583
+ data: requestOptions == null ? void 0 : requestOptions.data,
584
+ params: requestOptions == null ? void 0 : requestOptions.params
585
+ }
586
+ );
587
+ });
588
+ }
431
589
  /**
432
590
  * Performs a logout for the user.
433
591
  *
@@ -501,7 +659,7 @@ var AuthenticateApi = class extends BaseService {
501
659
  });
502
660
  }
503
661
  /**
504
- * Sends an OTP (One-Time Password) to the user for authentication.
662
+ * Sends an OTP (One-Time Password) to the user for authentication (GET method).
505
663
  *
506
664
  * @param params - The parameters.
507
665
  * @param params.uuid - The unique device identifier.
@@ -526,6 +684,62 @@ var AuthenticateApi = class extends BaseService {
526
684
  );
527
685
  });
528
686
  }
687
+ /**
688
+ * Sends an OTP (One-Time Password) to the user for authentication (POST method, V2).
689
+ *
690
+ * @param params - The parameters.
691
+ * @param params.appId - Your application id.
692
+ * @param params.contactNumber - The contact number for the user.
693
+ * @param params.channel - (Optional) The channel to use for OTP delivery.
694
+ * @param params.options - (Optional) Additional params for the request.
695
+ * @param requestOptions - (Optional) Additional options for the request.
696
+ * @returns A promise that resolves to a ServiceResponse containing the OTP response.
697
+ */
698
+ otpV2(params, requestOptions) {
699
+ return __async(this, null, function* () {
700
+ return yield this.post(
701
+ "auth/otp",
702
+ __spreadValues({
703
+ app_id: params.appId,
704
+ contact_number: params.contactNumber,
705
+ channel: params.channel
706
+ }, params.options),
707
+ {
708
+ headers: __spreadValues({
709
+ "Content-Type": "application/x-www-form-urlencoded"
710
+ }, requestOptions == null ? void 0 : requestOptions.headers),
711
+ data: requestOptions == null ? void 0 : requestOptions.data,
712
+ params: requestOptions == null ? void 0 : requestOptions.params
713
+ }
714
+ );
715
+ });
716
+ }
717
+ /**
718
+ * Sends an OTP (One-Time Password) via email to the user for authentication.
719
+ *
720
+ * @param params - The parameters.
721
+ * @param params.uuid - The unique device identifier.
722
+ * @param params.appId - Your application id.
723
+ * @param params.email - The email address for the user.
724
+ * @param params.channel - (Optional) The channel to use for OTP delivery.
725
+ * @param params.options - (Optional) Additional params for the request.
726
+ * @param requestOptions - (Optional) Additional options for the request.
727
+ * @returns A promise that resolves to a ServiceResponse containing the OTP response.
728
+ */
729
+ otpEmail(params, requestOptions) {
730
+ return __async(this, null, function* () {
731
+ return yield this.get(
732
+ "auth/otp_email",
733
+ __spreadValues({
734
+ uuid: params.uuid,
735
+ app_id: params.appId,
736
+ email: params.email,
737
+ channel: params.channel
738
+ }, params.options),
739
+ requestOptions
740
+ );
741
+ });
742
+ }
529
743
  /**
530
744
  * Confirm the OTP (One-Time Password) for authentication.
531
745
  *
@@ -563,8 +777,10 @@ var AuthenticateApi = class extends BaseService {
563
777
  * @param params.appId - Your application id.
564
778
  * @param params.otp - The OTP to validate.
565
779
  * @param params.refCode - The reference code for the OTP.
566
- * @param params.contactNumber - The contact number for the user.
567
- * @param params.use - Whether to use the OTP after validation.
780
+ * @param params.type - Type of contact (email or contact_number).
781
+ * @param params.contactNumber - (Optional) The contact number for the user.
782
+ * @param params.email - (Optional) The email address for the user.
783
+ * @param params.use - Whether to use the OTP after validation (default: false).
568
784
  * @param params.channel - (Optional) The channel to use for OTP delivery.
569
785
  * @param params.options - (Optional) Additional params for the request.
570
786
  * @param requestOptions - (Optional) Additional options for the request.
@@ -578,8 +794,10 @@ var AuthenticateApi = class extends BaseService {
578
794
  app_id: params.appId,
579
795
  otp: params.otp,
580
796
  refcode: params.refCode,
797
+ type: params.type,
581
798
  contact_number: params.contactNumber,
582
- use: params.use,
799
+ email: params.email,
800
+ use: params.use !== void 0 ? params.use : false,
583
801
  channel: params.channel
584
802
  }, params.options),
585
803
  {
@@ -593,13 +811,17 @@ var AuthenticateApi = class extends BaseService {
593
811
  });
594
812
  }
595
813
  /**
596
- * Retrieve a new token and update the current device token.
814
+ * Refresh buzzebees token and retrieve a new token.
597
815
  *
598
816
  * @param params - The parameters.
599
817
  * @param params.uuid - The unique device identifier.
600
- * @param params.appId - Your application id.
601
- * @param params.clientVersion - The version of the client.
602
- * @param params.deviceToken - The token of the device.
818
+ * @param params.deviceAppId - Your application id.
819
+ * @param params.os - Your device operation system + version. Ex. ios 11.2.1, android 9.0
820
+ * @param params.platform - Your platform. Ex. iPhone, Android
821
+ * @param params.macAddress - Unique device identifier
822
+ * @param params.deviceNotificationEnabled - Enable push notification
823
+ * @param params.clientVersion - Number of version (App Prefix + Your application version, Ex. ios_buzzebeesdemo1.0.1)
824
+ * @param params.deviceToken - Device token used for send push notification
603
825
  * @param params.options - (Optional) Additional params for the request.
604
826
  * @param requestOptions - (Optional) Additional options for the request.
605
827
  * @returns A promise that resolves to a ServiceResponse containing the resume response.
@@ -610,10 +832,13 @@ var AuthenticateApi = class extends BaseService {
610
832
  "auth/device_resume",
611
833
  __spreadValues({
612
834
  uuid: params.uuid,
613
- app_id: params.appId,
835
+ device_app_id: params.deviceAppId,
836
+ os: params.os,
837
+ platform: params.platform,
838
+ mac_address: params.macAddress,
839
+ device_noti_enable: params.deviceNotificationEnabled,
614
840
  client_version: params.clientVersion,
615
- device_token: params.deviceToken,
616
- mac_address: params.macAddress
841
+ device_token: params.deviceToken
617
842
  }, params.options),
618
843
  {
619
844
  headers: __spreadValues({
@@ -626,13 +851,17 @@ var AuthenticateApi = class extends BaseService {
626
851
  });
627
852
  }
628
853
  /**
629
- * Update the device token for push notification.
854
+ * Update device token for push notification.
630
855
  *
631
856
  * @param params - The parameters.
632
857
  * @param params.uuid - The unique device identifier.
633
- * @param params.appId - Your application id.
634
- * @param params.clientVersion - The version of the client.
635
- * @param params.deviceToken - The token of the device.
858
+ * @param params.deviceAppId - Your application id.
859
+ * @param params.os - Your device operation system + version. Ex. ios 11.2.1, android 9.0
860
+ * @param params.platform - Your platform. Ex. iPhone, Android
861
+ * @param params.macAddress - Unique device identifier
862
+ * @param params.deviceNotificationEnabled - Enable push notification
863
+ * @param params.clientVersion - Number of version (App Prefix + Your application version, Ex. ios_buzzebeesdemo1.0.1)
864
+ * @param params.deviceToken - Device token used for send push notification
636
865
  * @param params.options - (Optional) Additional params for the request.
637
866
  * @param requestOptions - (Optional) Additional options for the request.
638
867
  * @returns A promise that resolves to a ServiceResponse containing the resume response.
@@ -640,13 +869,16 @@ var AuthenticateApi = class extends BaseService {
640
869
  updateDevice(params, requestOptions) {
641
870
  return __async(this, null, function* () {
642
871
  return yield this.post(
643
- "auth/device_resume",
872
+ "auth/update_device",
644
873
  __spreadValues({
645
874
  uuid: params.uuid,
646
- app_id: params.appId,
875
+ device_app_id: params.deviceAppId,
876
+ os: params.os,
877
+ platform: params.platform,
878
+ mac_address: params.macAddress,
879
+ device_noti_enable: params.deviceNotificationEnabled,
647
880
  client_version: params.clientVersion,
648
- device_token: params.deviceToken,
649
- mac_address: params.macAddress
881
+ device_token: params.deviceToken
650
882
  }, params.options),
651
883
  {
652
884
  headers: __spreadValues({
@@ -2336,6 +2568,45 @@ var RequestHelpApi = class extends BaseService {
2336
2568
  }
2337
2569
  };
2338
2570
 
2571
+ // src/api/setting/setting-api.ts
2572
+ var SettingApi = class extends BaseService {
2573
+ constructor(client, baseUrl) {
2574
+ super(client, baseUrl);
2575
+ }
2576
+ /**
2577
+ * Get access key for web landing.
2578
+ *
2579
+ * @param params - The parameters.
2580
+ * @param params.data - JSON string of data. Available data:
2581
+ * - "app_id" (Required, string): App Id
2582
+ * - "campaign_id" (Required, int): Campaign ID
2583
+ * - "locale" (Required, int): User Locale
2584
+ * - "return_url" (Required, string): URL to redirect back to App
2585
+ * - "version" (Required, string): Version of landing interface
2586
+ * - "redeem_key" (Optional, string): Required for case history - Redeem Key from history API (CampaignID_ItemNumber)
2587
+ * @param params.options - (Optional) Additional params for the request.
2588
+ * @param requestOptions - (Optional) Additional options for the request.
2589
+ * @returns A promise that resolves to a ServiceResponse containing the access token response.
2590
+ */
2591
+ accessKey(params, requestOptions) {
2592
+ return __async(this, null, function* () {
2593
+ return yield this.post(
2594
+ "setting",
2595
+ __spreadValues({
2596
+ data: params.data
2597
+ }, params.options),
2598
+ {
2599
+ headers: __spreadValues({
2600
+ "Content-Type": "application/x-www-form-urlencoded"
2601
+ }, requestOptions == null ? void 0 : requestOptions.headers),
2602
+ data: requestOptions == null ? void 0 : requestOptions.data,
2603
+ params: requestOptions == null ? void 0 : requestOptions.params
2604
+ }
2605
+ );
2606
+ });
2607
+ }
2608
+ };
2609
+
2339
2610
  // src/api/blob/blob.ts
2340
2611
  var Blob = class extends BaseService {
2341
2612
  constructor(client, baseUrl) {
@@ -2385,6 +2656,7 @@ var BzbsService = class {
2385
2656
  this.addressApi = new AddressApi(this.client, this.baseUrl);
2386
2657
  this.stampApi = new StampApi(this.client, this.baseUrl);
2387
2658
  this.forumApi = new RequestHelpApi(this.client, this.baseUrl);
2659
+ this.settingApi = new SettingApi(this.client, this.baseUrl);
2388
2660
  this.blob = new Blob(this.client, this.baseBlobUrl);
2389
2661
  }
2390
2662
  };
@@ -2409,6 +2681,7 @@ export {
2409
2681
  ProfileApi,
2410
2682
  RegistrationApi,
2411
2683
  RequestHelpApi,
2684
+ SettingApi,
2412
2685
  StampApi
2413
2686
  };
2414
2687
  //# sourceMappingURL=index.mjs.map