@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,540 @@
|
|
|
1
|
+
const Paginator = require("../../common/Paginator");
|
|
2
|
+
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
|
+
const CompanyProfileValidator = require("../models/CompanyProfileValidator");
|
|
5
|
+
class CompanyProfile {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.config = config;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {Object} arg - Arg object.
|
|
12
|
+
* @summary: Get company profile
|
|
13
|
+
* @description: This API allows to view the company profile of the seller account.
|
|
14
|
+
*/
|
|
15
|
+
cbsOnboardGet({} = {}) {
|
|
16
|
+
const { error } = CompanyProfileValidator.cbsOnboardGet().validate(
|
|
17
|
+
{},
|
|
18
|
+
{ abortEarly: false, allowUnknown: true }
|
|
19
|
+
);
|
|
20
|
+
if (error) {
|
|
21
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const query_params = {};
|
|
25
|
+
|
|
26
|
+
const xHeaders = {};
|
|
27
|
+
|
|
28
|
+
return PlatformAPIClient.execute(
|
|
29
|
+
this.config,
|
|
30
|
+
"get",
|
|
31
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}`,
|
|
32
|
+
query_params,
|
|
33
|
+
undefined,
|
|
34
|
+
xHeaders
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {Object} arg - Arg object.
|
|
40
|
+
* @param {UpdateCompany} arg.body
|
|
41
|
+
* @summary: Edit company profile
|
|
42
|
+
* @description: This API allows to edit the company profile of the seller account.
|
|
43
|
+
*/
|
|
44
|
+
updateCompany({ body } = {}) {
|
|
45
|
+
const { error } = CompanyProfileValidator.updateCompany().validate(
|
|
46
|
+
{
|
|
47
|
+
body,
|
|
48
|
+
},
|
|
49
|
+
{ abortEarly: false, allowUnknown: true }
|
|
50
|
+
);
|
|
51
|
+
if (error) {
|
|
52
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const query_params = {};
|
|
56
|
+
|
|
57
|
+
const xHeaders = {};
|
|
58
|
+
|
|
59
|
+
return PlatformAPIClient.execute(
|
|
60
|
+
this.config,
|
|
61
|
+
"patch",
|
|
62
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}`,
|
|
63
|
+
query_params,
|
|
64
|
+
body,
|
|
65
|
+
xHeaders
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param {Object} arg - Arg object.
|
|
71
|
+
* @summary: Get company metrics
|
|
72
|
+
* @description: This API allows to view the company metrics, i.e. the status of its brand and stores. Also its allows to view the number of products, company documents & store documents which are verified and unverified.
|
|
73
|
+
*/
|
|
74
|
+
getCompanyMetrics({} = {}) {
|
|
75
|
+
const { error } = CompanyProfileValidator.getCompanyMetrics().validate(
|
|
76
|
+
{},
|
|
77
|
+
{ abortEarly: false, allowUnknown: true }
|
|
78
|
+
);
|
|
79
|
+
if (error) {
|
|
80
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const query_params = {};
|
|
84
|
+
|
|
85
|
+
const xHeaders = {};
|
|
86
|
+
|
|
87
|
+
return PlatformAPIClient.execute(
|
|
88
|
+
this.config,
|
|
89
|
+
"get",
|
|
90
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/metrics`,
|
|
91
|
+
query_params,
|
|
92
|
+
undefined,
|
|
93
|
+
xHeaders
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param {Object} arg - Arg object.
|
|
99
|
+
* @param {string} arg.brandId - Id of the brand to be viewed.
|
|
100
|
+
* @summary: Get a single brand.
|
|
101
|
+
* @description: This API helps to get data associated to a particular brand.
|
|
102
|
+
*/
|
|
103
|
+
getBrand({ brandId } = {}) {
|
|
104
|
+
const { error } = CompanyProfileValidator.getBrand().validate(
|
|
105
|
+
{
|
|
106
|
+
brandId,
|
|
107
|
+
},
|
|
108
|
+
{ abortEarly: false, allowUnknown: true }
|
|
109
|
+
);
|
|
110
|
+
if (error) {
|
|
111
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const query_params = {};
|
|
115
|
+
|
|
116
|
+
const xHeaders = {};
|
|
117
|
+
|
|
118
|
+
return PlatformAPIClient.execute(
|
|
119
|
+
this.config,
|
|
120
|
+
"get",
|
|
121
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/${brandId}`,
|
|
122
|
+
query_params,
|
|
123
|
+
undefined,
|
|
124
|
+
xHeaders
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {Object} arg - Arg object.
|
|
130
|
+
* @param {string} arg.brandId - Id of the brand to be viewed.
|
|
131
|
+
* @param {CreateUpdateBrandRequestSerializer} arg.body
|
|
132
|
+
* @summary: Edit a brand.
|
|
133
|
+
* @description: This API allows to edit meta of a brand.
|
|
134
|
+
*/
|
|
135
|
+
editBrand({ brandId, body } = {}) {
|
|
136
|
+
const { error } = CompanyProfileValidator.editBrand().validate(
|
|
137
|
+
{
|
|
138
|
+
brandId,
|
|
139
|
+
body,
|
|
140
|
+
},
|
|
141
|
+
{ abortEarly: false, allowUnknown: true }
|
|
142
|
+
);
|
|
143
|
+
if (error) {
|
|
144
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const query_params = {};
|
|
148
|
+
|
|
149
|
+
const xHeaders = {};
|
|
150
|
+
|
|
151
|
+
return PlatformAPIClient.execute(
|
|
152
|
+
this.config,
|
|
153
|
+
"put",
|
|
154
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/${brandId}`,
|
|
155
|
+
query_params,
|
|
156
|
+
body,
|
|
157
|
+
xHeaders
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {Object} arg - Arg object.
|
|
163
|
+
* @param {CreateUpdateBrandRequestSerializer} arg.body
|
|
164
|
+
* @summary: Create a Brand.
|
|
165
|
+
* @description: This API allows to create a brand associated to a company.
|
|
166
|
+
*/
|
|
167
|
+
createBrand({ body } = {}) {
|
|
168
|
+
const { error } = CompanyProfileValidator.createBrand().validate(
|
|
169
|
+
{
|
|
170
|
+
body,
|
|
171
|
+
},
|
|
172
|
+
{ abortEarly: false, allowUnknown: true }
|
|
173
|
+
);
|
|
174
|
+
if (error) {
|
|
175
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const query_params = {};
|
|
179
|
+
|
|
180
|
+
const xHeaders = {};
|
|
181
|
+
|
|
182
|
+
return PlatformAPIClient.execute(
|
|
183
|
+
this.config,
|
|
184
|
+
"post",
|
|
185
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/`,
|
|
186
|
+
query_params,
|
|
187
|
+
body,
|
|
188
|
+
xHeaders
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @param {Object} arg - Arg object.
|
|
194
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
195
|
+
* given set of results
|
|
196
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
197
|
+
* page. Default is 10.
|
|
198
|
+
* @param {string} [arg.q] - Search term for name.
|
|
199
|
+
* @summary: Get brands associated to a company
|
|
200
|
+
* @description: This API helps to get view brands associated to a particular company.
|
|
201
|
+
*/
|
|
202
|
+
getBrands({ pageNo, pageSize, q } = {}) {
|
|
203
|
+
const { error } = CompanyProfileValidator.getBrands().validate(
|
|
204
|
+
{
|
|
205
|
+
pageNo,
|
|
206
|
+
pageSize,
|
|
207
|
+
q,
|
|
208
|
+
},
|
|
209
|
+
{ abortEarly: false, allowUnknown: true }
|
|
210
|
+
);
|
|
211
|
+
if (error) {
|
|
212
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const query_params = {};
|
|
216
|
+
query_params["page_no"] = pageNo;
|
|
217
|
+
query_params["page_size"] = pageSize;
|
|
218
|
+
query_params["q"] = q;
|
|
219
|
+
|
|
220
|
+
const xHeaders = {};
|
|
221
|
+
|
|
222
|
+
return PlatformAPIClient.execute(
|
|
223
|
+
this.config,
|
|
224
|
+
"get",
|
|
225
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/company-brand`,
|
|
226
|
+
query_params,
|
|
227
|
+
undefined,
|
|
228
|
+
xHeaders
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @param {Object} arg - Arg object.
|
|
234
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
235
|
+
* page. Default is 10.
|
|
236
|
+
* @param {string} [arg.q] - Search term for name.
|
|
237
|
+
* @summary: Get brands associated to a company
|
|
238
|
+
* @description: This API helps to get view brands associated to a particular company.
|
|
239
|
+
*/
|
|
240
|
+
getBrandsPaginator({ pageSize, q } = {}) {
|
|
241
|
+
const paginator = new Paginator();
|
|
242
|
+
const callback = async () => {
|
|
243
|
+
const pageId = paginator.nextId;
|
|
244
|
+
const pageNo = paginator.pageNo;
|
|
245
|
+
const pageType = "number";
|
|
246
|
+
const data = await this.getBrands({
|
|
247
|
+
pageNo: pageNo,
|
|
248
|
+
pageSize: pageSize,
|
|
249
|
+
q: q,
|
|
250
|
+
});
|
|
251
|
+
paginator.setPaginator({
|
|
252
|
+
hasNext: data.page.has_next ? true : false,
|
|
253
|
+
nextId: data.page.next_id,
|
|
254
|
+
});
|
|
255
|
+
return data;
|
|
256
|
+
};
|
|
257
|
+
paginator.setCallback(callback);
|
|
258
|
+
return paginator;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* @param {Object} arg - Arg object.
|
|
263
|
+
* @param {CompanyBrandPostRequestSerializer} arg.body
|
|
264
|
+
* @summary: Create a company brand mapping.
|
|
265
|
+
* @description: This API allows to create a company brand mapping, for a already existing brand in the system.
|
|
266
|
+
*/
|
|
267
|
+
createCompanyBrandMapping({ body } = {}) {
|
|
268
|
+
const {
|
|
269
|
+
error,
|
|
270
|
+
} = CompanyProfileValidator.createCompanyBrandMapping().validate(
|
|
271
|
+
{
|
|
272
|
+
body,
|
|
273
|
+
},
|
|
274
|
+
{ abortEarly: false, allowUnknown: true }
|
|
275
|
+
);
|
|
276
|
+
if (error) {
|
|
277
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const query_params = {};
|
|
281
|
+
|
|
282
|
+
const xHeaders = {};
|
|
283
|
+
|
|
284
|
+
return PlatformAPIClient.execute(
|
|
285
|
+
this.config,
|
|
286
|
+
"post",
|
|
287
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/company-brand`,
|
|
288
|
+
query_params,
|
|
289
|
+
body,
|
|
290
|
+
xHeaders
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* @param {Object} arg - Arg object.
|
|
296
|
+
* @param {string} [arg.storeType] - Helps to sort the location list on the
|
|
297
|
+
* basis of location type.
|
|
298
|
+
* @param {string} [arg.q] - Query that is to be searched.
|
|
299
|
+
* @param {string} [arg.stage] - To filter companies on basis of verified or
|
|
300
|
+
* unverified companies.
|
|
301
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
302
|
+
* given set of results
|
|
303
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
304
|
+
* page. Default is 10.
|
|
305
|
+
* @param {number[]} [arg.locationIds] - Helps to filter stores on the basis of uids.
|
|
306
|
+
* @summary: Get list of locations
|
|
307
|
+
* @description: This API allows to view all the locations associated to a company.
|
|
308
|
+
*/
|
|
309
|
+
getLocations({ storeType, q, stage, pageNo, pageSize, locationIds } = {}) {
|
|
310
|
+
const { error } = CompanyProfileValidator.getLocations().validate(
|
|
311
|
+
{
|
|
312
|
+
storeType,
|
|
313
|
+
q,
|
|
314
|
+
stage,
|
|
315
|
+
pageNo,
|
|
316
|
+
pageSize,
|
|
317
|
+
locationIds,
|
|
318
|
+
},
|
|
319
|
+
{ abortEarly: false, allowUnknown: true }
|
|
320
|
+
);
|
|
321
|
+
if (error) {
|
|
322
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const query_params = {};
|
|
326
|
+
query_params["store_type"] = storeType;
|
|
327
|
+
query_params["q"] = q;
|
|
328
|
+
query_params["stage"] = stage;
|
|
329
|
+
query_params["page_no"] = pageNo;
|
|
330
|
+
query_params["page_size"] = pageSize;
|
|
331
|
+
query_params["location_ids"] = locationIds;
|
|
332
|
+
|
|
333
|
+
const xHeaders = {};
|
|
334
|
+
|
|
335
|
+
return PlatformAPIClient.execute(
|
|
336
|
+
this.config,
|
|
337
|
+
"get",
|
|
338
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location`,
|
|
339
|
+
query_params,
|
|
340
|
+
undefined,
|
|
341
|
+
xHeaders
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @param {Object} arg - Arg object.
|
|
347
|
+
* @param {string} [arg.storeType] - Helps to sort the location list on the
|
|
348
|
+
* basis of location type.
|
|
349
|
+
* @param {string} [arg.q] - Query that is to be searched.
|
|
350
|
+
* @param {string} [arg.stage] - To filter companies on basis of verified or
|
|
351
|
+
* unverified companies.
|
|
352
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
353
|
+
* page. Default is 10.
|
|
354
|
+
* @param {number[]} [arg.locationIds] - Helps to filter stores on the basis of uids.
|
|
355
|
+
* @summary: Get list of locations
|
|
356
|
+
* @description: This API allows to view all the locations associated to a company.
|
|
357
|
+
*/
|
|
358
|
+
getLocationsPaginator({ storeType, q, stage, pageSize, locationIds } = {}) {
|
|
359
|
+
const paginator = new Paginator();
|
|
360
|
+
const callback = async () => {
|
|
361
|
+
const pageId = paginator.nextId;
|
|
362
|
+
const pageNo = paginator.pageNo;
|
|
363
|
+
const pageType = "number";
|
|
364
|
+
const data = await this.getLocations({
|
|
365
|
+
storeType: storeType,
|
|
366
|
+
q: q,
|
|
367
|
+
stage: stage,
|
|
368
|
+
pageNo: pageNo,
|
|
369
|
+
pageSize: pageSize,
|
|
370
|
+
locationIds: locationIds,
|
|
371
|
+
});
|
|
372
|
+
paginator.setPaginator({
|
|
373
|
+
hasNext: data.page.has_next ? true : false,
|
|
374
|
+
nextId: data.page.next_id,
|
|
375
|
+
});
|
|
376
|
+
return data;
|
|
377
|
+
};
|
|
378
|
+
paginator.setCallback(callback);
|
|
379
|
+
return paginator;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @param {Object} arg - Arg object.
|
|
384
|
+
* @param {LocationSerializer} arg.body
|
|
385
|
+
* @summary: Create a location associated to a company.
|
|
386
|
+
* @description: This API allows to edit a location associated to a company.
|
|
387
|
+
*/
|
|
388
|
+
createLocation({ body } = {}) {
|
|
389
|
+
const { error } = CompanyProfileValidator.createLocation().validate(
|
|
390
|
+
{
|
|
391
|
+
body,
|
|
392
|
+
},
|
|
393
|
+
{ abortEarly: false, allowUnknown: true }
|
|
394
|
+
);
|
|
395
|
+
if (error) {
|
|
396
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const query_params = {};
|
|
400
|
+
|
|
401
|
+
const xHeaders = {};
|
|
402
|
+
|
|
403
|
+
return PlatformAPIClient.execute(
|
|
404
|
+
this.config,
|
|
405
|
+
"post",
|
|
406
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location`,
|
|
407
|
+
query_params,
|
|
408
|
+
body,
|
|
409
|
+
xHeaders
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @param {Object} arg - Arg object.
|
|
415
|
+
* @param {string} arg.locationId - Id of the location which you want to view.
|
|
416
|
+
* @summary: Get details of a specific location.
|
|
417
|
+
* @description: This API helps to get data associated to a specific location.
|
|
418
|
+
*/
|
|
419
|
+
getLocationDetail({ locationId } = {}) {
|
|
420
|
+
const { error } = CompanyProfileValidator.getLocationDetail().validate(
|
|
421
|
+
{
|
|
422
|
+
locationId,
|
|
423
|
+
},
|
|
424
|
+
{ abortEarly: false, allowUnknown: true }
|
|
425
|
+
);
|
|
426
|
+
if (error) {
|
|
427
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
const query_params = {};
|
|
431
|
+
|
|
432
|
+
const xHeaders = {};
|
|
433
|
+
|
|
434
|
+
return PlatformAPIClient.execute(
|
|
435
|
+
this.config,
|
|
436
|
+
"get",
|
|
437
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/${locationId}`,
|
|
438
|
+
query_params,
|
|
439
|
+
undefined,
|
|
440
|
+
xHeaders
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @param {Object} arg - Arg object.
|
|
446
|
+
* @param {string} arg.locationId - Id of the location which you want to edit.
|
|
447
|
+
* @param {LocationSerializer} arg.body
|
|
448
|
+
* @summary: Edit a location asscoiated to a company.
|
|
449
|
+
* @description: This API allows to edit a location associated to a company.
|
|
450
|
+
*/
|
|
451
|
+
updateLocation({ locationId, body } = {}) {
|
|
452
|
+
const { error } = CompanyProfileValidator.updateLocation().validate(
|
|
453
|
+
{
|
|
454
|
+
locationId,
|
|
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/company-profile/v1.0/company/${this.config.companyId}/location/${locationId}`,
|
|
471
|
+
query_params,
|
|
472
|
+
body,
|
|
473
|
+
xHeaders
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* @param {Object} arg - Arg object.
|
|
479
|
+
* @param {BulkLocationSerializer} arg.body
|
|
480
|
+
* @summary: Create a location asscoiated to a company in bulk.
|
|
481
|
+
* @description: This API allows to create a location associated to a company.
|
|
482
|
+
*/
|
|
483
|
+
createLocationBulk({ body } = {}) {
|
|
484
|
+
const { error } = CompanyProfileValidator.createLocationBulk().validate(
|
|
485
|
+
{
|
|
486
|
+
body,
|
|
487
|
+
},
|
|
488
|
+
{ abortEarly: false, allowUnknown: true }
|
|
489
|
+
);
|
|
490
|
+
if (error) {
|
|
491
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const query_params = {};
|
|
495
|
+
|
|
496
|
+
const xHeaders = {};
|
|
497
|
+
|
|
498
|
+
return PlatformAPIClient.execute(
|
|
499
|
+
this.config,
|
|
500
|
+
"post",
|
|
501
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/bulk`,
|
|
502
|
+
query_params,
|
|
503
|
+
body,
|
|
504
|
+
xHeaders
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* @param {Object} arg - Arg object.
|
|
510
|
+
* @param {AssignStoreRequestValidator} arg.body
|
|
511
|
+
* @summary: Location Reassignment
|
|
512
|
+
* @description:
|
|
513
|
+
*/
|
|
514
|
+
getOptimalLocations({ body } = {}) {
|
|
515
|
+
const { error } = CompanyProfileValidator.getOptimalLocations().validate(
|
|
516
|
+
{
|
|
517
|
+
body,
|
|
518
|
+
},
|
|
519
|
+
{ abortEarly: false, allowUnknown: true }
|
|
520
|
+
);
|
|
521
|
+
if (error) {
|
|
522
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
const query_params = {};
|
|
526
|
+
|
|
527
|
+
const xHeaders = {};
|
|
528
|
+
|
|
529
|
+
return PlatformAPIClient.execute(
|
|
530
|
+
this.config,
|
|
531
|
+
"post",
|
|
532
|
+
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/reassign`,
|
|
533
|
+
query_params,
|
|
534
|
+
body,
|
|
535
|
+
xHeaders
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
module.exports = CompanyProfile;
|