hey-pharmacist-ecommerce 1.0.0

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 (287) hide show
  1. package/README.md +269 -0
  2. package/dist/index.d.mts +564 -0
  3. package/dist/index.d.ts +564 -0
  4. package/dist/index.js +7541 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +7485 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +70 -0
  9. package/src/components/CartItem.tsx +103 -0
  10. package/src/components/EmptyState.tsx +27 -0
  11. package/src/components/Footer.tsx +147 -0
  12. package/src/components/Header.tsx +151 -0
  13. package/src/components/OrderCard.tsx +98 -0
  14. package/src/components/ProductCard.tsx +122 -0
  15. package/src/components/ui/Badge.tsx +31 -0
  16. package/src/components/ui/Button.tsx +61 -0
  17. package/src/components/ui/Input.tsx +45 -0
  18. package/src/components/ui/Modal.tsx +79 -0
  19. package/src/components/ui/Skeleton.tsx +46 -0
  20. package/src/hooks/useOrders.ts +98 -0
  21. package/src/hooks/useProducts.ts +125 -0
  22. package/src/index.ts +71 -0
  23. package/src/lib/Apis/api.ts +46 -0
  24. package/src/lib/Apis/apis/addresses-api.ts +1461 -0
  25. package/src/lib/Apis/apis/auth-api.ts +945 -0
  26. package/src/lib/Apis/apis/blogs-api.ts +582 -0
  27. package/src/lib/Apis/apis/cart-api.ts +456 -0
  28. package/src/lib/Apis/apis/categories-api.ts +725 -0
  29. package/src/lib/Apis/apis/chats-api.ts +1101 -0
  30. package/src/lib/Apis/apis/contact-us-api.ts +394 -0
  31. package/src/lib/Apis/apis/discounts-api.ts +763 -0
  32. package/src/lib/Apis/apis/drafts-api.ts +448 -0
  33. package/src/lib/Apis/apis/events-api.ts +1311 -0
  34. package/src/lib/Apis/apis/file-proccesor-api.ts +293 -0
  35. package/src/lib/Apis/apis/health-api.ts +119 -0
  36. package/src/lib/Apis/apis/images-api.ts +271 -0
  37. package/src/lib/Apis/apis/inventory-api.ts +375 -0
  38. package/src/lib/Apis/apis/marketing-api.ts +3099 -0
  39. package/src/lib/Apis/apis/notifications-api.ts +843 -0
  40. package/src/lib/Apis/apis/open-aiapi.ts +513 -0
  41. package/src/lib/Apis/apis/orders-api.ts +1343 -0
  42. package/src/lib/Apis/apis/payment-methods-api.ts +411 -0
  43. package/src/lib/Apis/apis/payments-api.ts +469 -0
  44. package/src/lib/Apis/apis/product-attributes-api.ts +538 -0
  45. package/src/lib/Apis/apis/product-favorite-list-api.ts +321 -0
  46. package/src/lib/Apis/apis/product-variants-api.ts +648 -0
  47. package/src/lib/Apis/apis/products-api.ts +1442 -0
  48. package/src/lib/Apis/apis/review-api.ts +1383 -0
  49. package/src/lib/Apis/apis/roles-api.ts +614 -0
  50. package/src/lib/Apis/apis/shipping-api.ts +703 -0
  51. package/src/lib/Apis/apis/statistics-api.ts +234 -0
  52. package/src/lib/Apis/apis/stores-api.ts +1519 -0
  53. package/src/lib/Apis/apis/sub-categories-api.ts +1208 -0
  54. package/src/lib/Apis/apis/user-groups-api.ts +1198 -0
  55. package/src/lib/Apis/apis/users-api.ts +1403 -0
  56. package/src/lib/Apis/apis/web-hooks-api.ts +198 -0
  57. package/src/lib/Apis/base.ts +70 -0
  58. package/src/lib/Apis/configuration.ts +75 -0
  59. package/src/lib/Apis/index.ts +17 -0
  60. package/src/lib/Apis/models/add-contact-to-list-dto.ts +33 -0
  61. package/src/lib/Apis/models/add-message-dto.ts +56 -0
  62. package/src/lib/Apis/models/address-created-request.ts +134 -0
  63. package/src/lib/Apis/models/address.ts +164 -0
  64. package/src/lib/Apis/models/allow-user-credit-dto.ts +27 -0
  65. package/src/lib/Apis/models/appointment.ts +75 -0
  66. package/src/lib/Apis/models/available-dates-dto.ts +33 -0
  67. package/src/lib/Apis/models/available-suggested-dates-dto.ts +33 -0
  68. package/src/lib/Apis/models/blog.ts +75 -0
  69. package/src/lib/Apis/models/browser-stats-response-dto.ts +40 -0
  70. package/src/lib/Apis/models/bulk-move-subcategories-dto.ts +33 -0
  71. package/src/lib/Apis/models/bulk-unassign-subcategories-dto.ts +27 -0
  72. package/src/lib/Apis/models/campaign-content-response-dto.ts +40 -0
  73. package/src/lib/Apis/models/campaign-draft-dto.ts +175 -0
  74. package/src/lib/Apis/models/campaign-draft-response-dto.ts +40 -0
  75. package/src/lib/Apis/models/campaign-draft-schedule-dto.ts +49 -0
  76. package/src/lib/Apis/models/campaign-draft-schedule-response-dto.ts +40 -0
  77. package/src/lib/Apis/models/campaign-draft-sending-dto.ts +43 -0
  78. package/src/lib/Apis/models/campaign-draft-sending-response-dto.ts +40 -0
  79. package/src/lib/Apis/models/cart-body-dto.ts +40 -0
  80. package/src/lib/Apis/models/cart-body-populated.ts +47 -0
  81. package/src/lib/Apis/models/cart-item-populated.ts +41 -0
  82. package/src/lib/Apis/models/cart-item.ts +33 -0
  83. package/src/lib/Apis/models/cart-response-dto.ts +70 -0
  84. package/src/lib/Apis/models/categories-paginated-response-dto.ts +52 -0
  85. package/src/lib/Apis/models/category-filters.ts +40 -0
  86. package/src/lib/Apis/models/category-populated.ts +106 -0
  87. package/src/lib/Apis/models/category-sub-category-populated.ts +51 -0
  88. package/src/lib/Apis/models/category.ts +99 -0
  89. package/src/lib/Apis/models/categorys-headlines-response-dto.ts +40 -0
  90. package/src/lib/Apis/models/change-user-email-dto.ts +27 -0
  91. package/src/lib/Apis/models/chat.ts +33 -0
  92. package/src/lib/Apis/models/check-notifications-response-dto.ts +33 -0
  93. package/src/lib/Apis/models/contact-aggregated-stats-response-dto.ts +40 -0
  94. package/src/lib/Apis/models/contact-full-dto.ts +93 -0
  95. package/src/lib/Apis/models/contact-full-response-dto.ts +40 -0
  96. package/src/lib/Apis/models/contact-list-stats-response-dto.ts +40 -0
  97. package/src/lib/Apis/models/contact-lists-response-dto.ts +40 -0
  98. package/src/lib/Apis/models/contact-us.ts +81 -0
  99. package/src/lib/Apis/models/country-stats-response-dto.ts +40 -0
  100. package/src/lib/Apis/models/create-address-dto.ts +134 -0
  101. package/src/lib/Apis/models/create-blog-dto.ts +45 -0
  102. package/src/lib/Apis/models/create-category-dto.ts +45 -0
  103. package/src/lib/Apis/models/create-chat-dto.ts +39 -0
  104. package/src/lib/Apis/models/create-contact-dto.ts +39 -0
  105. package/src/lib/Apis/models/create-contact-list-dto.ts +27 -0
  106. package/src/lib/Apis/models/create-discount-dto.ts +208 -0
  107. package/src/lib/Apis/models/create-draft-dto.ts +67 -0
  108. package/src/lib/Apis/models/create-email-template-dto.ts +51 -0
  109. package/src/lib/Apis/models/create-event-dto.ts +52 -0
  110. package/src/lib/Apis/models/create-marketing-campaign-dto.ts +81 -0
  111. package/src/lib/Apis/models/create-message-dto.ts +57 -0
  112. package/src/lib/Apis/models/create-notification-dto.ts +75 -0
  113. package/src/lib/Apis/models/create-product-attribute-dto.ts +33 -0
  114. package/src/lib/Apis/models/create-product-dto.ts +94 -0
  115. package/src/lib/Apis/models/create-review-dto.ts +63 -0
  116. package/src/lib/Apis/models/create-role-dto.ts +57 -0
  117. package/src/lib/Apis/models/create-single-variant-product-dto.ts +155 -0
  118. package/src/lib/Apis/models/create-store-address-dto.ts +134 -0
  119. package/src/lib/Apis/models/create-store-dto.ts +105 -0
  120. package/src/lib/Apis/models/create-sub-category-dto.ts +45 -0
  121. package/src/lib/Apis/models/create-user-dto.ts +89 -0
  122. package/src/lib/Apis/models/create-user-group-dto.ts +39 -0
  123. package/src/lib/Apis/models/create-variant-dto.ts +119 -0
  124. package/src/lib/Apis/models/create-zone-dto.ts +82 -0
  125. package/src/lib/Apis/models/custom-product-dto.ts +63 -0
  126. package/src/lib/Apis/models/default-payment-method-request-dto.ts +27 -0
  127. package/src/lib/Apis/models/delete-file-dto.ts +27 -0
  128. package/src/lib/Apis/models/delete-many-files-dto.ts +27 -0
  129. package/src/lib/Apis/models/discount-paginated-response.ts +52 -0
  130. package/src/lib/Apis/models/discount.ts +245 -0
  131. package/src/lib/Apis/models/discounts-insights-dto.ts +57 -0
  132. package/src/lib/Apis/models/draft.ts +79 -0
  133. package/src/lib/Apis/models/email-invoice-dto.ts +45 -0
  134. package/src/lib/Apis/models/email-template-response-dto.ts +117 -0
  135. package/src/lib/Apis/models/event.ts +76 -0
  136. package/src/lib/Apis/models/extended-product-dto.ts +204 -0
  137. package/src/lib/Apis/models/fileproccesor-upload-body.ts +27 -0
  138. package/src/lib/Apis/models/forget-password.ts +27 -0
  139. package/src/lib/Apis/models/frequently-bought-product-dto.ts +71 -0
  140. package/src/lib/Apis/models/general-stats-response-dto.ts +40 -0
  141. package/src/lib/Apis/models/generate-day-slots-dto.ts +51 -0
  142. package/src/lib/Apis/models/generate-month-slots-dto.ts +57 -0
  143. package/src/lib/Apis/models/generate-week-slots-dto.ts +57 -0
  144. package/src/lib/Apis/models/google-analytics-request-dto.ts +55 -0
  145. package/src/lib/Apis/models/google-analytics-response-dto.ts +39 -0
  146. package/src/lib/Apis/models/group-with-no-users-dto.ts +75 -0
  147. package/src/lib/Apis/models/group-with-users-dto.ts +76 -0
  148. package/src/lib/Apis/models/images-upload-body.ts +27 -0
  149. package/src/lib/Apis/models/index.ts +197 -0
  150. package/src/lib/Apis/models/inventory-paginated-response.ts +75 -0
  151. package/src/lib/Apis/models/link-stats-response-dto.ts +40 -0
  152. package/src/lib/Apis/models/login-dto.ts +33 -0
  153. package/src/lib/Apis/models/manual-discount.ts +49 -0
  154. package/src/lib/Apis/models/manual-order-dto.ts +133 -0
  155. package/src/lib/Apis/models/manual-shipping-dto.ts +45 -0
  156. package/src/lib/Apis/models/marketing-campaign-content-dto.ts +27 -0
  157. package/src/lib/Apis/models/marketing-list-contact-dto.ts +51 -0
  158. package/src/lib/Apis/models/move-subcategory-dto.ts +27 -0
  159. package/src/lib/Apis/models/my-favorite-list-dto.ts +52 -0
  160. package/src/lib/Apis/models/notification.ts +93 -0
  161. package/src/lib/Apis/models/object-id.ts +21 -0
  162. package/src/lib/Apis/models/open-api.ts +33 -0
  163. package/src/lib/Apis/models/order-paginated-response.ts +52 -0
  164. package/src/lib/Apis/models/order.ts +214 -0
  165. package/src/lib/Apis/models/orders-insights-dto.ts +69 -0
  166. package/src/lib/Apis/models/paginated-products-dto.ts +52 -0
  167. package/src/lib/Apis/models/payment-method-data.ts +34 -0
  168. package/src/lib/Apis/models/payment-method.ts +51 -0
  169. package/src/lib/Apis/models/payment-time-line-dto.ts +56 -0
  170. package/src/lib/Apis/models/payment.ts +182 -0
  171. package/src/lib/Apis/models/payments-insights-dto.ts +69 -0
  172. package/src/lib/Apis/models/payments-paginated-response.ts +52 -0
  173. package/src/lib/Apis/models/pick-type-class.ts +51 -0
  174. package/src/lib/Apis/models/populated-chat-dto.ts +95 -0
  175. package/src/lib/Apis/models/populated-discount.ts +246 -0
  176. package/src/lib/Apis/models/populated-order.ts +209 -0
  177. package/src/lib/Apis/models/prefered-pick-or-delivery-time-dto.ts +33 -0
  178. package/src/lib/Apis/models/price-range.ts +33 -0
  179. package/src/lib/Apis/models/product-attribute.ts +57 -0
  180. package/src/lib/Apis/models/product-variant.ts +167 -0
  181. package/src/lib/Apis/models/product.ts +136 -0
  182. package/src/lib/Apis/models/products-insights-dto.ts +45 -0
  183. package/src/lib/Apis/models/rate-dto.ts +123 -0
  184. package/src/lib/Apis/models/refill-request-dto.ts +75 -0
  185. package/src/lib/Apis/models/refill-request.ts +105 -0
  186. package/src/lib/Apis/models/register-or-login-with-gmail.ts +27 -0
  187. package/src/lib/Apis/models/reserve-appointment.ts +261 -0
  188. package/src/lib/Apis/models/review.ts +93 -0
  189. package/src/lib/Apis/models/role.ts +69 -0
  190. package/src/lib/Apis/models/schedule-campaign-draft-dto.ts +27 -0
  191. package/src/lib/Apis/models/send-test-email-dto.ts +28 -0
  192. package/src/lib/Apis/models/shallow-parent-category-dto.ts +33 -0
  193. package/src/lib/Apis/models/shipment-details-dto.ts +88 -0
  194. package/src/lib/Apis/models/shipment-status-dto.ts +117 -0
  195. package/src/lib/Apis/models/shipment-with-order.ts +105 -0
  196. package/src/lib/Apis/models/shipment.ts +104 -0
  197. package/src/lib/Apis/models/shipping-info.ts +88 -0
  198. package/src/lib/Apis/models/single-browser-stats-dto.ts +45 -0
  199. package/src/lib/Apis/models/single-contact-aggregated-stats-dto.ts +129 -0
  200. package/src/lib/Apis/models/single-contact-list-stats-dto.ts +117 -0
  201. package/src/lib/Apis/models/single-country-stats-dto.ts +39 -0
  202. package/src/lib/Apis/models/single-general-stats.ts +153 -0
  203. package/src/lib/Apis/models/single-link-stats-dto.ts +39 -0
  204. package/src/lib/Apis/models/single-message-populated.ts +59 -0
  205. package/src/lib/Apis/models/single-notification-dto.ts +99 -0
  206. package/src/lib/Apis/models/single-product-media.ts +74 -0
  207. package/src/lib/Apis/models/single-recipient-dto.ts +33 -0
  208. package/src/lib/Apis/models/single-suggest-attribute.ts +33 -0
  209. package/src/lib/Apis/models/statistic-dto.ts +171 -0
  210. package/src/lib/Apis/models/store-entity.ts +117 -0
  211. package/src/lib/Apis/models/store.ts +135 -0
  212. package/src/lib/Apis/models/sub-category-headlines-only-response-dto.ts +39 -0
  213. package/src/lib/Apis/models/sub-category.ts +93 -0
  214. package/src/lib/Apis/models/suggest-attributes.ts +28 -0
  215. package/src/lib/Apis/models/suggested-slot.ts +33 -0
  216. package/src/lib/Apis/models/table-cell-dto.ts +33 -0
  217. package/src/lib/Apis/models/table-dto.ts +34 -0
  218. package/src/lib/Apis/models/tadmin-session-data.ts +47 -0
  219. package/src/lib/Apis/models/track-dto.ts +94 -0
  220. package/src/lib/Apis/models/tracking-status-location-base.ts +45 -0
  221. package/src/lib/Apis/models/tracking-status-substatus.ts +39 -0
  222. package/src/lib/Apis/models/tracking-status.ts +71 -0
  223. package/src/lib/Apis/models/transfere-patient-request.ts +123 -0
  224. package/src/lib/Apis/models/transfere-patients-request-dto.ts +99 -0
  225. package/src/lib/Apis/models/tuser-session-data.ts +34 -0
  226. package/src/lib/Apis/models/update-address-dto.ts +134 -0
  227. package/src/lib/Apis/models/update-blog-dto.ts +45 -0
  228. package/src/lib/Apis/models/update-campaign-draft-content-dto.ts +27 -0
  229. package/src/lib/Apis/models/update-category-dto.ts +45 -0
  230. package/src/lib/Apis/models/update-discount-dto.ts +208 -0
  231. package/src/lib/Apis/models/update-event-dto.ts +52 -0
  232. package/src/lib/Apis/models/update-items-order-dto.ts +27 -0
  233. package/src/lib/Apis/models/update-marketing-camp-draft-dto.ts +81 -0
  234. package/src/lib/Apis/models/update-message-dto.ts +57 -0
  235. package/src/lib/Apis/models/update-product-attribute-dto.ts +33 -0
  236. package/src/lib/Apis/models/update-product-dto.ts +96 -0
  237. package/src/lib/Apis/models/update-product-variant-dto.ts +119 -0
  238. package/src/lib/Apis/models/update-refill-request-dto.ts +75 -0
  239. package/src/lib/Apis/models/update-review-dto.ts +63 -0
  240. package/src/lib/Apis/models/update-role-dto.ts +57 -0
  241. package/src/lib/Apis/models/update-store-dto.ts +105 -0
  242. package/src/lib/Apis/models/update-sub-category-dto.ts +45 -0
  243. package/src/lib/Apis/models/update-transfere-patients-request-dto.ts +99 -0
  244. package/src/lib/Apis/models/update-user-dto.ts +239 -0
  245. package/src/lib/Apis/models/update-user-group-dto.ts +39 -0
  246. package/src/lib/Apis/models/update-zone-dto.ts +82 -0
  247. package/src/lib/Apis/models/upload-pdf-body.ts +27 -0
  248. package/src/lib/Apis/models/used-by.ts +87 -0
  249. package/src/lib/Apis/models/user-entity.ts +220 -0
  250. package/src/lib/Apis/models/user-group.ts +75 -0
  251. package/src/lib/Apis/models/user-insights-dto.ts +39 -0
  252. package/src/lib/Apis/models/user-with-no-id.ts +226 -0
  253. package/src/lib/Apis/models/user.ts +232 -0
  254. package/src/lib/Apis/models/users-paginated-response.ts +52 -0
  255. package/src/lib/Apis/models/verify-email-dto.ts +33 -0
  256. package/src/lib/Apis/models/zone-single-size.ts +51 -0
  257. package/src/lib/Apis/models/zone.ts +106 -0
  258. package/src/lib/Apis/wrapper.ts +37 -0
  259. package/src/lib/api/auth.ts +81 -0
  260. package/src/lib/api/cart.ts +42 -0
  261. package/src/lib/api/client.ts +118 -0
  262. package/src/lib/api/orders.ts +53 -0
  263. package/src/lib/api/products.ts +51 -0
  264. package/src/lib/api-adapter/auth-adapter.ts +196 -0
  265. package/src/lib/api-adapter/cart-adapter.ts +193 -0
  266. package/src/lib/api-adapter/config.ts +76 -0
  267. package/src/lib/api-adapter/index.ts +13 -0
  268. package/src/lib/api-adapter/mappers.ts +147 -0
  269. package/src/lib/api-adapter/orders-adapter.ts +195 -0
  270. package/src/lib/api-adapter/products-adapter.ts +194 -0
  271. package/src/lib/types/index.ts +152 -0
  272. package/src/lib/utils/colors.ts +51 -0
  273. package/src/lib/utils/format.ts +48 -0
  274. package/src/providers/AuthProvider.tsx +117 -0
  275. package/src/providers/CartProvider.tsx +131 -0
  276. package/src/providers/EcommerceProvider.tsx +34 -0
  277. package/src/providers/ThemeProvider.tsx +57 -0
  278. package/src/screens/CartScreen.tsx +140 -0
  279. package/src/screens/CheckoutScreen.tsx +340 -0
  280. package/src/screens/CurrentOrdersScreen.tsx +85 -0
  281. package/src/screens/LoginScreen.tsx +149 -0
  282. package/src/screens/OrdersScreen.tsx +86 -0
  283. package/src/screens/ProductDetailScreen.tsx +255 -0
  284. package/src/screens/ProfileScreen.tsx +211 -0
  285. package/src/screens/RegisterScreen.tsx +200 -0
  286. package/src/screens/ShopScreen.tsx +233 -0
  287. package/src/styles/globals.css +51 -0
