@gofynd/fdk-client-javascript 0.1.35
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/.github/workflows/on_create_release.yml +23 -0
- package/.github/workflows/on_merge_main.yml +38 -0
- package/.github/workflows/on_pull_request.yml +35 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/application.d.ts +3 -0
- package/application.js +6 -0
- package/common.d.ts +4 -0
- package/common.js +9 -0
- package/documentation/application/CART.md +7290 -0
- package/documentation/application/CATALOG.md +9570 -0
- package/documentation/application/COMMON.md +448 -0
- package/documentation/application/COMMUNICATION.md +463 -0
- package/documentation/application/CONFIGURATION.md +2902 -0
- package/documentation/application/CONTENT.md +3350 -0
- package/documentation/application/FILESTORAGE.md +491 -0
- package/documentation/application/LEAD.md +1891 -0
- package/documentation/application/LOGISTIC.md +439 -0
- package/documentation/application/ORDER.md +3428 -0
- package/documentation/application/PAYMENT.md +5035 -0
- package/documentation/application/POSCART.md +7889 -0
- package/documentation/application/README.md +21 -0
- package/documentation/application/REWARDS.md +714 -0
- package/documentation/application/SHARE.md +729 -0
- package/documentation/application/THEME.md +5796 -0
- package/documentation/application/USER.md +4326 -0
- package/documentation/platform/ANALYTICS.md +1150 -0
- package/documentation/platform/AUDITTRAIL.md +572 -0
- package/documentation/platform/BILLING.md +2396 -0
- package/documentation/platform/CART.md +5539 -0
- package/documentation/platform/CATALOG.md +21624 -0
- package/documentation/platform/COMMON.md +448 -0
- package/documentation/platform/COMMUNICATION.md +5714 -0
- package/documentation/platform/COMPANYPROFILE.md +2141 -0
- package/documentation/platform/CONFIGURATION.md +7335 -0
- package/documentation/platform/CONTENT.md +8989 -0
- package/documentation/platform/DISCOUNT.md +773 -0
- package/documentation/platform/FILESTORAGE.md +994 -0
- package/documentation/platform/INVENTORY.md +1775 -0
- package/documentation/platform/LEAD.md +4736 -0
- package/documentation/platform/ORDER.md +3764 -0
- package/documentation/platform/PARTNER.md +216 -0
- package/documentation/platform/PAYMENT.md +3444 -0
- package/documentation/platform/README.md +27 -0
- package/documentation/platform/REWARDS.md +871 -0
- package/documentation/platform/SHARE.md +602 -0
- package/documentation/platform/THEME.md +35725 -0
- package/documentation/platform/USER.md +2305 -0
- package/documentation/platform/WEBHOOK.md +587 -0
- package/documentation/public/CONFIGURATION.md +448 -0
- package/documentation/public/INVENTORY.md +686 -0
- package/documentation/public/WEBHOOK.md +348 -0
- package/index.d.ts +10 -0
- package/index.js +18 -0
- package/jest.config.d.ts +4 -0
- package/jest.config.js +6 -0
- package/package.json +35 -0
- package/platform.d.ts +3 -0
- package/platform.js +6 -0
- package/public.d.ts +3 -0
- package/public.js +6 -0
- package/sdk/application/ApplicationAPIClient.d.ts +11 -0
- package/sdk/application/ApplicationAPIClient.js +44 -0
- package/sdk/application/ApplicationClient.d.ts +40 -0
- package/sdk/application/ApplicationClient.js +84 -0
- package/sdk/application/ApplicationConfig.d.ts +19 -0
- package/sdk/application/ApplicationConfig.js +55 -0
- package/sdk/application/ApplicationModels.d.ts +826 -0
- package/sdk/application/ApplicationModels.js +10474 -0
- package/sdk/application/client/CartApplicationClient.d.ts +432 -0
- package/sdk/application/client/CartApplicationClient.js +1066 -0
- package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
- package/sdk/application/client/CatalogApplicationClient.js +1629 -0
- package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
- package/sdk/application/client/CommonApplicationClient.js +105 -0
- package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
- package/sdk/application/client/CommunicationApplicationClient.js +131 -0
- package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
- package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
- package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
- package/sdk/application/client/ContentApplicationClient.js +785 -0
- package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
- package/sdk/application/client/FileStorageApplicationClient.js +214 -0
- package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
- package/sdk/application/client/LeadApplicationClient.js +264 -0
- package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
- package/sdk/application/client/LogisticApplicationClient.js +128 -0
- package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
- package/sdk/application/client/OrderApplicationClient.js +479 -0
- package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
- package/sdk/application/client/PaymentApplicationClient.js +1378 -0
- package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
- package/sdk/application/client/PosCartApplicationClient.js +1123 -0
- package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
- package/sdk/application/client/RewardsApplicationClient.js +293 -0
- package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
- package/sdk/application/client/ShareApplicationClient.js +268 -0
- package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
- package/sdk/application/client/ThemeApplicationClient.js +161 -0
- package/sdk/application/client/UserApplicationClient.d.ts +446 -0
- package/sdk/application/client/UserApplicationClient.js +1275 -0
- package/sdk/application/constructUrl.d.ts +5 -0
- package/sdk/application/constructUrl.js +13 -0
- package/sdk/application/index.d.ts +2 -0
- package/sdk/application/index.js +4 -0
- package/sdk/application/models/CartValidator.d.ts +29 -0
- package/sdk/application/models/CartValidator.js +223 -0
- package/sdk/application/models/CatalogValidator.d.ts +33 -0
- package/sdk/application/models/CatalogValidator.js +233 -0
- package/sdk/application/models/CommonValidator.d.ts +5 -0
- package/sdk/application/models/CommonValidator.js +18 -0
- package/sdk/application/models/CommunicationValidator.d.ts +6 -0
- package/sdk/application/models/CommunicationValidator.js +20 -0
- package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
- package/sdk/application/models/ConfigurationValidator.js +88 -0
- package/sdk/application/models/ContentValidator.d.ts +22 -0
- package/sdk/application/models/ContentValidator.js +106 -0
- package/sdk/application/models/FileStorageValidator.d.ts +6 -0
- package/sdk/application/models/FileStorageValidator.js +24 -0
- package/sdk/application/models/LeadValidator.d.ts +10 -0
- package/sdk/application/models/LeadValidator.js +48 -0
- package/sdk/application/models/LogisticValidator.d.ts +6 -0
- package/sdk/application/models/LogisticValidator.js +22 -0
- package/sdk/application/models/OrderValidator.d.ts +15 -0
- package/sdk/application/models/OrderValidator.js +87 -0
- package/sdk/application/models/PaymentValidator.d.ts +40 -0
- package/sdk/application/models/PaymentValidator.js +235 -0
- package/sdk/application/models/PosCartValidator.d.ts +30 -0
- package/sdk/application/models/PosCartValidator.js +232 -0
- package/sdk/application/models/RewardsValidator.d.ts +10 -0
- package/sdk/application/models/RewardsValidator.js +43 -0
- package/sdk/application/models/ShareValidator.d.ts +10 -0
- package/sdk/application/models/ShareValidator.js +44 -0
- package/sdk/application/models/ThemeValidator.d.ts +7 -0
- package/sdk/application/models/ThemeValidator.js +27 -0
- package/sdk/application/models/UserValidator.d.ts +38 -0
- package/sdk/application/models/UserValidator.js +233 -0
- package/sdk/common/AxiosHelper.d.ts +1 -0
- package/sdk/common/AxiosHelper.js +141 -0
- package/sdk/common/Constant.d.ts +294 -0
- package/sdk/common/Constant.js +332 -0
- package/sdk/common/FDKError.d.ts +26 -0
- package/sdk/common/FDKError.js +51 -0
- package/sdk/common/Logger.d.ts +2 -0
- package/sdk/common/Logger.js +85 -0
- package/sdk/common/Paginator.d.ts +16 -0
- package/sdk/common/Paginator.js +26 -0
- package/sdk/common/RequestSigner.d.ts +1 -0
- package/sdk/common/RequestSigner.js +306 -0
- package/sdk/common/Utility.d.ts +9 -0
- package/sdk/common/Utility.js +86 -0
- package/sdk/common/utils.d.ts +14 -0
- package/sdk/common/utils.js +165 -0
- package/sdk/platform/OAuthClient.d.ts +26 -0
- package/sdk/platform/OAuthClient.js +221 -0
- package/sdk/platform/PlatformAPIClient.d.ts +12 -0
- package/sdk/platform/PlatformAPIClient.js +43 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
- package/sdk/platform/PlatformApplicationClient.js +23185 -0
- package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
- package/sdk/platform/PlatformApplicationModels.js +21262 -0
- package/sdk/platform/PlatformClient.d.ts +9535 -0
- package/sdk/platform/PlatformClient.js +12336 -0
- package/sdk/platform/PlatformConfig.d.ts +29 -0
- package/sdk/platform/PlatformConfig.js +36 -0
- package/sdk/platform/PlatformModels.d.ts +1396 -0
- package/sdk/platform/PlatformModels.js +19222 -0
- package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
- package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
- package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
- package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
- package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
- package/sdk/platform/client/BillingPlatformClient.js +381 -0
- package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
- package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
- package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
- package/sdk/platform/client/CommonPlatformClient.js +84 -0
- package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
- package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
- package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
- package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
- package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
- package/sdk/platform/client/DiscountPlatformClient.js +364 -0
- package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
- package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
- package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
- package/sdk/platform/client/InventoryPlatformClient.js +409 -0
- package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
- package/sdk/platform/client/LeadPlatformClient.js +439 -0
- package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
- package/sdk/platform/client/OrderPlatformClient.js +521 -0
- package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
- package/sdk/platform/client/PaymentPlatformClient.js +331 -0
- package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
- package/sdk/platform/client/WebhookPlatformClient.js +207 -0
- package/sdk/platform/index.d.ts +2 -0
- package/sdk/platform/index.js +4 -0
- package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
- package/sdk/platform/models/AnalyticsValidator.js +36 -0
- package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
- package/sdk/platform/models/AuditTrailValidator.js +26 -0
- package/sdk/platform/models/BillingValidator.d.ts +15 -0
- package/sdk/platform/models/BillingValidator.js +72 -0
- package/sdk/platform/models/CartValidator.d.ts +0 -0
- package/sdk/platform/models/CartValidator.js +0 -0
- package/sdk/platform/models/CatalogValidator.d.ts +74 -0
- package/sdk/platform/models/CatalogValidator.js +484 -0
- package/sdk/platform/models/CommonValidator.d.ts +5 -0
- package/sdk/platform/models/CommonValidator.js +18 -0
- package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
- package/sdk/platform/models/CommunicationValidator.js +11 -0
- package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
- package/sdk/platform/models/CompanyProfileValidator.js +93 -0
- package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
- package/sdk/platform/models/ConfigurationValidator.js +134 -0
- package/sdk/platform/models/ContentValidator.d.ts +0 -0
- package/sdk/platform/models/ContentValidator.js +0 -0
- package/sdk/platform/models/DiscountValidator.d.ts +13 -0
- package/sdk/platform/models/DiscountValidator.js +75 -0
- package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
- package/sdk/platform/models/FileStorageValidator.js +44 -0
- package/sdk/platform/models/InventoryValidator.d.ts +15 -0
- package/sdk/platform/models/InventoryValidator.js +81 -0
- package/sdk/platform/models/LeadValidator.d.ts +14 -0
- package/sdk/platform/models/LeadValidator.js +78 -0
- package/sdk/platform/models/OrderValidator.d.ts +14 -0
- package/sdk/platform/models/OrderValidator.js +110 -0
- package/sdk/platform/models/PartnerValidator.d.ts +0 -0
- package/sdk/platform/models/PartnerValidator.js +0 -0
- package/sdk/platform/models/PaymentValidator.d.ts +13 -0
- package/sdk/platform/models/PaymentValidator.js +65 -0
- package/sdk/platform/models/RewardsValidator.d.ts +0 -0
- package/sdk/platform/models/RewardsValidator.js +0 -0
- package/sdk/platform/models/ShareValidator.d.ts +0 -0
- package/sdk/platform/models/ShareValidator.js +0 -0
- package/sdk/platform/models/ThemeValidator.d.ts +0 -0
- package/sdk/platform/models/ThemeValidator.js +0 -0
- package/sdk/platform/models/UserValidator.d.ts +0 -0
- package/sdk/platform/models/UserValidator.js +0 -0
- package/sdk/platform/models/WebhookValidator.d.ts +9 -0
- package/sdk/platform/models/WebhookValidator.js +42 -0
- package/sdk/public/PublicAPIClient.d.ts +11 -0
- package/sdk/public/PublicAPIClient.js +38 -0
- package/sdk/public/PublicClient.d.ts +12 -0
- package/sdk/public/PublicClient.js +24 -0
- package/sdk/public/PublicConfig.d.ts +10 -0
- package/sdk/public/PublicConfig.js +12 -0
- package/sdk/public/PublicModels.d.ts +50 -0
- package/sdk/public/PublicModels.js +712 -0
- package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
- package/sdk/public/client/ConfigurationPublicClient.js +102 -0
- package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
- package/sdk/public/client/InventoryPublicClient.js +239 -0
- package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
- package/sdk/public/client/WebhookPublicClient.js +92 -0
- package/sdk/public/constructUrl.d.ts +5 -0
- package/sdk/public/constructUrl.js +13 -0
- package/sdk/public/index.d.ts +2 -0
- package/sdk/public/index.js +4 -0
- package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
- package/sdk/public/models/ConfigurationValidator.js +18 -0
- package/sdk/public/models/InventoryValidator.d.ts +9 -0
- package/sdk/public/models/InventoryValidator.js +43 -0
- package/sdk/public/models/WebhookValidator.d.ts +5 -0
- package/sdk/public/models/WebhookValidator.js +14 -0
- package/tests/application/catalog.spec.js +47 -0
- package/tests/common/action-url.spec.js +35 -0
- package/tests/common/schema/action-url.json +163 -0
- package/tests/common/schema/url-action.json +667 -0
- package/tests/common/url-action.spec.js +48 -0
- package/tests/helpers/cookie.helper.js +31 -0
- package/tests/helpers/oauth.helper.js +43 -0
- package/tests/platform/catalog.spec.js +49 -0
- package/tests/public/location.spec.js +39 -0
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const UserValidator = require("../models/UserValidator");
|
|
6
|
+
|
|
7
|
+
class User {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
loginWithFacebook:
|
|
12
|
+
"/service/application/user/authentication/v1.0/login/facebook-token",
|
|
13
|
+
loginWithGoogle:
|
|
14
|
+
"/service/application/user/authentication/v1.0/login/google-token",
|
|
15
|
+
loginWithGoogleAndroid:
|
|
16
|
+
"/service/application/user/authentication/v1.0/login/google-android",
|
|
17
|
+
loginWithGoogleIOS:
|
|
18
|
+
"/service/application/user/authentication/v1.0/login/google-ios",
|
|
19
|
+
loginWithAppleIOS:
|
|
20
|
+
"/service/application/user/authentication/v1.0/login/apple-ios",
|
|
21
|
+
loginWithOTP: "/service/application/user/authentication/v1.0/login/otp",
|
|
22
|
+
loginWithEmailAndPassword:
|
|
23
|
+
"/service/application/user/authentication/v1.0/login/password",
|
|
24
|
+
sendResetPasswordEmail:
|
|
25
|
+
"/service/application/user/authentication/v1.0/login/password/reset",
|
|
26
|
+
sendResetPasswordMobile:
|
|
27
|
+
"/service/application/user/authentication/v1.0/login/password/mobile/reset",
|
|
28
|
+
forgotPassword:
|
|
29
|
+
"/service/application/user/authentication/v1.0/login/password/reset/forgot",
|
|
30
|
+
sendResetToken:
|
|
31
|
+
"/service/application/user/authentication/v1.0/login/password/reset/token",
|
|
32
|
+
loginWithToken:
|
|
33
|
+
"/service/application/user/authentication/v1.0/login/token",
|
|
34
|
+
registerWithForm:
|
|
35
|
+
"/service/application/user/authentication/v1.0/register/form",
|
|
36
|
+
verifyEmail: "/service/application/user/authentication/v1.0/verify/email",
|
|
37
|
+
verifyMobile:
|
|
38
|
+
"/service/application/user/authentication/v1.0/verify/mobile",
|
|
39
|
+
hasPassword: "/service/application/user/authentication/v1.0/has-password",
|
|
40
|
+
updatePassword: "/service/application/user/authentication/v1.0/password",
|
|
41
|
+
deleteUser: "/service/application/user/authentication/v1.0/delete",
|
|
42
|
+
logout: "/service/application/user/authentication/v1.0/logout",
|
|
43
|
+
sendOTPOnMobile:
|
|
44
|
+
"/service/application/user/authentication/v1.0/otp/mobile/send",
|
|
45
|
+
verifyMobileOTP:
|
|
46
|
+
"/service/application/user/authentication/v1.0/otp/mobile/verify",
|
|
47
|
+
sendOTPOnEmail:
|
|
48
|
+
"/service/application/user/authentication/v1.0/otp/email/send",
|
|
49
|
+
verifyEmailOTP:
|
|
50
|
+
"/service/application/user/authentication/v1.0/otp/email/verify",
|
|
51
|
+
getLoggedInUser: "/service/application/user/authentication/v1.0/session",
|
|
52
|
+
getListOfActiveSessions:
|
|
53
|
+
"/service/application/user/authentication/v1.0/sessions",
|
|
54
|
+
getPlatformConfig: "/service/application/user/platform/v1.0/config",
|
|
55
|
+
updateProfile: "/service/application/user/profile/v1.0/detail",
|
|
56
|
+
addMobileNumber: "/service/application/user/profile/v1.0/mobile",
|
|
57
|
+
deleteMobileNumber: "/service/application/user/profile/v1.0/mobile",
|
|
58
|
+
setMobileNumberAsPrimary:
|
|
59
|
+
"/service/application/user/profile/v1.0/mobile/primary",
|
|
60
|
+
sendVerificationLinkToMobile:
|
|
61
|
+
"/service/application/user/profile/v1.0/mobile/link/send",
|
|
62
|
+
addEmail: "/service/application/user/profile/v1.0/email",
|
|
63
|
+
deleteEmail: "/service/application/user/profile/v1.0/email",
|
|
64
|
+
setEmailAsPrimary: "/service/application/user/profile/v1.0/email/primary",
|
|
65
|
+
sendVerificationLinkToEmail:
|
|
66
|
+
"/service/application/user/profile/v1.0/email/link/send",
|
|
67
|
+
};
|
|
68
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
69
|
+
(urls, [method, relativeUrl]) => {
|
|
70
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
71
|
+
return urls;
|
|
72
|
+
},
|
|
73
|
+
{}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
updateUrls(urls) {
|
|
78
|
+
this._urls = {
|
|
79
|
+
...this._urls,
|
|
80
|
+
...urls,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @param {Object} arg - Arg object.
|
|
86
|
+
* @param {string} [arg.platform] - ID of the application
|
|
87
|
+
* @param {OAuthRequestSchema} arg.body
|
|
88
|
+
* @returns {Promise<AuthSuccess>} - Success response
|
|
89
|
+
* @summary: Login or Register using Facebook
|
|
90
|
+
* @description: Use this API to login or register using Facebook credentials.
|
|
91
|
+
*/
|
|
92
|
+
loginWithFacebook({ body, platform } = {}) {
|
|
93
|
+
const { error } = UserValidator.loginWithFacebook().validate(
|
|
94
|
+
{ body, platform },
|
|
95
|
+
{ abortEarly: false, allowUnknown: true }
|
|
96
|
+
);
|
|
97
|
+
if (error) {
|
|
98
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
99
|
+
}
|
|
100
|
+
const query_params = {};
|
|
101
|
+
query_params["platform"] = platform;
|
|
102
|
+
|
|
103
|
+
const xHeaders = {};
|
|
104
|
+
|
|
105
|
+
return APIClient.execute(
|
|
106
|
+
this._conf,
|
|
107
|
+
"post",
|
|
108
|
+
constructUrl({
|
|
109
|
+
url: this._urls["loginWithFacebook"],
|
|
110
|
+
params: {},
|
|
111
|
+
}),
|
|
112
|
+
query_params,
|
|
113
|
+
body,
|
|
114
|
+
xHeaders
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @param {Object} arg - Arg object.
|
|
120
|
+
* @param {string} [arg.platform] - ID of the application
|
|
121
|
+
* @param {OAuthRequestSchema} arg.body
|
|
122
|
+
* @returns {Promise<AuthSuccess>} - Success response
|
|
123
|
+
* @summary: Login or Register using Google
|
|
124
|
+
* @description: Use this API to login or register using Google Account credentials.
|
|
125
|
+
*/
|
|
126
|
+
loginWithGoogle({ body, platform } = {}) {
|
|
127
|
+
const { error } = UserValidator.loginWithGoogle().validate(
|
|
128
|
+
{ body, platform },
|
|
129
|
+
{ abortEarly: false, allowUnknown: true }
|
|
130
|
+
);
|
|
131
|
+
if (error) {
|
|
132
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
133
|
+
}
|
|
134
|
+
const query_params = {};
|
|
135
|
+
query_params["platform"] = platform;
|
|
136
|
+
|
|
137
|
+
const xHeaders = {};
|
|
138
|
+
|
|
139
|
+
return APIClient.execute(
|
|
140
|
+
this._conf,
|
|
141
|
+
"post",
|
|
142
|
+
constructUrl({
|
|
143
|
+
url: this._urls["loginWithGoogle"],
|
|
144
|
+
params: {},
|
|
145
|
+
}),
|
|
146
|
+
query_params,
|
|
147
|
+
body,
|
|
148
|
+
xHeaders
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @param {Object} arg - Arg object.
|
|
154
|
+
* @param {string} [arg.platform] - ID of the application
|
|
155
|
+
* @param {OAuthRequestSchema} arg.body
|
|
156
|
+
* @returns {Promise<AuthSuccess>} - Success response
|
|
157
|
+
* @summary: Login or Register using Google on Android
|
|
158
|
+
* @description: Use this API to login or register in Android app using Google Account credentials.
|
|
159
|
+
*/
|
|
160
|
+
loginWithGoogleAndroid({ body, platform } = {}) {
|
|
161
|
+
const { error } = UserValidator.loginWithGoogleAndroid().validate(
|
|
162
|
+
{ body, platform },
|
|
163
|
+
{ abortEarly: false, allowUnknown: true }
|
|
164
|
+
);
|
|
165
|
+
if (error) {
|
|
166
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
167
|
+
}
|
|
168
|
+
const query_params = {};
|
|
169
|
+
query_params["platform"] = platform;
|
|
170
|
+
|
|
171
|
+
const xHeaders = {};
|
|
172
|
+
|
|
173
|
+
return APIClient.execute(
|
|
174
|
+
this._conf,
|
|
175
|
+
"post",
|
|
176
|
+
constructUrl({
|
|
177
|
+
url: this._urls["loginWithGoogleAndroid"],
|
|
178
|
+
params: {},
|
|
179
|
+
}),
|
|
180
|
+
query_params,
|
|
181
|
+
body,
|
|
182
|
+
xHeaders
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @param {Object} arg - Arg object.
|
|
188
|
+
* @param {string} [arg.platform] - ID of the application
|
|
189
|
+
* @param {OAuthRequestSchema} arg.body
|
|
190
|
+
* @returns {Promise<AuthSuccess>} - Success response
|
|
191
|
+
* @summary: Login or Register using Google on iOS
|
|
192
|
+
* @description: Use this API to login or register in iOS app using Google Account credentials.
|
|
193
|
+
*/
|
|
194
|
+
loginWithGoogleIOS({ body, platform } = {}) {
|
|
195
|
+
const { error } = UserValidator.loginWithGoogleIOS().validate(
|
|
196
|
+
{ body, platform },
|
|
197
|
+
{ abortEarly: false, allowUnknown: true }
|
|
198
|
+
);
|
|
199
|
+
if (error) {
|
|
200
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
201
|
+
}
|
|
202
|
+
const query_params = {};
|
|
203
|
+
query_params["platform"] = platform;
|
|
204
|
+
|
|
205
|
+
const xHeaders = {};
|
|
206
|
+
|
|
207
|
+
return APIClient.execute(
|
|
208
|
+
this._conf,
|
|
209
|
+
"post",
|
|
210
|
+
constructUrl({
|
|
211
|
+
url: this._urls["loginWithGoogleIOS"],
|
|
212
|
+
params: {},
|
|
213
|
+
}),
|
|
214
|
+
query_params,
|
|
215
|
+
body,
|
|
216
|
+
xHeaders
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @param {Object} arg - Arg object.
|
|
222
|
+
* @param {string} [arg.platform] - ID of the application
|
|
223
|
+
* @param {OAuthRequestAppleSchema} arg.body
|
|
224
|
+
* @returns {Promise<AuthSuccess>} - Success response
|
|
225
|
+
* @summary: Login or Register using Apple on iOS
|
|
226
|
+
* @description: Use this API to login or register in iOS app using Apple Account credentials.
|
|
227
|
+
*/
|
|
228
|
+
loginWithAppleIOS({ body, platform } = {}) {
|
|
229
|
+
const { error } = UserValidator.loginWithAppleIOS().validate(
|
|
230
|
+
{ body, platform },
|
|
231
|
+
{ abortEarly: false, allowUnknown: true }
|
|
232
|
+
);
|
|
233
|
+
if (error) {
|
|
234
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
235
|
+
}
|
|
236
|
+
const query_params = {};
|
|
237
|
+
query_params["platform"] = platform;
|
|
238
|
+
|
|
239
|
+
const xHeaders = {};
|
|
240
|
+
|
|
241
|
+
return APIClient.execute(
|
|
242
|
+
this._conf,
|
|
243
|
+
"post",
|
|
244
|
+
constructUrl({
|
|
245
|
+
url: this._urls["loginWithAppleIOS"],
|
|
246
|
+
params: {},
|
|
247
|
+
}),
|
|
248
|
+
query_params,
|
|
249
|
+
body,
|
|
250
|
+
xHeaders
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @param {Object} arg - Arg object.
|
|
256
|
+
* @param {string} [arg.platform] - ID of the application
|
|
257
|
+
* @param {SendOtpRequestSchema} arg.body
|
|
258
|
+
* @returns {Promise<SendOtpResponse>} - Success response
|
|
259
|
+
* @summary: Login or Register with OTP
|
|
260
|
+
* @description: Use this API to login or register with a One-time Password (OTP) sent via Email or SMS.
|
|
261
|
+
*/
|
|
262
|
+
loginWithOTP({ body, platform } = {}) {
|
|
263
|
+
const { error } = UserValidator.loginWithOTP().validate(
|
|
264
|
+
{ body, platform },
|
|
265
|
+
{ abortEarly: false, allowUnknown: true }
|
|
266
|
+
);
|
|
267
|
+
if (error) {
|
|
268
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
269
|
+
}
|
|
270
|
+
const query_params = {};
|
|
271
|
+
query_params["platform"] = platform;
|
|
272
|
+
|
|
273
|
+
const xHeaders = {};
|
|
274
|
+
|
|
275
|
+
return APIClient.execute(
|
|
276
|
+
this._conf,
|
|
277
|
+
"post",
|
|
278
|
+
constructUrl({
|
|
279
|
+
url: this._urls["loginWithOTP"],
|
|
280
|
+
params: {},
|
|
281
|
+
}),
|
|
282
|
+
query_params,
|
|
283
|
+
body,
|
|
284
|
+
xHeaders
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @param {Object} arg - Arg object.
|
|
290
|
+
* @param {PasswordLoginRequestSchema} arg.body
|
|
291
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
292
|
+
* @summary: Login or Register with password
|
|
293
|
+
* @description: Use this API to login or register using an email address and password.
|
|
294
|
+
*/
|
|
295
|
+
loginWithEmailAndPassword({ body } = {}) {
|
|
296
|
+
const { error } = UserValidator.loginWithEmailAndPassword().validate(
|
|
297
|
+
{ body },
|
|
298
|
+
{ abortEarly: false, allowUnknown: true }
|
|
299
|
+
);
|
|
300
|
+
if (error) {
|
|
301
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
302
|
+
}
|
|
303
|
+
const query_params = {};
|
|
304
|
+
|
|
305
|
+
const xHeaders = {};
|
|
306
|
+
|
|
307
|
+
return APIClient.execute(
|
|
308
|
+
this._conf,
|
|
309
|
+
"post",
|
|
310
|
+
constructUrl({
|
|
311
|
+
url: this._urls["loginWithEmailAndPassword"],
|
|
312
|
+
params: {},
|
|
313
|
+
}),
|
|
314
|
+
query_params,
|
|
315
|
+
body,
|
|
316
|
+
xHeaders
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* @param {Object} arg - Arg object.
|
|
322
|
+
* @param {string} [arg.platform] - ID of the application
|
|
323
|
+
* @param {SendResetPasswordEmailRequestSchema} arg.body
|
|
324
|
+
* @returns {Promise<ResetPasswordSuccess>} - Success response
|
|
325
|
+
* @summary: Reset Password
|
|
326
|
+
* @description: Use this API to reset a password using the link sent on email.
|
|
327
|
+
*/
|
|
328
|
+
sendResetPasswordEmail({ body, platform } = {}) {
|
|
329
|
+
const { error } = UserValidator.sendResetPasswordEmail().validate(
|
|
330
|
+
{ body, platform },
|
|
331
|
+
{ abortEarly: false, allowUnknown: true }
|
|
332
|
+
);
|
|
333
|
+
if (error) {
|
|
334
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
335
|
+
}
|
|
336
|
+
const query_params = {};
|
|
337
|
+
query_params["platform"] = platform;
|
|
338
|
+
|
|
339
|
+
const xHeaders = {};
|
|
340
|
+
|
|
341
|
+
return APIClient.execute(
|
|
342
|
+
this._conf,
|
|
343
|
+
"post",
|
|
344
|
+
constructUrl({
|
|
345
|
+
url: this._urls["sendResetPasswordEmail"],
|
|
346
|
+
params: {},
|
|
347
|
+
}),
|
|
348
|
+
query_params,
|
|
349
|
+
body,
|
|
350
|
+
xHeaders
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @param {Object} arg - Arg object.
|
|
356
|
+
* @param {string} [arg.platform] - ID of the application
|
|
357
|
+
* @param {SendResetPasswordMobileRequestSchema} arg.body
|
|
358
|
+
* @returns {Promise<ResetPasswordSuccess>} - Success response
|
|
359
|
+
* @summary: Reset Password
|
|
360
|
+
* @description: Use this API to reset a password using the link sent on mobile.
|
|
361
|
+
*/
|
|
362
|
+
sendResetPasswordMobile({ body, platform } = {}) {
|
|
363
|
+
const { error } = UserValidator.sendResetPasswordMobile().validate(
|
|
364
|
+
{ body, platform },
|
|
365
|
+
{ abortEarly: false, allowUnknown: true }
|
|
366
|
+
);
|
|
367
|
+
if (error) {
|
|
368
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
369
|
+
}
|
|
370
|
+
const query_params = {};
|
|
371
|
+
query_params["platform"] = platform;
|
|
372
|
+
|
|
373
|
+
const xHeaders = {};
|
|
374
|
+
|
|
375
|
+
return APIClient.execute(
|
|
376
|
+
this._conf,
|
|
377
|
+
"post",
|
|
378
|
+
constructUrl({
|
|
379
|
+
url: this._urls["sendResetPasswordMobile"],
|
|
380
|
+
params: {},
|
|
381
|
+
}),
|
|
382
|
+
query_params,
|
|
383
|
+
body,
|
|
384
|
+
xHeaders
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @param {Object} arg - Arg object.
|
|
390
|
+
* @param {ForgotPasswordRequestSchema} arg.body
|
|
391
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
392
|
+
* @summary: Forgot Password
|
|
393
|
+
* @description: Use this API to reset a password using the code sent on email or SMS.
|
|
394
|
+
*/
|
|
395
|
+
forgotPassword({ body } = {}) {
|
|
396
|
+
const { error } = UserValidator.forgotPassword().validate(
|
|
397
|
+
{ body },
|
|
398
|
+
{ abortEarly: false, allowUnknown: true }
|
|
399
|
+
);
|
|
400
|
+
if (error) {
|
|
401
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
402
|
+
}
|
|
403
|
+
const query_params = {};
|
|
404
|
+
|
|
405
|
+
const xHeaders = {};
|
|
406
|
+
|
|
407
|
+
return APIClient.execute(
|
|
408
|
+
this._conf,
|
|
409
|
+
"post",
|
|
410
|
+
constructUrl({
|
|
411
|
+
url: this._urls["forgotPassword"],
|
|
412
|
+
params: {},
|
|
413
|
+
}),
|
|
414
|
+
query_params,
|
|
415
|
+
body,
|
|
416
|
+
xHeaders
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* @param {Object} arg - Arg object.
|
|
422
|
+
* @param {CodeRequestBodySchema} arg.body
|
|
423
|
+
* @returns {Promise<ResetPasswordSuccess>} - Success response
|
|
424
|
+
* @summary: Reset Password using token
|
|
425
|
+
* @description: Use this API to send code to reset password.
|
|
426
|
+
*/
|
|
427
|
+
sendResetToken({ body } = {}) {
|
|
428
|
+
const { error } = UserValidator.sendResetToken().validate(
|
|
429
|
+
{ body },
|
|
430
|
+
{ abortEarly: false, allowUnknown: true }
|
|
431
|
+
);
|
|
432
|
+
if (error) {
|
|
433
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
434
|
+
}
|
|
435
|
+
const query_params = {};
|
|
436
|
+
|
|
437
|
+
const xHeaders = {};
|
|
438
|
+
|
|
439
|
+
return APIClient.execute(
|
|
440
|
+
this._conf,
|
|
441
|
+
"post",
|
|
442
|
+
constructUrl({
|
|
443
|
+
url: this._urls["sendResetToken"],
|
|
444
|
+
params: {},
|
|
445
|
+
}),
|
|
446
|
+
query_params,
|
|
447
|
+
body,
|
|
448
|
+
xHeaders
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @param {Object} arg - Arg object.
|
|
454
|
+
* @param {TokenRequestBodySchema} arg.body
|
|
455
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
456
|
+
* @summary: Login or Register with token
|
|
457
|
+
* @description: Use this API to login or register using a token for authentication.
|
|
458
|
+
*/
|
|
459
|
+
loginWithToken({ body } = {}) {
|
|
460
|
+
const { error } = UserValidator.loginWithToken().validate(
|
|
461
|
+
{ body },
|
|
462
|
+
{ abortEarly: false, allowUnknown: true }
|
|
463
|
+
);
|
|
464
|
+
if (error) {
|
|
465
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
466
|
+
}
|
|
467
|
+
const query_params = {};
|
|
468
|
+
|
|
469
|
+
const xHeaders = {};
|
|
470
|
+
|
|
471
|
+
return APIClient.execute(
|
|
472
|
+
this._conf,
|
|
473
|
+
"post",
|
|
474
|
+
constructUrl({
|
|
475
|
+
url: this._urls["loginWithToken"],
|
|
476
|
+
params: {},
|
|
477
|
+
}),
|
|
478
|
+
query_params,
|
|
479
|
+
body,
|
|
480
|
+
xHeaders
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* @param {Object} arg - Arg object.
|
|
486
|
+
* @param {string} [arg.platform] - ID of the application
|
|
487
|
+
* @param {FormRegisterRequestSchema} arg.body
|
|
488
|
+
* @returns {Promise<RegisterFormSuccess>} - Success response
|
|
489
|
+
* @summary: Registration using a form
|
|
490
|
+
* @description: Use this API to perform user registration by sending form data in the request body.
|
|
491
|
+
*/
|
|
492
|
+
registerWithForm({ body, platform } = {}) {
|
|
493
|
+
const { error } = UserValidator.registerWithForm().validate(
|
|
494
|
+
{ body, platform },
|
|
495
|
+
{ abortEarly: false, allowUnknown: true }
|
|
496
|
+
);
|
|
497
|
+
if (error) {
|
|
498
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
499
|
+
}
|
|
500
|
+
const query_params = {};
|
|
501
|
+
query_params["platform"] = platform;
|
|
502
|
+
|
|
503
|
+
const xHeaders = {};
|
|
504
|
+
|
|
505
|
+
return APIClient.execute(
|
|
506
|
+
this._conf,
|
|
507
|
+
"post",
|
|
508
|
+
constructUrl({
|
|
509
|
+
url: this._urls["registerWithForm"],
|
|
510
|
+
params: {},
|
|
511
|
+
}),
|
|
512
|
+
query_params,
|
|
513
|
+
body,
|
|
514
|
+
xHeaders
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* @param {Object} arg - Arg object.
|
|
520
|
+
* @param {CodeRequestBodySchema} arg.body
|
|
521
|
+
* @returns {Promise<VerifyEmailSuccess>} - Success response
|
|
522
|
+
* @summary: Verify email
|
|
523
|
+
* @description: Use this API to send a verification code to verify an email.
|
|
524
|
+
*/
|
|
525
|
+
verifyEmail({ body } = {}) {
|
|
526
|
+
const { error } = UserValidator.verifyEmail().validate(
|
|
527
|
+
{ body },
|
|
528
|
+
{ abortEarly: false, allowUnknown: true }
|
|
529
|
+
);
|
|
530
|
+
if (error) {
|
|
531
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
532
|
+
}
|
|
533
|
+
const query_params = {};
|
|
534
|
+
|
|
535
|
+
const xHeaders = {};
|
|
536
|
+
|
|
537
|
+
return APIClient.execute(
|
|
538
|
+
this._conf,
|
|
539
|
+
"post",
|
|
540
|
+
constructUrl({
|
|
541
|
+
url: this._urls["verifyEmail"],
|
|
542
|
+
params: {},
|
|
543
|
+
}),
|
|
544
|
+
query_params,
|
|
545
|
+
body,
|
|
546
|
+
xHeaders
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* @param {Object} arg - Arg object.
|
|
552
|
+
* @param {CodeRequestBodySchema} arg.body
|
|
553
|
+
* @returns {Promise<VerifyEmailSuccess>} - Success response
|
|
554
|
+
* @summary: Verify mobile
|
|
555
|
+
* @description: Use this API to send a verification code to verify a mobile number.
|
|
556
|
+
*/
|
|
557
|
+
verifyMobile({ body } = {}) {
|
|
558
|
+
const { error } = UserValidator.verifyMobile().validate(
|
|
559
|
+
{ body },
|
|
560
|
+
{ abortEarly: false, allowUnknown: true }
|
|
561
|
+
);
|
|
562
|
+
if (error) {
|
|
563
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
564
|
+
}
|
|
565
|
+
const query_params = {};
|
|
566
|
+
|
|
567
|
+
const xHeaders = {};
|
|
568
|
+
|
|
569
|
+
return APIClient.execute(
|
|
570
|
+
this._conf,
|
|
571
|
+
"post",
|
|
572
|
+
constructUrl({
|
|
573
|
+
url: this._urls["verifyMobile"],
|
|
574
|
+
params: {},
|
|
575
|
+
}),
|
|
576
|
+
query_params,
|
|
577
|
+
body,
|
|
578
|
+
xHeaders
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* @param {Object} arg - Arg object.
|
|
584
|
+
* @returns {Promise<HasPasswordSuccess>} - Success response
|
|
585
|
+
* @summary: Check password
|
|
586
|
+
* @description: Use this API to check if user has created a password for login.
|
|
587
|
+
*/
|
|
588
|
+
hasPassword({} = {}) {
|
|
589
|
+
const { error } = UserValidator.hasPassword().validate(
|
|
590
|
+
{},
|
|
591
|
+
{ abortEarly: false, allowUnknown: true }
|
|
592
|
+
);
|
|
593
|
+
if (error) {
|
|
594
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
595
|
+
}
|
|
596
|
+
const query_params = {};
|
|
597
|
+
|
|
598
|
+
const xHeaders = {};
|
|
599
|
+
|
|
600
|
+
return APIClient.execute(
|
|
601
|
+
this._conf,
|
|
602
|
+
"get",
|
|
603
|
+
constructUrl({
|
|
604
|
+
url: this._urls["hasPassword"],
|
|
605
|
+
params: {},
|
|
606
|
+
}),
|
|
607
|
+
query_params,
|
|
608
|
+
undefined,
|
|
609
|
+
xHeaders
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* @param {Object} arg - Arg object.
|
|
615
|
+
* @param {UpdatePasswordRequestSchema} arg.body
|
|
616
|
+
* @returns {Promise<VerifyEmailSuccess>} - Success response
|
|
617
|
+
* @summary: Update user password
|
|
618
|
+
* @description: Use this API to update the password.
|
|
619
|
+
*/
|
|
620
|
+
updatePassword({ body } = {}) {
|
|
621
|
+
const { error } = UserValidator.updatePassword().validate(
|
|
622
|
+
{ body },
|
|
623
|
+
{ abortEarly: false, allowUnknown: true }
|
|
624
|
+
);
|
|
625
|
+
if (error) {
|
|
626
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
627
|
+
}
|
|
628
|
+
const query_params = {};
|
|
629
|
+
|
|
630
|
+
const xHeaders = {};
|
|
631
|
+
|
|
632
|
+
return APIClient.execute(
|
|
633
|
+
this._conf,
|
|
634
|
+
"post",
|
|
635
|
+
constructUrl({
|
|
636
|
+
url: this._urls["updatePassword"],
|
|
637
|
+
params: {},
|
|
638
|
+
}),
|
|
639
|
+
query_params,
|
|
640
|
+
body,
|
|
641
|
+
xHeaders
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* @param {Object} arg - Arg object.
|
|
647
|
+
* @param {DeleteApplicationUserRequestSchema} arg.body
|
|
648
|
+
* @returns {Promise<DeleteUserSuccess>} - Success response
|
|
649
|
+
* @summary: verify otp and delete user
|
|
650
|
+
* @description: verify otp and delete user
|
|
651
|
+
*/
|
|
652
|
+
deleteUser({ body } = {}) {
|
|
653
|
+
const { error } = UserValidator.deleteUser().validate(
|
|
654
|
+
{ body },
|
|
655
|
+
{ abortEarly: false, allowUnknown: true }
|
|
656
|
+
);
|
|
657
|
+
if (error) {
|
|
658
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
659
|
+
}
|
|
660
|
+
const query_params = {};
|
|
661
|
+
|
|
662
|
+
const xHeaders = {};
|
|
663
|
+
|
|
664
|
+
return APIClient.execute(
|
|
665
|
+
this._conf,
|
|
666
|
+
"post",
|
|
667
|
+
constructUrl({
|
|
668
|
+
url: this._urls["deleteUser"],
|
|
669
|
+
params: {},
|
|
670
|
+
}),
|
|
671
|
+
query_params,
|
|
672
|
+
body,
|
|
673
|
+
xHeaders
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* @param {Object} arg - Arg object.
|
|
679
|
+
* @returns {Promise<LogoutSuccess>} - Success response
|
|
680
|
+
* @summary: Logs out currently logged in user
|
|
681
|
+
* @description: Use this API to check to logout a user from the app.
|
|
682
|
+
*/
|
|
683
|
+
logout({} = {}) {
|
|
684
|
+
const { error } = UserValidator.logout().validate(
|
|
685
|
+
{},
|
|
686
|
+
{ abortEarly: false, allowUnknown: true }
|
|
687
|
+
);
|
|
688
|
+
if (error) {
|
|
689
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
690
|
+
}
|
|
691
|
+
const query_params = {};
|
|
692
|
+
|
|
693
|
+
const xHeaders = {};
|
|
694
|
+
|
|
695
|
+
return APIClient.execute(
|
|
696
|
+
this._conf,
|
|
697
|
+
"get",
|
|
698
|
+
constructUrl({
|
|
699
|
+
url: this._urls["logout"],
|
|
700
|
+
params: {},
|
|
701
|
+
}),
|
|
702
|
+
query_params,
|
|
703
|
+
undefined,
|
|
704
|
+
xHeaders
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* @param {Object} arg - Arg object.
|
|
710
|
+
* @param {string} [arg.platform] - ID of the application
|
|
711
|
+
* @param {SendMobileOtpRequestSchema} arg.body
|
|
712
|
+
* @returns {Promise<OtpSuccess>} - Success response
|
|
713
|
+
* @summary: Send OTP on mobile
|
|
714
|
+
* @description: Use this API to send an OTP to a mobile number.
|
|
715
|
+
*/
|
|
716
|
+
sendOTPOnMobile({ body, platform } = {}) {
|
|
717
|
+
const { error } = UserValidator.sendOTPOnMobile().validate(
|
|
718
|
+
{ body, platform },
|
|
719
|
+
{ abortEarly: false, allowUnknown: true }
|
|
720
|
+
);
|
|
721
|
+
if (error) {
|
|
722
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
723
|
+
}
|
|
724
|
+
const query_params = {};
|
|
725
|
+
query_params["platform"] = platform;
|
|
726
|
+
|
|
727
|
+
const xHeaders = {};
|
|
728
|
+
|
|
729
|
+
return APIClient.execute(
|
|
730
|
+
this._conf,
|
|
731
|
+
"post",
|
|
732
|
+
constructUrl({
|
|
733
|
+
url: this._urls["sendOTPOnMobile"],
|
|
734
|
+
params: {},
|
|
735
|
+
}),
|
|
736
|
+
query_params,
|
|
737
|
+
body,
|
|
738
|
+
xHeaders
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* @param {Object} arg - Arg object.
|
|
744
|
+
* @param {string} [arg.platform] - ID of the application
|
|
745
|
+
* @param {VerifyOtpRequestSchema} arg.body
|
|
746
|
+
* @returns {Promise<VerifyOtpSuccess>} - Success response
|
|
747
|
+
* @summary: Verify OTP on mobile
|
|
748
|
+
* @description: Use this API to verify the OTP received on a mobile number.
|
|
749
|
+
*/
|
|
750
|
+
verifyMobileOTP({ body, platform } = {}) {
|
|
751
|
+
const { error } = UserValidator.verifyMobileOTP().validate(
|
|
752
|
+
{ body, platform },
|
|
753
|
+
{ abortEarly: false, allowUnknown: true }
|
|
754
|
+
);
|
|
755
|
+
if (error) {
|
|
756
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
757
|
+
}
|
|
758
|
+
const query_params = {};
|
|
759
|
+
query_params["platform"] = platform;
|
|
760
|
+
|
|
761
|
+
const xHeaders = {};
|
|
762
|
+
|
|
763
|
+
return APIClient.execute(
|
|
764
|
+
this._conf,
|
|
765
|
+
"post",
|
|
766
|
+
constructUrl({
|
|
767
|
+
url: this._urls["verifyMobileOTP"],
|
|
768
|
+
params: {},
|
|
769
|
+
}),
|
|
770
|
+
query_params,
|
|
771
|
+
body,
|
|
772
|
+
xHeaders
|
|
773
|
+
);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* @param {Object} arg - Arg object.
|
|
778
|
+
* @param {string} [arg.platform] - ID of the application
|
|
779
|
+
* @param {SendEmailOtpRequestSchema} arg.body
|
|
780
|
+
* @returns {Promise<EmailOtpSuccess>} - Success response
|
|
781
|
+
* @summary: Send OTP on email
|
|
782
|
+
* @description: Use this API to send an OTP to an email ID.
|
|
783
|
+
*/
|
|
784
|
+
sendOTPOnEmail({ body, platform } = {}) {
|
|
785
|
+
const { error } = UserValidator.sendOTPOnEmail().validate(
|
|
786
|
+
{ body, platform },
|
|
787
|
+
{ abortEarly: false, allowUnknown: true }
|
|
788
|
+
);
|
|
789
|
+
if (error) {
|
|
790
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
791
|
+
}
|
|
792
|
+
const query_params = {};
|
|
793
|
+
query_params["platform"] = platform;
|
|
794
|
+
|
|
795
|
+
const xHeaders = {};
|
|
796
|
+
|
|
797
|
+
return APIClient.execute(
|
|
798
|
+
this._conf,
|
|
799
|
+
"post",
|
|
800
|
+
constructUrl({
|
|
801
|
+
url: this._urls["sendOTPOnEmail"],
|
|
802
|
+
params: {},
|
|
803
|
+
}),
|
|
804
|
+
query_params,
|
|
805
|
+
body,
|
|
806
|
+
xHeaders
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* @param {Object} arg - Arg object.
|
|
812
|
+
* @param {string} [arg.platform] - ID of the application
|
|
813
|
+
* @param {VerifyEmailOtpRequestSchema} arg.body
|
|
814
|
+
* @returns {Promise<VerifyOtpSuccess>} - Success response
|
|
815
|
+
* @summary: Verify OTP on email
|
|
816
|
+
* @description: Use this API to verify the OTP received on an email ID.
|
|
817
|
+
*/
|
|
818
|
+
verifyEmailOTP({ body, platform } = {}) {
|
|
819
|
+
const { error } = UserValidator.verifyEmailOTP().validate(
|
|
820
|
+
{ body, platform },
|
|
821
|
+
{ abortEarly: false, allowUnknown: true }
|
|
822
|
+
);
|
|
823
|
+
if (error) {
|
|
824
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
825
|
+
}
|
|
826
|
+
const query_params = {};
|
|
827
|
+
query_params["platform"] = platform;
|
|
828
|
+
|
|
829
|
+
const xHeaders = {};
|
|
830
|
+
|
|
831
|
+
return APIClient.execute(
|
|
832
|
+
this._conf,
|
|
833
|
+
"post",
|
|
834
|
+
constructUrl({
|
|
835
|
+
url: this._urls["verifyEmailOTP"],
|
|
836
|
+
params: {},
|
|
837
|
+
}),
|
|
838
|
+
query_params,
|
|
839
|
+
body,
|
|
840
|
+
xHeaders
|
|
841
|
+
);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* @param {Object} arg - Arg object.
|
|
846
|
+
* @returns {Promise<UserObjectSchema>} - Success response
|
|
847
|
+
* @summary: Get logged in user
|
|
848
|
+
* @description: Use this API to get the details of a logged in user.
|
|
849
|
+
*/
|
|
850
|
+
getLoggedInUser({} = {}) {
|
|
851
|
+
const { error } = UserValidator.getLoggedInUser().validate(
|
|
852
|
+
{},
|
|
853
|
+
{ abortEarly: false, allowUnknown: true }
|
|
854
|
+
);
|
|
855
|
+
if (error) {
|
|
856
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
857
|
+
}
|
|
858
|
+
const query_params = {};
|
|
859
|
+
|
|
860
|
+
const xHeaders = {};
|
|
861
|
+
|
|
862
|
+
return APIClient.execute(
|
|
863
|
+
this._conf,
|
|
864
|
+
"get",
|
|
865
|
+
constructUrl({
|
|
866
|
+
url: this._urls["getLoggedInUser"],
|
|
867
|
+
params: {},
|
|
868
|
+
}),
|
|
869
|
+
query_params,
|
|
870
|
+
undefined,
|
|
871
|
+
xHeaders
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* @param {Object} arg - Arg object.
|
|
877
|
+
* @returns {Promise<SessionListSuccess>} - Success response
|
|
878
|
+
* @summary: Get list of sessions
|
|
879
|
+
* @description: Use this API to retrieve all active sessions of a user.
|
|
880
|
+
*/
|
|
881
|
+
getListOfActiveSessions({} = {}) {
|
|
882
|
+
const { error } = UserValidator.getListOfActiveSessions().validate(
|
|
883
|
+
{},
|
|
884
|
+
{ abortEarly: false, allowUnknown: true }
|
|
885
|
+
);
|
|
886
|
+
if (error) {
|
|
887
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
888
|
+
}
|
|
889
|
+
const query_params = {};
|
|
890
|
+
|
|
891
|
+
const xHeaders = {};
|
|
892
|
+
|
|
893
|
+
return APIClient.execute(
|
|
894
|
+
this._conf,
|
|
895
|
+
"get",
|
|
896
|
+
constructUrl({
|
|
897
|
+
url: this._urls["getListOfActiveSessions"],
|
|
898
|
+
params: {},
|
|
899
|
+
}),
|
|
900
|
+
query_params,
|
|
901
|
+
undefined,
|
|
902
|
+
xHeaders
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* @param {Object} arg - Arg object.
|
|
908
|
+
* @param {string} [arg.name] - Name of the application, e.g. Fynd
|
|
909
|
+
* @returns {Promise<PlatformSchema>} - Success response
|
|
910
|
+
* @summary: Get platform configurations
|
|
911
|
+
* @description: Use this API to get all the platform configurations such as mobile image, desktop image, social logins, and all other text.
|
|
912
|
+
*/
|
|
913
|
+
getPlatformConfig({ name } = {}) {
|
|
914
|
+
const { error } = UserValidator.getPlatformConfig().validate(
|
|
915
|
+
{ name },
|
|
916
|
+
{ abortEarly: false, allowUnknown: true }
|
|
917
|
+
);
|
|
918
|
+
if (error) {
|
|
919
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
920
|
+
}
|
|
921
|
+
const query_params = {};
|
|
922
|
+
query_params["name"] = name;
|
|
923
|
+
|
|
924
|
+
const xHeaders = {};
|
|
925
|
+
|
|
926
|
+
return APIClient.execute(
|
|
927
|
+
this._conf,
|
|
928
|
+
"get",
|
|
929
|
+
constructUrl({
|
|
930
|
+
url: this._urls["getPlatformConfig"],
|
|
931
|
+
params: {},
|
|
932
|
+
}),
|
|
933
|
+
query_params,
|
|
934
|
+
undefined,
|
|
935
|
+
xHeaders
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* @param {Object} arg - Arg object.
|
|
941
|
+
* @param {string} [arg.platform] - ID of the application
|
|
942
|
+
* @param {EditProfileRequestSchema} arg.body
|
|
943
|
+
* @returns {Promise<ProfileEditSuccess>} - Success response
|
|
944
|
+
* @summary: Edit Profile Details
|
|
945
|
+
* @description: Use this API to update details in the user profile. Details can be first name, last name, gender, email, phone number, or profile picture.
|
|
946
|
+
*/
|
|
947
|
+
updateProfile({ body, platform } = {}) {
|
|
948
|
+
const { error } = UserValidator.updateProfile().validate(
|
|
949
|
+
{ body, platform },
|
|
950
|
+
{ abortEarly: false, allowUnknown: true }
|
|
951
|
+
);
|
|
952
|
+
if (error) {
|
|
953
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
954
|
+
}
|
|
955
|
+
const query_params = {};
|
|
956
|
+
query_params["platform"] = platform;
|
|
957
|
+
|
|
958
|
+
const xHeaders = {};
|
|
959
|
+
|
|
960
|
+
return APIClient.execute(
|
|
961
|
+
this._conf,
|
|
962
|
+
"post",
|
|
963
|
+
constructUrl({
|
|
964
|
+
url: this._urls["updateProfile"],
|
|
965
|
+
params: {},
|
|
966
|
+
}),
|
|
967
|
+
query_params,
|
|
968
|
+
body,
|
|
969
|
+
xHeaders
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* @param {Object} arg - Arg object.
|
|
975
|
+
* @param {string} [arg.platform] - ID of the application
|
|
976
|
+
* @param {EditMobileRequestSchema} arg.body
|
|
977
|
+
* @returns {Promise<VerifyMobileOTPSuccess>} - Success response
|
|
978
|
+
* @summary: Add mobile number to profile
|
|
979
|
+
* @description: Use this API to add a new mobile number to a profile.
|
|
980
|
+
*/
|
|
981
|
+
addMobileNumber({ body, platform } = {}) {
|
|
982
|
+
const { error } = UserValidator.addMobileNumber().validate(
|
|
983
|
+
{ body, platform },
|
|
984
|
+
{ abortEarly: false, allowUnknown: true }
|
|
985
|
+
);
|
|
986
|
+
if (error) {
|
|
987
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
988
|
+
}
|
|
989
|
+
const query_params = {};
|
|
990
|
+
query_params["platform"] = platform;
|
|
991
|
+
|
|
992
|
+
const xHeaders = {};
|
|
993
|
+
|
|
994
|
+
return APIClient.execute(
|
|
995
|
+
this._conf,
|
|
996
|
+
"put",
|
|
997
|
+
constructUrl({
|
|
998
|
+
url: this._urls["addMobileNumber"],
|
|
999
|
+
params: {},
|
|
1000
|
+
}),
|
|
1001
|
+
query_params,
|
|
1002
|
+
body,
|
|
1003
|
+
xHeaders
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* @param {Object} arg - Arg object.
|
|
1009
|
+
* @param {string} [arg.platform] - ID of the application
|
|
1010
|
+
* @param {boolean} arg.active - This is a boolean value to check if mobile
|
|
1011
|
+
* number is active 1.True - Number is active 2. False - Number is inactive
|
|
1012
|
+
* @param {boolean} arg.primary - This is a boolean value to check if mobile
|
|
1013
|
+
* number is primary number (main number) 1. True - Number is primary 2.
|
|
1014
|
+
* False - Number is not primary
|
|
1015
|
+
* @param {boolean} arg.verified - This is a boolean value to check if
|
|
1016
|
+
* mobile number is verified 1. True - Number is verified 2.False - Number
|
|
1017
|
+
* is not verified yet
|
|
1018
|
+
* @param {string} arg.countryCode - Country code of the phone number, e.g. 91
|
|
1019
|
+
* @param {string} arg.phone - Phone number
|
|
1020
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
1021
|
+
* @summary: Delete mobile number from profile
|
|
1022
|
+
* @description: Use this API to delete a mobile number from a profile.
|
|
1023
|
+
*/
|
|
1024
|
+
deleteMobileNumber({
|
|
1025
|
+
active,
|
|
1026
|
+
primary,
|
|
1027
|
+
verified,
|
|
1028
|
+
countryCode,
|
|
1029
|
+
phone,
|
|
1030
|
+
platform,
|
|
1031
|
+
} = {}) {
|
|
1032
|
+
const { error } = UserValidator.deleteMobileNumber().validate(
|
|
1033
|
+
{ active, primary, verified, countryCode, phone, platform },
|
|
1034
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1035
|
+
);
|
|
1036
|
+
if (error) {
|
|
1037
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1038
|
+
}
|
|
1039
|
+
const query_params = {};
|
|
1040
|
+
query_params["platform"] = platform;
|
|
1041
|
+
query_params["active"] = active;
|
|
1042
|
+
query_params["primary"] = primary;
|
|
1043
|
+
query_params["verified"] = verified;
|
|
1044
|
+
query_params["country_code"] = countryCode;
|
|
1045
|
+
query_params["phone"] = phone;
|
|
1046
|
+
|
|
1047
|
+
const xHeaders = {};
|
|
1048
|
+
|
|
1049
|
+
return APIClient.execute(
|
|
1050
|
+
this._conf,
|
|
1051
|
+
"delete",
|
|
1052
|
+
constructUrl({
|
|
1053
|
+
url: this._urls["deleteMobileNumber"],
|
|
1054
|
+
params: {},
|
|
1055
|
+
}),
|
|
1056
|
+
query_params,
|
|
1057
|
+
undefined,
|
|
1058
|
+
xHeaders
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* @param {Object} arg - Arg object.
|
|
1064
|
+
* @param {SendVerificationLinkMobileRequestSchema} arg.body
|
|
1065
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
1066
|
+
* @summary: Set mobile as primary
|
|
1067
|
+
* @description: Use this API to set a mobile number as primary. Primary number is a verified number used for all future communications.
|
|
1068
|
+
*/
|
|
1069
|
+
setMobileNumberAsPrimary({ body } = {}) {
|
|
1070
|
+
const { error } = UserValidator.setMobileNumberAsPrimary().validate(
|
|
1071
|
+
{ body },
|
|
1072
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1073
|
+
);
|
|
1074
|
+
if (error) {
|
|
1075
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1076
|
+
}
|
|
1077
|
+
const query_params = {};
|
|
1078
|
+
|
|
1079
|
+
const xHeaders = {};
|
|
1080
|
+
|
|
1081
|
+
return APIClient.execute(
|
|
1082
|
+
this._conf,
|
|
1083
|
+
"post",
|
|
1084
|
+
constructUrl({
|
|
1085
|
+
url: this._urls["setMobileNumberAsPrimary"],
|
|
1086
|
+
params: {},
|
|
1087
|
+
}),
|
|
1088
|
+
query_params,
|
|
1089
|
+
body,
|
|
1090
|
+
xHeaders
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* @param {Object} arg - Arg object.
|
|
1096
|
+
* @param {string} [arg.platform] - ID of the application
|
|
1097
|
+
* @param {SendVerificationLinkMobileRequestSchema} arg.body
|
|
1098
|
+
* @returns {Promise<SendMobileVerifyLinkSuccess>} - Success response
|
|
1099
|
+
* @summary: Send verification link to mobile
|
|
1100
|
+
* @description: Use this API to send a verification link to a mobile number
|
|
1101
|
+
*/
|
|
1102
|
+
sendVerificationLinkToMobile({ body, platform } = {}) {
|
|
1103
|
+
const { error } = UserValidator.sendVerificationLinkToMobile().validate(
|
|
1104
|
+
{ body, platform },
|
|
1105
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1106
|
+
);
|
|
1107
|
+
if (error) {
|
|
1108
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1109
|
+
}
|
|
1110
|
+
const query_params = {};
|
|
1111
|
+
query_params["platform"] = platform;
|
|
1112
|
+
|
|
1113
|
+
const xHeaders = {};
|
|
1114
|
+
|
|
1115
|
+
return APIClient.execute(
|
|
1116
|
+
this._conf,
|
|
1117
|
+
"post",
|
|
1118
|
+
constructUrl({
|
|
1119
|
+
url: this._urls["sendVerificationLinkToMobile"],
|
|
1120
|
+
params: {},
|
|
1121
|
+
}),
|
|
1122
|
+
query_params,
|
|
1123
|
+
body,
|
|
1124
|
+
xHeaders
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* @param {Object} arg - Arg object.
|
|
1130
|
+
* @param {string} [arg.platform] - ID of the application
|
|
1131
|
+
* @param {EditEmailRequestSchema} arg.body
|
|
1132
|
+
* @returns {Promise<VerifyEmailOTPSuccess>} - Success response
|
|
1133
|
+
* @summary: Add email to profile
|
|
1134
|
+
* @description: Use this API to add a new email address to a profile
|
|
1135
|
+
*/
|
|
1136
|
+
addEmail({ body, platform } = {}) {
|
|
1137
|
+
const { error } = UserValidator.addEmail().validate(
|
|
1138
|
+
{ body, platform },
|
|
1139
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1140
|
+
);
|
|
1141
|
+
if (error) {
|
|
1142
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1143
|
+
}
|
|
1144
|
+
const query_params = {};
|
|
1145
|
+
query_params["platform"] = platform;
|
|
1146
|
+
|
|
1147
|
+
const xHeaders = {};
|
|
1148
|
+
|
|
1149
|
+
return APIClient.execute(
|
|
1150
|
+
this._conf,
|
|
1151
|
+
"put",
|
|
1152
|
+
constructUrl({
|
|
1153
|
+
url: this._urls["addEmail"],
|
|
1154
|
+
params: {},
|
|
1155
|
+
}),
|
|
1156
|
+
query_params,
|
|
1157
|
+
body,
|
|
1158
|
+
xHeaders
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* @param {Object} arg - Arg object.
|
|
1164
|
+
* @param {string} [arg.platform] - ID of the application
|
|
1165
|
+
* @param {boolean} arg.active - This is a boolean value to check if email
|
|
1166
|
+
* ID is active 1. True - Email ID is active 2.False - Email ID is inactive
|
|
1167
|
+
* @param {boolean} arg.primary - This is a boolean value to check if email
|
|
1168
|
+
* ID is primary (main email ID) 1. True - Email ID is primary 2.False -
|
|
1169
|
+
* Email ID is not primary
|
|
1170
|
+
* @param {boolean} arg.verified - This is a boolean value to check if email
|
|
1171
|
+
* ID is verified 1. True - Email ID is verified 2.False - Email ID is not
|
|
1172
|
+
* verified yet
|
|
1173
|
+
* @param {string} arg.email - The email ID to delete
|
|
1174
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
1175
|
+
* @summary: Delete email from profile
|
|
1176
|
+
* @description: Use this API to delete an email address from a profile
|
|
1177
|
+
*/
|
|
1178
|
+
deleteEmail({ active, primary, verified, email, platform } = {}) {
|
|
1179
|
+
const { error } = UserValidator.deleteEmail().validate(
|
|
1180
|
+
{ active, primary, verified, email, platform },
|
|
1181
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1182
|
+
);
|
|
1183
|
+
if (error) {
|
|
1184
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1185
|
+
}
|
|
1186
|
+
const query_params = {};
|
|
1187
|
+
query_params["platform"] = platform;
|
|
1188
|
+
query_params["active"] = active;
|
|
1189
|
+
query_params["primary"] = primary;
|
|
1190
|
+
query_params["verified"] = verified;
|
|
1191
|
+
query_params["email"] = email;
|
|
1192
|
+
|
|
1193
|
+
const xHeaders = {};
|
|
1194
|
+
|
|
1195
|
+
return APIClient.execute(
|
|
1196
|
+
this._conf,
|
|
1197
|
+
"delete",
|
|
1198
|
+
constructUrl({
|
|
1199
|
+
url: this._urls["deleteEmail"],
|
|
1200
|
+
params: {},
|
|
1201
|
+
}),
|
|
1202
|
+
query_params,
|
|
1203
|
+
undefined,
|
|
1204
|
+
xHeaders
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* @param {Object} arg - Arg object.
|
|
1210
|
+
* @param {EditEmailRequestSchema} arg.body
|
|
1211
|
+
* @returns {Promise<LoginSuccess>} - Success response
|
|
1212
|
+
* @summary: Set email as primary
|
|
1213
|
+
* @description: Use this API to set an email address as primary. Primary email ID is a email address used for all future communications.
|
|
1214
|
+
*/
|
|
1215
|
+
setEmailAsPrimary({ body } = {}) {
|
|
1216
|
+
const { error } = UserValidator.setEmailAsPrimary().validate(
|
|
1217
|
+
{ body },
|
|
1218
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1219
|
+
);
|
|
1220
|
+
if (error) {
|
|
1221
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1222
|
+
}
|
|
1223
|
+
const query_params = {};
|
|
1224
|
+
|
|
1225
|
+
const xHeaders = {};
|
|
1226
|
+
|
|
1227
|
+
return APIClient.execute(
|
|
1228
|
+
this._conf,
|
|
1229
|
+
"post",
|
|
1230
|
+
constructUrl({
|
|
1231
|
+
url: this._urls["setEmailAsPrimary"],
|
|
1232
|
+
params: {},
|
|
1233
|
+
}),
|
|
1234
|
+
query_params,
|
|
1235
|
+
body,
|
|
1236
|
+
xHeaders
|
|
1237
|
+
);
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* @param {Object} arg - Arg object.
|
|
1242
|
+
* @param {string} [arg.platform] - ID of the application
|
|
1243
|
+
* @param {EditEmailRequestSchema} arg.body
|
|
1244
|
+
* @returns {Promise<SendEmailVerifyLinkSuccess>} - Success response
|
|
1245
|
+
* @summary: Send verification link to email
|
|
1246
|
+
* @description: Use this API to send verification link to an email address.
|
|
1247
|
+
*/
|
|
1248
|
+
sendVerificationLinkToEmail({ body, platform } = {}) {
|
|
1249
|
+
const { error } = UserValidator.sendVerificationLinkToEmail().validate(
|
|
1250
|
+
{ body, platform },
|
|
1251
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1252
|
+
);
|
|
1253
|
+
if (error) {
|
|
1254
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1255
|
+
}
|
|
1256
|
+
const query_params = {};
|
|
1257
|
+
query_params["platform"] = platform;
|
|
1258
|
+
|
|
1259
|
+
const xHeaders = {};
|
|
1260
|
+
|
|
1261
|
+
return APIClient.execute(
|
|
1262
|
+
this._conf,
|
|
1263
|
+
"post",
|
|
1264
|
+
constructUrl({
|
|
1265
|
+
url: this._urls["sendVerificationLinkToEmail"],
|
|
1266
|
+
params: {},
|
|
1267
|
+
}),
|
|
1268
|
+
query_params,
|
|
1269
|
+
body,
|
|
1270
|
+
xHeaders
|
|
1271
|
+
);
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
module.exports = User;
|