@emilgroup/discount-sdk 1.4.1-beta.0 → 1.5.1

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 (150) hide show
  1. package/README.md +2 -2
  2. package/index.js +99 -0
  3. package/package.json +8 -21
  4. package/scripts/deploy.js +225 -0
  5. package/.openapi-generator/FILES +0 -54
  6. package/.openapi-generator/VERSION +0 -1
  7. package/.openapi-generator-ignore +0 -23
  8. package/api/campaigns-api.ts +0 -1433
  9. package/api/default-api.ts +0 -124
  10. package/api/policy-vouchers-api.ts +0 -999
  11. package/api/vouchers-api.ts +0 -691
  12. package/api.ts +0 -33
  13. package/base.ts +0 -331
  14. package/common.ts +0 -198
  15. package/configuration.ts +0 -110
  16. package/dist/api/campaigns-api.d.ts +0 -808
  17. package/dist/api/campaigns-api.js +0 -1251
  18. package/dist/api/default-api.d.ts +0 -70
  19. package/dist/api/default-api.js +0 -200
  20. package/dist/api/policy-vouchers-api.d.ts +0 -555
  21. package/dist/api/policy-vouchers-api.js +0 -915
  22. package/dist/api/vouchers-api.d.ts +0 -393
  23. package/dist/api/vouchers-api.js +0 -642
  24. package/dist/api.d.ts +0 -15
  25. package/dist/api.js +0 -33
  26. package/dist/base.d.ts +0 -86
  27. package/dist/base.js +0 -367
  28. package/dist/common.d.ts +0 -91
  29. package/dist/common.js +0 -276
  30. package/dist/configuration.d.ts +0 -89
  31. package/dist/configuration.js +0 -52
  32. package/dist/index.d.ts +0 -15
  33. package/dist/index.js +0 -36
  34. package/dist/models/campaign-class.d.ts +0 -105
  35. package/dist/models/campaign-class.js +0 -24
  36. package/dist/models/charge-policy-voucher-request-dto.d.ts +0 -48
  37. package/dist/models/charge-policy-voucher-request-dto.js +0 -15
  38. package/dist/models/charge-policy-voucher-response-class.d.ts +0 -96
  39. package/dist/models/charge-policy-voucher-response-class.js +0 -21
  40. package/dist/models/check-account-eligibility-request-dto.d.ts +0 -48
  41. package/dist/models/check-account-eligibility-request-dto.js +0 -15
  42. package/dist/models/check-account-eligibility-response-class.d.ts +0 -57
  43. package/dist/models/check-account-eligibility-response-class.js +0 -24
  44. package/dist/models/create-campaign-request-dto.d.ts +0 -42
  45. package/dist/models/create-campaign-request-dto.js +0 -15
  46. package/dist/models/create-campaign-response-class.d.ts +0 -25
  47. package/dist/models/create-campaign-response-class.js +0 -15
  48. package/dist/models/create-eligible-account-request-dto.d.ts +0 -30
  49. package/dist/models/create-eligible-account-request-dto.js +0 -15
  50. package/dist/models/create-eligible-account-response-class.d.ts +0 -25
  51. package/dist/models/create-eligible-account-response-class.js +0 -15
  52. package/dist/models/create-policy-voucher-request-dto.d.ts +0 -48
  53. package/dist/models/create-policy-voucher-request-dto.js +0 -15
  54. package/dist/models/create-policy-voucher-response-class.d.ts +0 -25
  55. package/dist/models/create-policy-voucher-response-class.js +0 -15
  56. package/dist/models/create-product-discount-dto.d.ts +0 -48
  57. package/dist/models/create-product-discount-dto.js +0 -15
  58. package/dist/models/create-voucher-request-dto.d.ts +0 -66
  59. package/dist/models/create-voucher-request-dto.js +0 -20
  60. package/dist/models/create-voucher-response-class.d.ts +0 -25
  61. package/dist/models/create-voucher-response-class.js +0 -15
  62. package/dist/models/eligible-account-class.d.ts +0 -78
  63. package/dist/models/eligible-account-class.js +0 -15
  64. package/dist/models/get-campaign-response-class.d.ts +0 -25
  65. package/dist/models/get-campaign-response-class.js +0 -15
  66. package/dist/models/get-policy-voucher-response-class.d.ts +0 -25
  67. package/dist/models/get-policy-voucher-response-class.js +0 -15
  68. package/dist/models/get-voucher-response-class.d.ts +0 -25
  69. package/dist/models/get-voucher-response-class.js +0 -15
  70. package/dist/models/index.d.ts +0 -37
  71. package/dist/models/index.js +0 -53
  72. package/dist/models/inline-response200.d.ts +0 -54
  73. package/dist/models/inline-response200.js +0 -15
  74. package/dist/models/inline-response503.d.ts +0 -54
  75. package/dist/models/inline-response503.js +0 -15
  76. package/dist/models/list-campaigns-response-class.d.ts +0 -43
  77. package/dist/models/list-campaigns-response-class.js +0 -15
  78. package/dist/models/list-eligible-accounts-response-class.d.ts +0 -43
  79. package/dist/models/list-eligible-accounts-response-class.js +0 -15
  80. package/dist/models/list-policy-vouchers-response-class.d.ts +0 -43
  81. package/dist/models/list-policy-vouchers-response-class.js +0 -15
  82. package/dist/models/list-vouchers-response-class.d.ts +0 -43
  83. package/dist/models/list-vouchers-response-class.js +0 -15
  84. package/dist/models/policy-voucher-class.d.ts +0 -165
  85. package/dist/models/policy-voucher-class.js +0 -21
  86. package/dist/models/policy-voucher-transaction-class.d.ts +0 -126
  87. package/dist/models/policy-voucher-transaction-class.js +0 -26
  88. package/dist/models/product-discount-class.d.ts +0 -90
  89. package/dist/models/product-discount-class.js +0 -15
  90. package/dist/models/redeem-policy-voucher-request-dto.d.ts +0 -48
  91. package/dist/models/redeem-policy-voucher-request-dto.js +0 -15
  92. package/dist/models/redeem-policy-voucher-response-class.d.ts +0 -84
  93. package/dist/models/redeem-policy-voucher-response-class.js +0 -21
  94. package/dist/models/update-campaign-request-dto.d.ts +0 -42
  95. package/dist/models/update-campaign-request-dto.js +0 -15
  96. package/dist/models/update-campaign-response-class.d.ts +0 -25
  97. package/dist/models/update-campaign-response-class.js +0 -15
  98. package/dist/models/update-campaign-status-request-dto.d.ts +0 -33
  99. package/dist/models/update-campaign-status-request-dto.js +0 -24
  100. package/dist/models/update-voucher-request-dto.d.ts +0 -60
  101. package/dist/models/update-voucher-request-dto.js +0 -20
  102. package/dist/models/update-voucher-response-class.d.ts +0 -25
  103. package/dist/models/update-voucher-response-class.js +0 -15
  104. package/dist/models/voucher-class.d.ts +0 -127
  105. package/dist/models/voucher-class.js +0 -20
  106. package/dist/models/withdraw-policy-voucher-request-dto.d.ts +0 -36
  107. package/dist/models/withdraw-policy-voucher-request-dto.js +0 -15
  108. package/dist/models/withdraw-policy-voucher-response-class.d.ts +0 -78
  109. package/dist/models/withdraw-policy-voucher-response-class.js +0 -21
  110. package/git_push.sh +0 -57
  111. package/index.ts +0 -19
  112. package/models/campaign-class.ts +0 -114
  113. package/models/charge-policy-voucher-request-dto.ts +0 -54
  114. package/models/charge-policy-voucher-response-class.ts +0 -105
  115. package/models/check-account-eligibility-request-dto.ts +0 -54
  116. package/models/check-account-eligibility-response-class.ts +0 -66
  117. package/models/create-campaign-request-dto.ts +0 -48
  118. package/models/create-campaign-response-class.ts +0 -31
  119. package/models/create-eligible-account-request-dto.ts +0 -36
  120. package/models/create-eligible-account-response-class.ts +0 -31
  121. package/models/create-policy-voucher-request-dto.ts +0 -54
  122. package/models/create-policy-voucher-response-class.ts +0 -31
  123. package/models/create-product-discount-dto.ts +0 -54
  124. package/models/create-voucher-request-dto.ts +0 -75
  125. package/models/create-voucher-response-class.ts +0 -31
  126. package/models/eligible-account-class.ts +0 -84
  127. package/models/get-campaign-response-class.ts +0 -31
  128. package/models/get-policy-voucher-response-class.ts +0 -31
  129. package/models/get-voucher-response-class.ts +0 -31
  130. package/models/index.ts +0 -37
  131. package/models/inline-response200.ts +0 -48
  132. package/models/inline-response503.ts +0 -48
  133. package/models/list-campaigns-response-class.ts +0 -49
  134. package/models/list-eligible-accounts-response-class.ts +0 -49
  135. package/models/list-policy-vouchers-response-class.ts +0 -49
  136. package/models/list-vouchers-response-class.ts +0 -49
  137. package/models/policy-voucher-class.ts +0 -174
  138. package/models/policy-voucher-transaction-class.ts +0 -136
  139. package/models/product-discount-class.ts +0 -96
  140. package/models/redeem-policy-voucher-request-dto.ts +0 -54
  141. package/models/redeem-policy-voucher-response-class.ts +0 -93
  142. package/models/update-campaign-request-dto.ts +0 -48
  143. package/models/update-campaign-response-class.ts +0 -31
  144. package/models/update-campaign-status-request-dto.ts +0 -42
  145. package/models/update-voucher-request-dto.ts +0 -69
  146. package/models/update-voucher-response-class.ts +0 -31
  147. package/models/voucher-class.ts +0 -136
  148. package/models/withdraw-policy-voucher-request-dto.ts +0 -42
  149. package/models/withdraw-policy-voucher-response-class.ts +0 -87
  150. package/tsconfig.json +0 -23
