@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 = Configuration;
|
|
2
|
+
declare class Configuration {
|
|
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,102 @@
|
|
|
1
|
+
const PublicAPIClient = require("../PublicAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const ConfigurationValidator = require("../models/ConfigurationValidator");
|
|
5
|
+
class Configuration {
|
|
6
|
+
constructor(_conf) {
|
|
7
|
+
this._conf = _conf;
|
|
8
|
+
this._relativeUrls = {
|
|
9
|
+
searchApplication:
|
|
10
|
+
"/service/common/configuration/v1.0/application/search-application",
|
|
11
|
+
getLocations: "/service/common/configuration/v1.0/location",
|
|
12
|
+
};
|
|
13
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
14
|
+
(urls, [method, relativeUrl]) => {
|
|
15
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
16
|
+
return urls;
|
|
17
|
+
},
|
|
18
|
+
{}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
updateUrls(urls) {
|
|
23
|
+
this._urls = {
|
|
24
|
+
...this._urls,
|
|
25
|
+
...urls,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {Object} arg - Arg object.
|
|
31
|
+
* @param {string} [arg.authorization] -
|
|
32
|
+
* @param {string} [arg.query] - Provide application name
|
|
33
|
+
* @returns {Promise<ApplicationResponse>} - Success response
|
|
34
|
+
* @summary: Search Application
|
|
35
|
+
* @description: Provide application name or domain url
|
|
36
|
+
*/
|
|
37
|
+
searchApplication({ authorization, query } = {}) {
|
|
38
|
+
const { error } = ConfigurationValidator.searchApplication().validate(
|
|
39
|
+
{ authorization, query },
|
|
40
|
+
{ abortEarly: false, allowUnknown: true }
|
|
41
|
+
);
|
|
42
|
+
if (error) {
|
|
43
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
44
|
+
}
|
|
45
|
+
const query_params = {};
|
|
46
|
+
query_params["query"] = query;
|
|
47
|
+
|
|
48
|
+
const xHeaders = {};
|
|
49
|
+
xHeaders["authorization"] = authorization;
|
|
50
|
+
|
|
51
|
+
return PublicAPIClient.execute(
|
|
52
|
+
this._conf,
|
|
53
|
+
"get",
|
|
54
|
+
constructUrl({
|
|
55
|
+
url: this._urls["searchApplication"],
|
|
56
|
+
params: {},
|
|
57
|
+
}),
|
|
58
|
+
query_params,
|
|
59
|
+
undefined,
|
|
60
|
+
xHeaders
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Object} arg - Arg object.
|
|
66
|
+
* @param {string} [arg.locationType] - Provide location type to query on.
|
|
67
|
+
* Possible values : country, state, city
|
|
68
|
+
* @param {string} [arg.id] - Field is optional when location_type is
|
|
69
|
+
* country. If querying for state, provide id of country. If querying for
|
|
70
|
+
* city, provide id of state.
|
|
71
|
+
* @returns {Promise<Locations>} - Success response
|
|
72
|
+
* @summary: Get countries, states, cities
|
|
73
|
+
* @description:
|
|
74
|
+
*/
|
|
75
|
+
getLocations({ locationType, id } = {}) {
|
|
76
|
+
const { error } = ConfigurationValidator.getLocations().validate(
|
|
77
|
+
{ locationType, id },
|
|
78
|
+
{ abortEarly: false, allowUnknown: true }
|
|
79
|
+
);
|
|
80
|
+
if (error) {
|
|
81
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
82
|
+
}
|
|
83
|
+
const query_params = {};
|
|
84
|
+
query_params["location_type"] = locationType;
|
|
85
|
+
query_params["id"] = id;
|
|
86
|
+
|
|
87
|
+
const xHeaders = {};
|
|
88
|
+
|
|
89
|
+
return PublicAPIClient.execute(
|
|
90
|
+
this._conf,
|
|
91
|
+
"get",
|
|
92
|
+
constructUrl({
|
|
93
|
+
url: this._urls["getLocations"],
|
|
94
|
+
params: {},
|
|
95
|
+
}),
|
|
96
|
+
query_params,
|
|
97
|
+
undefined,
|
|
98
|
+
xHeaders
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
module.exports = Configuration;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export = Inventory;
|
|
2
|
+
declare class Inventory {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getJobCodesMetrics: string;
|
|
7
|
+
saveJobCodesMetrics: string;
|
|
8
|
+
getConfigByApiKey: string;
|
|
9
|
+
getApiKey: string;
|
|
10
|
+
getJobByCode: string;
|
|
11
|
+
getJobConfigByIntegrationType: string;
|
|
12
|
+
};
|
|
13
|
+
_urls: {};
|
|
14
|
+
updateUrls(urls: any): void;
|
|
15
|
+
/**
|
|
16
|
+
* @param {Object} arg - Arg object.
|
|
17
|
+
* @param {boolean} [arg.dailyJob] - Daily Job Flag
|
|
18
|
+
* @param {string} [arg.jobCode] - Email Job Code
|
|
19
|
+
* @returns {Promise<ResponseEnvelopeObject>} - Success response
|
|
20
|
+
* @summary: Find all the JobCodes from Metrics Collection based on the field Values
|
|
21
|
+
* @description: Endpoint to return all JobCodes present in Metrics Collection
|
|
22
|
+
*/
|
|
23
|
+
getJobCodesMetrics({ dailyJob, jobCode }?: {
|
|
24
|
+
dailyJob?: boolean;
|
|
25
|
+
jobCode?: string;
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
/**
|
|
28
|
+
* @param {Object} arg - Arg object.
|
|
29
|
+
* @param {EmailJobMetrics} arg.body
|
|
30
|
+
* @returns {Promise<ResponseEnvelopeEmailJobMetrics>} - Success response
|
|
31
|
+
* @summary: Save JobCode Metrics
|
|
32
|
+
* @description: Endpoint to save JobCode Metrics
|
|
33
|
+
*/
|
|
34
|
+
saveJobCodesMetrics({ body }?: {
|
|
35
|
+
body: any;
|
|
36
|
+
}): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* @param {Object} arg - Arg object.
|
|
39
|
+
* @param {string} arg.apikey - Api key
|
|
40
|
+
* @returns {Promise<ResponseEnvelopeSlingshotConfigurationDetail>} - Success response
|
|
41
|
+
* @summary: Get Slingshot Configuration Of A Company using API key
|
|
42
|
+
* @description: REST Endpoint that returns all configuration detail of a company
|
|
43
|
+
*/
|
|
44
|
+
getConfigByApiKey({ apikey }?: {
|
|
45
|
+
apikey: string;
|
|
46
|
+
}): Promise<any>;
|
|
47
|
+
/**
|
|
48
|
+
* @param {Object} arg - Arg object.
|
|
49
|
+
* @param {string} arg.userName - Integration id
|
|
50
|
+
* @param {string} arg.password - Company/store token
|
|
51
|
+
* @returns {Promise<ResponseEnvelopeApikeyModel>} - Success response
|
|
52
|
+
* @summary: Get apikey for Company to call other Slingshot Configuration APIs
|
|
53
|
+
* @description: REST Endpoint that returns apikey by username by password
|
|
54
|
+
*/
|
|
55
|
+
getApiKey({ userName, password }?: {
|
|
56
|
+
userName: string;
|
|
57
|
+
password: string;
|
|
58
|
+
}): Promise<any>;
|
|
59
|
+
/**
|
|
60
|
+
* @param {Object} arg - Arg object.
|
|
61
|
+
* @param {string} arg.code - Job Code
|
|
62
|
+
* @returns {Promise<ResponseEnvelopeJobConfigDTO>} - Success response
|
|
63
|
+
* @summary: Get Job Config By Code
|
|
64
|
+
* @description: REST Endpoint that returns job config by code
|
|
65
|
+
*/
|
|
66
|
+
getJobByCode({ code }?: {
|
|
67
|
+
code: string;
|
|
68
|
+
}): Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* @param {Object} arg - Arg object.
|
|
71
|
+
* @param {string} arg.integrationType - Integration Type
|
|
72
|
+
* @param {boolean} [arg.disable] - JobConfig current state
|
|
73
|
+
* @returns {Promise<ResponseEnvelopeListJobConfigDTO>} - Success response
|
|
74
|
+
* @summary: Get Job Configs By Integration Type
|
|
75
|
+
* @description: REST Endpoint that returns all job Configs by Integration Type
|
|
76
|
+
*/
|
|
77
|
+
getJobConfigByIntegrationType({ integrationType, disable }?: {
|
|
78
|
+
integrationType: string;
|
|
79
|
+
disable?: boolean;
|
|
80
|
+
}): Promise<any>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
const PublicAPIClient = require("../PublicAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const InventoryValidator = require("../models/InventoryValidator");
|
|
5
|
+
class Inventory {
|
|
6
|
+
constructor(_conf) {
|
|
7
|
+
this._conf = _conf;
|
|
8
|
+
this._relativeUrls = {
|
|
9
|
+
getJobCodesMetrics:
|
|
10
|
+
"/service/common/inventory/v1.0/company/email/jobCode",
|
|
11
|
+
saveJobCodesMetrics:
|
|
12
|
+
"/service/common/inventory/v1.0/company/email/jobCode",
|
|
13
|
+
getConfigByApiKey: "/service/common/inventory/v1.0/company/slingshot",
|
|
14
|
+
getApiKey: "/service/common/inventory/v1.0/company/slingshot/apikey",
|
|
15
|
+
getJobByCode: "/service/common/inventory/v1.0/company/jobs/code/{code}",
|
|
16
|
+
getJobConfigByIntegrationType:
|
|
17
|
+
"/service/common/inventory/v1.0/company/job/config",
|
|
18
|
+
};
|
|
19
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
20
|
+
(urls, [method, relativeUrl]) => {
|
|
21
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
22
|
+
return urls;
|
|
23
|
+
},
|
|
24
|
+
{}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
updateUrls(urls) {
|
|
29
|
+
this._urls = {
|
|
30
|
+
...this._urls,
|
|
31
|
+
...urls,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {Object} arg - Arg object.
|
|
37
|
+
* @param {boolean} [arg.dailyJob] - Daily Job Flag
|
|
38
|
+
* @param {string} [arg.jobCode] - Email Job Code
|
|
39
|
+
* @returns {Promise<ResponseEnvelopeObject>} - Success response
|
|
40
|
+
* @summary: Find all the JobCodes from Metrics Collection based on the field Values
|
|
41
|
+
* @description: Endpoint to return all JobCodes present in Metrics Collection
|
|
42
|
+
*/
|
|
43
|
+
getJobCodesMetrics({ dailyJob, jobCode } = {}) {
|
|
44
|
+
const { error } = InventoryValidator.getJobCodesMetrics().validate(
|
|
45
|
+
{ dailyJob, jobCode },
|
|
46
|
+
{ abortEarly: false, allowUnknown: true }
|
|
47
|
+
);
|
|
48
|
+
if (error) {
|
|
49
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
50
|
+
}
|
|
51
|
+
const query_params = {};
|
|
52
|
+
query_params["daily_job"] = dailyJob;
|
|
53
|
+
query_params["job_code"] = jobCode;
|
|
54
|
+
|
|
55
|
+
const xHeaders = {};
|
|
56
|
+
|
|
57
|
+
return PublicAPIClient.execute(
|
|
58
|
+
this._conf,
|
|
59
|
+
"get",
|
|
60
|
+
constructUrl({
|
|
61
|
+
url: this._urls["getJobCodesMetrics"],
|
|
62
|
+
params: {},
|
|
63
|
+
}),
|
|
64
|
+
query_params,
|
|
65
|
+
undefined,
|
|
66
|
+
xHeaders
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {Object} arg - Arg object.
|
|
72
|
+
* @param {EmailJobMetrics} arg.body
|
|
73
|
+
* @returns {Promise<ResponseEnvelopeEmailJobMetrics>} - Success response
|
|
74
|
+
* @summary: Save JobCode Metrics
|
|
75
|
+
* @description: Endpoint to save JobCode Metrics
|
|
76
|
+
*/
|
|
77
|
+
saveJobCodesMetrics({ body } = {}) {
|
|
78
|
+
const { error } = InventoryValidator.saveJobCodesMetrics().validate(
|
|
79
|
+
{ body },
|
|
80
|
+
{ abortEarly: false, allowUnknown: true }
|
|
81
|
+
);
|
|
82
|
+
if (error) {
|
|
83
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
84
|
+
}
|
|
85
|
+
const query_params = {};
|
|
86
|
+
|
|
87
|
+
const xHeaders = {};
|
|
88
|
+
|
|
89
|
+
return PublicAPIClient.execute(
|
|
90
|
+
this._conf,
|
|
91
|
+
"post",
|
|
92
|
+
constructUrl({
|
|
93
|
+
url: this._urls["saveJobCodesMetrics"],
|
|
94
|
+
params: {},
|
|
95
|
+
}),
|
|
96
|
+
query_params,
|
|
97
|
+
body,
|
|
98
|
+
xHeaders
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {Object} arg - Arg object.
|
|
104
|
+
* @param {string} arg.apikey - Api key
|
|
105
|
+
* @returns {Promise<ResponseEnvelopeSlingshotConfigurationDetail>} - Success response
|
|
106
|
+
* @summary: Get Slingshot Configuration Of A Company using API key
|
|
107
|
+
* @description: REST Endpoint that returns all configuration detail of a company
|
|
108
|
+
*/
|
|
109
|
+
getConfigByApiKey({ apikey } = {}) {
|
|
110
|
+
const { error } = InventoryValidator.getConfigByApiKey().validate(
|
|
111
|
+
{ apikey },
|
|
112
|
+
{ abortEarly: false, allowUnknown: true }
|
|
113
|
+
);
|
|
114
|
+
if (error) {
|
|
115
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
116
|
+
}
|
|
117
|
+
const query_params = {};
|
|
118
|
+
query_params["apikey"] = apikey;
|
|
119
|
+
|
|
120
|
+
const xHeaders = {};
|
|
121
|
+
|
|
122
|
+
return PublicAPIClient.execute(
|
|
123
|
+
this._conf,
|
|
124
|
+
"get",
|
|
125
|
+
constructUrl({
|
|
126
|
+
url: this._urls["getConfigByApiKey"],
|
|
127
|
+
params: {},
|
|
128
|
+
}),
|
|
129
|
+
query_params,
|
|
130
|
+
undefined,
|
|
131
|
+
xHeaders
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {Object} arg - Arg object.
|
|
137
|
+
* @param {string} arg.userName - Integration id
|
|
138
|
+
* @param {string} arg.password - Company/store token
|
|
139
|
+
* @returns {Promise<ResponseEnvelopeApikeyModel>} - Success response
|
|
140
|
+
* @summary: Get apikey for Company to call other Slingshot Configuration APIs
|
|
141
|
+
* @description: REST Endpoint that returns apikey by username by password
|
|
142
|
+
*/
|
|
143
|
+
getApiKey({ userName, password } = {}) {
|
|
144
|
+
const { error } = InventoryValidator.getApiKey().validate(
|
|
145
|
+
{ userName, password },
|
|
146
|
+
{ abortEarly: false, allowUnknown: true }
|
|
147
|
+
);
|
|
148
|
+
if (error) {
|
|
149
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
150
|
+
}
|
|
151
|
+
const query_params = {};
|
|
152
|
+
query_params["user_name"] = userName;
|
|
153
|
+
query_params["password"] = password;
|
|
154
|
+
|
|
155
|
+
const xHeaders = {};
|
|
156
|
+
|
|
157
|
+
return PublicAPIClient.execute(
|
|
158
|
+
this._conf,
|
|
159
|
+
"get",
|
|
160
|
+
constructUrl({
|
|
161
|
+
url: this._urls["getApiKey"],
|
|
162
|
+
params: {},
|
|
163
|
+
}),
|
|
164
|
+
query_params,
|
|
165
|
+
undefined,
|
|
166
|
+
xHeaders
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @param {Object} arg - Arg object.
|
|
172
|
+
* @param {string} arg.code - Job Code
|
|
173
|
+
* @returns {Promise<ResponseEnvelopeJobConfigDTO>} - Success response
|
|
174
|
+
* @summary: Get Job Config By Code
|
|
175
|
+
* @description: REST Endpoint that returns job config by code
|
|
176
|
+
*/
|
|
177
|
+
getJobByCode({ code } = {}) {
|
|
178
|
+
const { error } = InventoryValidator.getJobByCode().validate(
|
|
179
|
+
{ code },
|
|
180
|
+
{ abortEarly: false, allowUnknown: true }
|
|
181
|
+
);
|
|
182
|
+
if (error) {
|
|
183
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
184
|
+
}
|
|
185
|
+
const query_params = {};
|
|
186
|
+
|
|
187
|
+
const xHeaders = {};
|
|
188
|
+
|
|
189
|
+
return PublicAPIClient.execute(
|
|
190
|
+
this._conf,
|
|
191
|
+
"get",
|
|
192
|
+
constructUrl({
|
|
193
|
+
url: this._urls["getJobByCode"],
|
|
194
|
+
params: { code },
|
|
195
|
+
}),
|
|
196
|
+
query_params,
|
|
197
|
+
undefined,
|
|
198
|
+
xHeaders
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @param {Object} arg - Arg object.
|
|
204
|
+
* @param {string} arg.integrationType - Integration Type
|
|
205
|
+
* @param {boolean} [arg.disable] - JobConfig current state
|
|
206
|
+
* @returns {Promise<ResponseEnvelopeListJobConfigDTO>} - Success response
|
|
207
|
+
* @summary: Get Job Configs By Integration Type
|
|
208
|
+
* @description: REST Endpoint that returns all job Configs by Integration Type
|
|
209
|
+
*/
|
|
210
|
+
getJobConfigByIntegrationType({ integrationType, disable } = {}) {
|
|
211
|
+
const {
|
|
212
|
+
error,
|
|
213
|
+
} = InventoryValidator.getJobConfigByIntegrationType().validate(
|
|
214
|
+
{ integrationType, disable },
|
|
215
|
+
{ abortEarly: false, allowUnknown: true }
|
|
216
|
+
);
|
|
217
|
+
if (error) {
|
|
218
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
219
|
+
}
|
|
220
|
+
const query_params = {};
|
|
221
|
+
query_params["integration_type"] = integrationType;
|
|
222
|
+
query_params["disable"] = disable;
|
|
223
|
+
|
|
224
|
+
const xHeaders = {};
|
|
225
|
+
|
|
226
|
+
return PublicAPIClient.execute(
|
|
227
|
+
this._conf,
|
|
228
|
+
"get",
|
|
229
|
+
constructUrl({
|
|
230
|
+
url: this._urls["getJobConfigByIntegrationType"],
|
|
231
|
+
params: {},
|
|
232
|
+
}),
|
|
233
|
+
query_params,
|
|
234
|
+
undefined,
|
|
235
|
+
xHeaders
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
module.exports = Inventory;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export = Webhook;
|
|
2
|
+
declare class Webhook {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
fetchAllWebhookEvents: string;
|
|
7
|
+
queryWebhookEventDetails: string;
|
|
8
|
+
};
|
|
9
|
+
_urls: {};
|
|
10
|
+
updateUrls(urls: any): void;
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} arg - Arg object.
|
|
13
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
14
|
+
* @summary: Get All Webhook Events
|
|
15
|
+
* @description: Get All Webhook Events
|
|
16
|
+
*/
|
|
17
|
+
fetchAllWebhookEvents({}?: any): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} arg - Arg object.
|
|
20
|
+
* @param {EventConfigBase[]} arg.body
|
|
21
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
22
|
+
* @summary: Send webhook event name, type, version, category in request body to get complete details of event from server
|
|
23
|
+
* @description: Get Webhook Event Details for provided events
|
|
24
|
+
*/
|
|
25
|
+
queryWebhookEventDetails({ body }?: {
|
|
26
|
+
body: any[];
|
|
27
|
+
}): Promise<any>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const PublicAPIClient = require("../PublicAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const WebhookValidator = require("../models/WebhookValidator");
|
|
5
|
+
class Webhook {
|
|
6
|
+
constructor(_conf) {
|
|
7
|
+
this._conf = _conf;
|
|
8
|
+
this._relativeUrls = {
|
|
9
|
+
fetchAllWebhookEvents: "/service/common/webhook/v1.0/events",
|
|
10
|
+
queryWebhookEventDetails:
|
|
11
|
+
"/service/common/webhook/v1.0/events/query-event-details",
|
|
12
|
+
};
|
|
13
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
14
|
+
(urls, [method, relativeUrl]) => {
|
|
15
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
16
|
+
return urls;
|
|
17
|
+
},
|
|
18
|
+
{}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
updateUrls(urls) {
|
|
23
|
+
this._urls = {
|
|
24
|
+
...this._urls,
|
|
25
|
+
...urls,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {Object} arg - Arg object.
|
|
31
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
32
|
+
* @summary: Get All Webhook Events
|
|
33
|
+
* @description: Get All Webhook Events
|
|
34
|
+
*/
|
|
35
|
+
fetchAllWebhookEvents({} = {}) {
|
|
36
|
+
const { error } = WebhookValidator.fetchAllWebhookEvents().validate(
|
|
37
|
+
{},
|
|
38
|
+
{ abortEarly: false, allowUnknown: true }
|
|
39
|
+
);
|
|
40
|
+
if (error) {
|
|
41
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
42
|
+
}
|
|
43
|
+
const query_params = {};
|
|
44
|
+
|
|
45
|
+
const xHeaders = {};
|
|
46
|
+
|
|
47
|
+
return PublicAPIClient.execute(
|
|
48
|
+
this._conf,
|
|
49
|
+
"get",
|
|
50
|
+
constructUrl({
|
|
51
|
+
url: this._urls["fetchAllWebhookEvents"],
|
|
52
|
+
params: {},
|
|
53
|
+
}),
|
|
54
|
+
query_params,
|
|
55
|
+
undefined,
|
|
56
|
+
xHeaders
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {Object} arg - Arg object.
|
|
62
|
+
* @param {EventConfigBase[]} arg.body
|
|
63
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
64
|
+
* @summary: Send webhook event name, type, version, category in request body to get complete details of event from server
|
|
65
|
+
* @description: Get Webhook Event Details for provided events
|
|
66
|
+
*/
|
|
67
|
+
queryWebhookEventDetails({ body } = {}) {
|
|
68
|
+
const { error } = WebhookValidator.queryWebhookEventDetails().validate(
|
|
69
|
+
{ body },
|
|
70
|
+
{ abortEarly: false, allowUnknown: true }
|
|
71
|
+
);
|
|
72
|
+
if (error) {
|
|
73
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
74
|
+
}
|
|
75
|
+
const query_params = {};
|
|
76
|
+
|
|
77
|
+
const xHeaders = {};
|
|
78
|
+
|
|
79
|
+
return PublicAPIClient.execute(
|
|
80
|
+
this._conf,
|
|
81
|
+
"post",
|
|
82
|
+
constructUrl({
|
|
83
|
+
url: this._urls["queryWebhookEventDetails"],
|
|
84
|
+
params: {},
|
|
85
|
+
}),
|
|
86
|
+
query_params,
|
|
87
|
+
body,
|
|
88
|
+
xHeaders
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
module.exports = Webhook;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const camelCase = require("camelcase");
|
|
2
|
+
const constructUrl = ({ url, params }) => {
|
|
3
|
+
return url
|
|
4
|
+
.split("/")
|
|
5
|
+
.map((word) => {
|
|
6
|
+
if (word[0] === "{" && word[word.length - 1] === "}") {
|
|
7
|
+
word = params[camelCase(word.slice(1, word.length - 1))];
|
|
8
|
+
}
|
|
9
|
+
return word;
|
|
10
|
+
})
|
|
11
|
+
.join("/");
|
|
12
|
+
};
|
|
13
|
+
module.exports = constructUrl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const Validator = require("../PublicModels");
|
|
2
|
+
const Joi = require("joi");
|
|
3
|
+
class ConfigurationValidator {
|
|
4
|
+
static searchApplication() {
|
|
5
|
+
return Joi.object({
|
|
6
|
+
authorization: Joi.string().allow(""),
|
|
7
|
+
query: Joi.string().allow(""),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static getLocations() {
|
|
12
|
+
return Joi.object({
|
|
13
|
+
locationType: Joi.string().allow(""),
|
|
14
|
+
id: Joi.string().allow(""),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
module.exports = ConfigurationValidator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export = InventoryValidator;
|
|
2
|
+
declare class InventoryValidator {
|
|
3
|
+
static getJobCodesMetrics(): any;
|
|
4
|
+
static saveJobCodesMetrics(): any;
|
|
5
|
+
static getConfigByApiKey(): any;
|
|
6
|
+
static getApiKey(): any;
|
|
7
|
+
static getJobByCode(): any;
|
|
8
|
+
static getJobConfigByIntegrationType(): any;
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const Validator = require("../PublicModels");
|
|
2
|
+
const Joi = require("joi");
|
|
3
|
+
class InventoryValidator {
|
|
4
|
+
static getJobCodesMetrics() {
|
|
5
|
+
return Joi.object({
|
|
6
|
+
dailyJob: Joi.boolean(),
|
|
7
|
+
jobCode: Joi.string().allow(""),
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static saveJobCodesMetrics() {
|
|
12
|
+
return Joi.object({
|
|
13
|
+
body: Validator.EmailJobMetrics().required(),
|
|
14
|
+
}).required();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static getConfigByApiKey() {
|
|
18
|
+
return Joi.object({
|
|
19
|
+
apikey: Joi.string().allow("").required(),
|
|
20
|
+
}).required();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getApiKey() {
|
|
24
|
+
return Joi.object({
|
|
25
|
+
userName: Joi.string().allow("").required(),
|
|
26
|
+
password: Joi.string().allow("").required(),
|
|
27
|
+
}).required();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getJobByCode() {
|
|
31
|
+
return Joi.object({
|
|
32
|
+
code: Joi.string().allow("").required(),
|
|
33
|
+
}).required();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static getJobConfigByIntegrationType() {
|
|
37
|
+
return Joi.object({
|
|
38
|
+
integrationType: Joi.string().allow("").required(),
|
|
39
|
+
disable: Joi.boolean(),
|
|
40
|
+
}).required();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
module.exports = InventoryValidator;
|