@bzbs/react-api-client 1.2.6 → 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.js CHANGED
@@ -77,6 +77,7 @@ __export(index_exports, {
77
77
  ProfileApi: () => ProfileApi,
78
78
  RegistrationApi: () => RegistrationApi,
79
79
  RequestHelpApi: () => RequestHelpApi,
80
+ SettingApi: () => SettingApi,
80
81
  StampApi: () => StampApi
81
82
  });
82
83
  module.exports = __toCommonJS(index_exports);
@@ -471,6 +472,164 @@ var AuthenticateApi = class extends BaseService {
471
472
  );
472
473
  });
473
474
  }
475
+ /**
476
+ * Connect with LINE. If authorization token is provided, it will connect current user with given LINE credentials.
477
+ * Otherwise, it tries to login with those credentials.
478
+ *
479
+ * @param params - The parameters.
480
+ * @param params.idToken - The LINE id token.
481
+ * @param params.lineAccessToken - The LINE access token.
482
+ * @param params.authorizationCode - The LINE authorization code.
483
+ * @param params.appId - Your application id.
484
+ * @param params.uuid - The unique device identifier.
485
+ * @param params.options - (Optional) Additional params for the request.
486
+ * @param requestOptions - Optional request options.
487
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
488
+ */
489
+ connectLine(params, requestOptions) {
490
+ return __async(this, null, function* () {
491
+ return yield this.post(
492
+ "auth/line_login",
493
+ __spreadValues({
494
+ id_token: params.idToken,
495
+ line_access_token: params.lineAccessToken,
496
+ authorization_code: params.authorizationCode,
497
+ app_id: params.appId,
498
+ uuid: params.uuid,
499
+ device_locale: params.deviceLocale,
500
+ os: params.os,
501
+ platform: params.platform,
502
+ mac_address: params.macAddress,
503
+ device_noti_enable: true,
504
+ client_version: params.clientVersion,
505
+ device_token: params.deviceToken
506
+ }, params.options),
507
+ {
508
+ headers: __spreadValues({
509
+ "Content-Type": "application/x-www-form-urlencoded"
510
+ }, requestOptions == null ? void 0 : requestOptions.headers),
511
+ data: requestOptions == null ? void 0 : requestOptions.data,
512
+ params: requestOptions == null ? void 0 : requestOptions.params
513
+ }
514
+ );
515
+ });
516
+ }
517
+ /**
518
+ * Connect with Facebook. If authorization token is provided, it will connect current user with given Facebook access token.
519
+ * Otherwise, it tries to login with that access token.
520
+ *
521
+ * @param params - The parameters.
522
+ * @param params.accessToken - The Facebook access token.
523
+ * @param params.appId - Your application id.
524
+ * @param params.uuid - The unique device identifier.
525
+ * @param params.options - (Optional) Additional params for the request.
526
+ * @param requestOptions - Optional request options.
527
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
528
+ */
529
+ connectFacebook(params, requestOptions) {
530
+ return __async(this, null, function* () {
531
+ return yield this.post(
532
+ "auth/login",
533
+ __spreadValues({
534
+ access_token: params.accessToken,
535
+ app_id: params.appId,
536
+ uuid: params.uuid,
537
+ device_locale: params.deviceLocale,
538
+ os: params.os,
539
+ platform: params.platform,
540
+ mac_address: params.macAddress,
541
+ device_noti_enable: true,
542
+ client_version: params.clientVersion,
543
+ device_token: params.deviceToken
544
+ }, params.options),
545
+ {
546
+ headers: __spreadValues({
547
+ "Content-Type": "application/x-www-form-urlencoded"
548
+ }, requestOptions == null ? void 0 : requestOptions.headers),
549
+ data: requestOptions == null ? void 0 : requestOptions.data,
550
+ params: requestOptions == null ? void 0 : requestOptions.params
551
+ }
552
+ );
553
+ });
554
+ }
555
+ /**
556
+ * Connect with Google. If authorization token is provided, it will connect current user with given Google id token.
557
+ * Otherwise, it tries to login with that id token.
558
+ *
559
+ * @param params - The parameters.
560
+ * @param params.idToken - The Google id token.
561
+ * @param params.appId - Your application id.
562
+ * @param params.uuid - The unique device identifier.
563
+ * @param params.options - (Optional) Additional params for the request.
564
+ * @param requestOptions - Optional request options.
565
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
566
+ */
567
+ connectGoogle(params, requestOptions) {
568
+ return __async(this, null, function* () {
569
+ return yield this.post(
570
+ "auth/google_login",
571
+ __spreadValues({
572
+ id_token: params.idToken,
573
+ app_id: params.appId,
574
+ uuid: params.uuid,
575
+ device_locale: params.deviceLocale,
576
+ os: params.os,
577
+ platform: params.platform,
578
+ mac_address: params.macAddress,
579
+ device_noti_enable: true,
580
+ client_version: params.clientVersion,
581
+ device_token: params.deviceToken
582
+ }, params.options),
583
+ {
584
+ headers: __spreadValues({
585
+ "Content-Type": "application/x-www-form-urlencoded"
586
+ }, requestOptions == null ? void 0 : requestOptions.headers),
587
+ data: requestOptions == null ? void 0 : requestOptions.data,
588
+ params: requestOptions == null ? void 0 : requestOptions.params
589
+ }
590
+ );
591
+ });
592
+ }
593
+ /**
594
+ * Connect with Apple. If authorization token is provided, it will connect current user with given Apple credentials.
595
+ * Otherwise, it tries to login with those credentials.
596
+ *
597
+ * @param params - The parameters.
598
+ * @param params.idToken - The Apple id token.
599
+ * @param params.refreshToken - The Apple refresh token from appleToken().
600
+ * @param params.appId - Your application id.
601
+ * @param params.uuid - The unique device identifier.
602
+ * @param params.options - (Optional) Additional params for the request.
603
+ * @param requestOptions - Optional request options.
604
+ * @returns A promise that resolves to a ServiceResponse containing the login response.
605
+ */
606
+ connectApple(params, requestOptions) {
607
+ return __async(this, null, function* () {
608
+ return yield this.post(
609
+ "auth/apple_login",
610
+ __spreadValues({
611
+ id_token: params.idToken,
612
+ refresh_token: params.refreshToken,
613
+ app_id: params.appId,
614
+ uuid: params.uuid,
615
+ device_locale: params.deviceLocale,
616
+ os: params.os,
617
+ platform: params.platform,
618
+ mac_address: params.macAddress,
619
+ device_noti_enable: true,
620
+ client_version: params.clientVersion,
621
+ device_token: params.deviceToken
622
+ }, params.options),
623
+ {
624
+ headers: __spreadValues({
625
+ "Content-Type": "application/x-www-form-urlencoded"
626
+ }, requestOptions == null ? void 0 : requestOptions.headers),
627
+ data: requestOptions == null ? void 0 : requestOptions.data,
628
+ params: requestOptions == null ? void 0 : requestOptions.params
629
+ }
630
+ );
631
+ });
632
+ }
474
633
  /**
475
634
  * Performs a logout for the user.
476
635
  *
@@ -544,7 +703,7 @@ var AuthenticateApi = class extends BaseService {
544
703
  });
545
704
  }
546
705
  /**
547
- * Sends an OTP (One-Time Password) to the user for authentication.
706
+ * Sends an OTP (One-Time Password) to the user for authentication (GET method).
548
707
  *
549
708
  * @param params - The parameters.
550
709
  * @param params.uuid - The unique device identifier.
@@ -569,6 +728,62 @@ var AuthenticateApi = class extends BaseService {
569
728
  );
570
729
  });
571
730
  }
731
+ /**
732
+ * Sends an OTP (One-Time Password) to the user for authentication (POST method, V2).
733
+ *
734
+ * @param params - The parameters.
735
+ * @param params.appId - Your application id.
736
+ * @param params.contactNumber - The contact number for the user.
737
+ * @param params.channel - (Optional) The channel to use for OTP delivery.
738
+ * @param params.options - (Optional) Additional params for the request.
739
+ * @param requestOptions - (Optional) Additional options for the request.
740
+ * @returns A promise that resolves to a ServiceResponse containing the OTP response.
741
+ */
742
+ otpV2(params, requestOptions) {
743
+ return __async(this, null, function* () {
744
+ return yield this.post(
745
+ "auth/otp",
746
+ __spreadValues({
747
+ app_id: params.appId,
748
+ contact_number: params.contactNumber,
749
+ channel: params.channel
750
+ }, params.options),
751
+ {
752
+ headers: __spreadValues({
753
+ "Content-Type": "application/x-www-form-urlencoded"
754
+ }, requestOptions == null ? void 0 : requestOptions.headers),
755
+ data: requestOptions == null ? void 0 : requestOptions.data,
756
+ params: requestOptions == null ? void 0 : requestOptions.params
757
+ }
758
+ );
759
+ });
760
+ }
761
+ /**
762
+ * Sends an OTP (One-Time Password) via email to the user for authentication.
763
+ *
764
+ * @param params - The parameters.
765
+ * @param params.uuid - The unique device identifier.
766
+ * @param params.appId - Your application id.
767
+ * @param params.email - The email address for the user.
768
+ * @param params.channel - (Optional) The channel to use for OTP delivery.
769
+ * @param params.options - (Optional) Additional params for the request.
770
+ * @param requestOptions - (Optional) Additional options for the request.
771
+ * @returns A promise that resolves to a ServiceResponse containing the OTP response.
772
+ */
773
+ otpEmail(params, requestOptions) {
774
+ return __async(this, null, function* () {
775
+ return yield this.get(
776
+ "auth/otp_email",
777
+ __spreadValues({
778
+ uuid: params.uuid,
779
+ app_id: params.appId,
780
+ email: params.email,
781
+ channel: params.channel
782
+ }, params.options),
783
+ requestOptions
784
+ );
785
+ });
786
+ }
572
787
  /**
573
788
  * Confirm the OTP (One-Time Password) for authentication.
574
789
  *
@@ -606,8 +821,10 @@ var AuthenticateApi = class extends BaseService {
606
821
  * @param params.appId - Your application id.
607
822
  * @param params.otp - The OTP to validate.
608
823
  * @param params.refCode - The reference code for the OTP.
609
- * @param params.contactNumber - The contact number for the user.
610
- * @param params.use - Whether to use the OTP after validation.
824
+ * @param params.type - Type of contact (email or contact_number).
825
+ * @param params.contactNumber - (Optional) The contact number for the user.
826
+ * @param params.email - (Optional) The email address for the user.
827
+ * @param params.use - Whether to use the OTP after validation (default: false).
611
828
  * @param params.channel - (Optional) The channel to use for OTP delivery.
612
829
  * @param params.options - (Optional) Additional params for the request.
613
830
  * @param requestOptions - (Optional) Additional options for the request.
@@ -621,8 +838,10 @@ var AuthenticateApi = class extends BaseService {
621
838
  app_id: params.appId,
622
839
  otp: params.otp,
623
840
  refcode: params.refCode,
841
+ type: params.type,
624
842
  contact_number: params.contactNumber,
625
- use: params.use,
843
+ email: params.email,
844
+ use: params.use !== void 0 ? params.use : false,
626
845
  channel: params.channel
627
846
  }, params.options),
628
847
  {
@@ -636,13 +855,17 @@ var AuthenticateApi = class extends BaseService {
636
855
  });
637
856
  }
638
857
  /**
639
- * Retrieve a new token and update the current device token.
858
+ * Refresh buzzebees token and retrieve a new token.
640
859
  *
641
860
  * @param params - The parameters.
642
861
  * @param params.uuid - The unique device identifier.
643
- * @param params.appId - Your application id.
644
- * @param params.clientVersion - The version of the client.
645
- * @param params.deviceToken - The token of the device.
862
+ * @param params.deviceAppId - Your application id.
863
+ * @param params.os - Your device operation system + version. Ex. ios 11.2.1, android 9.0
864
+ * @param params.platform - Your platform. Ex. iPhone, Android
865
+ * @param params.macAddress - Unique device identifier
866
+ * @param params.deviceNotificationEnabled - Enable push notification
867
+ * @param params.clientVersion - Number of version (App Prefix + Your application version, Ex. ios_buzzebeesdemo1.0.1)
868
+ * @param params.deviceToken - Device token used for send push notification
646
869
  * @param params.options - (Optional) Additional params for the request.
647
870
  * @param requestOptions - (Optional) Additional options for the request.
648
871
  * @returns A promise that resolves to a ServiceResponse containing the resume response.
@@ -653,10 +876,13 @@ var AuthenticateApi = class extends BaseService {
653
876
  "auth/device_resume",
654
877
  __spreadValues({
655
878
  uuid: params.uuid,
656
- app_id: params.appId,
879
+ device_app_id: params.deviceAppId,
880
+ os: params.os,
881
+ platform: params.platform,
882
+ mac_address: params.macAddress,
883
+ device_noti_enable: params.deviceNotificationEnabled,
657
884
  client_version: params.clientVersion,
658
- device_token: params.deviceToken,
659
- mac_address: params.macAddress
885
+ device_token: params.deviceToken
660
886
  }, params.options),
661
887
  {
662
888
  headers: __spreadValues({
@@ -669,13 +895,17 @@ var AuthenticateApi = class extends BaseService {
669
895
  });
670
896
  }
671
897
  /**
672
- * Update the device token for push notification.
898
+ * Update device token for push notification.
673
899
  *
674
900
  * @param params - The parameters.
675
901
  * @param params.uuid - The unique device identifier.
676
- * @param params.appId - Your application id.
677
- * @param params.clientVersion - The version of the client.
678
- * @param params.deviceToken - The token of the device.
902
+ * @param params.deviceAppId - Your application id.
903
+ * @param params.os - Your device operation system + version. Ex. ios 11.2.1, android 9.0
904
+ * @param params.platform - Your platform. Ex. iPhone, Android
905
+ * @param params.macAddress - Unique device identifier
906
+ * @param params.deviceNotificationEnabled - Enable push notification
907
+ * @param params.clientVersion - Number of version (App Prefix + Your application version, Ex. ios_buzzebeesdemo1.0.1)
908
+ * @param params.deviceToken - Device token used for send push notification
679
909
  * @param params.options - (Optional) Additional params for the request.
680
910
  * @param requestOptions - (Optional) Additional options for the request.
681
911
  * @returns A promise that resolves to a ServiceResponse containing the resume response.
@@ -683,13 +913,16 @@ var AuthenticateApi = class extends BaseService {
683
913
  updateDevice(params, requestOptions) {
684
914
  return __async(this, null, function* () {
685
915
  return yield this.post(
686
- "auth/device_resume",
916
+ "auth/update_device",
687
917
  __spreadValues({
688
918
  uuid: params.uuid,
689
- app_id: params.appId,
919
+ device_app_id: params.deviceAppId,
920
+ os: params.os,
921
+ platform: params.platform,
922
+ mac_address: params.macAddress,
923
+ device_noti_enable: params.deviceNotificationEnabled,
690
924
  client_version: params.clientVersion,
691
- device_token: params.deviceToken,
692
- mac_address: params.macAddress
925
+ device_token: params.deviceToken
693
926
  }, params.options),
694
927
  {
695
928
  headers: __spreadValues({
@@ -2379,6 +2612,45 @@ var RequestHelpApi = class extends BaseService {
2379
2612
  }
2380
2613
  };
2381
2614
 
2615
+ // src/api/setting/setting-api.ts
2616
+ var SettingApi = class extends BaseService {
2617
+ constructor(client, baseUrl) {
2618
+ super(client, baseUrl);
2619
+ }
2620
+ /**
2621
+ * Get access key for web landing.
2622
+ *
2623
+ * @param params - The parameters.
2624
+ * @param params.data - JSON string of data. Available data:
2625
+ * - "app_id" (Required, string): App Id
2626
+ * - "campaign_id" (Required, int): Campaign ID
2627
+ * - "locale" (Required, int): User Locale
2628
+ * - "return_url" (Required, string): URL to redirect back to App
2629
+ * - "version" (Required, string): Version of landing interface
2630
+ * - "redeem_key" (Optional, string): Required for case history - Redeem Key from history API (CampaignID_ItemNumber)
2631
+ * @param params.options - (Optional) Additional params for the request.
2632
+ * @param requestOptions - (Optional) Additional options for the request.
2633
+ * @returns A promise that resolves to a ServiceResponse containing the access token response.
2634
+ */
2635
+ accessKey(params, requestOptions) {
2636
+ return __async(this, null, function* () {
2637
+ return yield this.post(
2638
+ "setting",
2639
+ __spreadValues({
2640
+ data: params.data
2641
+ }, params.options),
2642
+ {
2643
+ headers: __spreadValues({
2644
+ "Content-Type": "application/x-www-form-urlencoded"
2645
+ }, requestOptions == null ? void 0 : requestOptions.headers),
2646
+ data: requestOptions == null ? void 0 : requestOptions.data,
2647
+ params: requestOptions == null ? void 0 : requestOptions.params
2648
+ }
2649
+ );
2650
+ });
2651
+ }
2652
+ };
2653
+
2382
2654
  // src/api/blob/blob.ts
2383
2655
  var Blob = class extends BaseService {
2384
2656
  constructor(client, baseUrl) {
@@ -2428,6 +2700,7 @@ var BzbsService = class {
2428
2700
  this.addressApi = new AddressApi(this.client, this.baseUrl);
2429
2701
  this.stampApi = new StampApi(this.client, this.baseUrl);
2430
2702
  this.forumApi = new RequestHelpApi(this.client, this.baseUrl);
2703
+ this.settingApi = new SettingApi(this.client, this.baseUrl);
2431
2704
  this.blob = new Blob(this.client, this.baseBlobUrl);
2432
2705
  }
2433
2706
  };
@@ -2453,6 +2726,7 @@ var BzbsService = class {
2453
2726
  ProfileApi,
2454
2727
  RegistrationApi,
2455
2728
  RequestHelpApi,
2729
+ SettingApi,
2456
2730
  StampApi
2457
2731
  });
2458
2732
  //# sourceMappingURL=index.js.map