@@ -1,642 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * EMIL DiscountService
6
- * The EMIL DiscountService API description
7
- *
8
- * The version of the OpenAPI document: 1.0
9
- * Contact: kontakt@emil.de
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- var __extends = (this && this.__extends) || (function () {
16
- var extendStatics = function (d, b) {
17
- extendStatics = Object.setPrototypeOf ||
18
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
- return extendStatics(d, b);
21
- };
22
- return function (d, b) {
23
- if (typeof b !== "function" && b !== null)
24
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
- extendStatics(d, b);
26
- function __() { this.constructor = d; }
27
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
- };
29
- })();
30
- var __assign = (this && this.__assign) || function () {
31
- __assign = Object.assign || function(t) {
32
- for (var s, i = 1, n = arguments.length; i < n; i++) {
33
- s = arguments[i];
34
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
35
- t[p] = s[p];
36
- }
37
- return t;
38
- };
39
- return __assign.apply(this, arguments);
40
- };
41
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
- return new (P || (P = Promise))(function (resolve, reject) {
44
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
- step((generator = generator.apply(thisArg, _arguments || [])).next());
48
- });
49
- };
50
- var __generator = (this && this.__generator) || function (thisArg, body) {
51
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
52
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
53
- function verb(n) { return function (v) { return step([n, v]); }; }
54
- function step(op) {
55
- if (f) throw new TypeError("Generator is already executing.");
56
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
57
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
58
- if (y = 0, t) op = [op[0] & 2, t.value];
59
- switch (op[0]) {
60
- case 0: case 1: t = op; break;
61
- case 4: _.label++; return { value: op[1], done: false };
62
- case 5: _.label++; y = op[1]; op = [0]; continue;
63
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
64
- default:
65
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
66
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
67
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
68
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
69
- if (t[2]) _.ops.pop();
70
- _.trys.pop(); continue;
71
- }
72
- op = body.call(thisArg, _);
73
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
74
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
75
- }
76
- };
77
- var __importDefault = (this && this.__importDefault) || function (mod) {
78
- return (mod && mod.__esModule) ? mod : { "default": mod };
79
- };
80
- Object.defineProperty(exports, "__esModule", { value: true });
81
- exports.VouchersApi = exports.VouchersApiFactory = exports.VouchersApiFp = exports.VouchersApiAxiosParamCreator = void 0;
82
- var axios_1 = __importDefault(require("axios"));
83
- // Some imports not used depending on template conditions
84
- // @ts-ignore
85
- var common_1 = require("../common");
86
- // @ts-ignore
87
- var base_1 = require("../base");
88
- /**
89
- * VouchersApi - axios parameter creator
90
- * @export
91
- */
92
- var VouchersApiAxiosParamCreator = function (configuration) {
93
- var _this = this;
94
- return {
95
- /**
96
- * This will create a voucher.
97
- * @summary Create the Voucher
98
- * @param {CreateVoucherRequestDto} createVoucherRequestDto
99
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
100
- * @param {*} [options] Override http request option.
101
- * @throws {RequiredError}
102
- */
103
- createVoucher: function (createVoucherRequestDto, authorization, options) {
104
- if (options === void 0) { options = {}; }
105
- return __awaiter(_this, void 0, void 0, function () {
106
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
107
- return __generator(this, function (_a) {
108
- switch (_a.label) {
109
- case 0:
110
- // verify required parameter 'createVoucherRequestDto' is not null or undefined
111
- (0, common_1.assertParamExists)('createVoucher', 'createVoucherRequestDto', createVoucherRequestDto);
112
- localVarPath = "/discountservice/v1/vouchers";
113
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
114
- if (configuration) {
115
- baseOptions = configuration.baseOptions;
116
- baseAccessToken = configuration.accessToken;
117
- }
118
- localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
119
- localVarHeaderParameter = {};
120
- localVarQueryParameter = {};
121
- // authentication bearer required
122
- // http bearer authentication required
123
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
124
- case 1:
125
- // authentication bearer required
126
- // http bearer authentication required
127
- _a.sent();
128
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
129
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
130
- }
131
- localVarHeaderParameter['Content-Type'] = 'application/json';
132
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
133
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
134
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
135
- localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createVoucherRequestDto, localVarRequestOptions, configuration);
136
- return [2 /*return*/, {
137
- url: (0, common_1.toPathString)(localVarUrlObj),
138
- options: localVarRequestOptions,
139
- }];
140
- }
141
- });
142
- });
143
- },
144
- /**
145
- * This will delete a voucher.
146
- * @summary Delete the Voucher
147
- * @param {string} code Unique identifier for the object.
148
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
149
- * @param {*} [options] Override http request option.
150
- * @throws {RequiredError}
151
- */
152
- deleteVoucher: function (code, authorization, options) {
153
- if (options === void 0) { options = {}; }
154
- return __awaiter(_this, void 0, void 0, function () {
155
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
156
- return __generator(this, function (_a) {
157
- switch (_a.label) {
158
- case 0:
159
- // verify required parameter 'code' is not null or undefined
160
- (0, common_1.assertParamExists)('deleteVoucher', 'code', code);
161
- localVarPath = "/discountservice/v1/vouchers/{code}"
162
- .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
163
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
164
- if (configuration) {
165
- baseOptions = configuration.baseOptions;
166
- baseAccessToken = configuration.accessToken;
167
- }
168
- localVarRequestOptions = __assign(__assign({ method: 'DELETE' }, baseOptions), options);
169
- localVarHeaderParameter = {};
170
- localVarQueryParameter = {};
171
- // authentication bearer required
172
- // http bearer authentication required
173
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
174
- case 1:
175
- // authentication bearer required
176
- // http bearer authentication required
177
- _a.sent();
178
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
179
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
180
- }
181
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
182
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
183
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
184
- return [2 /*return*/, {
185
- url: (0, common_1.toPathString)(localVarUrlObj),
186
- options: localVarRequestOptions,
187
- }];
188
- }
189
- });
190
- });
191
- },
192
- /**
193
- * This will get a voucher.
194
- * @summary Retrieve the Voucher
195
- * @param {string} code Unique identifier for the object.
196
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
197
- * @param {'campaign' | 'productDiscounts'} [expand] You can expand voucher in this endpoint.
198
- * @param {*} [options] Override http request option.
199
- * @throws {RequiredError}
200
- */
201
- getVoucher: function (code, authorization, expand, options) {
202
- if (options === void 0) { options = {}; }
203
- return __awaiter(_this, void 0, void 0, function () {
204
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
205
- return __generator(this, function (_a) {
206
- switch (_a.label) {
207
- case 0:
208
- // verify required parameter 'code' is not null or undefined
209
- (0, common_1.assertParamExists)('getVoucher', 'code', code);
210
- localVarPath = "/discountservice/v1/vouchers/{code}"
211
- .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
212
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
213
- if (configuration) {
214
- baseOptions = configuration.baseOptions;
215
- baseAccessToken = configuration.accessToken;
216
- }
217
- localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
218
- localVarHeaderParameter = {};
219
- localVarQueryParameter = {};
220
- // authentication bearer required
221
- // http bearer authentication required
222
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
223
- case 1:
224
- // authentication bearer required
225
- // http bearer authentication required
226
- _a.sent();
227
- if (expand !== undefined) {
228
- localVarQueryParameter['expand'] = expand;
229
- }
230
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
231
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
232
- }
233
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
234
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
235
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
236
- return [2 /*return*/, {
237
- url: (0, common_1.toPathString)(localVarUrlObj),
238
- options: localVarRequestOptions,
239
- }];
240
- }
241
- });
242
- });
243
- },
244
- /**
245
- * Returns a list of Vouchers you have previously created. The Vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
246
- * @summary List Vouchers
247
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
248
- * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
249
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
250
- * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, voucherCode, campaignId, discountType, createdAt, discountValue, discountPeriodMonths, productDiscounts.productSlug&lt;/i&gt;
251
- * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: code, voucherCode, productSlugsList&lt;/i&gt;
252
- * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: code, voucherCode, campaignId, discountPeriodMonths, discountType, discountValue, createdAt&lt;/i&gt;
253
- * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: campaign, productDiscounts&lt;i&gt;
254
- * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, voucherCode, campaignId, discountType, createdAt, discountValue, discountPeriodMonths, productDiscounts.productSlug&lt;/i&gt;
255
- * @param {*} [options] Override http request option.
256
- * @throws {RequiredError}
257
- */
258
- listVouchers: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
259
- if (options === void 0) { options = {}; }
260
- return __awaiter(_this, void 0, void 0, function () {
261
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
262
- return __generator(this, function (_a) {
263
- switch (_a.label) {
264
- case 0:
265
- localVarPath = "/discountservice/v1/vouchers";
266
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
267
- if (configuration) {
268
- baseOptions = configuration.baseOptions;
269
- baseAccessToken = configuration.accessToken;
270
- }
271
- localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
272
- localVarHeaderParameter = {};
273
- localVarQueryParameter = {};
274
- // authentication bearer required
275
- // http bearer authentication required
276
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
277
- case 1:
278
- // authentication bearer required
279
- // http bearer authentication required
280
- _a.sent();
281
- if (pageSize !== undefined) {
282
- localVarQueryParameter['pageSize'] = pageSize;
283
- }
284
- if (pageToken !== undefined) {
285
- localVarQueryParameter['pageToken'] = pageToken;
286
- }
287
- if (filter !== undefined) {
288
- localVarQueryParameter['filter'] = filter;
289
- }
290
- if (search !== undefined) {
291
- localVarQueryParameter['search'] = search;
292
- }
293
- if (order !== undefined) {
294
- localVarQueryParameter['order'] = order;
295
- }
296
- if (expand !== undefined) {
297
- localVarQueryParameter['expand'] = expand;
298
- }
299
- if (filters !== undefined) {
300
- localVarQueryParameter['filters'] = filters;
301
- }
302
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
303
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
304
- }
305
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
306
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
307
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
308
- return [2 /*return*/, {
309
- url: (0, common_1.toPathString)(localVarUrlObj),
310
- options: localVarRequestOptions,
311
- }];
312
- }
313
- });
314
- });
315
- },
316
- /**
317
- * This will update a voucher.
318
- * @summary Update the Voucher
319
- * @param {string} code Unique identifier for the object.
320
- * @param {UpdateVoucherRequestDto} updateVoucherRequestDto
321
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
322
- * @param {*} [options] Override http request option.
323
- * @throws {RequiredError}
324
- */
325
- updateVoucher: function (code, updateVoucherRequestDto, authorization, options) {
326
- if (options === void 0) { options = {}; }
327
- return __awaiter(_this, void 0, void 0, function () {
328
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
329
- return __generator(this, function (_a) {
330
- switch (_a.label) {
331
- case 0:
332
- // verify required parameter 'code' is not null or undefined
333
- (0, common_1.assertParamExists)('updateVoucher', 'code', code);
334
- // verify required parameter 'updateVoucherRequestDto' is not null or undefined
335
- (0, common_1.assertParamExists)('updateVoucher', 'updateVoucherRequestDto', updateVoucherRequestDto);
336
- localVarPath = "/discountservice/v1/vouchers/{code}"
337
- .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
338
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
339
- if (configuration) {
340
- baseOptions = configuration.baseOptions;
341
- baseAccessToken = configuration.accessToken;
342
- }
343
- localVarRequestOptions = __assign(__assign({ method: 'PUT' }, baseOptions), options);
344
- localVarHeaderParameter = {};
345
- localVarQueryParameter = {};
346
- // authentication bearer required
347
- // http bearer authentication required
348
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
349
- case 1:
350
- // authentication bearer required
351
- // http bearer authentication required
352
- _a.sent();
353
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
354
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
355
- }
356
- localVarHeaderParameter['Content-Type'] = 'application/json';
357
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
358
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
359
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
360
- localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(updateVoucherRequestDto, localVarRequestOptions, configuration);
361
- return [2 /*return*/, {
362
- url: (0, common_1.toPathString)(localVarUrlObj),
363
- options: localVarRequestOptions,
364
- }];
365
- }
366
- });
367
- });
368
- },
369
- };
370
- };
371
- exports.VouchersApiAxiosParamCreator = VouchersApiAxiosParamCreator;
372
- /**
373
- * VouchersApi - functional programming interface
374
- * @export
375
- */
376
- var VouchersApiFp = function (configuration) {
377
- var localVarAxiosParamCreator = (0, exports.VouchersApiAxiosParamCreator)(configuration);
378
- return {
379
- /**
380
- * This will create a voucher.
381
- * @summary Create the Voucher
382
- * @param {CreateVoucherRequestDto} createVoucherRequestDto
383
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
384
- * @param {*} [options] Override http request option.
385
- * @throws {RequiredError}
386
- */
387
- createVoucher: function (createVoucherRequestDto, authorization, options) {
388
- return __awaiter(this, void 0, void 0, function () {
389
- var localVarAxiosArgs;
390
- return __generator(this, function (_a) {
391
- switch (_a.label) {
392
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.createVoucher(createVoucherRequestDto, authorization, options)];
393
- case 1:
394
- localVarAxiosArgs = _a.sent();
395
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
396
- }
397
- });
398
- });
399
- },
400
- /**
401
- * This will delete a voucher.
402
- * @summary Delete the Voucher
403
- * @param {string} code Unique identifier for the object.
404
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
405
- * @param {*} [options] Override http request option.
406
- * @throws {RequiredError}
407
- */
408
- deleteVoucher: function (code, authorization, options) {
409
- return __awaiter(this, void 0, void 0, function () {
410
- var localVarAxiosArgs;
411
- return __generator(this, function (_a) {
412
- switch (_a.label) {
413
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.deleteVoucher(code, authorization, options)];
414
- case 1:
415
- localVarAxiosArgs = _a.sent();
416
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
417
- }
418
- });
419
- });
420
- },
421
- /**
422
- * This will get a voucher.
423
- * @summary Retrieve the Voucher
424
- * @param {string} code Unique identifier for the object.
425
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
426
- * @param {'campaign' | 'productDiscounts'} [expand] You can expand voucher in this endpoint.
427
- * @param {*} [options] Override http request option.
428
- * @throws {RequiredError}
429
- */
430
- getVoucher: function (code, authorization, expand, options) {
431
- return __awaiter(this, void 0, void 0, function () {
432
- var localVarAxiosArgs;
433
- return __generator(this, function (_a) {
434
- switch (_a.label) {
435
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.getVoucher(code, authorization, expand, options)];
436
- case 1:
437
- localVarAxiosArgs = _a.sent();
438
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
439
- }
440
- });
441
- });
442
- },
443
- /**
444
- * Returns a list of Vouchers you have previously created. The Vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
445
- * @summary List Vouchers
446
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
447
- * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
448
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
449
- * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, voucherCode, campaignId, discountType, createdAt, discountValue, discountPeriodMonths, productDiscounts.productSlug&lt;/i&gt;
450
- * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: code, voucherCode, productSlugsList&lt;/i&gt;
451
- * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: code, voucherCode, campaignId, discountPeriodMonths, discountType, discountValue, createdAt&lt;/i&gt;
452
- * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: campaign, productDiscounts&lt;i&gt;
453
- * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, voucherCode, campaignId, discountType, createdAt, discountValue, discountPeriodMonths, productDiscounts.productSlug&lt;/i&gt;
454
- * @param {*} [options] Override http request option.
455
- * @throws {RequiredError}
456
- */
457
- listVouchers: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
458
- return __awaiter(this, void 0, void 0, function () {
459
- var localVarAxiosArgs;
460
- return __generator(this, function (_a) {
461
- switch (_a.label) {
462
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.listVouchers(authorization, pageSize, pageToken, filter, search, order, expand, filters, options)];
463
- case 1:
464
- localVarAxiosArgs = _a.sent();
465
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
466
- }
467
- });
468
- });
469
- },
470
- /**
471
- * This will update a voucher.
472
- * @summary Update the Voucher
473
- * @param {string} code Unique identifier for the object.
474
- * @param {UpdateVoucherRequestDto} updateVoucherRequestDto
475
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
476
- * @param {*} [options] Override http request option.
477
- * @throws {RequiredError}
478
- */
479
- updateVoucher: function (code, updateVoucherRequestDto, authorization, options) {
480
- return __awaiter(this, void 0, void 0, function () {
481
- var localVarAxiosArgs;
482
- return __generator(this, function (_a) {
483
- switch (_a.label) {
484
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.updateVoucher(code, updateVoucherRequestDto, authorization, options)];
485
- case 1:
486
- localVarAxiosArgs = _a.sent();
487
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
488
- }
489
- });
490
- });
491
- },
492
- };
493
- };
494
- exports.VouchersApiFp = VouchersApiFp;
495
- /**
496
- * VouchersApi - factory interface
497
- * @export
498
- */
499
- var VouchersApiFactory = function (configuration, basePath, axios) {
500
- var localVarFp = (0, exports.VouchersApiFp)(configuration);
501
- return {
502
- /**
503
- * This will create a voucher.
504
- * @summary Create the Voucher
505
- * @param {CreateVoucherRequestDto} createVoucherRequestDto
506
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
507
- * @param {*} [options] Override http request option.
508
- * @throws {RequiredError}
509
- */
510
- createVoucher: function (createVoucherRequestDto, authorization, options) {
511
- return localVarFp.createVoucher(createVoucherRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
512
- },
513
- /**
514
- * This will delete a voucher.
515
- * @summary Delete the Voucher
516
- * @param {string} code Unique identifier for the object.
517
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
518
- * @param {*} [options] Override http request option.
519
- * @throws {RequiredError}
520
- */
521
- deleteVoucher: function (code, authorization, options) {
522
- return localVarFp.deleteVoucher(code, authorization, options).then(function (request) { return request(axios, basePath); });
523
- },
524
- /**
525
- * This will get a voucher.
526
- * @summary Retrieve the Voucher
527
- * @param {string} code Unique identifier for the object.
528
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
529
- * @param {'campaign' | 'productDiscounts'} [expand] You can expand voucher in this endpoint.
530
- * @param {*} [options] Override http request option.
531
- * @throws {RequiredError}
532
- */
533
- getVoucher: function (code, authorization, expand, options) {
534
- return localVarFp.getVoucher(code, authorization, expand, options).then(function (request) { return request(axios, basePath); });
535
- },
536
- /**
537
- * Returns a list of Vouchers you have previously created. The Vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
538
- * @summary List Vouchers
539
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
540
- * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
541
- * @param {string} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken&#x3D;1, your subsequent call can include pageToken&#x3D;2 in order to fetch the next page of the list.
542
- * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, voucherCode, campaignId, discountType, createdAt, discountValue, discountPeriodMonths, productDiscounts.productSlug&lt;/i&gt;
543
- * @param {string} [search] Search the response for matches in any searchable field. Use filter instead where possible for improved performance.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Searchable fields: code, voucherCode, productSlugsList&lt;/i&gt;
544
- * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: code, voucherCode, campaignId, discountPeriodMonths, discountType, discountValue, createdAt&lt;/i&gt;
545
- * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: campaign, productDiscounts&lt;i&gt;
546
- * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.&lt;br/&gt; &lt;br/&gt; &lt;i&gt;Allowed values: id, code, voucherCode, campaignId, discountType, createdAt, discountValue, discountPeriodMonths, productDiscounts.productSlug&lt;/i&gt;
547
- * @param {*} [options] Override http request option.
548
- * @throws {RequiredError}
549
- */
550
- listVouchers: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
551
- return localVarFp.listVouchers(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then(function (request) { return request(axios, basePath); });
552
- },
553
- /**
554
- * This will update a voucher.
555
- * @summary Update the Voucher
556
- * @param {string} code Unique identifier for the object.
557
- * @param {UpdateVoucherRequestDto} updateVoucherRequestDto
558
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
559
- * @param {*} [options] Override http request option.
560
- * @throws {RequiredError}
561
- */
562
- updateVoucher: function (code, updateVoucherRequestDto, authorization, options) {
563
- return localVarFp.updateVoucher(code, updateVoucherRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
564
- },
565
- };
566
- };
567
- exports.VouchersApiFactory = VouchersApiFactory;
568
- /**
569
- * VouchersApi - object-oriented interface
570
- * @export
571
- * @class VouchersApi
572
- * @extends {BaseAPI}
573
- */
574
- var VouchersApi = /** @class */ (function (_super) {
575
- __extends(VouchersApi, _super);
576
- function VouchersApi() {
577
- return _super !== null && _super.apply(this, arguments) || this;
578
- }
579
- /**
580
- * This will create a voucher.
581
- * @summary Create the Voucher
582
- * @param {VouchersApiCreateVoucherRequest} requestParameters Request parameters.
583
- * @param {*} [options] Override http request option.
584
- * @throws {RequiredError}
585
- * @memberof VouchersApi
586
- */
587
- VouchersApi.prototype.createVoucher = function (requestParameters, options) {
588
- var _this = this;
589
- return (0, exports.VouchersApiFp)(this.configuration).createVoucher(requestParameters.createVoucherRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
590
- };
591
- /**
592
- * This will delete a voucher.
593
- * @summary Delete the Voucher
594
- * @param {VouchersApiDeleteVoucherRequest} requestParameters Request parameters.
595
- * @param {*} [options] Override http request option.
596
- * @throws {RequiredError}
597
- * @memberof VouchersApi
598
- */
599
- VouchersApi.prototype.deleteVoucher = function (requestParameters, options) {
600
- var _this = this;
601
- return (0, exports.VouchersApiFp)(this.configuration).deleteVoucher(requestParameters.code, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
602
- };
603
- /**
604
- * This will get a voucher.
605
- * @summary Retrieve the Voucher
606
- * @param {VouchersApiGetVoucherRequest} requestParameters Request parameters.
607
- * @param {*} [options] Override http request option.
608
- * @throws {RequiredError}
609
- * @memberof VouchersApi
610
- */
611
- VouchersApi.prototype.getVoucher = function (requestParameters, options) {
612
- var _this = this;
613
- return (0, exports.VouchersApiFp)(this.configuration).getVoucher(requestParameters.code, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
614
- };
615
- /**
616
- * Returns a list of Vouchers you have previously created. The Vouchers are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
617
- * @summary List Vouchers
618
- * @param {VouchersApiListVouchersRequest} requestParameters Request parameters.
619
- * @param {*} [options] Override http request option.
620
- * @throws {RequiredError}
621
- * @memberof VouchersApi
622
- */
623
- VouchersApi.prototype.listVouchers = function (requestParameters, options) {
624
- var _this = this;
625
- if (requestParameters === void 0) { requestParameters = {}; }
626
- return (0, exports.VouchersApiFp)(this.configuration).listVouchers(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then(function (request) { return request(_this.axios, _this.basePath); });
627
- };
628
- /**
629
- * This will update a voucher.
630
- * @summary Update the Voucher
631
- * @param {VouchersApiUpdateVoucherRequest} requestParameters Request parameters.
632
- * @param {*} [options] Override http request option.
633
- * @throws {RequiredError}
634
- * @memberof VouchersApi
635
- */
636
- VouchersApi.prototype.updateVoucher = function (requestParameters, options) {
637
- var _this = this;
638
- return (0, exports.VouchersApiFp)(this.configuration).updateVoucher(requestParameters.code, requestParameters.updateVoucherRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
639
- };
640
- return VouchersApi;
641
- }(base_1.BaseAPI));
642
- exports.VouchersApi = VouchersApi;