@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.
Files changed (277) hide show
  1. package/.github/workflows/on_create_release.yml +23 -0
  2. package/.github/workflows/on_merge_main.yml +38 -0
  3. package/.github/workflows/on_pull_request.yml +35 -0
  4. package/.prettierrc +5 -0
  5. package/LICENSE +21 -0
  6. package/README.md +118 -0
  7. package/application.d.ts +3 -0
  8. package/application.js +6 -0
  9. package/common.d.ts +4 -0
  10. package/common.js +9 -0
  11. package/documentation/application/CART.md +7290 -0
  12. package/documentation/application/CATALOG.md +9570 -0
  13. package/documentation/application/COMMON.md +448 -0
  14. package/documentation/application/COMMUNICATION.md +463 -0
  15. package/documentation/application/CONFIGURATION.md +2902 -0
  16. package/documentation/application/CONTENT.md +3350 -0
  17. package/documentation/application/FILESTORAGE.md +491 -0
  18. package/documentation/application/LEAD.md +1891 -0
  19. package/documentation/application/LOGISTIC.md +439 -0
  20. package/documentation/application/ORDER.md +3428 -0
  21. package/documentation/application/PAYMENT.md +5035 -0
  22. package/documentation/application/POSCART.md +7889 -0
  23. package/documentation/application/README.md +21 -0
  24. package/documentation/application/REWARDS.md +714 -0
  25. package/documentation/application/SHARE.md +729 -0
  26. package/documentation/application/THEME.md +5796 -0
  27. package/documentation/application/USER.md +4326 -0
  28. package/documentation/platform/ANALYTICS.md +1150 -0
  29. package/documentation/platform/AUDITTRAIL.md +572 -0
  30. package/documentation/platform/BILLING.md +2396 -0
  31. package/documentation/platform/CART.md +5539 -0
  32. package/documentation/platform/CATALOG.md +21624 -0
  33. package/documentation/platform/COMMON.md +448 -0
  34. package/documentation/platform/COMMUNICATION.md +5714 -0
  35. package/documentation/platform/COMPANYPROFILE.md +2141 -0
  36. package/documentation/platform/CONFIGURATION.md +7335 -0
  37. package/documentation/platform/CONTENT.md +8989 -0
  38. package/documentation/platform/DISCOUNT.md +773 -0
  39. package/documentation/platform/FILESTORAGE.md +994 -0
  40. package/documentation/platform/INVENTORY.md +1775 -0
  41. package/documentation/platform/LEAD.md +4736 -0
  42. package/documentation/platform/ORDER.md +3764 -0
  43. package/documentation/platform/PARTNER.md +216 -0
  44. package/documentation/platform/PAYMENT.md +3444 -0
  45. package/documentation/platform/README.md +27 -0
  46. package/documentation/platform/REWARDS.md +871 -0
  47. package/documentation/platform/SHARE.md +602 -0
  48. package/documentation/platform/THEME.md +35725 -0
  49. package/documentation/platform/USER.md +2305 -0
  50. package/documentation/platform/WEBHOOK.md +587 -0
  51. package/documentation/public/CONFIGURATION.md +448 -0
  52. package/documentation/public/INVENTORY.md +686 -0
  53. package/documentation/public/WEBHOOK.md +348 -0
  54. package/index.d.ts +10 -0
  55. package/index.js +18 -0
  56. package/jest.config.d.ts +4 -0
  57. package/jest.config.js +6 -0
  58. package/package.json +35 -0
  59. package/platform.d.ts +3 -0
  60. package/platform.js +6 -0
  61. package/public.d.ts +3 -0
  62. package/public.js +6 -0
  63. package/sdk/application/ApplicationAPIClient.d.ts +11 -0
  64. package/sdk/application/ApplicationAPIClient.js +44 -0
  65. package/sdk/application/ApplicationClient.d.ts +40 -0
  66. package/sdk/application/ApplicationClient.js +84 -0
  67. package/sdk/application/ApplicationConfig.d.ts +19 -0
  68. package/sdk/application/ApplicationConfig.js +55 -0
  69. package/sdk/application/ApplicationModels.d.ts +826 -0
  70. package/sdk/application/ApplicationModels.js +10474 -0
  71. package/sdk/application/client/CartApplicationClient.d.ts +432 -0
  72. package/sdk/application/client/CartApplicationClient.js +1066 -0
  73. package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
  74. package/sdk/application/client/CatalogApplicationClient.js +1629 -0
  75. package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
  76. package/sdk/application/client/CommonApplicationClient.js +105 -0
  77. package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
  78. package/sdk/application/client/CommunicationApplicationClient.js +131 -0
  79. package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
  80. package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
  81. package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
  82. package/sdk/application/client/ContentApplicationClient.js +785 -0
  83. package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
  84. package/sdk/application/client/FileStorageApplicationClient.js +214 -0
  85. package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
  86. package/sdk/application/client/LeadApplicationClient.js +264 -0
  87. package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
  88. package/sdk/application/client/LogisticApplicationClient.js +128 -0
  89. package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
  90. package/sdk/application/client/OrderApplicationClient.js +479 -0
  91. package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
  92. package/sdk/application/client/PaymentApplicationClient.js +1378 -0
  93. package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
  94. package/sdk/application/client/PosCartApplicationClient.js +1123 -0
  95. package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
  96. package/sdk/application/client/RewardsApplicationClient.js +293 -0
  97. package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
  98. package/sdk/application/client/ShareApplicationClient.js +268 -0
  99. package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
  100. package/sdk/application/client/ThemeApplicationClient.js +161 -0
  101. package/sdk/application/client/UserApplicationClient.d.ts +446 -0
  102. package/sdk/application/client/UserApplicationClient.js +1275 -0
  103. package/sdk/application/constructUrl.d.ts +5 -0
  104. package/sdk/application/constructUrl.js +13 -0
  105. package/sdk/application/index.d.ts +2 -0
  106. package/sdk/application/index.js +4 -0
  107. package/sdk/application/models/CartValidator.d.ts +29 -0
  108. package/sdk/application/models/CartValidator.js +223 -0
  109. package/sdk/application/models/CatalogValidator.d.ts +33 -0
  110. package/sdk/application/models/CatalogValidator.js +233 -0
  111. package/sdk/application/models/CommonValidator.d.ts +5 -0
  112. package/sdk/application/models/CommonValidator.js +18 -0
  113. package/sdk/application/models/CommunicationValidator.d.ts +6 -0
  114. package/sdk/application/models/CommunicationValidator.js +20 -0
  115. package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
  116. package/sdk/application/models/ConfigurationValidator.js +88 -0
  117. package/sdk/application/models/ContentValidator.d.ts +22 -0
  118. package/sdk/application/models/ContentValidator.js +106 -0
  119. package/sdk/application/models/FileStorageValidator.d.ts +6 -0
  120. package/sdk/application/models/FileStorageValidator.js +24 -0
  121. package/sdk/application/models/LeadValidator.d.ts +10 -0
  122. package/sdk/application/models/LeadValidator.js +48 -0
  123. package/sdk/application/models/LogisticValidator.d.ts +6 -0
  124. package/sdk/application/models/LogisticValidator.js +22 -0
  125. package/sdk/application/models/OrderValidator.d.ts +15 -0
  126. package/sdk/application/models/OrderValidator.js +87 -0
  127. package/sdk/application/models/PaymentValidator.d.ts +40 -0
  128. package/sdk/application/models/PaymentValidator.js +235 -0
  129. package/sdk/application/models/PosCartValidator.d.ts +30 -0
  130. package/sdk/application/models/PosCartValidator.js +232 -0
  131. package/sdk/application/models/RewardsValidator.d.ts +10 -0
  132. package/sdk/application/models/RewardsValidator.js +43 -0
  133. package/sdk/application/models/ShareValidator.d.ts +10 -0
  134. package/sdk/application/models/ShareValidator.js +44 -0
  135. package/sdk/application/models/ThemeValidator.d.ts +7 -0
  136. package/sdk/application/models/ThemeValidator.js +27 -0
  137. package/sdk/application/models/UserValidator.d.ts +38 -0
  138. package/sdk/application/models/UserValidator.js +233 -0
  139. package/sdk/common/AxiosHelper.d.ts +1 -0
  140. package/sdk/common/AxiosHelper.js +141 -0
  141. package/sdk/common/Constant.d.ts +294 -0
  142. package/sdk/common/Constant.js +332 -0
  143. package/sdk/common/FDKError.d.ts +26 -0
  144. package/sdk/common/FDKError.js +51 -0
  145. package/sdk/common/Logger.d.ts +2 -0
  146. package/sdk/common/Logger.js +85 -0
  147. package/sdk/common/Paginator.d.ts +16 -0
  148. package/sdk/common/Paginator.js +26 -0
  149. package/sdk/common/RequestSigner.d.ts +1 -0
  150. package/sdk/common/RequestSigner.js +306 -0
  151. package/sdk/common/Utility.d.ts +9 -0
  152. package/sdk/common/Utility.js +86 -0
  153. package/sdk/common/utils.d.ts +14 -0
  154. package/sdk/common/utils.js +165 -0
  155. package/sdk/platform/OAuthClient.d.ts +26 -0
  156. package/sdk/platform/OAuthClient.js +221 -0
  157. package/sdk/platform/PlatformAPIClient.d.ts +12 -0
  158. package/sdk/platform/PlatformAPIClient.js +43 -0
  159. package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
  160. package/sdk/platform/PlatformApplicationClient.js +23185 -0
  161. package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
  162. package/sdk/platform/PlatformApplicationModels.js +21262 -0
  163. package/sdk/platform/PlatformClient.d.ts +9535 -0
  164. package/sdk/platform/PlatformClient.js +12336 -0
  165. package/sdk/platform/PlatformConfig.d.ts +29 -0
  166. package/sdk/platform/PlatformConfig.js +36 -0
  167. package/sdk/platform/PlatformModels.d.ts +1396 -0
  168. package/sdk/platform/PlatformModels.js +19222 -0
  169. package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
  170. package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
  171. package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
  172. package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
  173. package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
  174. package/sdk/platform/client/BillingPlatformClient.js +381 -0
  175. package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
  176. package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
  177. package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
  178. package/sdk/platform/client/CommonPlatformClient.js +84 -0
  179. package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
  180. package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
  181. package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
  182. package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
  183. package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
  184. package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
  185. package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
  186. package/sdk/platform/client/DiscountPlatformClient.js +364 -0
  187. package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
  188. package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
  189. package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
  190. package/sdk/platform/client/InventoryPlatformClient.js +409 -0
  191. package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
  192. package/sdk/platform/client/LeadPlatformClient.js +439 -0
  193. package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
  194. package/sdk/platform/client/OrderPlatformClient.js +521 -0
  195. package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
  196. package/sdk/platform/client/PaymentPlatformClient.js +331 -0
  197. package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
  198. package/sdk/platform/client/WebhookPlatformClient.js +207 -0
  199. package/sdk/platform/index.d.ts +2 -0
  200. package/sdk/platform/index.js +4 -0
  201. package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
  202. package/sdk/platform/models/AnalyticsValidator.js +36 -0
  203. package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
  204. package/sdk/platform/models/AuditTrailValidator.js +26 -0
  205. package/sdk/platform/models/BillingValidator.d.ts +15 -0
  206. package/sdk/platform/models/BillingValidator.js +72 -0
  207. package/sdk/platform/models/CartValidator.d.ts +0 -0
  208. package/sdk/platform/models/CartValidator.js +0 -0
  209. package/sdk/platform/models/CatalogValidator.d.ts +74 -0
  210. package/sdk/platform/models/CatalogValidator.js +484 -0
  211. package/sdk/platform/models/CommonValidator.d.ts +5 -0
  212. package/sdk/platform/models/CommonValidator.js +18 -0
  213. package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
  214. package/sdk/platform/models/CommunicationValidator.js +11 -0
  215. package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
  216. package/sdk/platform/models/CompanyProfileValidator.js +93 -0
  217. package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
  218. package/sdk/platform/models/ConfigurationValidator.js +134 -0
  219. package/sdk/platform/models/ContentValidator.d.ts +0 -0
  220. package/sdk/platform/models/ContentValidator.js +0 -0
  221. package/sdk/platform/models/DiscountValidator.d.ts +13 -0
  222. package/sdk/platform/models/DiscountValidator.js +75 -0
  223. package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
  224. package/sdk/platform/models/FileStorageValidator.js +44 -0
  225. package/sdk/platform/models/InventoryValidator.d.ts +15 -0
  226. package/sdk/platform/models/InventoryValidator.js +81 -0
  227. package/sdk/platform/models/LeadValidator.d.ts +14 -0
  228. package/sdk/platform/models/LeadValidator.js +78 -0
  229. package/sdk/platform/models/OrderValidator.d.ts +14 -0
  230. package/sdk/platform/models/OrderValidator.js +110 -0
  231. package/sdk/platform/models/PartnerValidator.d.ts +0 -0
  232. package/sdk/platform/models/PartnerValidator.js +0 -0
  233. package/sdk/platform/models/PaymentValidator.d.ts +13 -0
  234. package/sdk/platform/models/PaymentValidator.js +65 -0
  235. package/sdk/platform/models/RewardsValidator.d.ts +0 -0
  236. package/sdk/platform/models/RewardsValidator.js +0 -0
  237. package/sdk/platform/models/ShareValidator.d.ts +0 -0
  238. package/sdk/platform/models/ShareValidator.js +0 -0
  239. package/sdk/platform/models/ThemeValidator.d.ts +0 -0
  240. package/sdk/platform/models/ThemeValidator.js +0 -0
  241. package/sdk/platform/models/UserValidator.d.ts +0 -0
  242. package/sdk/platform/models/UserValidator.js +0 -0
  243. package/sdk/platform/models/WebhookValidator.d.ts +9 -0
  244. package/sdk/platform/models/WebhookValidator.js +42 -0
  245. package/sdk/public/PublicAPIClient.d.ts +11 -0
  246. package/sdk/public/PublicAPIClient.js +38 -0
  247. package/sdk/public/PublicClient.d.ts +12 -0
  248. package/sdk/public/PublicClient.js +24 -0
  249. package/sdk/public/PublicConfig.d.ts +10 -0
  250. package/sdk/public/PublicConfig.js +12 -0
  251. package/sdk/public/PublicModels.d.ts +50 -0
  252. package/sdk/public/PublicModels.js +712 -0
  253. package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
  254. package/sdk/public/client/ConfigurationPublicClient.js +102 -0
  255. package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
  256. package/sdk/public/client/InventoryPublicClient.js +239 -0
  257. package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
  258. package/sdk/public/client/WebhookPublicClient.js +92 -0
  259. package/sdk/public/constructUrl.d.ts +5 -0
  260. package/sdk/public/constructUrl.js +13 -0
  261. package/sdk/public/index.d.ts +2 -0
  262. package/sdk/public/index.js +4 -0
  263. package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
  264. package/sdk/public/models/ConfigurationValidator.js +18 -0
  265. package/sdk/public/models/InventoryValidator.d.ts +9 -0
  266. package/sdk/public/models/InventoryValidator.js +43 -0
  267. package/sdk/public/models/WebhookValidator.d.ts +5 -0
  268. package/sdk/public/models/WebhookValidator.js +14 -0
  269. package/tests/application/catalog.spec.js +47 -0
  270. package/tests/common/action-url.spec.js +35 -0
  271. package/tests/common/schema/action-url.json +163 -0
  272. package/tests/common/schema/url-action.json +667 -0
  273. package/tests/common/url-action.spec.js +48 -0
  274. package/tests/helpers/cookie.helper.js +31 -0
  275. package/tests/helpers/oauth.helper.js +43 -0
  276. package/tests/platform/catalog.spec.js +49 -0
  277. package/tests/public/location.spec.js +39 -0
