@tradecafe/offer-service-sdk 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/apis.js CHANGED
@@ -1,55 +1,57 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.APIS = exports.HttpError = void 0;
33
- __exportStar(require("./futureBidsApi"), exports);
34
- var futureBidsApi_1 = require("./futureBidsApi");
35
- __exportStar(require("./healthApi"), exports);
36
- var healthApi_1 = require("./healthApi");
37
- __exportStar(require("./matchedOffersApi"), exports);
38
- var matchedOffersApi_1 = require("./matchedOffersApi");
39
- __exportStar(require("./offersApi"), exports);
40
- var offersApi_1 = require("./offersApi");
41
- var HttpError = (function (_super) {
42
- __extends(HttpError, _super);
43
- function HttpError(response, body, statusCode) {
44
- var _this = _super.call(this, 'HTTP request failed') || this;
45
- _this.response = response;
46
- _this.body = body;
47
- _this.statusCode = statusCode;
48
- _this.name = 'HttpError';
49
- return _this;
50
- }
51
- return HttpError;
52
- }(Error));
53
- exports.HttpError = HttpError;
54
- exports.APIS = [futureBidsApi_1.FutureBidsApi, healthApi_1.HealthApi, matchedOffersApi_1.MatchedOffersApi, offersApi_1.OffersApi];
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.APIS = exports.HttpError = void 0;
33
+ __exportStar(require("./automatedOffersApi"), exports);
34
+ var automatedOffersApi_1 = require("./automatedOffersApi");
35
+ __exportStar(require("./futureBidsApi"), exports);
36
+ var futureBidsApi_1 = require("./futureBidsApi");
37
+ __exportStar(require("./healthApi"), exports);
38
+ var healthApi_1 = require("./healthApi");
39
+ __exportStar(require("./matchedOffersApi"), exports);
40
+ var matchedOffersApi_1 = require("./matchedOffersApi");
41
+ __exportStar(require("./offersApi"), exports);
42
+ var offersApi_1 = require("./offersApi");
43
+ var HttpError = (function (_super) {
44
+ __extends(HttpError, _super);
45
+ function HttpError(response, body, statusCode) {
46
+ var _this = _super.call(this, 'HTTP request failed') || this;
47
+ _this.response = response;
48
+ _this.body = body;
49
+ _this.statusCode = statusCode;
50
+ _this.name = 'HttpError';
51
+ return _this;
52
+ }
53
+ return HttpError;
54
+ }(Error));
55
+ exports.HttpError = HttpError;
56
+ exports.APIS = [automatedOffersApi_1.AutomatedOffersApi, futureBidsApi_1.FutureBidsApi, healthApi_1.HealthApi, matchedOffersApi_1.MatchedOffersApi, offersApi_1.OffersApi];
55
57
  //# sourceMappingURL=apis.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"apis.js","sourceRoot":"","sources":["../../api/apis.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,iDAAgD;AAChD,8CAA4B;AAC5B,yCAAwC;AACxC,qDAAmC;AACnC,uDAAsD;AACtD,8CAA4B;AAC5B,yCAAwC;AAGxC;IAA+B,6BAAK;IAChC,mBAAoB,QAA8B,EAAS,IAAS,EAAS,UAAmB;QAAhG,YACI,kBAAM,qBAAqB,CAAC,SAE/B;QAHmB,cAAQ,GAAR,QAAQ,CAAsB;QAAS,UAAI,GAAJ,IAAI,CAAK;QAAS,gBAAU,GAAV,UAAU,CAAS;QAE5F,KAAI,CAAC,IAAI,GAAG,WAAW,CAAC;;IAC5B,CAAC;IACL,gBAAC;AAAD,CAAC,AALD,CAA+B,KAAK,GAKnC;AALY,8BAAS;AAST,QAAA,IAAI,GAAG,CAAC,6BAAa,EAAE,qBAAS,EAAE,mCAAgB,EAAE,qBAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"apis.js","sourceRoot":"","sources":["../../api/apis.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,2DAA0D;AAC1D,kDAAgC;AAChC,iDAAgD;AAChD,8CAA4B;AAC5B,yCAAwC;AACxC,qDAAmC;AACnC,uDAAsD;AACtD,8CAA4B;AAC5B,yCAAwC;AAGxC;IAA+B,6BAAK;IAChC,mBAAoB,QAA8B,EAAS,IAAS,EAAS,UAAmB;QAAhG,YACI,kBAAM,qBAAqB,CAAC,SAE/B;QAHmB,cAAQ,GAAR,QAAQ,CAAsB;QAAS,UAAI,GAAJ,IAAI,CAAK;QAAS,gBAAU,GAAV,UAAU,CAAS;QAE5F,KAAI,CAAC,IAAI,GAAG,WAAW,CAAC;;IAC5B,CAAC;IACL,gBAAC;AAAD,CAAC,AALD,CAA+B,KAAK,GAKnC;AALY,8BAAS;AAST,QAAA,IAAI,GAAG,CAAC,uCAAkB,EAAE,6BAAa,EAAE,qBAAS,EAAE,mCAAgB,EAAE,qBAAS,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ /// <reference types="node" />