@@ -0,0 +1,763 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Hey Pharamcist API
5
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
6
+ *
7
+ * OpenAPI spec version: 1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by the swagger code generator program.
11
+ * https://github.com/swagger-api/swagger-codegen.git
12
+ * Do not edit the class manually.
13
+ */
14
+ import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios';
15
+ import { Configuration } from '../configuration';
16
+ // Some imports not used depending on template conditions
17
+ // @ts-ignore
18
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
19
+ import { CreateDiscountDto } from '../models';
20
+ import { Discount } from '../models';
21
+ import { DiscountPaginatedResponse } from '../models';
22
+ import { DiscountsInsightsDto } from '../models';
23
+ import { PopulatedDiscount } from '../models';
24
+ import { UpdateDiscountDto } from '../models';
25
+ /**
26
+ * DiscountsApi - axios parameter creator
27
+ * @export
28
+ */
29
+ export const DiscountsApiAxiosParamCreator = function (configuration?: Configuration) {
30
+ return {
31
+ /**
32
+ *
33
+ * @summary Create a new discount
34
+ * @param {CreateDiscountDto} body
35
+ * @param {*} [options] Override http request option.
36
+ * @throws {RequiredError}
37
+ */
38
+ createDiscount: async (body: CreateDiscountDto, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
39
+ // verify required parameter 'body' is not null or undefined
40
+ if (body === null || body === undefined) {
41
+ throw new RequiredError('body','Required parameter body was null or undefined when calling createDiscount.');
42
+ }
43
+ const localVarPath = `/discounts`;
44
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
45
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
46
+ let baseOptions;
47
+ if (configuration) {
48
+ baseOptions = configuration.baseOptions;
49
+ }
50
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
51
+ const localVarHeaderParameter = {} as any;
52
+ const localVarQueryParameter = {} as any;
53
+
54
+ // authentication bearer required
55
+ // http bearer authentication required
56
+ if (configuration && configuration.accessToken) {
57
+ const accessToken = typeof configuration.accessToken === 'function'
58
+ ? await configuration.accessToken()
59
+ : await configuration.accessToken;
60
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
61
+ }
62
+
63
+ // authentication x-store-key required
64
+ if (configuration && configuration.apiKey) {
65
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
66
+ ? await configuration.apiKey("x-store-key")
67
+ : await configuration.apiKey;
68
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
69
+ }
70
+
71
+ localVarHeaderParameter['Content-Type'] = 'application/json';
72
+
73
+ const query = new URLSearchParams(localVarUrlObj.search);
74
+ for (const key in localVarQueryParameter) {
75
+ query.set(key, localVarQueryParameter[key]);
76
+ }
77
+ for (const key in options.params) {
78
+ query.set(key, options.params[key]);
79
+ }
80
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
81
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
82
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
83
+ const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
84
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
85
+
86
+ return {
87
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
88
+ options: localVarRequestOptions,
89
+ };
90
+ },
91
+ /**
92
+ *
93
+ * @summary Delete a discount
94
+ * @param {string} id
95
+ * @param {*} [options] Override http request option.
96
+ * @throws {RequiredError}
97
+ */
98
+ deleteDiscount: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
99
+ // verify required parameter 'id' is not null or undefined
100
+ if (id === null || id === undefined) {
101
+ throw new RequiredError('id','Required parameter id was null or undefined when calling deleteDiscount.');
102
+ }
103
+ const localVarPath = `/discounts/{id}`
104
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
105
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
106
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
107
+ let baseOptions;
108
+ if (configuration) {
109
+ baseOptions = configuration.baseOptions;
110
+ }
111
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'DELETE', ...baseOptions, ...options};
112
+ const localVarHeaderParameter = {} as any;
113
+ const localVarQueryParameter = {} as any;
114
+
115
+ // authentication bearer required
116
+ // http bearer authentication required
117
+ if (configuration && configuration.accessToken) {
118
+ const accessToken = typeof configuration.accessToken === 'function'
119
+ ? await configuration.accessToken()
120
+ : await configuration.accessToken;
121
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
122
+ }
123
+
124
+ // authentication x-store-key required
125
+ if (configuration && configuration.apiKey) {
126
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
127
+ ? await configuration.apiKey("x-store-key")
128
+ : await configuration.apiKey;
129
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
130
+ }
131
+
132
+ const query = new URLSearchParams(localVarUrlObj.search);
133
+ for (const key in localVarQueryParameter) {
134
+ query.set(key, localVarQueryParameter[key]);
135
+ }
136
+ for (const key in options.params) {
137
+ query.set(key, options.params[key]);
138
+ }
139
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
140
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
141
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
142
+
143
+ return {
144
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
145
+ options: localVarRequestOptions,
146
+ };
147
+ },
148
+ /**
149
+ *
150
+ * @summary Get all discounts
151
+ * @param {string} [discountState]
152
+ * @param {number} [page]
153
+ * @param {number} [limit]
154
+ * @param {string} [search]
155
+ * @param {string} [sortingColumn]
156
+ * @param {string} [sortingOrder]
157
+ * @param {*} [options] Override http request option.
158
+ * @throws {RequiredError}
159
+ */
160
+ getAllDiscounts: async (discountState?: string, page?: number, limit?: number, search?: string, sortingColumn?: string, sortingOrder?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
161
+ const localVarPath = `/discounts`;
162
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
163
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
164
+ let baseOptions;
165
+ if (configuration) {
166
+ baseOptions = configuration.baseOptions;
167
+ }
168
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
169
+ const localVarHeaderParameter = {} as any;
170
+ const localVarQueryParameter = {} as any;
171
+
172
+ // authentication bearer required
173
+ // http bearer authentication required
174
+ if (configuration && configuration.accessToken) {
175
+ const accessToken = typeof configuration.accessToken === 'function'
176
+ ? await configuration.accessToken()
177
+ : await configuration.accessToken;
178
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
179
+ }
180
+
181
+ // authentication x-store-key required
182
+ if (configuration && configuration.apiKey) {
183
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
184
+ ? await configuration.apiKey("x-store-key")
185
+ : await configuration.apiKey;
186
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
187
+ }
188
+
189
+ if (discountState !== undefined) {
190
+ localVarQueryParameter['discountState'] = discountState;
191
+ }
192
+
193
+ if (page !== undefined) {
194
+ localVarQueryParameter['page'] = page;
195
+ }
196
+
197
+ if (limit !== undefined) {
198
+ localVarQueryParameter['limit'] = limit;
199
+ }
200
+
201
+ if (search !== undefined) {
202
+ localVarQueryParameter['search'] = search;
203
+ }
204
+
205
+ if (sortingColumn !== undefined) {
206
+ localVarQueryParameter['sortingColumn'] = sortingColumn;
207
+ }
208
+
209
+ if (sortingOrder !== undefined) {
210
+ localVarQueryParameter['sortingOrder'] = sortingOrder;
211
+ }
212
+
213
+ const query = new URLSearchParams(localVarUrlObj.search);
214
+ for (const key in localVarQueryParameter) {
215
+ query.set(key, localVarQueryParameter[key]);
216
+ }
217
+ for (const key in options.params) {
218
+ query.set(key, options.params[key]);
219
+ }
220
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
221
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
222
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
223
+
224
+ return {
225
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
226
+ options: localVarRequestOptions,
227
+ };
228
+ },
229
+ /**
230
+ *
231
+ * @summary Get insights on store discounts
232
+ * @param {*} [options] Override http request option.
233
+ * @throws {RequiredError}
234
+ */
235
+ getDiscountsInsights: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
236
+ const localVarPath = `/discounts/insights`;
237
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
238
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
239
+ let baseOptions;
240
+ if (configuration) {
241
+ baseOptions = configuration.baseOptions;
242
+ }
243
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
244
+ const localVarHeaderParameter = {} as any;
245
+ const localVarQueryParameter = {} as any;
246
+
247
+ // authentication bearer required
248
+ // http bearer authentication required
249
+ if (configuration && configuration.accessToken) {
250
+ const accessToken = typeof configuration.accessToken === 'function'
251
+ ? await configuration.accessToken()
252
+ : await configuration.accessToken;
253
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
254
+ }
255
+
256
+ // authentication x-store-key required
257
+ if (configuration && configuration.apiKey) {
258
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
259
+ ? await configuration.apiKey("x-store-key")
260
+ : await configuration.apiKey;
261
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
262
+ }
263
+
264
+ const query = new URLSearchParams(localVarUrlObj.search);
265
+ for (const key in localVarQueryParameter) {
266
+ query.set(key, localVarQueryParameter[key]);
267
+ }
268
+ for (const key in options.params) {
269
+ query.set(key, options.params[key]);
270
+ }
271
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
272
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
273
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
274
+
275
+ return {
276
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
277
+ options: localVarRequestOptions,
278
+ };
279
+ },
280
+ /**
281
+ *
282
+ * @summary Get discount by id
283
+ * @param {string} id
284
+ * @param {*} [options] Override http request option.
285
+ * @throws {RequiredError}
286
+ */
287
+ getSingleDiscount: async (id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
288
+ // verify required parameter 'id' is not null or undefined
289
+ if (id === null || id === undefined) {
290
+ throw new RequiredError('id','Required parameter id was null or undefined when calling getSingleDiscount.');
291
+ }
292
+ const localVarPath = `/discounts/{id}`
293
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
294
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
295
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
296
+ let baseOptions;
297
+ if (configuration) {
298
+ baseOptions = configuration.baseOptions;
299
+ }
300
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options};
301
+ const localVarHeaderParameter = {} as any;
302
+ const localVarQueryParameter = {} as any;
303
+
304
+ // authentication bearer required
305
+ // http bearer authentication required
306
+ if (configuration && configuration.accessToken) {
307
+ const accessToken = typeof configuration.accessToken === 'function'
308
+ ? await configuration.accessToken()
309
+ : await configuration.accessToken;
310
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
311
+ }
312
+
313
+ // authentication x-store-key required
314
+ if (configuration && configuration.apiKey) {
315
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
316
+ ? await configuration.apiKey("x-store-key")
317
+ : await configuration.apiKey;
318
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
319
+ }
320
+
321
+ const query = new URLSearchParams(localVarUrlObj.search);
322
+ for (const key in localVarQueryParameter) {
323
+ query.set(key, localVarQueryParameter[key]);
324
+ }
325
+ for (const key in options.params) {
326
+ query.set(key, options.params[key]);
327
+ }
328
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
329
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
330
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
331
+
332
+ return {
333
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
334
+ options: localVarRequestOptions,
335
+ };
336
+ },
337
+ /**
338
+ *
339
+ * @summary Update a discount
340
+ * @param {UpdateDiscountDto} body
341
+ * @param {string} id
342
+ * @param {*} [options] Override http request option.
343
+ * @throws {RequiredError}
344
+ */
345
+ updateDiscount: async (body: UpdateDiscountDto, id: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
346
+ // verify required parameter 'body' is not null or undefined
347
+ if (body === null || body === undefined) {
348
+ throw new RequiredError('body','Required parameter body was null or undefined when calling updateDiscount.');
349
+ }
350
+ // verify required parameter 'id' is not null or undefined
351
+ if (id === null || id === undefined) {
352
+ throw new RequiredError('id','Required parameter id was null or undefined when calling updateDiscount.');
353
+ }
354
+ const localVarPath = `/discounts/{id}`
355
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
356
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
357
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
358
+ let baseOptions;
359
+ if (configuration) {
360
+ baseOptions = configuration.baseOptions;
361
+ }
362
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'PATCH', ...baseOptions, ...options};
363
+ const localVarHeaderParameter = {} as any;
364
+ const localVarQueryParameter = {} as any;
365
+
366
+ // authentication bearer required
367
+ // http bearer authentication required
368
+ if (configuration && configuration.accessToken) {
369
+ const accessToken = typeof configuration.accessToken === 'function'
370
+ ? await configuration.accessToken()
371
+ : await configuration.accessToken;
372
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
373
+ }
374
+
375
+ // authentication x-store-key required
376
+ if (configuration && configuration.apiKey) {
377
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
378
+ ? await configuration.apiKey("x-store-key")
379
+ : await configuration.apiKey;
380
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
381
+ }
382
+
383
+ localVarHeaderParameter['Content-Type'] = 'application/json';
384
+
385
+ const query = new URLSearchParams(localVarUrlObj.search);
386
+ for (const key in localVarQueryParameter) {
387
+ query.set(key, localVarQueryParameter[key]);
388
+ }
389
+ for (const key in options.params) {
390
+ query.set(key, options.params[key]);
391
+ }
392
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
393
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
394
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
395
+ const needsSerialization = (typeof body !== "string") || (localVarRequestOptions.headers ||= {})['Content-Type'] === 'application/json';
396
+ localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
397
+
398
+ return {
399
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
400
+ options: localVarRequestOptions,
401
+ };
402
+ },
403
+ /**
404
+ *
405
+ * @summary Checks the validity of a discount -- either through couponCode or discountId
406
+ * @param {string} [code]
407
+ * @param {string} [userId]
408
+ * @param {string} [discountId]
409
+ * @param {*} [options] Override http request option.
410
+ * @throws {RequiredError}
411
+ */
412
+ validateCoupon: async (code?: string, userId?: string, discountId?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
413
+ const localVarPath = `/discounts/validate`;
414
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
415
+ const localVarUrlObj = new URL(localVarPath, 'https://example.com');
416
+ let baseOptions;
417
+ if (configuration) {
418
+ baseOptions = configuration.baseOptions;
419
+ }
420
+ const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options};
421
+ const localVarHeaderParameter = {} as any;
422
+ const localVarQueryParameter = {} as any;
423
+
424
+ // authentication bearer required
425
+ // http bearer authentication required
426
+ if (configuration && configuration.accessToken) {
427
+ const accessToken = typeof configuration.accessToken === 'function'
428
+ ? await configuration.accessToken()
429
+ : await configuration.accessToken;
430
+ localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
431
+ }
432
+
433
+ // authentication x-store-key required
434
+ if (configuration && configuration.apiKey) {
435
+ const localVarApiKeyValue = typeof configuration.apiKey === 'function'
436
+ ? await configuration.apiKey("x-store-key")
437
+ : await configuration.apiKey;
438
+ localVarHeaderParameter["x-store-key"] = localVarApiKeyValue;
439
+ }
440
+
441
+ if (code !== undefined) {
442
+ localVarQueryParameter['code'] = code;
443
+ }
444
+
445
+ if (userId !== undefined) {
446
+ localVarQueryParameter['userId'] = userId;
447
+ }
448
+
449
+ if (discountId !== undefined) {
450
+ localVarQueryParameter['discountId'] = discountId;
451
+ }
452
+
453
+ const query = new URLSearchParams(localVarUrlObj.search);
454
+ for (const key in localVarQueryParameter) {
455
+ query.set(key, localVarQueryParameter[key]);
456
+ }
457
+ for (const key in options.params) {
458
+ query.set(key, options.params[key]);
459
+ }
460
+ localVarUrlObj.search = (new URLSearchParams(query)).toString();
461
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
462
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
463
+
464
+ return {
465
+ url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
466
+ options: localVarRequestOptions,
467
+ };
468
+ },
469
+ }
470
+ };
471
+
472
+ /**
473
+ * DiscountsApi - functional programming interface
474
+ * @export
475
+ */
476
+ export const DiscountsApiFp = function(configuration?: Configuration) {
477
+ return {
478
+ /**
479
+ *
480
+ * @summary Create a new discount
481
+ * @param {CreateDiscountDto} body
482
+ * @param {*} [options] Override http request option.
483
+ * @throws {RequiredError}
484
+ */
485
+ async createDiscount(body: CreateDiscountDto, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Discount>>> {
486
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).createDiscount(body, options);
487
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
488
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
489
+ return axios.request(axiosRequestArgs);
490
+ };
491
+ },
492
+ /**
493
+ *
494
+ * @summary Delete a discount
495
+ * @param {string} id
496
+ * @param {*} [options] Override http request option.
497
+ * @throws {RequiredError}
498
+ */
499
+ async deleteDiscount(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
500
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).deleteDiscount(id, options);
501
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
502
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
503
+ return axios.request(axiosRequestArgs);
504
+ };
505
+ },
506
+ /**
507
+ *
508
+ * @summary Get all discounts
509
+ * @param {string} [discountState]
510
+ * @param {number} [page]
511
+ * @param {number} [limit]
512
+ * @param {string} [search]
513
+ * @param {string} [sortingColumn]
514
+ * @param {string} [sortingOrder]
515
+ * @param {*} [options] Override http request option.
516
+ * @throws {RequiredError}
517
+ */
518
+ async getAllDiscounts(discountState?: string, page?: number, limit?: number, search?: string, sortingColumn?: string, sortingOrder?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<DiscountPaginatedResponse>>> {
519
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).getAllDiscounts(discountState, page, limit, search, sortingColumn, sortingOrder, options);
520
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
521
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
522
+ return axios.request(axiosRequestArgs);
523
+ };
524
+ },
525
+ /**
526
+ *
527
+ * @summary Get insights on store discounts
528
+ * @param {*} [options] Override http request option.
529
+ * @throws {RequiredError}
530
+ */
531
+ async getDiscountsInsights(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<DiscountsInsightsDto>>> {
532
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).getDiscountsInsights(options);
533
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
534
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
535
+ return axios.request(axiosRequestArgs);
536
+ };
537
+ },
538
+ /**
539
+ *
540
+ * @summary Get discount by id
541
+ * @param {string} id
542
+ * @param {*} [options] Override http request option.
543
+ * @throws {RequiredError}
544
+ */
545
+ async getSingleDiscount(id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<PopulatedDiscount>>> {
546
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).getSingleDiscount(id, options);
547
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
548
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
549
+ return axios.request(axiosRequestArgs);
550
+ };
551
+ },
552
+ /**
553
+ *
554
+ * @summary Update a discount
555
+ * @param {UpdateDiscountDto} body
556
+ * @param {string} id
557
+ * @param {*} [options] Override http request option.
558
+ * @throws {RequiredError}
559
+ */
560
+ async updateDiscount(body: UpdateDiscountDto, id: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Discount>>> {
561
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).updateDiscount(body, id, options);
562
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
563
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
564
+ return axios.request(axiosRequestArgs);
565
+ };
566
+ },
567
+ /**
568
+ *
569
+ * @summary Checks the validity of a discount -- either through couponCode or discountId
570
+ * @param {string} [code]
571
+ * @param {string} [userId]
572
+ * @param {string} [discountId]
573
+ * @param {*} [options] Override http request option.
574
+ * @throws {RequiredError}
575
+ */
576
+ async validateCoupon(code?: string, userId?: string, discountId?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<Discount>>> {
577
+ const localVarAxiosArgs = await DiscountsApiAxiosParamCreator(configuration).validateCoupon(code, userId, discountId, options);
578
+ return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
579
+ const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
580
+ return axios.request(axiosRequestArgs);
581
+ };
582
+ },
583
+ }
584
+ };
585
+
586
+ /**
587
+ * DiscountsApi - factory interface
588
+ * @export
589
+ */
590
+ export const DiscountsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
591
+ return {
592
+ /**
593
+ *
594
+ * @summary Create a new discount
595
+ * @param {CreateDiscountDto} body
596
+ * @param {*} [options] Override http request option.
597
+ * @throws {RequiredError}
598
+ */
599
+ async createDiscount(body: CreateDiscountDto, options?: AxiosRequestConfig): Promise<AxiosResponse<Discount>> {
600
+ return DiscountsApiFp(configuration).createDiscount(body, options).then((request) => request(axios, basePath));
601
+ },
602
+ /**
603
+ *
604
+ * @summary Delete a discount
605
+ * @param {string} id
606
+ * @param {*} [options] Override http request option.
607
+ * @throws {RequiredError}
608
+ */
609
+ async deleteDiscount(id: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
610
+ return DiscountsApiFp(configuration).deleteDiscount(id, options).then((request) => request(axios, basePath));
611
+ },
612
+ /**
613
+ *
614
+ * @summary Get all discounts
615
+ * @param {string} [discountState]
616
+ * @param {number} [page]
617
+ * @param {number} [limit]
618
+ * @param {string} [search]
619
+ * @param {string} [sortingColumn]
620
+ * @param {string} [sortingOrder]
621
+ * @param {*} [options] Override http request option.
622
+ * @throws {RequiredError}
623
+ */
624
+ async getAllDiscounts(discountState?: string, page?: number, limit?: number, search?: string, sortingColumn?: string, sortingOrder?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<DiscountPaginatedResponse>> {
625
+ return DiscountsApiFp(configuration).getAllDiscounts(discountState, page, limit, search, sortingColumn, sortingOrder, options).then((request) => request(axios, basePath));
626
+ },
627
+ /**
628
+ *
629
+ * @summary Get insights on store discounts
630
+ * @param {*} [options] Override http request option.
631
+ * @throws {RequiredError}
632
+ */
633
+ async getDiscountsInsights(options?: AxiosRequestConfig): Promise<AxiosResponse<DiscountsInsightsDto>> {
634
+ return DiscountsApiFp(configuration).getDiscountsInsights(options).then((request) => request(axios, basePath));
635
+ },
636
+ /**
637
+ *
638
+ * @summary Get discount by id
639
+ * @param {string} id
640
+ * @param {*} [options] Override http request option.
641
+ * @throws {RequiredError}
642
+ */
643
+ async getSingleDiscount(id: string, options?: AxiosRequestConfig): Promise<AxiosResponse<PopulatedDiscount>> {
644
+ return DiscountsApiFp(configuration).getSingleDiscount(id, options).then((request) => request(axios, basePath));
645
+ },
646
+ /**
647
+ *
648
+ * @summary Update a discount
649
+ * @param {UpdateDiscountDto} body
650
+ * @param {string} id
651
+ * @param {*} [options] Override http request option.
652
+ * @throws {RequiredError}
653
+ */
654
+ async updateDiscount(body: UpdateDiscountDto, id: string, options?: AxiosRequestConfig): Promise<AxiosResponse<Discount>> {
655
+ return DiscountsApiFp(configuration).updateDiscount(body, id, options).then((request) => request(axios, basePath));
656
+ },
657
+ /**
658
+ *
659
+ * @summary Checks the validity of a discount -- either through couponCode or discountId
660
+ * @param {string} [code]
661
+ * @param {string} [userId]
662
+ * @param {string} [discountId]
663
+ * @param {*} [options] Override http request option.
664
+ * @throws {RequiredError}
665
+ */
666
+ async validateCoupon(code?: string, userId?: string, discountId?: string, options?: AxiosRequestConfig): Promise<AxiosResponse<Discount>> {
667
+ return DiscountsApiFp(configuration).validateCoupon(code, userId, discountId, options).then((request) => request(axios, basePath));
668
+ },
669
+ };
670
+ };
671
+
672
+ /**
673
+ * DiscountsApi - object-oriented interface
674
+ * @export
675
+ * @class DiscountsApi
676
+ * @extends {BaseAPI}
677
+ */
678
+ export class DiscountsApi extends BaseAPI {
679
+ /**
680
+ *
681
+ * @summary Create a new discount
682
+ * @param {CreateDiscountDto} body
683
+ * @param {*} [options] Override http request option.
684
+ * @throws {RequiredError}
685
+ * @memberof DiscountsApi
686
+ */
687
+ public async createDiscount(body: CreateDiscountDto, options?: AxiosRequestConfig) : Promise<AxiosResponse<Discount>> {
688
+ return DiscountsApiFp(this.configuration).createDiscount(body, options).then((request) => request(this.axios, this.basePath));
689
+ }
690
+ /**
691
+ *
692
+ * @summary Delete a discount
693
+ * @param {string} id
694
+ * @param {*} [options] Override http request option.
695
+ * @throws {RequiredError}
696
+ * @memberof DiscountsApi
697
+ */
698
+ public async deleteDiscount(id: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
699
+ return DiscountsApiFp(this.configuration).deleteDiscount(id, options).then((request) => request(this.axios, this.basePath));
700
+ }
701
+ /**
702
+ *
703
+ * @summary Get all discounts
704
+ * @param {string} [discountState]
705
+ * @param {number} [page]
706
+ * @param {number} [limit]
707
+ * @param {string} [search]
708
+ * @param {string} [sortingColumn]
709
+ * @param {string} [sortingOrder]
710
+ * @param {*} [options] Override http request option.
711
+ * @throws {RequiredError}
712
+ * @memberof DiscountsApi
713
+ */
714
+ public async getAllDiscounts(discountState?: string, page?: number, limit?: number, search?: string, sortingColumn?: string, sortingOrder?: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<DiscountPaginatedResponse>> {
715
+ return DiscountsApiFp(this.configuration).getAllDiscounts(discountState, page, limit, search, sortingColumn, sortingOrder, options).then((request) => request(this.axios, this.basePath));
716
+ }
717
+ /**
718
+ *
719
+ * @summary Get insights on store discounts
720
+ * @param {*} [options] Override http request option.
721
+ * @throws {RequiredError}
722
+ * @memberof DiscountsApi
723
+ */
724
+ public async getDiscountsInsights(options?: AxiosRequestConfig) : Promise<AxiosResponse<DiscountsInsightsDto>> {
725
+ return DiscountsApiFp(this.configuration).getDiscountsInsights(options).then((request) => request(this.axios, this.basePath));
726
+ }
727
+ /**
728
+ *
729
+ * @summary Get discount by id
730
+ * @param {string} id
731
+ * @param {*} [options] Override http request option.
732
+ * @throws {RequiredError}
733
+ * @memberof DiscountsApi
734
+ */
735
+ public async getSingleDiscount(id: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<PopulatedDiscount>> {
736
+ return DiscountsApiFp(this.configuration).getSingleDiscount(id, options).then((request) => request(this.axios, this.basePath));
737
+ }
738
+ /**
739
+ *
740
+ * @summary Update a discount
741
+ * @param {UpdateDiscountDto} body
742
+ * @param {string} id
743
+ * @param {*} [options] Override http request option.
744
+ * @throws {RequiredError}
745
+ * @memberof DiscountsApi
746
+ */
747
+ public async updateDiscount(body: UpdateDiscountDto, id: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<Discount>> {
748
+ return DiscountsApiFp(this.configuration).updateDiscount(body, id, options).then((request) => request(this.axios, this.basePath));
749
+ }
750
+ /**
751
+ *
752
+ * @summary Checks the validity of a discount -- either through couponCode or discountId
753
+ * @param {string} [code]
754
+ * @param {string} [userId]
755
+ * @param {string} [discountId]
756
+ * @param {*} [options] Override http request option.
757
+ * @throws {RequiredError}
758
+ * @memberof DiscountsApi
759
+ */
760
+ public async validateCoupon(code?: string, userId?: string, discountId?: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<Discount>> {
761
+ return DiscountsApiFp(this.configuration).validateCoupon(code, userId, discountId, options).then((request) => request(this.axios, this.basePath));
762
+ }
763
+ }