@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,806 @@
|
|
|
1
|
+
const Paginator = require("../../common/Paginator");
|
|
2
|
+
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
|
+
const ConfigurationValidator = require("../models/ConfigurationValidator");
|
|
5
|
+
class Configuration {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.config = config;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} arg - Arg object.
|
|
12
|
+
* @param {CreateApplicationRequest} arg.body
|
|
13
|
+
* @summary: Create application
|
|
14
|
+
* @description: Create new application
|
|
15
|
+
*/
|
|
16
|
+
createApplication({ body } = {}) {
|
|
17
|
+
const { error } = ConfigurationValidator.createApplication().validate(
|
|
18
|
+
{
|
|
19
|
+
body,
|
|
20
|
+
},
|
|
21
|
+
{ abortEarly: false, allowUnknown: true }
|
|
22
|
+
);
|
|
23
|
+
if (error) {
|
|
24
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const query_params = {};
|
|
28
|
+
|
|
29
|
+
const xHeaders = {};
|
|
30
|
+
|
|
31
|
+
return PlatformAPIClient.execute(
|
|
32
|
+
this.config,
|
|
33
|
+
"post",
|
|
34
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/application`,
|
|
35
|
+
query_params,
|
|
36
|
+
body,
|
|
37
|
+
xHeaders
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {Object} arg - Arg object.
|
|
43
|
+
* @param {number} [arg.pageNo] -
|
|
44
|
+
* @param {number} [arg.pageSize] -
|
|
45
|
+
* @param {string} [arg.q] - Url encoded object used as mongodb query
|
|
46
|
+
* @summary: Get list of application under company
|
|
47
|
+
* @description: Get list of application under company
|
|
48
|
+
*/
|
|
49
|
+
getApplications({ pageNo, pageSize, q } = {}) {
|
|
50
|
+
const { error } = ConfigurationValidator.getApplications().validate(
|
|
51
|
+
{
|
|
52
|
+
pageNo,
|
|
53
|
+
pageSize,
|
|
54
|
+
q,
|
|
55
|
+
},
|
|
56
|
+
{ abortEarly: false, allowUnknown: true }
|
|
57
|
+
);
|
|
58
|
+
if (error) {
|
|
59
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const query_params = {};
|
|
63
|
+
query_params["page_no"] = pageNo;
|
|
64
|
+
query_params["page_size"] = pageSize;
|
|
65
|
+
query_params["q"] = q;
|
|
66
|
+
|
|
67
|
+
const xHeaders = {};
|
|
68
|
+
|
|
69
|
+
return PlatformAPIClient.execute(
|
|
70
|
+
this.config,
|
|
71
|
+
"get",
|
|
72
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/application`,
|
|
73
|
+
query_params,
|
|
74
|
+
undefined,
|
|
75
|
+
xHeaders
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {Object} arg - Arg object.
|
|
81
|
+
* @param {number} [arg.pageSize] -
|
|
82
|
+
* @param {string} [arg.q] - Url encoded object used as mongodb query
|
|
83
|
+
* @summary: Get list of application under company
|
|
84
|
+
* @description: Get list of application under company
|
|
85
|
+
*/
|
|
86
|
+
getApplicationsPaginator({ pageSize, q } = {}) {
|
|
87
|
+
const paginator = new Paginator();
|
|
88
|
+
const callback = async () => {
|
|
89
|
+
const pageId = paginator.nextId;
|
|
90
|
+
const pageNo = paginator.pageNo;
|
|
91
|
+
const pageType = "number";
|
|
92
|
+
const data = await this.getApplications({
|
|
93
|
+
pageNo: pageNo,
|
|
94
|
+
pageSize: pageSize,
|
|
95
|
+
q: q,
|
|
96
|
+
});
|
|
97
|
+
paginator.setPaginator({
|
|
98
|
+
hasNext: data.page.has_next ? true : false,
|
|
99
|
+
nextId: data.page.next_id,
|
|
100
|
+
});
|
|
101
|
+
return data;
|
|
102
|
+
};
|
|
103
|
+
paginator.setCallback(callback);
|
|
104
|
+
return paginator;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @param {Object} arg - Arg object.
|
|
109
|
+
* @summary: Get all currencies
|
|
110
|
+
* @description: Get all currencies
|
|
111
|
+
*/
|
|
112
|
+
getCurrencies({} = {}) {
|
|
113
|
+
const { error } = ConfigurationValidator.getCurrencies().validate(
|
|
114
|
+
{},
|
|
115
|
+
{ abortEarly: false, allowUnknown: true }
|
|
116
|
+
);
|
|
117
|
+
if (error) {
|
|
118
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const query_params = {};
|
|
122
|
+
|
|
123
|
+
const xHeaders = {};
|
|
124
|
+
|
|
125
|
+
return PlatformAPIClient.execute(
|
|
126
|
+
this.config,
|
|
127
|
+
"get",
|
|
128
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/currencies`,
|
|
129
|
+
query_params,
|
|
130
|
+
undefined,
|
|
131
|
+
xHeaders
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {Object} arg - Arg object.
|
|
137
|
+
* @param {DomainSuggestionsRequest} arg.body
|
|
138
|
+
* @summary: Check domain availibility before linking to application
|
|
139
|
+
* @description: Check domain availibility before linking to application. Also sends domain suggestions with similar to queried domain. \ Custom domain search is currently powered by GoDaddy provider.
|
|
140
|
+
*/
|
|
141
|
+
getDomainAvailibility({ body } = {}) {
|
|
142
|
+
const { error } = ConfigurationValidator.getDomainAvailibility().validate(
|
|
143
|
+
{
|
|
144
|
+
body,
|
|
145
|
+
},
|
|
146
|
+
{ abortEarly: false, allowUnknown: true }
|
|
147
|
+
);
|
|
148
|
+
if (error) {
|
|
149
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const query_params = {};
|
|
153
|
+
|
|
154
|
+
const xHeaders = {};
|
|
155
|
+
|
|
156
|
+
return PlatformAPIClient.execute(
|
|
157
|
+
this.config,
|
|
158
|
+
"post",
|
|
159
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/domain/suggestions`,
|
|
160
|
+
query_params,
|
|
161
|
+
body,
|
|
162
|
+
xHeaders
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param {Object} arg - Arg object.
|
|
168
|
+
* @param {number} arg.id - Integration id
|
|
169
|
+
* @summary: Get integration data
|
|
170
|
+
* @description: Get integration data
|
|
171
|
+
*/
|
|
172
|
+
getIntegrationById({ id } = {}) {
|
|
173
|
+
const { error } = ConfigurationValidator.getIntegrationById().validate(
|
|
174
|
+
{
|
|
175
|
+
id,
|
|
176
|
+
},
|
|
177
|
+
{ abortEarly: false, allowUnknown: true }
|
|
178
|
+
);
|
|
179
|
+
if (error) {
|
|
180
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const query_params = {};
|
|
184
|
+
|
|
185
|
+
const xHeaders = {};
|
|
186
|
+
|
|
187
|
+
return PlatformAPIClient.execute(
|
|
188
|
+
this.config,
|
|
189
|
+
"get",
|
|
190
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration/${id}`,
|
|
191
|
+
query_params,
|
|
192
|
+
undefined,
|
|
193
|
+
xHeaders
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @param {Object} arg - Arg object.
|
|
199
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
200
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
201
|
+
* @summary: Get all available integration opt-ins
|
|
202
|
+
* @description: Get all available integration opt-ins
|
|
203
|
+
*/
|
|
204
|
+
getAvailableOptIns({ pageNo, pageSize } = {}) {
|
|
205
|
+
const { error } = ConfigurationValidator.getAvailableOptIns().validate(
|
|
206
|
+
{
|
|
207
|
+
pageNo,
|
|
208
|
+
pageSize,
|
|
209
|
+
},
|
|
210
|
+
{ abortEarly: false, allowUnknown: true }
|
|
211
|
+
);
|
|
212
|
+
if (error) {
|
|
213
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const query_params = {};
|
|
217
|
+
query_params["page_no"] = pageNo;
|
|
218
|
+
query_params["page_size"] = pageSize;
|
|
219
|
+
|
|
220
|
+
const xHeaders = {};
|
|
221
|
+
|
|
222
|
+
return PlatformAPIClient.execute(
|
|
223
|
+
this.config,
|
|
224
|
+
"get",
|
|
225
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/available`,
|
|
226
|
+
query_params,
|
|
227
|
+
undefined,
|
|
228
|
+
xHeaders
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @param {Object} arg - Arg object.
|
|
234
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
235
|
+
* @summary: Get all available integration opt-ins
|
|
236
|
+
* @description: Get all available integration opt-ins
|
|
237
|
+
*/
|
|
238
|
+
getAvailableOptInsPaginator({ pageSize } = {}) {
|
|
239
|
+
const paginator = new Paginator();
|
|
240
|
+
const callback = async () => {
|
|
241
|
+
const pageId = paginator.nextId;
|
|
242
|
+
const pageNo = paginator.pageNo;
|
|
243
|
+
const pageType = "number";
|
|
244
|
+
const data = await this.getAvailableOptIns({
|
|
245
|
+
pageNo: pageNo,
|
|
246
|
+
pageSize: pageSize,
|
|
247
|
+
});
|
|
248
|
+
paginator.setPaginator({
|
|
249
|
+
hasNext: data.page.has_next ? true : false,
|
|
250
|
+
nextId: data.page.next_id,
|
|
251
|
+
});
|
|
252
|
+
return data;
|
|
253
|
+
};
|
|
254
|
+
paginator.setCallback(callback);
|
|
255
|
+
return paginator;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* @param {Object} arg - Arg object.
|
|
260
|
+
* @param {string} arg.level - Integration level
|
|
261
|
+
* @param {number} arg.uid - Integration level uid
|
|
262
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
263
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
264
|
+
* @summary: Get company/store level integration opt-ins
|
|
265
|
+
* @description: Get company/store level integration opt-ins
|
|
266
|
+
*/
|
|
267
|
+
getSelectedOptIns({ level, uid, pageNo, pageSize } = {}) {
|
|
268
|
+
const { error } = ConfigurationValidator.getSelectedOptIns().validate(
|
|
269
|
+
{
|
|
270
|
+
level,
|
|
271
|
+
uid,
|
|
272
|
+
pageNo,
|
|
273
|
+
pageSize,
|
|
274
|
+
},
|
|
275
|
+
{ abortEarly: false, allowUnknown: true }
|
|
276
|
+
);
|
|
277
|
+
if (error) {
|
|
278
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const query_params = {};
|
|
282
|
+
query_params["page_no"] = pageNo;
|
|
283
|
+
query_params["page_size"] = pageSize;
|
|
284
|
+
|
|
285
|
+
const xHeaders = {};
|
|
286
|
+
|
|
287
|
+
return PlatformAPIClient.execute(
|
|
288
|
+
this.config,
|
|
289
|
+
"get",
|
|
290
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/selected/${level}/${uid}`,
|
|
291
|
+
query_params,
|
|
292
|
+
undefined,
|
|
293
|
+
xHeaders
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @param {Object} arg - Arg object.
|
|
299
|
+
* @param {string} arg.level - Integration level
|
|
300
|
+
* @param {number} arg.uid - Integration level uid
|
|
301
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
302
|
+
* @summary: Get company/store level integration opt-ins
|
|
303
|
+
* @description: Get company/store level integration opt-ins
|
|
304
|
+
*/
|
|
305
|
+
getSelectedOptInsPaginator({ level, uid, pageSize } = {}) {
|
|
306
|
+
const paginator = new Paginator();
|
|
307
|
+
const callback = async () => {
|
|
308
|
+
const pageId = paginator.nextId;
|
|
309
|
+
const pageNo = paginator.pageNo;
|
|
310
|
+
const pageType = "number";
|
|
311
|
+
const data = await this.getSelectedOptIns({
|
|
312
|
+
level: level,
|
|
313
|
+
uid: uid,
|
|
314
|
+
pageNo: pageNo,
|
|
315
|
+
pageSize: pageSize,
|
|
316
|
+
});
|
|
317
|
+
paginator.setPaginator({
|
|
318
|
+
hasNext: data.page.has_next ? true : false,
|
|
319
|
+
nextId: data.page.next_id,
|
|
320
|
+
});
|
|
321
|
+
return data;
|
|
322
|
+
};
|
|
323
|
+
paginator.setCallback(callback);
|
|
324
|
+
return paginator;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @param {Object} arg - Arg object.
|
|
329
|
+
* @param {string} arg.id - Integration id
|
|
330
|
+
* @param {string} arg.level - Integration level
|
|
331
|
+
* @param {boolean} [arg.opted] - Filter on opted stores
|
|
332
|
+
* @param {boolean} [arg.checkPermission] - Filter on if permissions are present
|
|
333
|
+
* @summary: Get integration level config
|
|
334
|
+
* @description: Get integration/integration-opt-in level config
|
|
335
|
+
*/
|
|
336
|
+
getIntegrationLevelConfig({ id, level, opted, checkPermission } = {}) {
|
|
337
|
+
const {
|
|
338
|
+
error,
|
|
339
|
+
} = ConfigurationValidator.getIntegrationLevelConfig().validate(
|
|
340
|
+
{
|
|
341
|
+
id,
|
|
342
|
+
level,
|
|
343
|
+
opted,
|
|
344
|
+
checkPermission,
|
|
345
|
+
},
|
|
346
|
+
{ abortEarly: false, allowUnknown: true }
|
|
347
|
+
);
|
|
348
|
+
if (error) {
|
|
349
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
const query_params = {};
|
|
353
|
+
query_params["opted"] = opted;
|
|
354
|
+
query_params["check_permission"] = checkPermission;
|
|
355
|
+
|
|
356
|
+
const xHeaders = {};
|
|
357
|
+
|
|
358
|
+
return PlatformAPIClient.execute(
|
|
359
|
+
this.config,
|
|
360
|
+
"get",
|
|
361
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/configuration/${id}/${level}`,
|
|
362
|
+
query_params,
|
|
363
|
+
undefined,
|
|
364
|
+
xHeaders
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @param {Object} arg - Arg object.
|
|
370
|
+
* @param {string} arg.id - Integration id
|
|
371
|
+
* @param {string} arg.level - Integration level
|
|
372
|
+
* @param {UpdateIntegrationLevelRequest} arg.body
|
|
373
|
+
* @summary: Update a store level opt-in for integration
|
|
374
|
+
* @description: Update a store level opt-in for integration
|
|
375
|
+
*/
|
|
376
|
+
updateLevelIntegration({ id, level, body } = {}) {
|
|
377
|
+
const { error } = ConfigurationValidator.updateLevelIntegration().validate(
|
|
378
|
+
{
|
|
379
|
+
id,
|
|
380
|
+
level,
|
|
381
|
+
body,
|
|
382
|
+
},
|
|
383
|
+
{ abortEarly: false, allowUnknown: true }
|
|
384
|
+
);
|
|
385
|
+
if (error) {
|
|
386
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
const query_params = {};
|
|
390
|
+
|
|
391
|
+
const xHeaders = {};
|
|
392
|
+
|
|
393
|
+
return PlatformAPIClient.execute(
|
|
394
|
+
this.config,
|
|
395
|
+
"put",
|
|
396
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/configuration/${id}/${level}`,
|
|
397
|
+
query_params,
|
|
398
|
+
body,
|
|
399
|
+
xHeaders
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @param {Object} arg - Arg object.
|
|
405
|
+
* @param {string} arg.id - Integration id
|
|
406
|
+
* @param {string} arg.level - Integration level
|
|
407
|
+
* @param {number} arg.uid - Integration level uid
|
|
408
|
+
* @summary: Get level data for integration
|
|
409
|
+
* @description: Get level data for integration
|
|
410
|
+
*/
|
|
411
|
+
getIntegrationByLevelId({ id, level, uid } = {}) {
|
|
412
|
+
const { error } = ConfigurationValidator.getIntegrationByLevelId().validate(
|
|
413
|
+
{
|
|
414
|
+
id,
|
|
415
|
+
level,
|
|
416
|
+
uid,
|
|
417
|
+
},
|
|
418
|
+
{ abortEarly: false, allowUnknown: true }
|
|
419
|
+
);
|
|
420
|
+
if (error) {
|
|
421
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const query_params = {};
|
|
425
|
+
|
|
426
|
+
const xHeaders = {};
|
|
427
|
+
|
|
428
|
+
return PlatformAPIClient.execute(
|
|
429
|
+
this.config,
|
|
430
|
+
"get",
|
|
431
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/configuration/${id}/${level}/${uid}`,
|
|
432
|
+
query_params,
|
|
433
|
+
undefined,
|
|
434
|
+
xHeaders
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* @param {Object} arg - Arg object.
|
|
440
|
+
* @param {string} arg.id - Integration id
|
|
441
|
+
* @param {string} arg.level - Integration level
|
|
442
|
+
* @param {number} arg.uid - Integration level uid
|
|
443
|
+
* @param {IntegrationLevel} arg.body
|
|
444
|
+
* @summary: Update a store level opt-in for integration
|
|
445
|
+
* @description: Update a store level opt-in for integration
|
|
446
|
+
*/
|
|
447
|
+
updateLevelUidIntegration({ id, level, uid, body } = {}) {
|
|
448
|
+
const {
|
|
449
|
+
error,
|
|
450
|
+
} = ConfigurationValidator.updateLevelUidIntegration().validate(
|
|
451
|
+
{
|
|
452
|
+
id,
|
|
453
|
+
level,
|
|
454
|
+
uid,
|
|
455
|
+
body,
|
|
456
|
+
},
|
|
457
|
+
{ abortEarly: false, allowUnknown: true }
|
|
458
|
+
);
|
|
459
|
+
if (error) {
|
|
460
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const query_params = {};
|
|
464
|
+
|
|
465
|
+
const xHeaders = {};
|
|
466
|
+
|
|
467
|
+
return PlatformAPIClient.execute(
|
|
468
|
+
this.config,
|
|
469
|
+
"put",
|
|
470
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/configuration/${id}/${level}/${uid}`,
|
|
471
|
+
query_params,
|
|
472
|
+
body,
|
|
473
|
+
xHeaders
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* @param {Object} arg - Arg object.
|
|
479
|
+
* @param {string} arg.id - Integration id
|
|
480
|
+
* @param {string} arg.level - Integration level
|
|
481
|
+
* @param {number} arg.uid - Integration level uid
|
|
482
|
+
* @summary: Check store has active integration
|
|
483
|
+
* @description: API checks if a store is already opted in any other integrations
|
|
484
|
+
*/
|
|
485
|
+
getLevelActiveIntegrations({ id, level, uid } = {}) {
|
|
486
|
+
const {
|
|
487
|
+
error,
|
|
488
|
+
} = ConfigurationValidator.getLevelActiveIntegrations().validate(
|
|
489
|
+
{
|
|
490
|
+
id,
|
|
491
|
+
level,
|
|
492
|
+
uid,
|
|
493
|
+
},
|
|
494
|
+
{ abortEarly: false, allowUnknown: true }
|
|
495
|
+
);
|
|
496
|
+
if (error) {
|
|
497
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const query_params = {};
|
|
501
|
+
|
|
502
|
+
const xHeaders = {};
|
|
503
|
+
|
|
504
|
+
return PlatformAPIClient.execute(
|
|
505
|
+
this.config,
|
|
506
|
+
"get",
|
|
507
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/integration-opt-in/check/configuration/${id}/${level}/${uid}`,
|
|
508
|
+
query_params,
|
|
509
|
+
undefined,
|
|
510
|
+
xHeaders
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* @param {Object} arg - Arg object.
|
|
516
|
+
* @param {string} [arg.q] - Search text for brand name
|
|
517
|
+
* @summary: Get brands by company
|
|
518
|
+
* @description: Get brands by company
|
|
519
|
+
*/
|
|
520
|
+
getBrandsByCompany({ q } = {}) {
|
|
521
|
+
const { error } = ConfigurationValidator.getBrandsByCompany().validate(
|
|
522
|
+
{
|
|
523
|
+
q,
|
|
524
|
+
},
|
|
525
|
+
{ abortEarly: false, allowUnknown: true }
|
|
526
|
+
);
|
|
527
|
+
if (error) {
|
|
528
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
const query_params = {};
|
|
532
|
+
query_params["q"] = q;
|
|
533
|
+
|
|
534
|
+
const xHeaders = {};
|
|
535
|
+
|
|
536
|
+
return PlatformAPIClient.execute(
|
|
537
|
+
this.config,
|
|
538
|
+
"get",
|
|
539
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/inventory/brands-by-companies`,
|
|
540
|
+
query_params,
|
|
541
|
+
undefined,
|
|
542
|
+
xHeaders
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* @param {Object} arg - Arg object.
|
|
548
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
549
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
550
|
+
* @param {CompanyByBrandsRequest} arg.body
|
|
551
|
+
* @summary: Get company by brand uids
|
|
552
|
+
* @description: Get company by brand uids
|
|
553
|
+
*/
|
|
554
|
+
getCompanyByBrands({ body, pageNo, pageSize } = {}) {
|
|
555
|
+
const { error } = ConfigurationValidator.getCompanyByBrands().validate(
|
|
556
|
+
{
|
|
557
|
+
body,
|
|
558
|
+
pageNo,
|
|
559
|
+
pageSize,
|
|
560
|
+
},
|
|
561
|
+
{ abortEarly: false, allowUnknown: true }
|
|
562
|
+
);
|
|
563
|
+
if (error) {
|
|
564
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
const query_params = {};
|
|
568
|
+
query_params["page_no"] = pageNo;
|
|
569
|
+
query_params["page_size"] = pageSize;
|
|
570
|
+
|
|
571
|
+
const xHeaders = {};
|
|
572
|
+
|
|
573
|
+
return PlatformAPIClient.execute(
|
|
574
|
+
this.config,
|
|
575
|
+
"post",
|
|
576
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/inventory/companies-by-brands`,
|
|
577
|
+
query_params,
|
|
578
|
+
body,
|
|
579
|
+
xHeaders
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* @param {Object} arg - Arg object.
|
|
585
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
586
|
+
* @param {CompanyByBrandsRequest} arg.body
|
|
587
|
+
* @summary: Get company by brand uids
|
|
588
|
+
* @description: Get company by brand uids
|
|
589
|
+
*/
|
|
590
|
+
getCompanyByBrandsPaginator({ pageSize, body } = {}) {
|
|
591
|
+
const paginator = new Paginator();
|
|
592
|
+
const callback = async () => {
|
|
593
|
+
const pageId = paginator.nextId;
|
|
594
|
+
const pageNo = paginator.pageNo;
|
|
595
|
+
const pageType = "number";
|
|
596
|
+
const data = await this.getCompanyByBrands({
|
|
597
|
+
body: body,
|
|
598
|
+
pageNo: pageNo,
|
|
599
|
+
pageSize: pageSize,
|
|
600
|
+
});
|
|
601
|
+
paginator.setPaginator({
|
|
602
|
+
hasNext: data.page.has_next ? true : false,
|
|
603
|
+
nextId: data.page.next_id,
|
|
604
|
+
});
|
|
605
|
+
return data;
|
|
606
|
+
};
|
|
607
|
+
paginator.setCallback(callback);
|
|
608
|
+
return paginator;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @param {Object} arg - Arg object.
|
|
613
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
614
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
615
|
+
* @param {StoreByBrandsRequest} arg.body
|
|
616
|
+
* @summary: Get stores by brand uids
|
|
617
|
+
* @description: Get stores by brand uids
|
|
618
|
+
*/
|
|
619
|
+
getStoreByBrands({ body, pageNo, pageSize } = {}) {
|
|
620
|
+
const { error } = ConfigurationValidator.getStoreByBrands().validate(
|
|
621
|
+
{
|
|
622
|
+
body,
|
|
623
|
+
pageNo,
|
|
624
|
+
pageSize,
|
|
625
|
+
},
|
|
626
|
+
{ abortEarly: false, allowUnknown: true }
|
|
627
|
+
);
|
|
628
|
+
if (error) {
|
|
629
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const query_params = {};
|
|
633
|
+
query_params["page_no"] = pageNo;
|
|
634
|
+
query_params["page_size"] = pageSize;
|
|
635
|
+
|
|
636
|
+
const xHeaders = {};
|
|
637
|
+
|
|
638
|
+
return PlatformAPIClient.execute(
|
|
639
|
+
this.config,
|
|
640
|
+
"post",
|
|
641
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/inventory/stores-by-brands`,
|
|
642
|
+
query_params,
|
|
643
|
+
body,
|
|
644
|
+
xHeaders
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* @param {Object} arg - Arg object.
|
|
650
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
651
|
+
* @param {StoreByBrandsRequest} arg.body
|
|
652
|
+
* @summary: Get stores by brand uids
|
|
653
|
+
* @description: Get stores by brand uids
|
|
654
|
+
*/
|
|
655
|
+
getStoreByBrandsPaginator({ pageSize, body } = {}) {
|
|
656
|
+
const paginator = new Paginator();
|
|
657
|
+
const callback = async () => {
|
|
658
|
+
const pageId = paginator.nextId;
|
|
659
|
+
const pageNo = paginator.pageNo;
|
|
660
|
+
const pageType = "number";
|
|
661
|
+
const data = await this.getStoreByBrands({
|
|
662
|
+
body: body,
|
|
663
|
+
pageNo: pageNo,
|
|
664
|
+
pageSize: pageSize,
|
|
665
|
+
});
|
|
666
|
+
paginator.setPaginator({
|
|
667
|
+
hasNext: data.page.has_next ? true : false,
|
|
668
|
+
nextId: data.page.next_id,
|
|
669
|
+
});
|
|
670
|
+
return data;
|
|
671
|
+
};
|
|
672
|
+
paginator.setCallback(callback);
|
|
673
|
+
return paginator;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* @param {Object} arg - Arg object.
|
|
678
|
+
* @param {number} [arg.pageNo] - Current page no
|
|
679
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
680
|
+
* @summary: Get other seller applications
|
|
681
|
+
* @description: Get other seller applications who has opted current company as inventory
|
|
682
|
+
*/
|
|
683
|
+
getOtherSellerApplications({ pageNo, pageSize } = {}) {
|
|
684
|
+
const {
|
|
685
|
+
error,
|
|
686
|
+
} = ConfigurationValidator.getOtherSellerApplications().validate(
|
|
687
|
+
{
|
|
688
|
+
pageNo,
|
|
689
|
+
pageSize,
|
|
690
|
+
},
|
|
691
|
+
{ abortEarly: false, allowUnknown: true }
|
|
692
|
+
);
|
|
693
|
+
if (error) {
|
|
694
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
const query_params = {};
|
|
698
|
+
query_params["page_no"] = pageNo;
|
|
699
|
+
query_params["page_size"] = pageSize;
|
|
700
|
+
|
|
701
|
+
const xHeaders = {};
|
|
702
|
+
|
|
703
|
+
return PlatformAPIClient.execute(
|
|
704
|
+
this.config,
|
|
705
|
+
"get",
|
|
706
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/other-seller-applications/`,
|
|
707
|
+
query_params,
|
|
708
|
+
undefined,
|
|
709
|
+
xHeaders
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* @param {Object} arg - Arg object.
|
|
715
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
716
|
+
* @summary: Get other seller applications
|
|
717
|
+
* @description: Get other seller applications who has opted current company as inventory
|
|
718
|
+
*/
|
|
719
|
+
getOtherSellerApplicationsPaginator({ pageSize } = {}) {
|
|
720
|
+
const paginator = new Paginator();
|
|
721
|
+
const callback = async () => {
|
|
722
|
+
const pageId = paginator.nextId;
|
|
723
|
+
const pageNo = paginator.pageNo;
|
|
724
|
+
const pageType = "number";
|
|
725
|
+
const data = await this.getOtherSellerApplications({
|
|
726
|
+
pageNo: pageNo,
|
|
727
|
+
pageSize: pageSize,
|
|
728
|
+
});
|
|
729
|
+
paginator.setPaginator({
|
|
730
|
+
hasNext: data.page.has_next ? true : false,
|
|
731
|
+
nextId: data.page.next_id,
|
|
732
|
+
});
|
|
733
|
+
return data;
|
|
734
|
+
};
|
|
735
|
+
paginator.setCallback(callback);
|
|
736
|
+
return paginator;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* @param {Object} arg - Arg object.
|
|
741
|
+
* @param {string} arg.id - Application Id
|
|
742
|
+
* @summary: Get other seller applications
|
|
743
|
+
* @description: Get other seller application
|
|
744
|
+
*/
|
|
745
|
+
getOtherSellerApplicationById({ id } = {}) {
|
|
746
|
+
const {
|
|
747
|
+
error,
|
|
748
|
+
} = ConfigurationValidator.getOtherSellerApplicationById().validate(
|
|
749
|
+
{
|
|
750
|
+
id,
|
|
751
|
+
},
|
|
752
|
+
{ abortEarly: false, allowUnknown: true }
|
|
753
|
+
);
|
|
754
|
+
if (error) {
|
|
755
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
const query_params = {};
|
|
759
|
+
|
|
760
|
+
const xHeaders = {};
|
|
761
|
+
|
|
762
|
+
return PlatformAPIClient.execute(
|
|
763
|
+
this.config,
|
|
764
|
+
"get",
|
|
765
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/other-seller-applications/${id}`,
|
|
766
|
+
query_params,
|
|
767
|
+
undefined,
|
|
768
|
+
xHeaders
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* @param {Object} arg - Arg object.
|
|
774
|
+
* @param {string} arg.id - Application Id
|
|
775
|
+
* @param {OptOutInventory} arg.body
|
|
776
|
+
* @summary: Opt out company or store from other seller application
|
|
777
|
+
* @description: Opt out company or store from other seller application
|
|
778
|
+
*/
|
|
779
|
+
optOutFromApplication({ id, body } = {}) {
|
|
780
|
+
const { error } = ConfigurationValidator.optOutFromApplication().validate(
|
|
781
|
+
{
|
|
782
|
+
id,
|
|
783
|
+
body,
|
|
784
|
+
},
|
|
785
|
+
{ abortEarly: false, allowUnknown: true }
|
|
786
|
+
);
|
|
787
|
+
if (error) {
|
|
788
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
const query_params = {};
|
|
792
|
+
|
|
793
|
+
const xHeaders = {};
|
|
794
|
+
|
|
795
|
+
return PlatformAPIClient.execute(
|
|
796
|
+
this.config,
|
|
797
|
+
"put",
|
|
798
|
+
`/service/platform/configuration/v1.0/company/${this.config.companyId}/other-seller-applications/${id}/opt_out`,
|
|
799
|
+
query_params,
|
|
800
|
+
body,
|
|
801
|
+
xHeaders
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
module.exports = Configuration;
|