@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,268 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const ShareValidator = require("../models/ShareValidator");
|
|
6
|
+
|
|
7
|
+
class Share {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
getApplicationQRCode: "/service/application/share/v1.0/qr/",
|
|
12
|
+
getProductQRCodeBySlug:
|
|
13
|
+
"/service/application/share/v1.0/qr/products/{slug}/",
|
|
14
|
+
getCollectionQRCodeBySlug:
|
|
15
|
+
"/service/application/share/v1.0/qr/collection/{slug}/",
|
|
16
|
+
getUrlQRCode: "/service/application/share/v1.0/qr/url/",
|
|
17
|
+
createShortLink: "/service/application/share/v1.0/links/short-link/",
|
|
18
|
+
getShortLinkByHash:
|
|
19
|
+
"/service/application/share/v1.0/links/short-link/{hash}/",
|
|
20
|
+
getOriginalShortLinkByHash:
|
|
21
|
+
"/service/application/share/v1.0/links/short-link/{hash}/original/",
|
|
22
|
+
};
|
|
23
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
24
|
+
(urls, [method, relativeUrl]) => {
|
|
25
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
26
|
+
return urls;
|
|
27
|
+
},
|
|
28
|
+
{}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
updateUrls(urls) {
|
|
33
|
+
this._urls = {
|
|
34
|
+
...this._urls,
|
|
35
|
+
...urls,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {Object} arg - Arg object.
|
|
41
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
42
|
+
* @summary: Create QR Code of an app
|
|
43
|
+
* @description: Use this API to create a QR code of an app for sharing it with users who want to use the app.
|
|
44
|
+
*/
|
|
45
|
+
getApplicationQRCode({} = {}) {
|
|
46
|
+
const { error } = ShareValidator.getApplicationQRCode().validate(
|
|
47
|
+
{},
|
|
48
|
+
{ abortEarly: false, allowUnknown: true }
|
|
49
|
+
);
|
|
50
|
+
if (error) {
|
|
51
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
52
|
+
}
|
|
53
|
+
const query_params = {};
|
|
54
|
+
|
|
55
|
+
const xHeaders = {};
|
|
56
|
+
|
|
57
|
+
return APIClient.execute(
|
|
58
|
+
this._conf,
|
|
59
|
+
"post",
|
|
60
|
+
constructUrl({
|
|
61
|
+
url: this._urls["getApplicationQRCode"],
|
|
62
|
+
params: {},
|
|
63
|
+
}),
|
|
64
|
+
query_params,
|
|
65
|
+
undefined,
|
|
66
|
+
xHeaders
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {Object} arg - Arg object.
|
|
72
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
73
|
+
* identifier of a product. You can get slug value from the endpoint.
|
|
74
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
75
|
+
* @summary: Create QR Code of a product
|
|
76
|
+
* @description: Use this API to create a QR code of a product for sharing it with users who want to view/purchase the product.
|
|
77
|
+
*/
|
|
78
|
+
getProductQRCodeBySlug({ slug } = {}) {
|
|
79
|
+
const { error } = ShareValidator.getProductQRCodeBySlug().validate(
|
|
80
|
+
{ slug },
|
|
81
|
+
{ abortEarly: false, allowUnknown: true }
|
|
82
|
+
);
|
|
83
|
+
if (error) {
|
|
84
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
85
|
+
}
|
|
86
|
+
const query_params = {};
|
|
87
|
+
|
|
88
|
+
const xHeaders = {};
|
|
89
|
+
|
|
90
|
+
return APIClient.execute(
|
|
91
|
+
this._conf,
|
|
92
|
+
"post",
|
|
93
|
+
constructUrl({
|
|
94
|
+
url: this._urls["getProductQRCodeBySlug"],
|
|
95
|
+
params: { slug },
|
|
96
|
+
}),
|
|
97
|
+
query_params,
|
|
98
|
+
undefined,
|
|
99
|
+
xHeaders
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {Object} arg - Arg object.
|
|
105
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
106
|
+
* identifier of a collection. You can get slug value from the endpoint.
|
|
107
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
108
|
+
* @summary: Create QR Code of a collection
|
|
109
|
+
* @description: Use this API to create a QR code of a collection of products for sharing it with users who want to view/purchase the collection.
|
|
110
|
+
*/
|
|
111
|
+
getCollectionQRCodeBySlug({ slug } = {}) {
|
|
112
|
+
const { error } = ShareValidator.getCollectionQRCodeBySlug().validate(
|
|
113
|
+
{ slug },
|
|
114
|
+
{ abortEarly: false, allowUnknown: true }
|
|
115
|
+
);
|
|
116
|
+
if (error) {
|
|
117
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
118
|
+
}
|
|
119
|
+
const query_params = {};
|
|
120
|
+
|
|
121
|
+
const xHeaders = {};
|
|
122
|
+
|
|
123
|
+
return APIClient.execute(
|
|
124
|
+
this._conf,
|
|
125
|
+
"post",
|
|
126
|
+
constructUrl({
|
|
127
|
+
url: this._urls["getCollectionQRCodeBySlug"],
|
|
128
|
+
params: { slug },
|
|
129
|
+
}),
|
|
130
|
+
query_params,
|
|
131
|
+
undefined,
|
|
132
|
+
xHeaders
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @param {Object} arg - Arg object.
|
|
138
|
+
* @param {string} arg.url - A link or a web address
|
|
139
|
+
* @returns {Promise<QRCodeResp>} - Success response
|
|
140
|
+
* @summary: Create QR Code of a URL
|
|
141
|
+
* @description: Use this API to create a QR code of a URL for sharing it with users who want to visit the link.
|
|
142
|
+
*/
|
|
143
|
+
getUrlQRCode({ url } = {}) {
|
|
144
|
+
const { error } = ShareValidator.getUrlQRCode().validate(
|
|
145
|
+
{ url },
|
|
146
|
+
{ abortEarly: false, allowUnknown: true }
|
|
147
|
+
);
|
|
148
|
+
if (error) {
|
|
149
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
150
|
+
}
|
|
151
|
+
const query_params = {};
|
|
152
|
+
query_params["url"] = url;
|
|
153
|
+
|
|
154
|
+
const xHeaders = {};
|
|
155
|
+
|
|
156
|
+
return APIClient.execute(
|
|
157
|
+
this._conf,
|
|
158
|
+
"post",
|
|
159
|
+
constructUrl({
|
|
160
|
+
url: this._urls["getUrlQRCode"],
|
|
161
|
+
params: {},
|
|
162
|
+
}),
|
|
163
|
+
query_params,
|
|
164
|
+
undefined,
|
|
165
|
+
xHeaders
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @param {Object} arg - Arg object.
|
|
171
|
+
* @param {ShortLinkReq} arg.body
|
|
172
|
+
* @returns {Promise<ShortLinkRes>} - Success response
|
|
173
|
+
* @summary: Create a short link
|
|
174
|
+
* @description: Use this API to create a short link that is easy to write/share/read as compared to long URLs.
|
|
175
|
+
*/
|
|
176
|
+
createShortLink({ body } = {}) {
|
|
177
|
+
const { error } = ShareValidator.createShortLink().validate(
|
|
178
|
+
{ body },
|
|
179
|
+
{ abortEarly: false, allowUnknown: true }
|
|
180
|
+
);
|
|
181
|
+
if (error) {
|
|
182
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
183
|
+
}
|
|
184
|
+
const query_params = {};
|
|
185
|
+
|
|
186
|
+
const xHeaders = {};
|
|
187
|
+
|
|
188
|
+
return APIClient.execute(
|
|
189
|
+
this._conf,
|
|
190
|
+
"post",
|
|
191
|
+
constructUrl({
|
|
192
|
+
url: this._urls["createShortLink"],
|
|
193
|
+
params: {},
|
|
194
|
+
}),
|
|
195
|
+
query_params,
|
|
196
|
+
body,
|
|
197
|
+
xHeaders
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @param {Object} arg - Arg object.
|
|
203
|
+
* @param {string} arg.hash - A string value used for converting long URL to
|
|
204
|
+
* short URL and vice-versa.
|
|
205
|
+
* @returns {Promise<ShortLinkRes>} - Success response
|
|
206
|
+
* @summary: Get short link by hash
|
|
207
|
+
* @description: Use this API to get a short link by using a hash value.
|
|
208
|
+
*/
|
|
209
|
+
getShortLinkByHash({ hash } = {}) {
|
|
210
|
+
const { error } = ShareValidator.getShortLinkByHash().validate(
|
|
211
|
+
{ hash },
|
|
212
|
+
{ abortEarly: false, allowUnknown: true }
|
|
213
|
+
);
|
|
214
|
+
if (error) {
|
|
215
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
216
|
+
}
|
|
217
|
+
const query_params = {};
|
|
218
|
+
|
|
219
|
+
const xHeaders = {};
|
|
220
|
+
|
|
221
|
+
return APIClient.execute(
|
|
222
|
+
this._conf,
|
|
223
|
+
"get",
|
|
224
|
+
constructUrl({
|
|
225
|
+
url: this._urls["getShortLinkByHash"],
|
|
226
|
+
params: { hash },
|
|
227
|
+
}),
|
|
228
|
+
query_params,
|
|
229
|
+
undefined,
|
|
230
|
+
xHeaders
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @param {Object} arg - Arg object.
|
|
236
|
+
* @param {string} arg.hash - A string value used for converting long URL to
|
|
237
|
+
* short URL and vice-versa.
|
|
238
|
+
* @returns {Promise<ShortLinkRes>} - Success response
|
|
239
|
+
* @summary: Get original link by hash
|
|
240
|
+
* @description: Use this API to retrieve the original link from a short-link by using a hash value.
|
|
241
|
+
*/
|
|
242
|
+
getOriginalShortLinkByHash({ hash } = {}) {
|
|
243
|
+
const { error } = ShareValidator.getOriginalShortLinkByHash().validate(
|
|
244
|
+
{ hash },
|
|
245
|
+
{ abortEarly: false, allowUnknown: true }
|
|
246
|
+
);
|
|
247
|
+
if (error) {
|
|
248
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
249
|
+
}
|
|
250
|
+
const query_params = {};
|
|
251
|
+
|
|
252
|
+
const xHeaders = {};
|
|
253
|
+
|
|
254
|
+
return APIClient.execute(
|
|
255
|
+
this._conf,
|
|
256
|
+
"get",
|
|
257
|
+
constructUrl({
|
|
258
|
+
url: this._urls["getOriginalShortLinkByHash"],
|
|
259
|
+
params: { hash },
|
|
260
|
+
}),
|
|
261
|
+
query_params,
|
|
262
|
+
undefined,
|
|
263
|
+
xHeaders
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
module.exports = Share;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export = Theme;
|
|
2
|
+
declare class Theme {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getAllPages: string;
|
|
7
|
+
getPage: string;
|
|
8
|
+
getAppliedTheme: string;
|
|
9
|
+
getThemeForPreview: string;
|
|
10
|
+
};
|
|
11
|
+
_urls: {};
|
|
12
|
+
updateUrls(urls: any): void;
|
|
13
|
+
/**
|
|
14
|
+
* @param {Object} arg - Arg object.
|
|
15
|
+
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
16
|
+
* @returns {Promise<AllAvailablePageSchema>} - Success response
|
|
17
|
+
* @summary: Get all pages of a theme
|
|
18
|
+
* @description: Use this API to retrieve all the available pages of a theme by its ID.
|
|
19
|
+
*/
|
|
20
|
+
getAllPages({ themeId }?: {
|
|
21
|
+
themeId: string;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* @param {Object} arg - Arg object.
|
|
25
|
+
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
26
|
+
* @param {string} arg.pageValue - Value of the page to be retrieved
|
|
27
|
+
* @returns {Promise<AvailablePageSchema>} - Success response
|
|
28
|
+
* @summary: Get page of a theme
|
|
29
|
+
* @description: Use this API to retrieve a page of a theme.
|
|
30
|
+
*/
|
|
31
|
+
getPage({ themeId, pageValue }?: {
|
|
32
|
+
themeId: string;
|
|
33
|
+
pageValue: string;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* @param {Object} arg - Arg object.
|
|
37
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
38
|
+
* @summary: Get the theme currently applied to an application
|
|
39
|
+
* @description: An application has multiple themes, but only one theme can be applied at a time. Use this API to retrieve the theme currently applied to the application.
|
|
40
|
+
*/
|
|
41
|
+
getAppliedTheme({}?: any): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* @param {Object} arg - Arg object.
|
|
44
|
+
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
45
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
46
|
+
* @summary: Get a theme for a preview
|
|
47
|
+
* @description: A theme can be previewed before applying it. Use this API to retrieve the preview of a theme by its ID.
|
|
48
|
+
*/
|
|
49
|
+
getThemeForPreview({ themeId }?: {
|
|
50
|
+
themeId: string;
|
|
51
|
+
}): Promise<any>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const APIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const Paginator = require("../../common/Paginator");
|
|
3
|
+
const constructUrl = require("../constructUrl");
|
|
4
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
|
+
const ThemeValidator = require("../models/ThemeValidator");
|
|
6
|
+
|
|
7
|
+
class Theme {
|
|
8
|
+
constructor(_conf) {
|
|
9
|
+
this._conf = _conf;
|
|
10
|
+
this._relativeUrls = {
|
|
11
|
+
getAllPages: "/service/application/theme/v1.0/{theme_id}/page",
|
|
12
|
+
getPage: "/service/application/theme/v1.0/{theme_id}/{page_value}",
|
|
13
|
+
getAppliedTheme: "/service/application/theme/v1.0/applied-theme",
|
|
14
|
+
getThemeForPreview: "/service/application/theme/v1.0/{theme_id}/preview",
|
|
15
|
+
};
|
|
16
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
17
|
+
(urls, [method, relativeUrl]) => {
|
|
18
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
19
|
+
return urls;
|
|
20
|
+
},
|
|
21
|
+
{}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
updateUrls(urls) {
|
|
26
|
+
this._urls = {
|
|
27
|
+
...this._urls,
|
|
28
|
+
...urls,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {Object} arg - Arg object.
|
|
34
|
+
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
35
|
+
* @returns {Promise<AllAvailablePageSchema>} - Success response
|
|
36
|
+
* @summary: Get all pages of a theme
|
|
37
|
+
* @description: Use this API to retrieve all the available pages of a theme by its ID.
|
|
38
|
+
*/
|
|
39
|
+
getAllPages({ themeId } = {}) {
|
|
40
|
+
const { error } = ThemeValidator.getAllPages().validate(
|
|
41
|
+
{ themeId },
|
|
42
|
+
{ abortEarly: false, allowUnknown: true }
|
|
43
|
+
);
|
|
44
|
+
if (error) {
|
|
45
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
46
|
+
}
|
|
47
|
+
const query_params = {};
|
|
48
|
+
|
|
49
|
+
const xHeaders = {};
|
|
50
|
+
|
|
51
|
+
return APIClient.execute(
|
|
52
|
+
this._conf,
|
|
53
|
+
"get",
|
|
54
|
+
constructUrl({
|
|
55
|
+
url: this._urls["getAllPages"],
|
|
56
|
+
params: { themeId },
|
|
57
|
+
}),
|
|
58
|
+
query_params,
|
|
59
|
+
undefined,
|
|
60
|
+
xHeaders
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Object} arg - Arg object.
|
|
66
|
+
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
67
|
+
* @param {string} arg.pageValue - Value of the page to be retrieved
|
|
68
|
+
* @returns {Promise<AvailablePageSchema>} - Success response
|
|
69
|
+
* @summary: Get page of a theme
|
|
70
|
+
* @description: Use this API to retrieve a page of a theme.
|
|
71
|
+
*/
|
|
72
|
+
getPage({ themeId, pageValue } = {}) {
|
|
73
|
+
const { error } = ThemeValidator.getPage().validate(
|
|
74
|
+
{ themeId, pageValue },
|
|
75
|
+
{ abortEarly: false, allowUnknown: true }
|
|
76
|
+
);
|
|
77
|
+
if (error) {
|
|
78
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
79
|
+
}
|
|
80
|
+
const query_params = {};
|
|
81
|
+
|
|
82
|
+
const xHeaders = {};
|
|
83
|
+
|
|
84
|
+
return APIClient.execute(
|
|
85
|
+
this._conf,
|
|
86
|
+
"get",
|
|
87
|
+
constructUrl({
|
|
88
|
+
url: this._urls["getPage"],
|
|
89
|
+
params: { themeId, pageValue },
|
|
90
|
+
}),
|
|
91
|
+
query_params,
|
|
92
|
+
undefined,
|
|
93
|
+
xHeaders
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param {Object} arg - Arg object.
|
|
99
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
100
|
+
* @summary: Get the theme currently applied to an application
|
|
101
|
+
* @description: An application has multiple themes, but only one theme can be applied at a time. Use this API to retrieve the theme currently applied to the application.
|
|
102
|
+
*/
|
|
103
|
+
getAppliedTheme({} = {}) {
|
|
104
|
+
const { error } = ThemeValidator.getAppliedTheme().validate(
|
|
105
|
+
{},
|
|
106
|
+
{ abortEarly: false, allowUnknown: true }
|
|
107
|
+
);
|
|
108
|
+
if (error) {
|
|
109
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
110
|
+
}
|
|
111
|
+
const query_params = {};
|
|
112
|
+
|
|
113
|
+
const xHeaders = {};
|
|
114
|
+
|
|
115
|
+
return APIClient.execute(
|
|
116
|
+
this._conf,
|
|
117
|
+
"get",
|
|
118
|
+
constructUrl({
|
|
119
|
+
url: this._urls["getAppliedTheme"],
|
|
120
|
+
params: {},
|
|
121
|
+
}),
|
|
122
|
+
query_params,
|
|
123
|
+
undefined,
|
|
124
|
+
xHeaders
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @param {Object} arg - Arg object.
|
|
130
|
+
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
131
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
132
|
+
* @summary: Get a theme for a preview
|
|
133
|
+
* @description: A theme can be previewed before applying it. Use this API to retrieve the preview of a theme by its ID.
|
|
134
|
+
*/
|
|
135
|
+
getThemeForPreview({ themeId } = {}) {
|
|
136
|
+
const { error } = ThemeValidator.getThemeForPreview().validate(
|
|
137
|
+
{ themeId },
|
|
138
|
+
{ abortEarly: false, allowUnknown: true }
|
|
139
|
+
);
|
|
140
|
+
if (error) {
|
|
141
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
142
|
+
}
|
|
143
|
+
const query_params = {};
|
|
144
|
+
|
|
145
|
+
const xHeaders = {};
|
|
146
|
+
|
|
147
|
+
return APIClient.execute(
|
|
148
|
+
this._conf,
|
|
149
|
+
"get",
|
|
150
|
+
constructUrl({
|
|
151
|
+
url: this._urls["getThemeForPreview"],
|
|
152
|
+
params: { themeId },
|
|
153
|
+
}),
|
|
154
|
+
query_params,
|
|
155
|
+
undefined,
|
|
156
|
+
xHeaders
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = Theme;
|