2
+ import http from 'http';
3
+ import { Authentication, Interceptor } from '../model/models';
4
+ export declare enum AutomatedOffersApiApiKeys {
5
+ }
6
+ export declare class AutomatedOffersApi {
7
+ protected _basePath: string;
8
+ protected _defaultHeaders: any;
9
+ protected _useQuerystring: boolean;
10
+ protected authentications: {
11
+ default: Authentication;
12
+ };
13
+ protected interceptors: Interceptor[];
14
+ constructor(basePath?: string);
15
+ set useQuerystring(value: boolean);
16
+ set basePath(basePath: string);
17
+ set defaultHeaders(defaultHeaders: any);
18
+ get defaultHeaders(): any;
19
+ get basePath(): string;
20
+ setDefaultAuthentication(auth: Authentication): void;
21
+ setApiKey(key: AutomatedOffersApiApiKeys, value: string): void;
22
+ addInterceptor(interceptor: Interceptor): void;
23
+ automatedOffersControllerCreate(account: string, body: object, options?: {
24
+ headers: {
25
+ [name: string]: string;
26
+ };
27
+ }): Promise<{
28
+ response: http.IncomingMessage;
29
+ body?: any;
30
+ }>;
31
+ automatedOffersControllerFindall(account: string, body: object, skip?: number, limit?: number, sort?: string, options?: {
32
+ headers: {
33
+ [name: string]: string;
34
+ };
35
+ }): Promise<{
36
+ response: http.IncomingMessage;
37
+ body?: any;
38
+ }>;
39
+ automatedOffersControllerFindone(id: string, account: string, options?: {
40
+ headers: {
41
+ [name: string]: string;
42
+ };
43
+ }): Promise<{
44
+ response: http.IncomingMessage;
45
+ body?: any;
46
+ }>;
47
+ automatedOffersControllerRemove(id: string, account: string, options?: {
48
+ headers: {
49
+ [name: string]: string;
50
+ };
51
+ }): Promise<{
52
+ response: http.IncomingMessage;
53
+ body?: any;
54
+ }>;
55
+ automatedOffersControllerUpdate(id: string, account: string, body: object, options?: {
56
+ headers: {
57
+ [name: string]: string;
58
+ };
59
+ }): Promise<{
60
+ response: http.IncomingMessage;
61
+ body?: any;
62
+ }>;
63
+ }
@@ -0,0 +1,452 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.AutomatedOffersApi = exports.AutomatedOffersApiApiKeys = void 0;
43
+ var request_1 = __importDefault(require("request"));
44
+ var models_1 = require("../model/models");
45
+ var apis_1 = require("./apis");
46
+ var defaultBasePath = 'http://localhost';
47
+ var AutomatedOffersApiApiKeys;
48
+ (function (AutomatedOffersApiApiKeys) {
49
+ })(AutomatedOffersApiApiKeys = exports.AutomatedOffersApiApiKeys || (exports.AutomatedOffersApiApiKeys = {}));
50
+ var AutomatedOffersApi = (function () {
51
+ function AutomatedOffersApi(basePathOrUsername, password, basePath) {
52
+ this._basePath = defaultBasePath;
53
+ this._defaultHeaders = {};
54
+ this._useQuerystring = false;
55
+ this.authentications = {
56
+ 'default': new models_1.VoidAuth(),
57
+ };
58
+ this.interceptors = [];
59
+ if (password) {
60
+ if (basePath) {
61
+ this.basePath = basePath;
62
+ }
63
+ }
64
+ else {
65
+ if (basePathOrUsername) {
66
+ this.basePath = basePathOrUsername;
67
+ }
68
+ }
69
+ }
70
+ Object.defineProperty(AutomatedOffersApi.prototype, "useQuerystring", {
71
+ set: function (value) {
72
+ this._useQuerystring = value;
73
+ },
74
+ enumerable: false,
75
+ configurable: true
76
+ });
77
+ Object.defineProperty(AutomatedOffersApi.prototype, "basePath", {
78
+ get: function () {
79
+ return this._basePath;
80
+ },
81
+ set: function (basePath) {
82
+ this._basePath = basePath;
83
+ },
84
+ enumerable: false,
85
+ configurable: true
86
+ });
87
+ Object.defineProperty(AutomatedOffersApi.prototype, "defaultHeaders", {
88
+ get: function () {
89
+ return this._defaultHeaders;
90
+ },
91
+ set: function (defaultHeaders) {
92
+ this._defaultHeaders = defaultHeaders;
93
+ },
94
+ enumerable: false,
95
+ configurable: true
96
+ });
97
+ AutomatedOffersApi.prototype.setDefaultAuthentication = function (auth) {
98
+ this.authentications.default = auth;
99
+ };
100
+ AutomatedOffersApi.prototype.setApiKey = function (key, value) {
101
+ this.authentications[AutomatedOffersApiApiKeys[key]].apiKey = value;
102
+ };
103
+ AutomatedOffersApi.prototype.addInterceptor = function (interceptor) {
104
+ this.interceptors.push(interceptor);
105
+ };
106
+ AutomatedOffersApi.prototype.automatedOffersControllerCreate = function (account, body, options) {
107
+ if (options === void 0) { options = { headers: {} }; }
108
+ return __awaiter(this, void 0, void 0, function () {
109
+ var localVarPath, localVarQueryParameters, localVarHeaderParams, localVarFormParams, localVarUseFormData, localVarRequestOptions, authenticationPromise, interceptorPromise, _loop_1, _i, _a, interceptor;
110
+ var _this = this;
111
+ return __generator(this, function (_b) {
112
+ localVarPath = this.basePath + '/automated-offers/{account}'
113
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
114
+ localVarQueryParameters = {};
115
+ localVarHeaderParams = Object.assign({}, this._defaultHeaders);
116
+ localVarFormParams = {};
117
+ if (account === null || account === undefined) {
118
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerCreate.');
119
+ }
120
+ if (body === null || body === undefined) {
121
+ throw new Error('Required parameter body was null or undefined when calling automatedOffersControllerCreate.');
122
+ }
123
+ Object.assign(localVarHeaderParams, options.headers);
124
+ localVarUseFormData = false;
125
+ localVarRequestOptions = {
126
+ method: 'POST',
127
+ qs: localVarQueryParameters,
128
+ headers: localVarHeaderParams,
129
+ uri: localVarPath,
130
+ useQuerystring: this._useQuerystring,
131
+ json: true,
132
+ body: models_1.ObjectSerializer.serialize(body, "object")
133
+ };
134
+ authenticationPromise = Promise.resolve();
135
+ authenticationPromise = authenticationPromise.then(function () { return _this.authentications.default.applyToRequest(localVarRequestOptions); });
136
+ interceptorPromise = authenticationPromise;
137
+ _loop_1 = function (interceptor) {
138
+ interceptorPromise = interceptorPromise.then(function () { return interceptor(localVarRequestOptions); });
139
+ };
140
+ for (_i = 0, _a = this.interceptors; _i < _a.length; _i++) {
141
+ interceptor = _a[_i];
142
+ _loop_1(interceptor);
143
+ }
144
+ return [2, interceptorPromise.then(function () {
145
+ if (Object.keys(localVarFormParams).length) {
146
+ if (localVarUseFormData) {
147
+ localVarRequestOptions.formData = localVarFormParams;
148
+ }
149
+ else {
150
+ localVarRequestOptions.form = localVarFormParams;
151
+ }
152
+ }
153
+ return new Promise(function (resolve, reject) {
154
+ (0, request_1.default)(localVarRequestOptions, function (error, response, body) {
155
+ if (error) {
156
+ reject(error);
157
+ }
158
+ else {
159
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
160
+ resolve({ response: response, body: body });
161
+ }
162
+ else {
163
+ reject(new apis_1.HttpError(response, body, response.statusCode));
164
+ }
165
+ }
166
+ });
167
+ });
168
+ })];
169
+ });
170
+ });
171
+ };
172
+ AutomatedOffersApi.prototype.automatedOffersControllerFindall = function (account, body, skip, limit, sort, options) {
173
+ if (options === void 0) { options = { headers: {} }; }
174
+ return __awaiter(this, void 0, void 0, function () {
175
+ var localVarPath, localVarQueryParameters, localVarHeaderParams, localVarFormParams, localVarUseFormData, localVarRequestOptions, authenticationPromise, interceptorPromise, _loop_2, _i, _a, interceptor;
176
+ var _this = this;
177
+ return __generator(this, function (_b) {
178
+ localVarPath = this.basePath + '/automated-offers/{account}'
179
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
180
+ localVarQueryParameters = {};
181
+ localVarHeaderParams = Object.assign({}, this._defaultHeaders);
182
+ localVarFormParams = {};
183
+ if (account === null || account === undefined) {
184
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerFindall.');
185
+ }
186
+ if (body === null || body === undefined) {
187
+ throw new Error('Required parameter body was null or undefined when calling automatedOffersControllerFindall.');
188
+ }
189
+ if (skip !== undefined) {
190
+ localVarQueryParameters['skip'] = models_1.ObjectSerializer.serialize(skip, "number");
191
+ }
192
+ if (limit !== undefined) {
193
+ localVarQueryParameters['limit'] = models_1.ObjectSerializer.serialize(limit, "number");
194
+ }
195
+ if (sort !== undefined) {
196
+ localVarQueryParameters['sort'] = models_1.ObjectSerializer.serialize(sort, "string");
197
+ }
198
+ Object.assign(localVarHeaderParams, options.headers);
199
+ localVarUseFormData = false;
200
+ localVarRequestOptions = {
201
+ method: 'GET',
202
+ qs: localVarQueryParameters,
203
+ headers: localVarHeaderParams,
204
+ uri: localVarPath,
205
+ useQuerystring: this._useQuerystring,
206
+ json: true,
207
+ body: models_1.ObjectSerializer.serialize(body, "object")
208
+ };
209
+ authenticationPromise = Promise.resolve();
210
+ authenticationPromise = authenticationPromise.then(function () { return _this.authentications.default.applyToRequest(localVarRequestOptions); });
211
+ interceptorPromise = authenticationPromise;
212
+ _loop_2 = function (interceptor) {
213
+ interceptorPromise = interceptorPromise.then(function () { return interceptor(localVarRequestOptions); });
214
+ };
215
+ for (_i = 0, _a = this.interceptors; _i < _a.length; _i++) {
216
+ interceptor = _a[_i];
217
+ _loop_2(interceptor);
218
+ }
219
+ return [2, interceptorPromise.then(function () {
220
+ if (Object.keys(localVarFormParams).length) {
221
+ if (localVarUseFormData) {
222
+ localVarRequestOptions.formData = localVarFormParams;
223
+ }
224
+ else {
225
+ localVarRequestOptions.form = localVarFormParams;
226
+ }
227
+ }
228
+ return new Promise(function (resolve, reject) {
229
+ (0, request_1.default)(localVarRequestOptions, function (error, response, body) {
230
+ if (error) {
231
+ reject(error);
232
+ }
233
+ else {
234
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
235
+ resolve({ response: response, body: body });
236
+ }
237
+ else {
238
+ reject(new apis_1.HttpError(response, body, response.statusCode));
239
+ }
240
+ }
241
+ });
242
+ });
243
+ })];
244
+ });
245
+ });
246
+ };
247
+ AutomatedOffersApi.prototype.automatedOffersControllerFindone = function (id, account, options) {
248
+ if (options === void 0) { options = { headers: {} }; }
249
+ return __awaiter(this, void 0, void 0, function () {
250
+ var localVarPath, localVarQueryParameters, localVarHeaderParams, localVarFormParams, localVarUseFormData, localVarRequestOptions, authenticationPromise, interceptorPromise, _loop_3, _i, _a, interceptor;
251
+ var _this = this;
252
+ return __generator(this, function (_b) {
253
+ localVarPath = this.basePath + '/automated-offers/{account}/{id}'
254
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
255
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
256
+ localVarQueryParameters = {};
257
+ localVarHeaderParams = Object.assign({}, this._defaultHeaders);
258
+ localVarFormParams = {};
259
+ if (id === null || id === undefined) {
260
+ throw new Error('Required parameter id was null or undefined when calling automatedOffersControllerFindone.');
261
+ }
262
+ if (account === null || account === undefined) {
263
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerFindone.');
264
+ }
265
+ Object.assign(localVarHeaderParams, options.headers);
266
+ localVarUseFormData = false;
267
+ localVarRequestOptions = {
268
+ method: 'GET',
269
+ qs: localVarQueryParameters,
270
+ headers: localVarHeaderParams,
271
+ uri: localVarPath,
272
+ useQuerystring: this._useQuerystring,
273
+ json: true,
274
+ };
275
+ authenticationPromise = Promise.resolve();
276
+ authenticationPromise = authenticationPromise.then(function () { return _this.authentications.default.applyToRequest(localVarRequestOptions); });
277
+ interceptorPromise = authenticationPromise;
278
+ _loop_3 = function (interceptor) {
279
+ interceptorPromise = interceptorPromise.then(function () { return interceptor(localVarRequestOptions); });
280
+ };
281
+ for (_i = 0, _a = this.interceptors; _i < _a.length; _i++) {
282
+ interceptor = _a[_i];
283
+ _loop_3(interceptor);
284
+ }
285
+ return [2, interceptorPromise.then(function () {
286
+ if (Object.keys(localVarFormParams).length) {
287
+ if (localVarUseFormData) {
288
+ localVarRequestOptions.formData = localVarFormParams;
289
+ }
290
+ else {
291
+ localVarRequestOptions.form = localVarFormParams;
292
+ }
293
+ }
294
+ return new Promise(function (resolve, reject) {
295
+ (0, request_1.default)(localVarRequestOptions, function (error, response, body) {
296
+ if (error) {
297
+ reject(error);
298
+ }
299
+ else {
300
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
301
+ resolve({ response: response, body: body });
302
+ }
303
+ else {
304
+ reject(new apis_1.HttpError(response, body, response.statusCode));
305
+ }
306
+ }
307
+ });
308
+ });
309
+ })];
310
+ });
311
+ });
312
+ };
313
+ AutomatedOffersApi.prototype.automatedOffersControllerRemove = function (id, account, options) {
314
+ if (options === void 0) { options = { headers: {} }; }
315
+ return __awaiter(this, void 0, void 0, function () {
316
+ var localVarPath, localVarQueryParameters, localVarHeaderParams, localVarFormParams, localVarUseFormData, localVarRequestOptions, authenticationPromise, interceptorPromise, _loop_4, _i, _a, interceptor;
317
+ var _this = this;
318
+ return __generator(this, function (_b) {
319
+ localVarPath = this.basePath + '/automated-offers/{account}/{id}'
320
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
321
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
322
+ localVarQueryParameters = {};
323
+ localVarHeaderParams = Object.assign({}, this._defaultHeaders);
324
+ localVarFormParams = {};
325
+ if (id === null || id === undefined) {
326
+ throw new Error('Required parameter id was null or undefined when calling automatedOffersControllerRemove.');
327
+ }
328
+ if (account === null || account === undefined) {
329
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerRemove.');
330
+ }
331
+ Object.assign(localVarHeaderParams, options.headers);
332
+ localVarUseFormData = false;
333
+ localVarRequestOptions = {
334
+ method: 'DELETE',
335
+ qs: localVarQueryParameters,
336
+ headers: localVarHeaderParams,
337
+ uri: localVarPath,
338
+ useQuerystring: this._useQuerystring,
339
+ json: true,
340
+ };
341
+ authenticationPromise = Promise.resolve();
342
+ authenticationPromise = authenticationPromise.then(function () { return _this.authentications.default.applyToRequest(localVarRequestOptions); });
343
+ interceptorPromise = authenticationPromise;
344
+ _loop_4 = function (interceptor) {
345
+ interceptorPromise = interceptorPromise.then(function () { return interceptor(localVarRequestOptions); });
346
+ };
347
+ for (_i = 0, _a = this.interceptors; _i < _a.length; _i++) {
348
+ interceptor = _a[_i];
349
+ _loop_4(interceptor);
350
+ }
351
+ return [2, interceptorPromise.then(function () {
352
+ if (Object.keys(localVarFormParams).length) {
353
+ if (localVarUseFormData) {
354
+ localVarRequestOptions.formData = localVarFormParams;
355
+ }
356
+ else {
357
+ localVarRequestOptions.form = localVarFormParams;
358
+ }
359
+ }
360
+ return new Promise(function (resolve, reject) {
361
+ (0, request_1.default)(localVarRequestOptions, function (error, response, body) {
362
+ if (error) {
363
+ reject(error);
364
+ }
365
+ else {
366
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
367
+ resolve({ response: response, body: body });
368
+ }
369
+ else {
370
+ reject(new apis_1.HttpError(response, body, response.statusCode));
371
+ }
372
+ }
373
+ });
374
+ });
375
+ })];
376
+ });
377
+ });
378
+ };
379
+ AutomatedOffersApi.prototype.automatedOffersControllerUpdate = function (id, account, body, options) {
380
+ if (options === void 0) { options = { headers: {} }; }
381
+ return __awaiter(this, void 0, void 0, function () {
382
+ var localVarPath, localVarQueryParameters, localVarHeaderParams, localVarFormParams, localVarUseFormData, localVarRequestOptions, authenticationPromise, interceptorPromise, _loop_5, _i, _a, interceptor;
383
+ var _this = this;
384
+ return __generator(this, function (_b) {
385
+ localVarPath = this.basePath + '/automated-offers/{account}/{id}'
386
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
387
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
388
+ localVarQueryParameters = {};
389
+ localVarHeaderParams = Object.assign({}, this._defaultHeaders);
390
+ localVarFormParams = {};
391
+ if (id === null || id === undefined) {
392
+ throw new Error('Required parameter id was null or undefined when calling automatedOffersControllerUpdate.');
393
+ }
394
+ if (account === null || account === undefined) {
395
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerUpdate.');
396
+ }
397
+ if (body === null || body === undefined) {
398
+ throw new Error('Required parameter body was null or undefined when calling automatedOffersControllerUpdate.');
399
+ }
400
+ Object.assign(localVarHeaderParams, options.headers);
401
+ localVarUseFormData = false;
402
+ localVarRequestOptions = {
403
+ method: 'PUT',
404
+ qs: localVarQueryParameters,
405
+ headers: localVarHeaderParams,
406
+ uri: localVarPath,
407
+ useQuerystring: this._useQuerystring,
408
+ json: true,
409
+ body: models_1.ObjectSerializer.serialize(body, "object")
410
+ };
411
+ authenticationPromise = Promise.resolve();
412
+ authenticationPromise = authenticationPromise.then(function () { return _this.authentications.default.applyToRequest(localVarRequestOptions); });
413
+ interceptorPromise = authenticationPromise;
414
+ _loop_5 = function (interceptor) {
415
+ interceptorPromise = interceptorPromise.then(function () { return interceptor(localVarRequestOptions); });
416
+ };
417
+ for (_i = 0, _a = this.interceptors; _i < _a.length; _i++) {
418
+ interceptor = _a[_i];
419
+ _loop_5(interceptor);
420
+ }
421
+ return [2, interceptorPromise.then(function () {
422
+ if (Object.keys(localVarFormParams).length) {
423
+ if (localVarUseFormData) {
424
+ localVarRequestOptions.formData = localVarFormParams;
425
+ }
426
+ else {
427
+ localVarRequestOptions.form = localVarFormParams;
428
+ }
429
+ }
430
+ return new Promise(function (resolve, reject) {
431
+ (0, request_1.default)(localVarRequestOptions, function (error, response, body) {
432
+ if (error) {
433
+ reject(error);
434
+ }
435
+ else {
436
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
437
+ resolve({ response: response, body: body });
438
+ }
439
+ else {
440
+ reject(new apis_1.HttpError(response, body, response.statusCode));
441
+ }
442
+ }
443
+ });
444
+ });
445
+ })];
446
+ });
447
+ });
448
+ };
449
+ return AutomatedOffersApi;
450
+ }());
451
+ exports.AutomatedOffersApi = AutomatedOffersApi;
452
+ //# sourceMappingURL=automatedOffersApi.js.map