@@ -0,0 +1,1629 @@
1
+ const APIClient = require("../ApplicationAPIClient");
2
+ const Paginator = require("../../common/Paginator");
3
+ const constructUrl = require("../constructUrl");
4
+ const { FDKClientValidationError } = require("../../common/FDKError");
5
+ const CatalogValidator = require("../models/CatalogValidator");
6
+
7
+ class Catalog {
8
+ constructor(_conf) {
9
+ this._conf = _conf;
10
+ this._relativeUrls = {
11
+ getProductDetailBySlug:
12
+ "/service/application/catalog/v1.0/products/{slug}/",
13
+ getProductSizesBySlug:
14
+ "/service/application/catalog/v1.0/products/{slug}/sizes/",
15
+ getProductComparisonBySlugs:
16
+ "/service/application/catalog/v1.0/products/compare/",
17
+ getSimilarComparisonProductBySlug:
18
+ "/service/application/catalog/v1.0/products/{slug}/similar/compare/",
19
+ getComparedFrequentlyProductBySlug:
20
+ "/service/application/catalog/v1.0/products/{slug}/similar/compared-frequently/",
21
+ getProductVariantsBySlug:
22
+ "/service/application/catalog/v1.0/products/{slug}/variants/",
23
+ getProductStockByIds:
24
+ "/service/application/catalog/v1.0/products/stock-status/",
25
+ getProductStockForTimeByIds:
26
+ "/service/application/catalog/v1.0/products/stock-status/poll/",
27
+ getProducts: "/service/application/catalog/v1.0/products/",
28
+ getBrands: "/service/application/catalog/v1.0/brands/",
29
+ getBrandDetailBySlug: "/service/application/catalog/v1.0/brands/{slug}/",
30
+ getCategories: "/service/application/catalog/v1.0/categories/",
31
+ getCategoryDetailBySlug:
32
+ "/service/application/catalog/v1.0/categories/{slug}/",
33
+ getHomeProducts: "/service/application/catalog/v1.0/home/listing/",
34
+ getDepartments: "/service/application/catalog/v1.0/departments/",
35
+ getSearchResults: "/service/application/catalog/v1.0/auto-complete/",
36
+ getCollections: "/service/application/catalog/v1.0/collections/",
37
+ getCollectionItemsBySlug:
38
+ "/service/application/catalog/v1.0/collections/{slug}/items/",
39
+ getCollectionDetailBySlug:
40
+ "/service/application/catalog/v1.0/collections/{slug}/",
41
+ getFollowedListing:
42
+ "/service/application/catalog/v1.0/follow/{collection_type}/",
43
+ unfollowById:
44
+ "/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/",
45
+ followById:
46
+ "/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/",
47
+ getFollowerCountById:
48
+ "/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/count/",
49
+ getFollowIds: "/service/application/catalog/v1.0/follow/ids/",
50
+ getStores: "/service/application/catalog/v1.0/locations/",
51
+ getInStockLocations:
52
+ "/service/application/catalog/v1.0/in-stock/locations/",
53
+ getLocationDetailsById:
54
+ "/service/application/catalog/v1.0/locations/{location_id}/",
55
+ getProductBundlesBySlug:
56
+ "/service/application/catalog/v1.0/product-grouping/",
57
+ getProductPriceBySlug:
58
+ "/service/application/catalog/v2.0/products/{slug}/sizes/{size}/price/",
59
+ getProductSellersBySlug:
60
+ "/service/application/catalog/v2.0/products/{slug}/sizes/{size}/sellers/",
61
+ };
62
+ this._urls = Object.entries(this._relativeUrls).reduce(
63
+ (urls, [method, relativeUrl]) => {
64
+ urls[method] = `${_conf.domain}${relativeUrl}`;
65
+ return urls;
66
+ },
67
+ {}
68
+ );
69
+ }
70
+
71
+ updateUrls(urls) {
72
+ this._urls = {
73
+ ...this._urls,
74
+ ...urls,
75
+ };
76
+ }
77
+
78
+ /**
79
+ * @param {Object} arg - Arg object.
80
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
81
+ * identifier of a product. You can get slug value from the endpoint
82
+ * /service/application/catalog/v1.0/products/
83
+ * @returns {Promise<ProductDetail>} - Success response
84
+ * @summary: Get a product
85
+ * @description: Use this API to retrieve a product by its slug value.
86
+ */
87
+ getProductDetailBySlug({ slug } = {}) {
88
+ const { error } = CatalogValidator.getProductDetailBySlug().validate(
89
+ { slug },
90
+ { abortEarly: false, allowUnknown: true }
91
+ );
92
+ if (error) {
93
+ return Promise.reject(new FDKClientValidationError(error));
94
+ }
95
+ const query_params = {};
96
+
97
+ const xHeaders = {};
98
+
99
+ return APIClient.execute(
100
+ this._conf,
101
+ "get",
102
+ constructUrl({
103
+ url: this._urls["getProductDetailBySlug"],
104
+ params: { slug },
105
+ }),
106
+ query_params,
107
+ undefined,
108
+ xHeaders
109
+ );
110
+ }
111
+
112
+ /**
113
+ * @param {Object} arg - Arg object.
114
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
115
+ * identifier of a product. You can get slug value from the endpoint
116
+ * /service/application/catalog/v1.0/products/
117
+ * @param {number} [arg.storeId] - The ID of the store that is selling the
118
+ * product, e.g. 1,2,3.
119
+ * @returns {Promise<ProductSizes>} - Success response
120
+ * @summary: Get the sizes of a product
121
+ * @description: A product can have multiple sizes. Use this API to fetch all the available sizes of a product.
122
+ */
123
+ getProductSizesBySlug({ slug, storeId } = {}) {
124
+ const { error } = CatalogValidator.getProductSizesBySlug().validate(
125
+ { slug, storeId },
126
+ { abortEarly: false, allowUnknown: true }
127
+ );
128
+ if (error) {
129
+ return Promise.reject(new FDKClientValidationError(error));
130
+ }
131
+ const query_params = {};
132
+ query_params["store_id"] = storeId;
133
+
134
+ const xHeaders = {};
135
+
136
+ return APIClient.execute(
137
+ this._conf,
138
+ "get",
139
+ constructUrl({
140
+ url: this._urls["getProductSizesBySlug"],
141
+ params: { slug },
142
+ }),
143
+ query_params,
144
+ undefined,
145
+ xHeaders
146
+ );
147
+ }
148
+
149
+ /**
150
+ * @param {Object} arg - Arg object.
151
+ * @param {string[]} arg.slug - A short, human-readable, URL-friendly
152
+ * identifier of a product. You can get slug value from the endpoint
153
+ * /service/application/catalog/v1.0/products/.
154
+ * @returns {Promise<ProductsComparisonResponse>} - Success response
155
+ * @summary: Compare products
156
+ * @description: Use this API to compare the features of products belonging to the same category. Note that at least one slug is mandatory in the request query.
157
+ */
158
+ getProductComparisonBySlugs({ slug } = {}) {
159
+ const { error } = CatalogValidator.getProductComparisonBySlugs().validate(
160
+ { slug },
161
+ { abortEarly: false, allowUnknown: true }
162
+ );
163
+ if (error) {
164
+ return Promise.reject(new FDKClientValidationError(error));
165
+ }
166
+ const query_params = {};
167
+ query_params["slug"] = slug;
168
+
169
+ const xHeaders = {};
170
+
171
+ return APIClient.execute(
172
+ this._conf,
173
+ "get",
174
+ constructUrl({
175
+ url: this._urls["getProductComparisonBySlugs"],
176
+ params: {},
177
+ }),
178
+ query_params,
179
+ undefined,
180
+ xHeaders
181
+ );
182
+ }
183
+
184
+ /**
185
+ * @param {Object} arg - Arg object.
186
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
187
+ * identifier of a product. You can get slug value from the endpoint
188
+ * /service/application/catalog/v1.0/products/
189
+ * @returns {Promise<ProductCompareResponse>} - Success response
190
+ * @summary: Get comparison between similar products
191
+ * @description: Use this API to compare a given product automatically with similar products. Only one slug is needed.
192
+ */
193
+ getSimilarComparisonProductBySlug({ slug } = {}) {
194
+ const {
195
+ error,
196
+ } = CatalogValidator.getSimilarComparisonProductBySlug().validate(
197
+ { slug },
198
+ { abortEarly: false, allowUnknown: true }
199
+ );
200
+ if (error) {
201
+ return Promise.reject(new FDKClientValidationError(error));
202
+ }
203
+ const query_params = {};
204
+
205
+ const xHeaders = {};
206
+
207
+ return APIClient.execute(
208
+ this._conf,
209
+ "get",
210
+ constructUrl({
211
+ url: this._urls["getSimilarComparisonProductBySlug"],
212
+ params: { slug },
213
+ }),
214
+ query_params,
215
+ undefined,
216
+ xHeaders
217
+ );
218
+ }
219
+
220
+ /**
221
+ * @param {Object} arg - Arg object.
222
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
223
+ * identifier of a product. You can get slug value from the endpoint
224
+ * /service/application/catalog/v1.0/products/
225
+ * @returns {Promise<ProductFrequentlyComparedSimilarResponse>} - Success response
226
+ * @summary: Get comparison between frequently compared products with the given product
227
+ * @description: Use this API to compare a given product automatically with products that are frequently compared with it. Only one slug is needed.
228
+ */
229
+ getComparedFrequentlyProductBySlug({ slug } = {}) {
230
+ const {
231
+ error,
232
+ } = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
233
+ { slug },
234
+ { abortEarly: false, allowUnknown: true }
235
+ );
236
+ if (error) {
237
+ return Promise.reject(new FDKClientValidationError(error));
238
+ }
239
+ const query_params = {};
240
+
241
+ const xHeaders = {};
242
+
243
+ return APIClient.execute(
244
+ this._conf,
245
+ "get",
246
+ constructUrl({
247
+ url: this._urls["getComparedFrequentlyProductBySlug"],
248
+ params: { slug },
249
+ }),
250
+ query_params,
251
+ undefined,
252
+ xHeaders
253
+ );
254
+ }
255
+
256
+ /**
257
+ * @param {Object} arg - Arg object.
258
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
259
+ * identifier of a product. You can get slug value from the endpoint
260
+ * /service/application/catalog/v1.0/products/
261
+ * @returns {Promise<ProductVariantsResponse>} - Success response
262
+ * @summary: Get variant of a particular product
263
+ * @description: A product can have a different type of variants such as colour, shade, memory. Use this API to fetch all the available variants of a product using its slug.
264
+ */
265
+ getProductVariantsBySlug({ slug } = {}) {
266
+ const { error } = CatalogValidator.getProductVariantsBySlug().validate(
267
+ { slug },
268
+ { abortEarly: false, allowUnknown: true }
269
+ );
270
+ if (error) {
271
+ return Promise.reject(new FDKClientValidationError(error));
272
+ }
273
+ const query_params = {};
274
+
275
+ const xHeaders = {};
276
+
277
+ return APIClient.execute(
278
+ this._conf,
279
+ "get",
280
+ constructUrl({
281
+ url: this._urls["getProductVariantsBySlug"],
282
+ params: { slug },
283
+ }),
284
+ query_params,
285
+ undefined,
286
+ xHeaders
287
+ );
288
+ }
289
+
290
+ /**
291
+ * @param {Object} arg - Arg object.
292
+ * @param {string} [arg.itemId] - The Item ID of the product (Max. 50 allowed)
293
+ * @param {string} [arg.alu] - ALU of the product (limited upto 50 ALU
294
+ * identifier in a single request)
295
+ * @param {string} [arg.skuCode] - Stock-keeping Unit of the product
296
+ * (limited upto 50 SKU Code in a single request)
297
+ * @param {string} [arg.ean] - European Article Number of the product
298
+ * (limited upto 50 EAN identifier in a single request)
299
+ * @param {string} [arg.upc] - Universal Product Code of the product
300
+ * (limited upto 50 UPC identifier in a single request)
301
+ * @returns {Promise<ProductStockStatusResponse>} - Success response
302
+ * @summary: Get the stock of a product
303
+ * @description: Retrieve the available stock of the products. Use this API to retrieve stock of multiple products (up to 50) at a time.
304
+ */
305
+ getProductStockByIds({ itemId, alu, skuCode, ean, upc } = {}) {
306
+ const { error } = CatalogValidator.getProductStockByIds().validate(
307
+ { itemId, alu, skuCode, ean, upc },
308
+ { abortEarly: false, allowUnknown: true }
309
+ );
310
+ if (error) {
311
+ return Promise.reject(new FDKClientValidationError(error));
312
+ }
313
+ const query_params = {};
314
+ query_params["item_id"] = itemId;
315
+ query_params["alu"] = alu;
316
+ query_params["sku_code"] = skuCode;
317
+ query_params["ean"] = ean;
318
+ query_params["upc"] = upc;
319
+
320
+ const xHeaders = {};
321
+
322
+ return APIClient.execute(
323
+ this._conf,
324
+ "get",
325
+ constructUrl({
326
+ url: this._urls["getProductStockByIds"],
327
+ params: {},
328
+ }),
329
+ query_params,
330
+ undefined,
331
+ xHeaders
332
+ );
333
+ }
334
+
335
+ /**
336
+ * @param {Object} arg - Arg object.
337
+ * @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z)
338
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
339
+ * @param {string} [arg.pageId] - Page ID to retrieve next set of results.
340
+ * @returns {Promise<ProductStockPolling>} - Success response
341
+ * @summary: Get the stock of a product
342
+ * @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
343
+ */
344
+ getProductStockForTimeByIds({ timestamp, pageSize, pageId } = {}) {
345
+ const { error } = CatalogValidator.getProductStockForTimeByIds().validate(
346
+ { timestamp, pageSize, pageId },
347
+ { abortEarly: false, allowUnknown: true }
348
+ );
349
+ if (error) {
350
+ return Promise.reject(new FDKClientValidationError(error));
351
+ }
352
+ const query_params = {};
353
+ query_params["timestamp"] = timestamp;
354
+ query_params["page_size"] = pageSize;
355
+ query_params["page_id"] = pageId;
356
+
357
+ const xHeaders = {};
358
+
359
+ return APIClient.execute(
360
+ this._conf,
361
+ "get",
362
+ constructUrl({
363
+ url: this._urls["getProductStockForTimeByIds"],
364
+ params: {},
365
+ }),
366
+ query_params,
367
+ undefined,
368
+ xHeaders
369
+ );
370
+ }
371
+
372
+ /**
373
+ * @param {Object} arg - Arg object.
374
+ * @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z)
375
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
376
+ * @summary: Get the stock of a product
377
+ * @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
378
+ */
379
+ getProductStockForTimeByIdsPaginator({ timestamp, pageSize } = {}) {
380
+ const paginator = new Paginator();
381
+ const callback = async () => {
382
+ const pageId = paginator.nextId;
383
+ const pageNo = paginator.pageNo;
384
+ const pageType = "cursor";
385
+ const data = await this.getProductStockForTimeByIds({
386
+ timestamp: timestamp,
387
+ pageSize: pageSize,
388
+ pageId: pageId,
389
+ });
390
+ paginator.setPaginator({
391
+ hasNext: data.page.has_next ? true : false,
392
+ nextId: data.page.next_id,
393
+ });
394
+ return data;
395
+ };
396
+ paginator.setCallback(callback);
397
+ return paginator;
398
+ }
399
+
400
+ /**
401
+ * @param {Object} arg - Arg object.
402
+ * @param {string} [arg.q] - The search query for entering partial or full
403
+ * name of product, brand, category, or collection.
404
+ * @param {string} [arg.f] - The search filter parameters. Filter parameters
405
+ * will be passed in f parameter as shown in the example below. Double
406
+ * Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
407
+ * indicates a new filter paramater applied as an AND condition.
408
+ * @param {boolean} [arg.filters] - This is a boolean value, True for
409
+ * fetching all filter parameters and False for disabling the filter parameters.
410
+ * @param {string} [arg.sortOn] - The order in which the list of products
411
+ * should be sorted, e.g. popularity, price, latest and discount, in
412
+ * either ascending or descending order. See the supported values below.
413
+ * @param {string} [arg.pageId] - Page ID to retrieve next set of results.
414
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
415
+ * @param {number} [arg.pageNo] - The page number to navigate through the
416
+ * given set of results.
417
+ * @param {string} [arg.pageType] - Available pagination types are cursor or number.
418
+ * @returns {Promise<ProductListingResponse>} - Success response
419
+ * @summary: Get all the products
420
+ * @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
421
+ */
422
+ getProducts({
423
+ q,
424
+ f,
425
+ filters,
426
+ sortOn,
427
+ pageId,
428
+ pageSize,
429
+ pageNo,
430
+ pageType,
431
+ } = {}) {
432
+ const { error } = CatalogValidator.getProducts().validate(
433
+ { q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
434
+ { abortEarly: false, allowUnknown: true }
435
+ );
436
+ if (error) {
437
+ return Promise.reject(new FDKClientValidationError(error));
438
+ }
439
+ const query_params = {};
440
+ query_params["q"] = q;
441
+ query_params["f"] = f;
442
+ query_params["filters"] = filters;
443
+ query_params["sort_on"] = sortOn;
444
+ query_params["page_id"] = pageId;
445
+ query_params["page_size"] = pageSize;
446
+ query_params["page_no"] = pageNo;
447
+ query_params["page_type"] = pageType;
448
+
449
+ const xHeaders = {};
450
+
451
+ return APIClient.execute(
452
+ this._conf,
453
+ "get",
454
+ constructUrl({
455
+ url: this._urls["getProducts"],
456
+ params: {},
457
+ }),
458
+ query_params,
459
+ undefined,
460
+ xHeaders
461
+ );
462
+ }
463
+
464
+ /**
465
+ * @param {Object} arg - Arg object.
466
+ * @param {string} [arg.q] - The search query for entering partial or full
467
+ * name of product, brand, category, or collection.
468
+ * @param {string} [arg.f] - The search filter parameters. Filter parameters
469
+ * will be passed in f parameter as shown in the example below. Double
470
+ * Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
471
+ * indicates a new filter paramater applied as an AND condition.
472
+ * @param {boolean} [arg.filters] - This is a boolean value, True for
473
+ * fetching all filter parameters and False for disabling the filter parameters.
474
+ * @param {string} [arg.sortOn] - The order in which the list of products
475
+ * should be sorted, e.g. popularity, price, latest and discount, in
476
+ * either ascending or descending order. See the supported values below.
477
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
478
+ * @summary: Get all the products
479
+ * @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
480
+ */
481
+ getProductsPaginator({ q, f, filters, sortOn, pageSize } = {}) {
482
+ const paginator = new Paginator();
483
+ const callback = async () => {
484
+ const pageId = paginator.nextId;
485
+ const pageNo = paginator.pageNo;
486
+ const pageType = "cursor";
487
+ const data = await this.getProducts({
488
+ q: q,
489
+ f: f,
490
+ filters: filters,
491
+ sortOn: sortOn,
492
+ pageId: pageId,
493
+ pageSize: pageSize,
494
+ pageNo: pageNo,
495
+ pageType: pageType,
496
+ });
497
+ paginator.setPaginator({
498
+ hasNext: data.page.has_next ? true : false,
499
+ nextId: data.page.next_id,
500
+ });
501
+ return data;
502
+ };
503
+ paginator.setCallback(callback);
504
+ return paginator;
505
+ }
506
+
507
+ /**
508
+ * @param {Object} arg - Arg object.
509
+ * @param {string} [arg.department] - The name of the department. Use this
510
+ * parameter to filter products by a particular department. See the list
511
+ * of available departments below. Also, you can get available departments
512
+ * from the endpoint /service/application/catalog/v1.0/departments/
513
+ * @param {number} [arg.pageNo] - The page number to navigate through the
514
+ * given set of results.
515
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
516
+ * @returns {Promise<BrandListingResponse>} - Success response
517
+ * @summary: Get all the brands
518
+ * @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
519
+ */
520
+ getBrands({ department, pageNo, pageSize } = {}) {
521
+ const { error } = CatalogValidator.getBrands().validate(
522
+ { department, pageNo, pageSize },
523
+ { abortEarly: false, allowUnknown: true }
524
+ );
525
+ if (error) {
526
+ return Promise.reject(new FDKClientValidationError(error));
527
+ }
528
+ const query_params = {};
529
+ query_params["department"] = department;
530
+ query_params["page_no"] = pageNo;
531
+ query_params["page_size"] = pageSize;
532
+
533
+ const xHeaders = {};
534
+
535
+ return APIClient.execute(
536
+ this._conf,
537
+ "get",
538
+ constructUrl({
539
+ url: this._urls["getBrands"],
540
+ params: {},
541
+ }),
542
+ query_params,
543
+ undefined,
544
+ xHeaders
545
+ );
546
+ }
547
+
548
+ /**
549
+ * @param {Object} arg - Arg object.
550
+ * @param {string} [arg.department] - The name of the department. Use this
551
+ * parameter to filter products by a particular department. See the list
552
+ * of available departments below. Also, you can get available departments
553
+ * from the endpoint /service/application/catalog/v1.0/departments/
554
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
555
+ * @summary: Get all the brands
556
+ * @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
557
+ */
558
+ getBrandsPaginator({ department, pageSize } = {}) {
559
+ const paginator = new Paginator();
560
+ const callback = async () => {
561
+ const pageId = paginator.nextId;
562
+ const pageNo = paginator.pageNo;
563
+ const pageType = "number";
564
+ const data = await this.getBrands({
565
+ department: department,
566
+ pageNo: pageNo,
567
+ pageSize: pageSize,
568
+ });
569
+ paginator.setPaginator({
570
+ hasNext: data.page.has_next ? true : false,
571
+ nextId: data.page.next_id,
572
+ });
573
+ return data;
574
+ };
575
+ paginator.setCallback(callback);
576
+ return paginator;
577
+ }
578
+
579
+ /**
580
+ * @param {Object} arg - Arg object.
581
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
582
+ * identifier of a brand. You can get slug value from the endpoint
583
+ * /service/application/catalog/v1.0/brands/.
584
+ * @returns {Promise<BrandDetailResponse>} - Success response
585
+ * @summary: Get metadata of a brand
586
+ * @description: Fetch metadata of a brand such as name, information, logo, banner, etc.
587
+ */
588
+ getBrandDetailBySlug({ slug } = {}) {
589
+ const { error } = CatalogValidator.getBrandDetailBySlug().validate(
590
+ { slug },
591
+ { abortEarly: false, allowUnknown: true }
592
+ );
593
+ if (error) {
594
+ return Promise.reject(new FDKClientValidationError(error));
595
+ }
596
+ const query_params = {};
597
+
598
+ const xHeaders = {};
599
+
600
+ return APIClient.execute(
601
+ this._conf,
602
+ "get",
603
+ constructUrl({
604
+ url: this._urls["getBrandDetailBySlug"],
605
+ params: { slug },
606
+ }),
607
+ query_params,
608
+ undefined,
609
+ xHeaders
610
+ );
611
+ }
612
+
613
+ /**
614
+ * @param {Object} arg - Arg object.
615
+ * @param {string} [arg.department] - The name of the department. Use this
616
+ * parameter to filter products by a particular department. See the list
617
+ * of available departments below. Also, you can get available departments
618
+ * from the endpoint /service/application/catalog/v1.0/departments/
619
+ * @returns {Promise<CategoryListingResponse>} - Success response
620
+ * @summary: List all the categories
621
+ * @description: Use this API to list all the categories. You can also filter the categories by department.
622
+ */
623
+ getCategories({ department } = {}) {
624
+ const { error } = CatalogValidator.getCategories().validate(
625
+ { department },
626
+ { abortEarly: false, allowUnknown: true }
627
+ );
628
+ if (error) {
629
+ return Promise.reject(new FDKClientValidationError(error));
630
+ }
631
+ const query_params = {};
632
+ query_params["department"] = department;
633
+
634
+ const xHeaders = {};
635
+
636
+ return APIClient.execute(
637
+ this._conf,
638
+ "get",
639
+ constructUrl({
640
+ url: this._urls["getCategories"],
641
+ params: {},
642
+ }),
643
+ query_params,
644
+ undefined,
645
+ xHeaders
646
+ );
647
+ }
648
+
649
+ /**
650
+ * @param {Object} arg - Arg object.
651
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
652
+ * identifier of a brand. You can get slug value from the endpoint
653
+ * /service/application/catalog/v1.0/brands/.
654
+ * @returns {Promise<CategoryMetaResponse>} - Success response
655
+ * @summary: Get metadata of a category
656
+ * @description: Fetch metadata of a category such as name, information, logo, banner, etc.
657
+ */
658
+ getCategoryDetailBySlug({ slug } = {}) {
659
+ const { error } = CatalogValidator.getCategoryDetailBySlug().validate(
660
+ { slug },
661
+ { abortEarly: false, allowUnknown: true }
662
+ );
663
+ if (error) {
664
+ return Promise.reject(new FDKClientValidationError(error));
665
+ }
666
+ const query_params = {};
667
+
668
+ const xHeaders = {};
669
+
670
+ return APIClient.execute(
671
+ this._conf,
672
+ "get",
673
+ constructUrl({
674
+ url: this._urls["getCategoryDetailBySlug"],
675
+ params: { slug },
676
+ }),
677
+ query_params,
678
+ undefined,
679
+ xHeaders
680
+ );
681
+ }
682
+
683
+ /**
684
+ * @param {Object} arg - Arg object.
685
+ * @param {string} [arg.sortOn] - The order in which the list of products
686
+ * should be sorted, e.g. popularity, price, latest and discount, in
687
+ * either ascending or descending order.
688
+ * @param {string} [arg.pageId] - Page ID to retrieve next set of results.
689
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
690
+ * @returns {Promise<HomeListingResponse>} - Success response
691
+ * @summary: List the products
692
+ * @description: List all the products associated with a brand, collection or category in a random order.
693
+ */
694
+ getHomeProducts({ sortOn, pageId, pageSize } = {}) {
695
+ const { error } = CatalogValidator.getHomeProducts().validate(
696
+ { sortOn, pageId, pageSize },
697
+ { abortEarly: false, allowUnknown: true }
698
+ );
699
+ if (error) {
700
+ return Promise.reject(new FDKClientValidationError(error));
701
+ }
702
+ const query_params = {};
703
+ query_params["sort_on"] = sortOn;
704
+ query_params["page_id"] = pageId;
705
+ query_params["page_size"] = pageSize;
706
+
707
+ const xHeaders = {};
708
+
709
+ return APIClient.execute(
710
+ this._conf,
711
+ "get",
712
+ constructUrl({
713
+ url: this._urls["getHomeProducts"],
714
+ params: {},
715
+ }),
716
+ query_params,
717
+ undefined,
718
+ xHeaders
719
+ );
720
+ }
721
+
722
+ /**
723
+ * @param {Object} arg - Arg object.
724
+ * @param {string} [arg.sortOn] - The order in which the list of products
725
+ * should be sorted, e.g. popularity, price, latest and discount, in
726
+ * either ascending or descending order.
727
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
728
+ * @summary: List the products
729
+ * @description: List all the products associated with a brand, collection or category in a random order.
730
+ */
731
+ getHomeProductsPaginator({ sortOn, pageSize } = {}) {
732
+ const paginator = new Paginator();
733
+ const callback = async () => {
734
+ const pageId = paginator.nextId;
735
+ const pageNo = paginator.pageNo;
736
+ const pageType = "cursor";
737
+ const data = await this.getHomeProducts({
738
+ sortOn: sortOn,
739
+ pageId: pageId,
740
+ pageSize: pageSize,
741
+ });
742
+ paginator.setPaginator({
743
+ hasNext: data.page.has_next ? true : false,
744
+ nextId: data.page.next_id,
745
+ });
746
+ return data;
747
+ };
748
+ paginator.setCallback(callback);
749
+ return paginator;
750
+ }
751
+
752
+ /**
753
+ * @param {Object} arg - Arg object.
754
+ * @returns {Promise<DepartmentResponse>} - Success response
755
+ * @summary: List all the departments
756
+ * @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the departments. If successful, returns the list of departments specified in `DepartmentResponse`
757
+ */
758
+ getDepartments({} = {}) {
759
+ const { error } = CatalogValidator.getDepartments().validate(
760
+ {},
761
+ { abortEarly: false, allowUnknown: true }
762
+ );
763
+ if (error) {
764
+ return Promise.reject(new FDKClientValidationError(error));
765
+ }
766
+ const query_params = {};
767
+
768
+ const xHeaders = {};
769
+
770
+ return APIClient.execute(
771
+ this._conf,
772
+ "get",
773
+ constructUrl({
774
+ url: this._urls["getDepartments"],
775
+ params: {},
776
+ }),
777
+ query_params,
778
+ undefined,
779
+ xHeaders
780
+ );
781
+ }
782
+
783
+ /**
784
+ * @param {Object} arg - Arg object.
785
+ * @param {string} arg.q - The search query for entering partial or full
786
+ * name of a product, brand or category. For example, if the given search
787
+ * query `q` is *ski*, the relevant search suggestions could be *skirt*,
788
+ * *ski shoes*, _*skin cream* etc.
789
+ * @returns {Promise<AutoCompleteResponse>} - Success response
790
+ * @summary: Get relevant suggestions for a search query
791
+ * @description: Retrieves a list of suggestions for a given search query. Each suggestion is a valid search term that's generated on the basis of query. This is particularly useful to enhance the user experience while using the search tool.
792
+ */
793
+ getSearchResults({ q } = {}) {
794
+ const { error } = CatalogValidator.getSearchResults().validate(
795
+ { q },
796
+ { abortEarly: false, allowUnknown: true }
797
+ );
798
+ if (error) {
799
+ return Promise.reject(new FDKClientValidationError(error));
800
+ }
801
+ const query_params = {};
802
+ query_params["q"] = q;
803
+
804
+ const xHeaders = {};
805
+
806
+ return APIClient.execute(
807
+ this._conf,
808
+ "get",
809
+ constructUrl({
810
+ url: this._urls["getSearchResults"],
811
+ params: {},
812
+ }),
813
+ query_params,
814
+ undefined,
815
+ xHeaders
816
+ );
817
+ }
818
+
819
+ /**
820
+ * @param {Object} arg - Arg object.
821
+ * @param {number} [arg.pageNo] - The page number to navigate through the
822
+ * given set of results.
823
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
824
+ * @param {string[]} [arg.tag] - List of tags to filter collections
825
+ * @returns {Promise<GetCollectionListingResponse>} - Success response
826
+ * @summary: List all the collections
827
+ * @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
828
+ */
829
+ getCollections({ pageNo, pageSize, tag } = {}) {
830
+ const { error } = CatalogValidator.getCollections().validate(
831
+ { pageNo, pageSize, tag },
832
+ { abortEarly: false, allowUnknown: true }
833
+ );
834
+ if (error) {
835
+ return Promise.reject(new FDKClientValidationError(error));
836
+ }
837
+ const query_params = {};
838
+ query_params["page_no"] = pageNo;
839
+ query_params["page_size"] = pageSize;
840
+ query_params["tag"] = tag;
841
+
842
+ const xHeaders = {};
843
+
844
+ return APIClient.execute(
845
+ this._conf,
846
+ "get",
847
+ constructUrl({
848
+ url: this._urls["getCollections"],
849
+ params: {},
850
+ }),
851
+ query_params,
852
+ undefined,
853
+ xHeaders
854
+ );
855
+ }
856
+
857
+ /**
858
+ * @param {Object} arg - Arg object.
859
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
860
+ * @param {string[]} [arg.tag] - List of tags to filter collections
861
+ * @summary: List all the collections
862
+ * @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
863
+ */
864
+ getCollectionsPaginator({ pageSize, tag } = {}) {
865
+ const paginator = new Paginator();
866
+ const callback = async () => {
867
+ const pageId = paginator.nextId;
868
+ const pageNo = paginator.pageNo;
869
+ const pageType = "number";
870
+ const data = await this.getCollections({
871
+ pageNo: pageNo,
872
+ pageSize: pageSize,
873
+ tag: tag,
874
+ });
875
+ paginator.setPaginator({
876
+ hasNext: data.page.has_next ? true : false,
877
+ nextId: data.page.next_id,
878
+ });
879
+ return data;
880
+ };
881
+ paginator.setCallback(callback);
882
+ return paginator;
883
+ }
884
+
885
+ /**
886
+ * @param {Object} arg - Arg object.
887
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
888
+ * identifier of a collection. You can get slug value from the endpoint
889
+ * /service/application/catalog/v1.0/collections/.
890
+ * @param {string} [arg.f] - The search filter parameters. Filter parameters
891
+ * will be passed in f parameter as shown in the example below. Double
892
+ * Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
893
+ * indicates a new filter paramater applied as an AND condition.
894
+ * @param {boolean} [arg.filters] - This is a boolean value, True for
895
+ * fetching all filter parameters and False for disabling the filter parameters.
896
+ * @param {string} [arg.sortOn] - The order in which the list of products
897
+ * should be sorted, e.g. popularity, price, latest and discount, in
898
+ * either ascending or descending order. See the supported values below.
899
+ * @param {string} [arg.pageId] - Page ID to retrieve next set of results.
900
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
901
+ * @returns {Promise<ProductListingResponse>} - Success response
902
+ * @summary: Get the items in a collection
903
+ * @description: Get items in a collection specified by its `slug`.
904
+ */
905
+ getCollectionItemsBySlug({
906
+ slug,
907
+ f,
908
+ filters,
909
+ sortOn,
910
+ pageId,
911
+ pageSize,
912
+ } = {}) {
913
+ const { error } = CatalogValidator.getCollectionItemsBySlug().validate(
914
+ { slug, f, filters, sortOn, pageId, pageSize },
915
+ { abortEarly: false, allowUnknown: true }
916
+ );
917
+ if (error) {
918
+ return Promise.reject(new FDKClientValidationError(error));
919
+ }
920
+ const query_params = {};
921
+ query_params["f"] = f;
922
+ query_params["filters"] = filters;
923
+ query_params["sort_on"] = sortOn;
924
+ query_params["page_id"] = pageId;
925
+ query_params["page_size"] = pageSize;
926
+
927
+ const xHeaders = {};
928
+
929
+ return APIClient.execute(
930
+ this._conf,
931
+ "get",
932
+ constructUrl({
933
+ url: this._urls["getCollectionItemsBySlug"],
934
+ params: { slug },
935
+ }),
936
+ query_params,
937
+ undefined,
938
+ xHeaders
939
+ );
940
+ }
941
+
942
+ /**
943
+ * @param {Object} arg - Arg object.
944
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
945
+ * identifier of a collection. You can get slug value from the endpoint
946
+ * /service/application/catalog/v1.0/collections/.
947
+ * @param {string} [arg.f] - The search filter parameters. Filter parameters
948
+ * will be passed in f parameter as shown in the example below. Double
949
+ * Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
950
+ * indicates a new filter paramater applied as an AND condition.
951
+ * @param {boolean} [arg.filters] - This is a boolean value, True for
952
+ * fetching all filter parameters and False for disabling the filter parameters.
953
+ * @param {string} [arg.sortOn] - The order in which the list of products
954
+ * should be sorted, e.g. popularity, price, latest and discount, in
955
+ * either ascending or descending order. See the supported values below.
956
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
957
+ * @summary: Get the items in a collection
958
+ * @description: Get items in a collection specified by its `slug`.
959
+ */
960
+ getCollectionItemsBySlugPaginator({
961
+ slug,
962
+ f,
963
+ filters,
964
+ sortOn,
965
+ pageSize,
966
+ } = {}) {
967
+ const paginator = new Paginator();
968
+ const callback = async () => {
969
+ const pageId = paginator.nextId;
970
+ const pageNo = paginator.pageNo;
971
+ const pageType = "cursor";
972
+ const data = await this.getCollectionItemsBySlug({
973
+ slug: slug,
974
+ f: f,
975
+ filters: filters,
976
+ sortOn: sortOn,
977
+ pageId: pageId,
978
+ pageSize: pageSize,
979
+ });
980
+ paginator.setPaginator({
981
+ hasNext: data.page.has_next ? true : false,
982
+ nextId: data.page.next_id,
983
+ });
984
+ return data;
985
+ };
986
+ paginator.setCallback(callback);
987
+ return paginator;
988
+ }
989
+
990
+ /**
991
+ * @param {Object} arg - Arg object.
992
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
993
+ * identifier of a collection. You can get slug value from the endpoint
994
+ * /service/application/catalog/v1.0/collections/.
995
+ * @returns {Promise<CollectionDetailResponse>} - Success response
996
+ * @summary: Get a particular collection
997
+ * @description: Get the details of a collection by its `slug`.
998
+ */
999
+ getCollectionDetailBySlug({ slug } = {}) {
1000
+ const { error } = CatalogValidator.getCollectionDetailBySlug().validate(
1001
+ { slug },
1002
+ { abortEarly: false, allowUnknown: true }
1003
+ );
1004
+ if (error) {
1005
+ return Promise.reject(new FDKClientValidationError(error));
1006
+ }
1007
+ const query_params = {};
1008
+
1009
+ const xHeaders = {};
1010
+
1011
+ return APIClient.execute(
1012
+ this._conf,
1013
+ "get",
1014
+ constructUrl({
1015
+ url: this._urls["getCollectionDetailBySlug"],
1016
+ params: { slug },
1017
+ }),
1018
+ query_params,
1019
+ undefined,
1020
+ xHeaders
1021
+ );
1022
+ }
1023
+
1024
+ /**
1025
+ * @param {Object} arg - Arg object.
1026
+ * @param {string} arg.collectionType - Type of collection followed, i.e.
1027
+ * products, brands, or collections.
1028
+ * @param {string} [arg.pageId] - Page ID to retrieve next set of results.
1029
+ * @param {number} [arg.pageSize] - Page ID to retrieve next set of results.
1030
+ * @returns {Promise<GetFollowListingResponse>} - Success response
1031
+ * @summary: Get a list of followed Products, Brands, Collections
1032
+ * @description: Users can follow a product they like. This API retrieves the products the user have followed.
1033
+ */
1034
+ getFollowedListing({ collectionType, pageId, pageSize } = {}) {
1035
+ const { error } = CatalogValidator.getFollowedListing().validate(
1036
+ { collectionType, pageId, pageSize },
1037
+ { abortEarly: false, allowUnknown: true }
1038
+ );
1039
+ if (error) {
1040
+ return Promise.reject(new FDKClientValidationError(error));
1041
+ }
1042
+ const query_params = {};
1043
+ query_params["page_id"] = pageId;
1044
+ query_params["page_size"] = pageSize;
1045
+
1046
+ const xHeaders = {};
1047
+
1048
+ return APIClient.execute(
1049
+ this._conf,
1050
+ "get",
1051
+ constructUrl({
1052
+ url: this._urls["getFollowedListing"],
1053
+ params: { collectionType },
1054
+ }),
1055
+ query_params,
1056
+ undefined,
1057
+ xHeaders
1058
+ );
1059
+ }
1060
+
1061
+ /**
1062
+ * @param {Object} arg - Arg object.
1063
+ * @param {string} arg.collectionType - Type of collection followed, i.e.
1064
+ * products, brands, or collections.
1065
+ * @param {number} [arg.pageSize] - Page ID to retrieve next set of results.
1066
+ * @summary: Get a list of followed Products, Brands, Collections
1067
+ * @description: Users can follow a product they like. This API retrieves the products the user have followed.
1068
+ */
1069
+ getFollowedListingPaginator({ collectionType, pageSize } = {}) {
1070
+ const paginator = new Paginator();
1071
+ const callback = async () => {
1072
+ const pageId = paginator.nextId;
1073
+ const pageNo = paginator.pageNo;
1074
+ const pageType = "cursor";
1075
+ const data = await this.getFollowedListing({
1076
+ collectionType: collectionType,
1077
+ pageId: pageId,
1078
+ pageSize: pageSize,
1079
+ });
1080
+ paginator.setPaginator({
1081
+ hasNext: data.page.has_next ? true : false,
1082
+ nextId: data.page.next_id,
1083
+ });
1084
+ return data;
1085
+ };
1086
+ paginator.setCallback(callback);
1087
+ return paginator;
1088
+ }
1089
+
1090
+ /**
1091
+ * @param {Object} arg - Arg object.
1092
+ * @param {string} arg.collectionType - Type of collection followed, i.e.
1093
+ * products, brands, or collections.
1094
+ * @param {string} arg.collectionId - The ID of the collection type.
1095
+ * @returns {Promise<FollowPostResponse>} - Success response
1096
+ * @summary: Unfollow an entity (product/brand/collection)
1097
+ * @description: You can undo a followed product, brand or collection by its ID. This action is referred as _unfollow_.
1098
+ */
1099
+ unfollowById({ collectionType, collectionId } = {}) {
1100
+ const { error } = CatalogValidator.unfollowById().validate(
1101
+ { collectionType, collectionId },
1102
+ { abortEarly: false, allowUnknown: true }
1103
+ );
1104
+ if (error) {
1105
+ return Promise.reject(new FDKClientValidationError(error));
1106
+ }
1107
+ const query_params = {};
1108
+
1109
+ const xHeaders = {};
1110
+
1111
+ return APIClient.execute(
1112
+ this._conf,
1113
+ "delete",
1114
+ constructUrl({
1115
+ url: this._urls["unfollowById"],
1116
+ params: { collectionType, collectionId },
1117
+ }),
1118
+ query_params,
1119
+ undefined,
1120
+ xHeaders
1121
+ );
1122
+ }
1123
+
1124
+ /**
1125
+ * @param {Object} arg - Arg object.
1126
+ * @param {string} arg.collectionType - Type of collection followed, i.e.
1127
+ * products, brands, or collections.
1128
+ * @param {string} arg.collectionId - The ID of the collection type.
1129
+ * @returns {Promise<FollowPostResponse>} - Success response
1130
+ * @summary: Follow an entity (product/brand/collection)
1131
+ * @description: Follow a particular entity such as product, brand, collection specified by its ID.
1132
+ */
1133
+ followById({ collectionType, collectionId } = {}) {
1134
+ const { error } = CatalogValidator.followById().validate(
1135
+ { collectionType, collectionId },
1136
+ { abortEarly: false, allowUnknown: true }
1137
+ );
1138
+ if (error) {
1139
+ return Promise.reject(new FDKClientValidationError(error));
1140
+ }
1141
+ const query_params = {};
1142
+
1143
+ const xHeaders = {};
1144
+
1145
+ return APIClient.execute(
1146
+ this._conf,
1147
+ "post",
1148
+ constructUrl({
1149
+ url: this._urls["followById"],
1150
+ params: { collectionType, collectionId },
1151
+ }),
1152
+ query_params,
1153
+ undefined,
1154
+ xHeaders
1155
+ );
1156
+ }
1157
+
1158
+ /**
1159
+ * @param {Object} arg - Arg object.
1160
+ * @param {string} arg.collectionType - Type of collection, i.e. products,
1161
+ * brands, or collections.
1162
+ * @param {string} arg.collectionId - The ID of the collection type.
1163
+ * @returns {Promise<FollowerCountResponse>} - Success response
1164
+ * @summary: Get Follow Count
1165
+ * @description: Get the total count of followers for a given collection type and collection ID.
1166
+ */
1167
+ getFollowerCountById({ collectionType, collectionId } = {}) {
1168
+ const { error } = CatalogValidator.getFollowerCountById().validate(
1169
+ { collectionType, collectionId },
1170
+ { abortEarly: false, allowUnknown: true }
1171
+ );
1172
+ if (error) {
1173
+ return Promise.reject(new FDKClientValidationError(error));
1174
+ }
1175
+ const query_params = {};
1176
+
1177
+ const xHeaders = {};
1178
+
1179
+ return APIClient.execute(
1180
+ this._conf,
1181
+ "get",
1182
+ constructUrl({
1183
+ url: this._urls["getFollowerCountById"],
1184
+ params: { collectionType, collectionId },
1185
+ }),
1186
+ query_params,
1187
+ undefined,
1188
+ xHeaders
1189
+ );
1190
+ }
1191
+
1192
+ /**
1193
+ * @param {Object} arg - Arg object.
1194
+ * @param {string} [arg.collectionType] - Type of collection, i.e. products,
1195
+ * brands, collections.
1196
+ * @returns {Promise<FollowIdsResponse>} - Success response
1197
+ * @summary: Get the IDs of followed products, brands and collections.
1198
+ * @description: You can get the IDs of all the followed Products, Brands and Collections. Pass collection_type as query parameter to fetch specific Ids
1199
+ */
1200
+ getFollowIds({ collectionType } = {}) {
1201
+ const { error } = CatalogValidator.getFollowIds().validate(
1202
+ { collectionType },
1203
+ { abortEarly: false, allowUnknown: true }
1204
+ );
1205
+ if (error) {
1206
+ return Promise.reject(new FDKClientValidationError(error));
1207
+ }
1208
+ const query_params = {};
1209
+ query_params["collection_type"] = collectionType;
1210
+
1211
+ const xHeaders = {};
1212
+
1213
+ return APIClient.execute(
1214
+ this._conf,
1215
+ "get",
1216
+ constructUrl({
1217
+ url: this._urls["getFollowIds"],
1218
+ params: {},
1219
+ }),
1220
+ query_params,
1221
+ undefined,
1222
+ xHeaders
1223
+ );
1224
+ }
1225
+
1226
+ /**
1227
+ * @param {Object} arg - Arg object.
1228
+ * @param {number} [arg.pageNo] - The page number to navigate through the
1229
+ * given set of results.
1230
+ * @param {number} [arg.pageSize] - Number of items to retrieve in each page.
1231
+ * @param {string} [arg.q] - Search a store by its name or store_code.
1232
+ * @param {string} [arg.city] - Search stores by the city in which they are situated.
1233
+ * @param {number} [arg.range] - Use this to retrieve stores within a
1234
+ * particular range in meters, e.g. 10000, to indicate a 10km range
1235
+ * @param {number} [arg.latitude] - Latitude of the location from where one
1236
+ * wants to retreive the nearest stores, e.g. 72.8691788
1237
+ * @param {number} [arg.longitude] - Longitude of the location from where
1238
+ * one wants to retreive the nearest stores, e.g. 19.1174114
1239
+ * @returns {Promise<StoreListingResponse>} - Success response
1240
+ * @summary: Get store meta information.
1241
+ * @description: Use this API to get a list of stores in a specific application.
1242
+ */
1243
+ getStores({ pageNo, pageSize, q, city, range, latitude, longitude } = {}) {
1244
+ const { error } = CatalogValidator.getStores().validate(
1245
+ { pageNo, pageSize, q, city, range, latitude, longitude },
1246
+ { abortEarly: false, allowUnknown: true }
1247
+ );
1248
+ if (error) {
1249
+ return Promise.reject(new FDKClientValidationError(error));
1250
+ }
1251
+ const query_params = {};
1252
+ query_params["page_no"] = pageNo;
1253
+ query_params["page_size"] = pageSize;
1254
+ query_params["q"] = q;
1255
+ query_params["city"] = city;
1256
+ query_params["range"] = range;
1257
+ query_params["latitude"] = latitude;
1258
+ query_params["longitude"] = longitude;
1259
+
1260
+ const xHeaders = {};
1261
+
1262
+ return APIClient.execute(
1263
+ this._conf,
1264
+ "get",
1265
+ constructUrl({
1266
+ url: this._urls["getStores"],
1267
+ params: {},
1268
+ }),
1269
+ query_params,
1270
+ undefined,
1271
+ xHeaders
1272
+ );
1273
+ }
1274
+
1275
+ /**
1276
+ * @param {Object} arg - Arg object.
1277
+ * @param {number} [arg.pageSize] - Number of items to retrieve in each page.
1278
+ * @param {string} [arg.q] - Search a store by its name or store_code.
1279
+ * @param {string} [arg.city] - Search stores by the city in which they are situated.
1280
+ * @param {number} [arg.range] - Use this to retrieve stores within a
1281
+ * particular range in meters, e.g. 10000, to indicate a 10km range
1282
+ * @param {number} [arg.latitude] - Latitude of the location from where one
1283
+ * wants to retreive the nearest stores, e.g. 72.8691788
1284
+ * @param {number} [arg.longitude] - Longitude of the location from where
1285
+ * one wants to retreive the nearest stores, e.g. 19.1174114
1286
+ * @summary: Get store meta information.
1287
+ * @description: Use this API to get a list of stores in a specific application.
1288
+ */
1289
+ getStoresPaginator({ pageSize, q, city, range, latitude, longitude } = {}) {
1290
+ const paginator = new Paginator();
1291
+ const callback = async () => {
1292
+ const pageId = paginator.nextId;
1293
+ const pageNo = paginator.pageNo;
1294
+ const pageType = "number";
1295
+ const data = await this.getStores({
1296
+ pageNo: pageNo,
1297
+ pageSize: pageSize,
1298
+ q: q,
1299
+ city: city,
1300
+ range: range,
1301
+ latitude: latitude,
1302
+ longitude: longitude,
1303
+ });
1304
+ paginator.setPaginator({
1305
+ hasNext: data.page.has_next ? true : false,
1306
+ nextId: data.page.next_id,
1307
+ });
1308
+ return data;
1309
+ };
1310
+ paginator.setCallback(callback);
1311
+ return paginator;
1312
+ }
1313
+
1314
+ /**
1315
+ * @param {Object} arg - Arg object.
1316
+ * @param {number} [arg.pageNo] - The page number to navigate through the
1317
+ * given set of results.
1318
+ * @param {number} [arg.pageSize] - Number of items to retrieve in each page.
1319
+ * @param {string} [arg.q] - Search a store by its name or store_code.
1320
+ * @param {string} [arg.city] - Search stores by the city in which they are situated.
1321
+ * @param {number} [arg.range] - Use this to retrieve stores within a
1322
+ * particular range in meters, e.g. 10000, to indicate a 10km range
1323
+ * @param {number} [arg.latitude] - Latitude of the location from where one
1324
+ * wants to retreive the nearest stores, e.g. 72.8691788
1325
+ * @param {number} [arg.longitude] - Longitude of the location from where
1326
+ * one wants to retreive the nearest stores, e.g. 19.1174114
1327
+ * @returns {Promise<ApplicationStoreListing>} - Success response
1328
+ * @summary: Get store meta information.
1329
+ * @description: Use this API to get a list of stores in a specific application.
1330
+ */
1331
+ getInStockLocations({
1332
+ pageNo,
1333
+ pageSize,
1334
+ q,
1335
+ city,
1336
+ range,
1337
+ latitude,
1338
+ longitude,
1339
+ } = {}) {
1340
+ const { error } = CatalogValidator.getInStockLocations().validate(
1341
+ { pageNo, pageSize, q, city, range, latitude, longitude },
1342
+ { abortEarly: false, allowUnknown: true }
1343
+ );
1344
+ if (error) {
1345
+ return Promise.reject(new FDKClientValidationError(error));
1346
+ }
1347
+ const query_params = {};
1348
+ query_params["page_no"] = pageNo;
1349
+ query_params["page_size"] = pageSize;
1350
+ query_params["q"] = q;
1351
+ query_params["city"] = city;
1352
+ query_params["range"] = range;
1353
+ query_params["latitude"] = latitude;
1354
+ query_params["longitude"] = longitude;
1355
+
1356
+ const xHeaders = {};
1357
+
1358
+ return APIClient.execute(
1359
+ this._conf,
1360
+ "get",
1361
+ constructUrl({
1362
+ url: this._urls["getInStockLocations"],
1363
+ params: {},
1364
+ }),
1365
+ query_params,
1366
+ undefined,
1367
+ xHeaders
1368
+ );
1369
+ }
1370
+
1371
+ /**
1372
+ * @param {Object} arg - Arg object.
1373
+ * @param {number} [arg.pageSize] - Number of items to retrieve in each page.
1374
+ * @param {string} [arg.q] - Search a store by its name or store_code.
1375
+ * @param {string} [arg.city] - Search stores by the city in which they are situated.
1376
+ * @param {number} [arg.range] - Use this to retrieve stores within a
1377
+ * particular range in meters, e.g. 10000, to indicate a 10km range
1378
+ * @param {number} [arg.latitude] - Latitude of the location from where one
1379
+ * wants to retreive the nearest stores, e.g. 72.8691788
1380
+ * @param {number} [arg.longitude] - Longitude of the location from where
1381
+ * one wants to retreive the nearest stores, e.g. 19.1174114
1382
+ * @summary: Get store meta information.
1383
+ * @description: Use this API to get a list of stores in a specific application.
1384
+ */
1385
+ getInStockLocationsPaginator({
1386
+ pageSize,
1387
+ q,
1388
+ city,
1389
+ range,
1390
+ latitude,
1391
+ longitude,
1392
+ } = {}) {
1393
+ const paginator = new Paginator();
1394
+ const callback = async () => {
1395
+ const pageId = paginator.nextId;
1396
+ const pageNo = paginator.pageNo;
1397
+ const pageType = "number";
1398
+ const data = await this.getInStockLocations({
1399
+ pageNo: pageNo,
1400
+ pageSize: pageSize,
1401
+ q: q,
1402
+ city: city,
1403
+ range: range,
1404
+ latitude: latitude,
1405
+ longitude: longitude,
1406
+ });
1407
+ paginator.setPaginator({
1408
+ hasNext: data.page.has_next ? true : false,
1409
+ nextId: data.page.next_id,
1410
+ });
1411
+ return data;
1412
+ };
1413
+ paginator.setCallback(callback);
1414
+ return paginator;
1415
+ }
1416
+
1417
+ /**
1418
+ * @param {Object} arg - Arg object.
1419
+ * @param {number} arg.locationId - Unique Location ID.
1420
+ * @returns {Promise<StoreDetails>} - Success response
1421
+ * @summary: Get store meta information.
1422
+ * @description: Use this API to get meta details for a store.
1423
+ */
1424
+ getLocationDetailsById({ locationId } = {}) {
1425
+ const { error } = CatalogValidator.getLocationDetailsById().validate(
1426
+ { locationId },
1427
+ { abortEarly: false, allowUnknown: true }
1428
+ );
1429
+ if (error) {
1430
+ return Promise.reject(new FDKClientValidationError(error));
1431
+ }
1432
+ const query_params = {};
1433
+
1434
+ const xHeaders = {};
1435
+
1436
+ return APIClient.execute(
1437
+ this._conf,
1438
+ "get",
1439
+ constructUrl({
1440
+ url: this._urls["getLocationDetailsById"],
1441
+ params: { locationId },
1442
+ }),
1443
+ query_params,
1444
+ undefined,
1445
+ xHeaders
1446
+ );
1447
+ }
1448
+
1449
+ /**
1450
+ * @param {Object} arg - Arg object.
1451
+ * @param {string} [arg.slug] - Product slug for which bundles need to be fetched.
1452
+ * @param {string} [arg.id] - Product uid
1453
+ * @returns {Promise<ProductBundle>} - Success response
1454
+ * @summary: Get product bundles
1455
+ * @description: Use this API to retrieve products bundles to the one specified by its slug.
1456
+ */
1457
+ getProductBundlesBySlug({ slug, id } = {}) {
1458
+ const { error } = CatalogValidator.getProductBundlesBySlug().validate(
1459
+ { slug, id },
1460
+ { abortEarly: false, allowUnknown: true }
1461
+ );
1462
+ if (error) {
1463
+ return Promise.reject(new FDKClientValidationError(error));
1464
+ }
1465
+ const query_params = {};
1466
+ query_params["slug"] = slug;
1467
+ query_params["id"] = id;
1468
+
1469
+ const xHeaders = {};
1470
+
1471
+ return APIClient.execute(
1472
+ this._conf,
1473
+ "get",
1474
+ constructUrl({
1475
+ url: this._urls["getProductBundlesBySlug"],
1476
+ params: {},
1477
+ }),
1478
+ query_params,
1479
+ undefined,
1480
+ xHeaders
1481
+ );
1482
+ }
1483
+
1484
+ /**
1485
+ * @param {Object} arg - Arg object.
1486
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
1487
+ * identifier of a product. You can get slug value from the endpoint
1488
+ * /service/application/catalog/v1.0/products/
1489
+ * @param {string} arg.size - A string indicating the size of the product,
1490
+ * e.g. S, M, XL. You can get slug value from the endpoint
1491
+ * /service/application/catalog/v1.0/products/sizes
1492
+ * @param {number} [arg.storeId] - The ID of the store that is selling the
1493
+ * product, e.g. 1,2,3.
1494
+ * @param {string} [arg.pincode] - The PIN Code of the area near which the
1495
+ * selling locations should be searched, e.g. 400059.
1496
+ * @returns {Promise<ProductSizePriceResponseV2>} - Success response
1497
+ * @summary: Get the price of a product size at a PIN Code
1498
+ * @description: Prices may vary for different sizes of a product. Use this API to retrieve the price of a product size at all the selling locations near to a PIN Code.
1499
+ */
1500
+ getProductPriceBySlug({ slug, size, storeId, pincode } = {}) {
1501
+ const { error } = CatalogValidator.getProductPriceBySlug().validate(
1502
+ { slug, size, storeId, pincode },
1503
+ { abortEarly: false, allowUnknown: true }
1504
+ );
1505
+ if (error) {
1506
+ return Promise.reject(new FDKClientValidationError(error));
1507
+ }
1508
+ const query_params = {};
1509
+ query_params["store_id"] = storeId;
1510
+ query_params["pincode"] = pincode;
1511
+
1512
+ const xHeaders = {};
1513
+
1514
+ return APIClient.execute(
1515
+ this._conf,
1516
+ "get",
1517
+ constructUrl({
1518
+ url: this._urls["getProductPriceBySlug"],
1519
+ params: { slug, size },
1520
+ }),
1521
+ query_params,
1522
+ undefined,
1523
+ xHeaders
1524
+ );
1525
+ }
1526
+
1527
+ /**
1528
+ * @param {Object} arg - Arg object.
1529
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
1530
+ * identifier of a product. You can get slug value from the endpoint
1531
+ * /service/application/catalog/v1.0/products/
1532
+ * @param {string} arg.size - A string indicating the size of the product,
1533
+ * e.g. S, M, XL. You can get slug value from the endpoint
1534
+ * /service/application/catalog/v1.0/products/sizes
1535
+ * @param {string} [arg.pincode] - The 6-digit PIN Code of the area near
1536
+ * which the selling locations should be searched, e.g. 400059
1537
+ * @param {string} [arg.strategy] - Sort stores on the basis of strategy.
1538
+ * eg, fast-delivery, low-price, optimal.
1539
+ * @param {number} [arg.pageNo] - The page number to navigate through the
1540
+ * given set of results.
1541
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
1542
+ * @returns {Promise<ProductSizeSellersResponseV2>} - Success response
1543
+ * @summary: Get the sellers of a product size at a PIN Code
1544
+ * @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
1545
+ */
1546
+ getProductSellersBySlug({
1547
+ slug,
1548
+ size,
1549
+ pincode,
1550
+ strategy,
1551
+ pageNo,
1552
+ pageSize,
1553
+ } = {}) {
1554
+ const { error } = CatalogValidator.getProductSellersBySlug().validate(
1555
+ { slug, size, pincode, strategy, pageNo, pageSize },
1556
+ { abortEarly: false, allowUnknown: true }
1557
+ );
1558
+ if (error) {
1559
+ return Promise.reject(new FDKClientValidationError(error));
1560
+ }
1561
+ const query_params = {};
1562
+ query_params["pincode"] = pincode;
1563
+ query_params["strategy"] = strategy;
1564
+ query_params["page_no"] = pageNo;
1565
+ query_params["page_size"] = pageSize;
1566
+
1567
+ const xHeaders = {};
1568
+
1569
+ return APIClient.execute(
1570
+ this._conf,
1571
+ "get",
1572
+ constructUrl({
1573
+ url: this._urls["getProductSellersBySlug"],
1574
+ params: { slug, size },
1575
+ }),
1576
+ query_params,
1577
+ undefined,
1578
+ xHeaders
1579
+ );
1580
+ }
1581
+
1582
+ /**
1583
+ * @param {Object} arg - Arg object.
1584
+ * @param {string} arg.slug - A short, human-readable, URL-friendly
1585
+ * identifier of a product. You can get slug value from the endpoint
1586
+ * /service/application/catalog/v1.0/products/
1587
+ * @param {string} arg.size - A string indicating the size of the product,
1588
+ * e.g. S, M, XL. You can get slug value from the endpoint
1589
+ * /service/application/catalog/v1.0/products/sizes
1590
+ * @param {string} [arg.pincode] - The 6-digit PIN Code of the area near
1591
+ * which the selling locations should be searched, e.g. 400059
1592
+ * @param {string} [arg.strategy] - Sort stores on the basis of strategy.
1593
+ * eg, fast-delivery, low-price, optimal.
1594
+ * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
1595
+ * @summary: Get the sellers of a product size at a PIN Code
1596
+ * @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
1597
+ */
1598
+ getProductSellersBySlugPaginator({
1599
+ slug,
1600
+ size,
1601
+ pincode,
1602
+ strategy,
1603
+ pageSize,
1604
+ } = {}) {
1605
+ const paginator = new Paginator();
1606
+ const callback = async () => {
1607
+ const pageId = paginator.nextId;
1608
+ const pageNo = paginator.pageNo;
1609
+ const pageType = "number";
1610
+ const data = await this.getProductSellersBySlug({
1611
+ slug: slug,
1612
+ size: size,
1613
+ pincode: pincode,
1614
+ strategy: strategy,
1615
+ pageNo: pageNo,
1616
+ pageSize: pageSize,
1617
+ });
1618
+ paginator.setPaginator({
1619
+ hasNext: data.page.has_next ? true : false,
1620
+ nextId: data.page.next_id,
1621
+ });
1622
+ return data;
1623
+ };
1624
+ paginator.setCallback(callback);
1625
+ return paginator;
1626
+ }
1627
+ }
1628
+
1629
+ module.exports = Catalog;