@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,38 @@
|
|
|
1
|
+
export = Common;
|
|
2
|
+
declare class Common {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
searchApplication: string;
|
|
7
|
+
getLocations: string;
|
|
8
|
+
};
|
|
9
|
+
_urls: {};
|
|
10
|
+
updateUrls(urls: any): void;
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} arg - Arg object.
|
|
13
|
+
* @param {string} [arg.authorization] -
|
|
14
|
+
* @param {string} [arg.query] - Provide application name
|
|
15
|
+
* @returns {Promise<ApplicationResponse>} - Success response
|
|
16
|
+
* @summary: Search Application
|
|
17
|
+
* @description: Provide application name or domain url
|
|
18
|
+
*/
|
|
19
|
+
searchApplication({ authorization, query }?: {
|
|
20
|
+
authorization?: string;
|
|
21
|
+
query?: string;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} arg - Arg object.
|
|
25
|
+
* @param {string} [arg.locationType] - Provide location type to query on.
|
|
26
|
+
* Possible values : country, state, city
|
|
27
|
+
* @param {string} [arg.id] - Field is optional when location_type is
|
|
28
|
+
* country. If querying for state, provide id of country. If querying for
|
|
29
|
+
* city, provide id of state.
|
|
30
|
+
* @returns {Promise<Locations>} - Success response
|
|
31
|
+
* @summary: Get countries, states, cities
|
|
32
|
+
* @description:
|
|
33
|
+
*/
|
|
34
|
+
getLocations({ locationType, id }?: {
|
|
35
|
+
locationType?: string;
|
|
36
|
+
id?: string;
|
|
37
|
+
}): Promise<any>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const CommonValidator = require("../models/CommonValidator");
|
|
6
|
+
|
|
7
|
+
class Common {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
searchApplication:
|
|
12
|
+
"/service/common/configuration/v1.0/application/search-application",
|
|
13
|
+
getLocations: "/service/common/configuration/v1.0/location",
|
|
14
|
+
};
|
|
15
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
16
|
+
(urls, [method, relativeUrl]) => {
|
|
17
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
18
|
+
return urls;
|
|
19
|
+
},
|
|
20
|
+
{}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
updateUrls(urls) {
|
|
25
|
+
this._urls = {
|
|
26
|
+
...this._urls,
|
|
27
|
+
...urls,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {Object} arg - Arg object.
|
|
33
|
+
* @param {string} [arg.authorization] -
|
|
34
|
+
* @param {string} [arg.query] - Provide application name
|
|
35
|
+
* @returns {Promise<ApplicationResponse>} - Success response
|
|
36
|
+
* @summary: Search Application
|
|
37
|
+
* @description: Provide application name or domain url
|
|
38
|
+
*/
|
|
39
|
+
searchApplication({ authorization, query } = {}) {
|
|
40
|
+
const { error } = CommonValidator.searchApplication().validate(
|
|
41
|
+
{ authorization, query },
|
|
42
|
+
{ abortEarly: false, allowUnknown: true }
|
|
43
|
+
);
|
|
44
|
+
if (error) {
|
|
45
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
46
|
+
}
|
|
47
|
+
const query_params = {};
|
|
48
|
+
query_params["query"] = query;
|
|
49
|
+
|
|
50
|
+
const xHeaders = {};
|
|
51
|
+
xHeaders["authorization"] = authorization;
|
|
52
|
+
|
|
53
|
+
return APIClient.execute(
|
|
54
|
+
this._conf,
|
|
55
|
+
"get",
|
|
56
|
+
constructUrl({
|
|
57
|
+
url: this._urls["searchApplication"],
|
|
58
|
+
params: {},
|
|
59
|
+
}),
|
|
60
|
+
query_params,
|
|
61
|
+
undefined,
|
|
62
|
+
xHeaders
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {Object} arg - Arg object.
|
|
68
|
+
* @param {string} [arg.locationType] - Provide location type to query on.
|
|
69
|
+
* Possible values : country, state, city
|
|
70
|
+
* @param {string} [arg.id] - Field is optional when location_type is
|
|
71
|
+
* country. If querying for state, provide id of country. If querying for
|
|
72
|
+
* city, provide id of state.
|
|
73
|
+
* @returns {Promise<Locations>} - Success response
|
|
74
|
+
* @summary: Get countries, states, cities
|
|
75
|
+
* @description:
|
|
76
|
+
*/
|
|
77
|
+
getLocations({ locationType, id } = {}) {
|
|
78
|
+
const { error } = CommonValidator.getLocations().validate(
|
|
79
|
+
{ locationType, id },
|
|
80
|
+
{ abortEarly: false, allowUnknown: true }
|
|
81
|
+
);
|
|
82
|
+
if (error) {
|
|
83
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
84
|
+
}
|
|
85
|
+
const query_params = {};
|
|
86
|
+
query_params["location_type"] = locationType;
|
|
87
|
+
query_params["id"] = id;
|
|
88
|
+
|
|
89
|
+
const xHeaders = {};
|
|
90
|
+
|
|
91
|
+
return APIClient.execute(
|
|
92
|
+
this._conf,
|
|
93
|
+
"get",
|
|
94
|
+
constructUrl({
|
|
95
|
+
url: this._urls["getLocations"],
|
|
96
|
+
params: {},
|
|
97
|
+
}),
|
|
98
|
+
query_params,
|
|
99
|
+
undefined,
|
|
100
|
+
xHeaders
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = Common;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export = Communication;
|
|
2
|
+
declare class Communication {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getCommunicationConsent: string;
|
|
7
|
+
upsertCommunicationConsent: string;
|
|
8
|
+
upsertAppPushtoken: string;
|
|
9
|
+
};
|
|
10
|
+
_urls: {};
|
|
11
|
+
updateUrls(urls: any): void;
|
|
12
|
+
/**
|
|
13
|
+
* @param {Object} arg - Arg object.
|
|
14
|
+
* @returns {Promise<CommunicationConsent>} - Success response
|
|
15
|
+
* @summary: Get communication consent
|
|
16
|
+
* @description: Use this API to retrieve the consent provided by the user for receiving communication messages over Email/SMS/WhatsApp.
|
|
17
|
+
*/
|
|
18
|
+
getCommunicationConsent({}?: any): Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* @param {Object} arg - Arg object.
|
|
21
|
+
* @param {CommunicationConsentReq} arg.body
|
|
22
|
+
* @returns {Promise<CommunicationConsentRes>} - Success response
|
|
23
|
+
* @summary: Upsert communication consent
|
|
24
|
+
* @description: Use this API to update and insert the consent provided by the user for receiving communication messages over Email/SMS/WhatsApp.
|
|
25
|
+
*/
|
|
26
|
+
upsertCommunicationConsent({ body }?: {
|
|
27
|
+
body: any;
|
|
28
|
+
}): Promise<any>;
|
|
29
|
+
/**
|
|
30
|
+
* @param {Object} arg - Arg object.
|
|
31
|
+
* @param {PushtokenReq} arg.body
|
|
32
|
+
* @returns {Promise<PushtokenRes>} - Success response
|
|
33
|
+
* @summary: Upsert push token of a user
|
|
34
|
+
* @description: Use this API to update and insert the push token of the user.
|
|
35
|
+
*/
|
|
36
|
+
upsertAppPushtoken({ body }?: {
|
|
37
|
+
body: any;
|
|
38
|
+
}): Promise<any>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const CommunicationValidator = require("../models/CommunicationValidator");
|
|
6
|
+
|
|
7
|
+
class Communication {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
getCommunicationConsent:
|
|
12
|
+
"/service/application/communication/v1.0/consent",
|
|
13
|
+
upsertCommunicationConsent:
|
|
14
|
+
"/service/application/communication/v1.0/consent",
|
|
15
|
+
upsertAppPushtoken: "/service/application/communication/v1.0/pn-token",
|
|
16
|
+
};
|
|
17
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
18
|
+
(urls, [method, relativeUrl]) => {
|
|
19
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
20
|
+
return urls;
|
|
21
|
+
},
|
|
22
|
+
{}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
updateUrls(urls) {
|
|
27
|
+
this._urls = {
|
|
28
|
+
...this._urls,
|
|
29
|
+
...urls,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Object} arg - Arg object.
|
|
35
|
+
* @returns {Promise<CommunicationConsent>} - Success response
|
|
36
|
+
* @summary: Get communication consent
|
|
37
|
+
* @description: Use this API to retrieve the consent provided by the user for receiving communication messages over Email/SMS/WhatsApp.
|
|
38
|
+
*/
|
|
39
|
+
getCommunicationConsent({} = {}) {
|
|
40
|
+
const { error } = CommunicationValidator.getCommunicationConsent().validate(
|
|
41
|
+
{},
|
|
42
|
+
{ abortEarly: false, allowUnknown: true }
|
|
43
|
+
);
|
|
44
|
+
if (error) {
|
|
45
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
46
|
+
}
|
|
47
|
+
const query_params = {};
|
|
48
|
+
|
|
49
|
+
const xHeaders = {};
|
|
50
|
+
|
|
51
|
+
return APIClient.execute(
|
|
52
|
+
this._conf,
|
|
53
|
+
"get",
|
|
54
|
+
constructUrl({
|
|
55
|
+
url: this._urls["getCommunicationConsent"],
|
|
56
|
+
params: {},
|
|
57
|
+
}),
|
|
58
|
+
query_params,
|
|
59
|
+
undefined,
|
|
60
|
+
xHeaders
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Object} arg - Arg object.
|
|
66
|
+
* @param {CommunicationConsentReq} arg.body
|
|
67
|
+
* @returns {Promise<CommunicationConsentRes>} - Success response
|
|
68
|
+
* @summary: Upsert communication consent
|
|
69
|
+
* @description: Use this API to update and insert the consent provided by the user for receiving communication messages over Email/SMS/WhatsApp.
|
|
70
|
+
*/
|
|
71
|
+
upsertCommunicationConsent({ body } = {}) {
|
|
72
|
+
const {
|
|
73
|
+
error,
|
|
74
|
+
} = CommunicationValidator.upsertCommunicationConsent().validate(
|
|
75
|
+
{ body },
|
|
76
|
+
{ abortEarly: false, allowUnknown: true }
|
|
77
|
+
);
|
|
78
|
+
if (error) {
|
|
79
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
80
|
+
}
|
|
81
|
+
const query_params = {};
|
|
82
|
+
|
|
83
|
+
const xHeaders = {};
|
|
84
|
+
|
|
85
|
+
return APIClient.execute(
|
|
86
|
+
this._conf,
|
|
87
|
+
"post",
|
|
88
|
+
constructUrl({
|
|
89
|
+
url: this._urls["upsertCommunicationConsent"],
|
|
90
|
+
params: {},
|
|
91
|
+
}),
|
|
92
|
+
query_params,
|
|
93
|
+
body,
|
|
94
|
+
xHeaders
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @param {Object} arg - Arg object.
|
|
100
|
+
* @param {PushtokenReq} arg.body
|
|
101
|
+
* @returns {Promise<PushtokenRes>} - Success response
|
|
102
|
+
* @summary: Upsert push token of a user
|
|
103
|
+
* @description: Use this API to update and insert the push token of the user.
|
|
104
|
+
*/
|
|
105
|
+
upsertAppPushtoken({ body } = {}) {
|
|
106
|
+
const { error } = CommunicationValidator.upsertAppPushtoken().validate(
|
|
107
|
+
{ body },
|
|
108
|
+
{ abortEarly: false, allowUnknown: true }
|
|
109
|
+
);
|
|
110
|
+
if (error) {
|
|
111
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
112
|
+
}
|
|
113
|
+
const query_params = {};
|
|
114
|
+
|
|
115
|
+
const xHeaders = {};
|
|
116
|
+
|
|
117
|
+
return APIClient.execute(
|
|
118
|
+
this._conf,
|
|
119
|
+
"post",
|
|
120
|
+
constructUrl({
|
|
121
|
+
url: this._urls["upsertAppPushtoken"],
|
|
122
|
+
params: {},
|
|
123
|
+
}),
|
|
124
|
+
query_params,
|
|
125
|
+
body,
|
|
126
|
+
xHeaders
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
module.exports = Communication;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
export = Configuration;
|
|
2
|
+
declare class Configuration {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getApplication: string;
|
|
7
|
+
getOwnerInfo: string;
|
|
8
|
+
getBasicDetails: string;
|
|
9
|
+
getIntegrationTokens: string;
|
|
10
|
+
getOrderingStores: string;
|
|
11
|
+
getStoreDetailById: string;
|
|
12
|
+
getFeatures: string;
|
|
13
|
+
getContactInfo: string;
|
|
14
|
+
getCurrencies: string;
|
|
15
|
+
getCurrencyById: string;
|
|
16
|
+
getAppCurrencies: string;
|
|
17
|
+
getLanguages: string;
|
|
18
|
+
getOrderingStoreCookie: string;
|
|
19
|
+
removeOrderingStoreCookie: string;
|
|
20
|
+
getAppStaffList: string;
|
|
21
|
+
getAppStaffs: string;
|
|
22
|
+
};
|
|
23
|
+
_urls: {};
|
|
24
|
+
updateUrls(urls: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* @param {Object} arg - Arg object.
|
|
27
|
+
* @returns {Promise<Application>} - Success response
|
|
28
|
+
* @summary: Get current application details
|
|
29
|
+
* @description: Use this API to get the current application details which includes configurations that indicate the status of the website, domain, ID, tokens, images, etc.
|
|
30
|
+
*/
|
|
31
|
+
getApplication({}?: any): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* @param {Object} arg - Arg object.
|
|
34
|
+
* @returns {Promise<ApplicationAboutResponse>} - Success response
|
|
35
|
+
* @summary: Get application, owner and seller information
|
|
36
|
+
* @description: Use this API to get the current application details which includes channel name, description, banner, logo, favicon, domain details, etc. This API also retrieves the seller and owner information such as address, email address, and phone number.
|
|
37
|
+
*/
|
|
38
|
+
getOwnerInfo({}?: any): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* @param {Object} arg - Arg object.
|
|
41
|
+
* @returns {Promise<ApplicationDetail>} - Success response
|
|
42
|
+
* @summary: Get basic application details
|
|
43
|
+
* @description: Use this API to retrieve only the basic details of the application which includes channel name, description, banner, logo, favicon, domain details, etc.
|
|
44
|
+
*/
|
|
45
|
+
getBasicDetails({}?: any): Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* @param {Object} arg - Arg object.
|
|
48
|
+
* @returns {Promise<AppTokenResponse>} - Success response
|
|
49
|
+
* @summary: Get integration tokens
|
|
50
|
+
* @description: Use this API to retrieve the tokens used while integrating Firebase, MoEngage, Segment, GTM, Freshchat, Safetynet, Google Map and Facebook. **Note** - Token values are encrypted with AES encryption using a secret key. Kindly reach out to the developers for obtaining the secret key.
|
|
51
|
+
*/
|
|
52
|
+
getIntegrationTokens({}?: any): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* @param {Object} arg - Arg object.
|
|
55
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
56
|
+
* given set of results. Default value is 1.
|
|
57
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
58
|
+
* page. Default value is 10.
|
|
59
|
+
* @param {string} [arg.q] - Store code or name of the ordering store.
|
|
60
|
+
* @returns {Promise<OrderingStores>} - Success response
|
|
61
|
+
* @summary: Get deployment stores
|
|
62
|
+
* @description: Use this API to retrieve the details of all the deployment stores (the selling locations where the application will be utilized for placing orders).
|
|
63
|
+
*/
|
|
64
|
+
getOrderingStores({ pageNo, pageSize, q }?: {
|
|
65
|
+
pageNo?: number;
|
|
66
|
+
pageSize?: number;
|
|
67
|
+
q?: string;
|
|
68
|
+
}): Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* @param {Object} arg - Arg object.
|
|
71
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
72
|
+
* page. Default value is 10.
|
|
73
|
+
* @param {string} [arg.q] - Store code or name of the ordering store.
|
|
74
|
+
* @summary: Get deployment stores
|
|
75
|
+
* @description: Use this API to retrieve the details of all the deployment stores (the selling locations where the application will be utilized for placing orders).
|
|
76
|
+
*/
|
|
77
|
+
getOrderingStoresPaginator({ pageSize, q }?: {
|
|
78
|
+
pageSize?: number;
|
|
79
|
+
q?: string;
|
|
80
|
+
}): Paginator;
|
|
81
|
+
/**
|
|
82
|
+
* @param {Object} arg - Arg object.
|
|
83
|
+
* @param {number} arg.storeId - Store uid
|
|
84
|
+
* @returns {Promise<OrderingStore>} - Success response
|
|
85
|
+
* @summary: Get ordering store details
|
|
86
|
+
* @description: Use this API to retrieve the details of given stores uid (the selling locations where the application will be utilized for placing orders).
|
|
87
|
+
*/
|
|
88
|
+
getStoreDetailById({ storeId }?: {
|
|
89
|
+
storeId: number;
|
|
90
|
+
}): Promise<any>;
|
|
91
|
+
/**
|
|
92
|
+
* @param {Object} arg - Arg object.
|
|
93
|
+
* @returns {Promise<AppFeatureResponse>} - Success response
|
|
94
|
+
* @summary: Get features of application
|
|
95
|
+
* @description: Use this API to retrieve the configuration of features such as product detail, landing page, options in the login/registration screen, communication opt-in, cart options and many more.
|
|
96
|
+
*/
|
|
97
|
+
getFeatures({}?: any): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* @param {Object} arg - Arg object.
|
|
100
|
+
* @returns {Promise<ApplicationInformation>} - Success response
|
|
101
|
+
* @summary: Get application information
|
|
102
|
+
* @description: Use this API to retrieve information about the social links, address and contact information of the company/seller/brand operating the application.
|
|
103
|
+
*/
|
|
104
|
+
getContactInfo({}?: any): Promise<any>;
|
|
105
|
+
/**
|
|
106
|
+
* @param {Object} arg - Arg object.
|
|
107
|
+
* @returns {Promise<CurrenciesResponse>} - Success response
|
|
108
|
+
* @summary: Get all currencies list
|
|
109
|
+
* @description: Use this API to get a list of currencies available. Moreover, get the name, code, symbol, and the decimal digits of the currencies.
|
|
110
|
+
*/
|
|
111
|
+
getCurrencies({}?: any): Promise<any>;
|
|
112
|
+
/**
|
|
113
|
+
* @param {Object} arg - Arg object.
|
|
114
|
+
* @param {string} arg.id - Object ID assigned to the currency
|
|
115
|
+
* @returns {Promise<Currency>} - Success response
|
|
116
|
+
* @summary: Get currency by its ID
|
|
117
|
+
* @description: Use this API to retrieve a currency using its ID.
|
|
118
|
+
*/
|
|
119
|
+
getCurrencyById({ id }?: {
|
|
120
|
+
id: string;
|
|
121
|
+
}): Promise<any>;
|
|
122
|
+
/**
|
|
123
|
+
* @param {Object} arg - Arg object.
|
|
124
|
+
* @returns {Promise<AppCurrencyResponse>} - Success response
|
|
125
|
+
* @summary: Get currencies enabled in the application
|
|
126
|
+
* @description: Use this API to get a list of currencies allowed in the current application. Moreover, get the name, code, symbol, and the decimal digits of the currencies.
|
|
127
|
+
*/
|
|
128
|
+
getAppCurrencies({}?: any): Promise<any>;
|
|
129
|
+
/**
|
|
130
|
+
* @param {Object} arg - Arg object.
|
|
131
|
+
* @returns {Promise<LanguageResponse>} - Success response
|
|
132
|
+
* @summary: Get list of languages
|
|
133
|
+
* @description: Use this API to get a list of languages supported in the application.
|
|
134
|
+
*/
|
|
135
|
+
getLanguages({}?: any): Promise<any>;
|
|
136
|
+
/**
|
|
137
|
+
* @param {Object} arg - Arg object.
|
|
138
|
+
* @param {OrderingStoreSelectRequest} arg.body
|
|
139
|
+
* @returns {Promise<SuccessMessageResponse>} - Success response
|
|
140
|
+
* @summary: Get an Ordering Store signed cookie on selection of ordering store.
|
|
141
|
+
* @description: Use this API to get an Ordering Store signed cookie upon selecting an ordering store. This will be used by the cart service to verify a coupon against the selected ordering store in cart.
|
|
142
|
+
*/
|
|
143
|
+
getOrderingStoreCookie({ body }?: {
|
|
144
|
+
body: any;
|
|
145
|
+
}): Promise<any>;
|
|
146
|
+
/**
|
|
147
|
+
* @param {Object} arg - Arg object.
|
|
148
|
+
* @returns {Promise<SuccessMessageResponse>} - Success response
|
|
149
|
+
* @summary: Unset the Ordering Store signed cookie.
|
|
150
|
+
* @description: Use this API to unset the Ordering Store cookie upon changing the sales channel, by its domain URL, in the Universal Fynd Store app.
|
|
151
|
+
*/
|
|
152
|
+
removeOrderingStoreCookie({}?: any): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* @param {Object} arg - Arg object.
|
|
155
|
+
* @param {number} [arg.pageNo] -
|
|
156
|
+
* @param {number} [arg.pageSize] -
|
|
157
|
+
* @param {boolean} [arg.orderIncent] - This is a boolean value. Select
|
|
158
|
+
* `true` to retrieve the staff members eligible for getting incentives on orders.
|
|
159
|
+
* @param {number} [arg.orderingStore] - ID of the ordering store. Helps in
|
|
160
|
+
* retrieving staff members working at a particular ordering store.
|
|
161
|
+
* @param {string} [arg.user] - Mongo ID of the staff. Helps in retrieving
|
|
162
|
+
* the details of a particular staff member.
|
|
163
|
+
* @returns {Promise<AppStaffListResponse>} - Success response
|
|
164
|
+
* @summary: Get a list of staff.
|
|
165
|
+
* @description: Use this API to get a list of staff including the names, employee code, incentive status, assigned ordering stores, and title of each staff added to the application.
|
|
166
|
+
*/
|
|
167
|
+
getAppStaffList({ pageNo, pageSize, orderIncent, orderingStore, user }?: {
|
|
168
|
+
pageNo?: number;
|
|
169
|
+
pageSize?: number;
|
|
170
|
+
orderIncent?: boolean;
|
|
171
|
+
orderingStore?: number;
|
|
172
|
+
user?: string;
|
|
173
|
+
}): Promise<any>;
|
|
174
|
+
/**
|
|
175
|
+
* @param {Object} arg - Arg object.
|
|
176
|
+
* @param {number} [arg.pageSize] -
|
|
177
|
+
* @param {boolean} [arg.orderIncent] - This is a boolean value. Select
|
|
178
|
+
* `true` to retrieve the staff members eligible for getting incentives on orders.
|
|
179
|
+
* @param {number} [arg.orderingStore] - ID of the ordering store. Helps in
|
|
180
|
+
* retrieving staff members working at a particular ordering store.
|
|
181
|
+
* @param {string} [arg.user] - Mongo ID of the staff. Helps in retrieving
|
|
182
|
+
* the details of a particular staff member.
|
|
183
|
+
* @summary: Get a list of staff.
|
|
184
|
+
* @description: Use this API to get a list of staff including the names, employee code, incentive status, assigned ordering stores, and title of each staff added to the application.
|
|
185
|
+
*/
|
|
186
|
+
getAppStaffListPaginator({ pageSize, orderIncent, orderingStore, user, }?: {
|
|
187
|
+
pageSize?: number;
|
|
188
|
+
orderIncent?: boolean;
|
|
189
|
+
orderingStore?: number;
|
|
190
|
+
user?: string;
|
|
191
|
+
}): Paginator;
|
|
192
|
+
/**
|
|
193
|
+
* @param {Object} arg - Arg object.
|
|
194
|
+
* @param {boolean} [arg.orderIncent] - This is a boolean value. Select
|
|
195
|
+
* `true` to retrieve the staff members eligible for getting incentives on orders.
|
|
196
|
+
* @param {number} [arg.orderingStore] - ID of the ordering store. Helps in
|
|
197
|
+
* retrieving staff members working at a particular ordering store.
|
|
198
|
+
* @param {string} [arg.user] - Mongo ID of the staff. Helps in retrieving
|
|
199
|
+
* the details of a particular staff member.
|
|
200
|
+
* @returns {Promise<AppStaffResponse>} - Success response
|
|
201
|
+
* @summary: Get a list of staff.
|
|
202
|
+
* @description: Use this API to get a list of staff including the names, employee code, incentive status, assigned ordering stores, and title of each staff added to the application.
|
|
203
|
+
*/
|
|
204
|
+
getAppStaffs({ orderIncent, orderingStore, user }?: {
|
|
205
|
+
orderIncent?: boolean;
|
|
206
|
+
orderingStore?: number;
|
|
207
|
+
user?: string;
|
|
208
|
+
}): Promise<any>;
|
|
209
|
+
}
|
|
210
|
+
import Paginator = require("../../common/Paginator");
|