@tradecafe/offer-service-sdk 0.0.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.
@@ -0,0 +1,1440 @@
1
+ /**
2
+ * TradeCafé Offer Service
3
+ * Offer Service allows supplies to submit product offers into the TradeCafe platform
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+
14
+ import localVarRequest from 'request';
15
+ import http from 'http';
16
+
17
+ /* tslint:disable:no-unused-locals */
18
+
19
+ import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
20
+
21
+ import { HttpError, RequestFile } from './apis';
22
+
23
+ let defaultBasePath = 'http://localhost';
24
+
25
+ // ===============================================
26
+ // This file is autogenerated - Please do not edit
27
+ // ===============================================
28
+
29
+ export enum OffersApiApiKeys {
30
+ }
31
+
32
+ export class OffersApi {
33
+ protected _basePath = defaultBasePath;
34
+ protected _defaultHeaders : any = {};
35
+ protected _useQuerystring : boolean = false;
36
+
37
+ protected authentications = {
38
+ 'default': <Authentication>new VoidAuth(),
39
+ }
40
+
41
+ protected interceptors: Interceptor[] = [];
42
+
43
+ constructor(basePath?: string);
44
+ constructor(basePathOrUsername: string, password?: string, basePath?: string) {
45
+ if (password) {
46
+ if (basePath) {
47
+ this.basePath = basePath;
48
+ }
49
+ } else {
50
+ if (basePathOrUsername) {
51
+ this.basePath = basePathOrUsername
52
+ }
53
+ }
54
+ }
55
+
56
+ set useQuerystring(value: boolean) {
57
+ this._useQuerystring = value;
58
+ }
59
+
60
+ set basePath(basePath: string) {
61
+ this._basePath = basePath;
62
+ }
63
+
64
+ set defaultHeaders(defaultHeaders: any) {
65
+ this._defaultHeaders = defaultHeaders;
66
+ }
67
+
68
+ get defaultHeaders() {
69
+ return this._defaultHeaders;
70
+ }
71
+
72
+ get basePath() {
73
+ return this._basePath;
74
+ }
75
+
76
+ public setDefaultAuthentication(auth: Authentication) {
77
+ this.authentications.default = auth;
78
+ }
79
+
80
+ public setApiKey(key: OffersApiApiKeys, value: string) {
81
+ (this.authentications as any)[OffersApiApiKeys[key]].apiKey = value;
82
+ }
83
+
84
+ public addInterceptor(interceptor: Interceptor) {
85
+ this.interceptors.push(interceptor);
86
+ }
87
+
88
+ /**
89
+ *
90
+ * @summary Adds note to the offer with the provided ID
91
+ * @param id
92
+ * @param account
93
+ * @param body
94
+ */
95
+ public async offersControllerAddnote (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
96
+ const localVarPath = this.basePath + '/offers/{account}/{id}/notes'
97
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
98
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
99
+ let localVarQueryParameters: any = {};
100
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
101
+ let localVarFormParams: any = {};
102
+
103
+ // verify required parameter 'id' is not null or undefined
104
+ if (id === null || id === undefined) {
105
+ throw new Error('Required parameter id was null or undefined when calling offersControllerAddnote.');
106
+ }
107
+
108
+ // verify required parameter 'account' is not null or undefined
109
+ if (account === null || account === undefined) {
110
+ throw new Error('Required parameter account was null or undefined when calling offersControllerAddnote.');
111
+ }
112
+
113
+ // verify required parameter 'body' is not null or undefined
114
+ if (body === null || body === undefined) {
115
+ throw new Error('Required parameter body was null or undefined when calling offersControllerAddnote.');
116
+ }
117
+
118
+ (<any>Object).assign(localVarHeaderParams, options.headers);
119
+
120
+ let localVarUseFormData = false;
121
+
122
+ let localVarRequestOptions: localVarRequest.Options = {
123
+ method: 'POST',
124
+ qs: localVarQueryParameters,
125
+ headers: localVarHeaderParams,
126
+ uri: localVarPath,
127
+ useQuerystring: this._useQuerystring,
128
+ json: true,
129
+ body: ObjectSerializer.serialize(body, "object")
130
+ };
131
+
132
+ let authenticationPromise = Promise.resolve();
133
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
134
+
135
+ let interceptorPromise = authenticationPromise;
136
+ for (const interceptor of this.interceptors) {
137
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
138
+ }
139
+
140
+ return interceptorPromise.then(() => {
141
+ if (Object.keys(localVarFormParams).length) {
142
+ if (localVarUseFormData) {
143
+ (<any>localVarRequestOptions).formData = localVarFormParams;
144
+ } else {
145
+ localVarRequestOptions.form = localVarFormParams;
146
+ }
147
+ }
148
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
149
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
150
+ if (error) {
151
+ reject(error);
152
+ } else {
153
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
154
+ resolve({ response: response, body: body });
155
+ } else {
156
+ reject(new HttpError(response, body, response.statusCode));
157
+ }
158
+ }
159
+ });
160
+ });
161
+ });
162
+ }
163
+ /**
164
+ *
165
+ * @summary Attach clones to the offer
166
+ * @param id
167
+ * @param account
168
+ * @param body
169
+ */
170
+ public async offersControllerAttachclones (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
171
+ const localVarPath = this.basePath + '/offers/{account}/{id}/clones/add'
172
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
173
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
174
+ let localVarQueryParameters: any = {};
175
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
176
+ let localVarFormParams: any = {};
177
+
178
+ // verify required parameter 'id' is not null or undefined
179
+ if (id === null || id === undefined) {
180
+ throw new Error('Required parameter id was null or undefined when calling offersControllerAttachclones.');
181
+ }
182
+
183
+ // verify required parameter 'account' is not null or undefined
184
+ if (account === null || account === undefined) {
185
+ throw new Error('Required parameter account was null or undefined when calling offersControllerAttachclones.');
186
+ }
187
+
188
+ // verify required parameter 'body' is not null or undefined
189
+ if (body === null || body === undefined) {
190
+ throw new Error('Required parameter body was null or undefined when calling offersControllerAttachclones.');
191
+ }
192
+
193
+ (<any>Object).assign(localVarHeaderParams, options.headers);
194
+
195
+ let localVarUseFormData = false;
196
+
197
+ let localVarRequestOptions: localVarRequest.Options = {
198
+ method: 'PUT',
199
+ qs: localVarQueryParameters,
200
+ headers: localVarHeaderParams,
201
+ uri: localVarPath,
202
+ useQuerystring: this._useQuerystring,
203
+ json: true,
204
+ body: ObjectSerializer.serialize(body, "object")
205
+ };
206
+
207
+ let authenticationPromise = Promise.resolve();
208
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
209
+
210
+ let interceptorPromise = authenticationPromise;
211
+ for (const interceptor of this.interceptors) {
212
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
213
+ }
214
+
215
+ return interceptorPromise.then(() => {
216
+ if (Object.keys(localVarFormParams).length) {
217
+ if (localVarUseFormData) {
218
+ (<any>localVarRequestOptions).formData = localVarFormParams;
219
+ } else {
220
+ localVarRequestOptions.form = localVarFormParams;
221
+ }
222
+ }
223
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
224
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
225
+ if (error) {
226
+ reject(error);
227
+ } else {
228
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
229
+ resolve({ response: response, body: body });
230
+ } else {
231
+ reject(new HttpError(response, body, response.statusCode));
232
+ }
233
+ }
234
+ });
235
+ });
236
+ });
237
+ }
238
+ /**
239
+ *
240
+ * @summary Attach matched offers to the offer
241
+ * @param id
242
+ * @param account
243
+ * @param body
244
+ */
245
+ public async offersControllerAttachmatchedoffers (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
246
+ const localVarPath = this.basePath + '/offers/{account}/{id}/matched-offers/add'
247
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
248
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
249
+ let localVarQueryParameters: any = {};
250
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
251
+ let localVarFormParams: any = {};
252
+
253
+ // verify required parameter 'id' is not null or undefined
254
+ if (id === null || id === undefined) {
255
+ throw new Error('Required parameter id was null or undefined when calling offersControllerAttachmatchedoffers.');
256
+ }
257
+
258
+ // verify required parameter 'account' is not null or undefined
259
+ if (account === null || account === undefined) {
260
+ throw new Error('Required parameter account was null or undefined when calling offersControllerAttachmatchedoffers.');
261
+ }
262
+
263
+ // verify required parameter 'body' is not null or undefined
264
+ if (body === null || body === undefined) {
265
+ throw new Error('Required parameter body was null or undefined when calling offersControllerAttachmatchedoffers.');
266
+ }
267
+
268
+ (<any>Object).assign(localVarHeaderParams, options.headers);
269
+
270
+ let localVarUseFormData = false;
271
+
272
+ let localVarRequestOptions: localVarRequest.Options = {
273
+ method: 'PUT',
274
+ qs: localVarQueryParameters,
275
+ headers: localVarHeaderParams,
276
+ uri: localVarPath,
277
+ useQuerystring: this._useQuerystring,
278
+ json: true,
279
+ body: ObjectSerializer.serialize(body, "object")
280
+ };
281
+
282
+ let authenticationPromise = Promise.resolve();
283
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
284
+
285
+ let interceptorPromise = authenticationPromise;
286
+ for (const interceptor of this.interceptors) {
287
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
288
+ }
289
+
290
+ return interceptorPromise.then(() => {
291
+ if (Object.keys(localVarFormParams).length) {
292
+ if (localVarUseFormData) {
293
+ (<any>localVarRequestOptions).formData = localVarFormParams;
294
+ } else {
295
+ localVarRequestOptions.form = localVarFormParams;
296
+ }
297
+ }
298
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
299
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
300
+ if (error) {
301
+ reject(error);
302
+ } else {
303
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
304
+ resolve({ response: response, body: body });
305
+ } else {
306
+ reject(new HttpError(response, body, response.statusCode));
307
+ }
308
+ }
309
+ });
310
+ });
311
+ });
312
+ }
313
+ /**
314
+ *
315
+ * @summary Cancel the offer with the provided ID
316
+ * @param account
317
+ * @param body
318
+ */
319
+ public async offersControllerCancel (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
320
+ const localVarPath = this.basePath + '/offers/{account}/cancel'
321
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
322
+ let localVarQueryParameters: any = {};
323
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
324
+ let localVarFormParams: any = {};
325
+
326
+ // verify required parameter 'account' is not null or undefined
327
+ if (account === null || account === undefined) {
328
+ throw new Error('Required parameter account was null or undefined when calling offersControllerCancel.');
329
+ }
330
+
331
+ // verify required parameter 'body' is not null or undefined
332
+ if (body === null || body === undefined) {
333
+ throw new Error('Required parameter body was null or undefined when calling offersControllerCancel.');
334
+ }
335
+
336
+ (<any>Object).assign(localVarHeaderParams, options.headers);
337
+
338
+ let localVarUseFormData = false;
339
+
340
+ let localVarRequestOptions: localVarRequest.Options = {
341
+ method: 'GET',
342
+ qs: localVarQueryParameters,
343
+ headers: localVarHeaderParams,
344
+ uri: localVarPath,
345
+ useQuerystring: this._useQuerystring,
346
+ json: true,
347
+ body: ObjectSerializer.serialize(body, "object")
348
+ };
349
+
350
+ let authenticationPromise = Promise.resolve();
351
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
352
+
353
+ let interceptorPromise = authenticationPromise;
354
+ for (const interceptor of this.interceptors) {
355
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
356
+ }
357
+
358
+ return interceptorPromise.then(() => {
359
+ if (Object.keys(localVarFormParams).length) {
360
+ if (localVarUseFormData) {
361
+ (<any>localVarRequestOptions).formData = localVarFormParams;
362
+ } else {
363
+ localVarRequestOptions.form = localVarFormParams;
364
+ }
365
+ }
366
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
367
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
368
+ if (error) {
369
+ reject(error);
370
+ } else {
371
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
372
+ resolve({ response: response, body: body });
373
+ } else {
374
+ reject(new HttpError(response, body, response.statusCode));
375
+ }
376
+ }
377
+ });
378
+ });
379
+ });
380
+ }
381
+ /**
382
+ *
383
+ * @summary Creates a new offer
384
+ * @param account
385
+ * @param body
386
+ */
387
+ public async offersControllerCreate (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
388
+ const localVarPath = this.basePath + '/offers/{account}'
389
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
390
+ let localVarQueryParameters: any = {};
391
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
392
+ let localVarFormParams: any = {};
393
+
394
+ // verify required parameter 'account' is not null or undefined
395
+ if (account === null || account === undefined) {
396
+ throw new Error('Required parameter account was null or undefined when calling offersControllerCreate.');
397
+ }
398
+
399
+ // verify required parameter 'body' is not null or undefined
400
+ if (body === null || body === undefined) {
401
+ throw new Error('Required parameter body was null or undefined when calling offersControllerCreate.');
402
+ }
403
+
404
+ (<any>Object).assign(localVarHeaderParams, options.headers);
405
+
406
+ let localVarUseFormData = false;
407
+
408
+ let localVarRequestOptions: localVarRequest.Options = {
409
+ method: 'POST',
410
+ qs: localVarQueryParameters,
411
+ headers: localVarHeaderParams,
412
+ uri: localVarPath,
413
+ useQuerystring: this._useQuerystring,
414
+ json: true,
415
+ body: ObjectSerializer.serialize(body, "object")
416
+ };
417
+
418
+ let authenticationPromise = Promise.resolve();
419
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
420
+
421
+ let interceptorPromise = authenticationPromise;
422
+ for (const interceptor of this.interceptors) {
423
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
424
+ }
425
+
426
+ return interceptorPromise.then(() => {
427
+ if (Object.keys(localVarFormParams).length) {
428
+ if (localVarUseFormData) {
429
+ (<any>localVarRequestOptions).formData = localVarFormParams;
430
+ } else {
431
+ localVarRequestOptions.form = localVarFormParams;
432
+ }
433
+ }
434
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
435
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
436
+ if (error) {
437
+ reject(error);
438
+ } else {
439
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
440
+ resolve({ response: response, body: body });
441
+ } else {
442
+ reject(new HttpError(response, body, response.statusCode));
443
+ }
444
+ }
445
+ });
446
+ });
447
+ });
448
+ }
449
+ /**
450
+ *
451
+ * @summary Delete offers with the provided IDs
452
+ * @param account
453
+ * @param body
454
+ */
455
+ public async offersControllerDeletebatch (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
456
+ const localVarPath = this.basePath + '/offers/{account}'
457
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
458
+ let localVarQueryParameters: any = {};
459
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
460
+ let localVarFormParams: any = {};
461
+
462
+ // verify required parameter 'account' is not null or undefined
463
+ if (account === null || account === undefined) {
464
+ throw new Error('Required parameter account was null or undefined when calling offersControllerDeletebatch.');
465
+ }
466
+
467
+ // verify required parameter 'body' is not null or undefined
468
+ if (body === null || body === undefined) {
469
+ throw new Error('Required parameter body was null or undefined when calling offersControllerDeletebatch.');
470
+ }
471
+
472
+ (<any>Object).assign(localVarHeaderParams, options.headers);
473
+
474
+ let localVarUseFormData = false;
475
+
476
+ let localVarRequestOptions: localVarRequest.Options = {
477
+ method: 'DELETE',
478
+ qs: localVarQueryParameters,
479
+ headers: localVarHeaderParams,
480
+ uri: localVarPath,
481
+ useQuerystring: this._useQuerystring,
482
+ json: true,
483
+ body: ObjectSerializer.serialize(body, "object")
484
+ };
485
+
486
+ let authenticationPromise = Promise.resolve();
487
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
488
+
489
+ let interceptorPromise = authenticationPromise;
490
+ for (const interceptor of this.interceptors) {
491
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
492
+ }
493
+
494
+ return interceptorPromise.then(() => {
495
+ if (Object.keys(localVarFormParams).length) {
496
+ if (localVarUseFormData) {
497
+ (<any>localVarRequestOptions).formData = localVarFormParams;
498
+ } else {
499
+ localVarRequestOptions.form = localVarFormParams;
500
+ }
501
+ }
502
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
503
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
504
+ if (error) {
505
+ reject(error);
506
+ } else {
507
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
508
+ resolve({ response: response, body: body });
509
+ } else {
510
+ reject(new HttpError(response, body, response.statusCode));
511
+ }
512
+ }
513
+ });
514
+ });
515
+ });
516
+ }
517
+ /**
518
+ *
519
+ * @summary Retrieves a list of all offers by search criteria
520
+ * @param account
521
+ * @param skip
522
+ * @param limit
523
+ * @param sort
524
+ * @param body
525
+ */
526
+ public async offersControllerFilter (account: string, skip?: number, limit?: number, sort?: string, body?: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
527
+ const localVarPath = this.basePath + '/offers/{account}/search'
528
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
529
+ let localVarQueryParameters: any = {};
530
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
531
+ let localVarFormParams: any = {};
532
+
533
+ // verify required parameter 'account' is not null or undefined
534
+ if (account === null || account === undefined) {
535
+ throw new Error('Required parameter account was null or undefined when calling offersControllerFilter.');
536
+ }
537
+
538
+ if (skip !== undefined) {
539
+ localVarQueryParameters['skip'] = ObjectSerializer.serialize(skip, "number");
540
+ }
541
+
542
+ if (limit !== undefined) {
543
+ localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
544
+ }
545
+
546
+ if (sort !== undefined) {
547
+ localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "string");
548
+ }
549
+
550
+ (<any>Object).assign(localVarHeaderParams, options.headers);
551
+
552
+ let localVarUseFormData = false;
553
+
554
+ let localVarRequestOptions: localVarRequest.Options = {
555
+ method: 'POST',
556
+ qs: localVarQueryParameters,
557
+ headers: localVarHeaderParams,
558
+ uri: localVarPath,
559
+ useQuerystring: this._useQuerystring,
560
+ json: true,
561
+ body: ObjectSerializer.serialize(body, "object")
562
+ };
563
+
564
+ let authenticationPromise = Promise.resolve();
565
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
566
+
567
+ let interceptorPromise = authenticationPromise;
568
+ for (const interceptor of this.interceptors) {
569
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
570
+ }
571
+
572
+ return interceptorPromise.then(() => {
573
+ if (Object.keys(localVarFormParams).length) {
574
+ if (localVarUseFormData) {
575
+ (<any>localVarRequestOptions).formData = localVarFormParams;
576
+ } else {
577
+ localVarRequestOptions.form = localVarFormParams;
578
+ }
579
+ }
580
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
581
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
582
+ if (error) {
583
+ reject(error);
584
+ } else {
585
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
586
+ resolve({ response: response, body: body });
587
+ } else {
588
+ reject(new HttpError(response, body, response.statusCode));
589
+ }
590
+ }
591
+ });
592
+ });
593
+ });
594
+ }
595
+ /**
596
+ *
597
+ * @summary Retrieves a list of all offers
598
+ * @param account
599
+ * @param body
600
+ * @param skip
601
+ * @param limit
602
+ * @param sort
603
+ */
604
+ public async offersControllerFindall (account: string, body: object, skip?: number, limit?: number, sort?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
605
+ const localVarPath = this.basePath + '/offers/{account}'
606
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
607
+ let localVarQueryParameters: any = {};
608
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
609
+ let localVarFormParams: any = {};
610
+
611
+ // verify required parameter 'account' is not null or undefined
612
+ if (account === null || account === undefined) {
613
+ throw new Error('Required parameter account was null or undefined when calling offersControllerFindall.');
614
+ }
615
+
616
+ // verify required parameter 'body' is not null or undefined
617
+ if (body === null || body === undefined) {
618
+ throw new Error('Required parameter body was null or undefined when calling offersControllerFindall.');
619
+ }
620
+
621
+ if (skip !== undefined) {
622
+ localVarQueryParameters['skip'] = ObjectSerializer.serialize(skip, "number");
623
+ }
624
+
625
+ if (limit !== undefined) {
626
+ localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
627
+ }
628
+
629
+ if (sort !== undefined) {
630
+ localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "string");
631
+ }
632
+
633
+ (<any>Object).assign(localVarHeaderParams, options.headers);
634
+
635
+ let localVarUseFormData = false;
636
+
637
+ let localVarRequestOptions: localVarRequest.Options = {
638
+ method: 'GET',
639
+ qs: localVarQueryParameters,
640
+ headers: localVarHeaderParams,
641
+ uri: localVarPath,
642
+ useQuerystring: this._useQuerystring,
643
+ json: true,
644
+ body: ObjectSerializer.serialize(body, "object")
645
+ };
646
+
647
+ let authenticationPromise = Promise.resolve();
648
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
649
+
650
+ let interceptorPromise = authenticationPromise;
651
+ for (const interceptor of this.interceptors) {
652
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
653
+ }
654
+
655
+ return interceptorPromise.then(() => {
656
+ if (Object.keys(localVarFormParams).length) {
657
+ if (localVarUseFormData) {
658
+ (<any>localVarRequestOptions).formData = localVarFormParams;
659
+ } else {
660
+ localVarRequestOptions.form = localVarFormParams;
661
+ }
662
+ }
663
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
664
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
665
+ if (error) {
666
+ reject(error);
667
+ } else {
668
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
669
+ resolve({ response: response, body: body });
670
+ } else {
671
+ reject(new HttpError(response, body, response.statusCode));
672
+ }
673
+ }
674
+ });
675
+ });
676
+ });
677
+ }
678
+ /**
679
+ *
680
+ * @summary Retrieves a unique list of existing counties of offers
681
+ * @param account
682
+ */
683
+ public async offersControllerFindcountries (account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
684
+ const localVarPath = this.basePath + '/offers/{account}/countries'
685
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
686
+ let localVarQueryParameters: any = {};
687
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
688
+ let localVarFormParams: any = {};
689
+
690
+ // verify required parameter 'account' is not null or undefined
691
+ if (account === null || account === undefined) {
692
+ throw new Error('Required parameter account was null or undefined when calling offersControllerFindcountries.');
693
+ }
694
+
695
+ (<any>Object).assign(localVarHeaderParams, options.headers);
696
+
697
+ let localVarUseFormData = false;
698
+
699
+ let localVarRequestOptions: localVarRequest.Options = {
700
+ method: 'GET',
701
+ qs: localVarQueryParameters,
702
+ headers: localVarHeaderParams,
703
+ uri: localVarPath,
704
+ useQuerystring: this._useQuerystring,
705
+ json: true,
706
+ };
707
+
708
+ let authenticationPromise = Promise.resolve();
709
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
710
+
711
+ let interceptorPromise = authenticationPromise;
712
+ for (const interceptor of this.interceptors) {
713
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
714
+ }
715
+
716
+ return interceptorPromise.then(() => {
717
+ if (Object.keys(localVarFormParams).length) {
718
+ if (localVarUseFormData) {
719
+ (<any>localVarRequestOptions).formData = localVarFormParams;
720
+ } else {
721
+ localVarRequestOptions.form = localVarFormParams;
722
+ }
723
+ }
724
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
725
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
726
+ if (error) {
727
+ reject(error);
728
+ } else {
729
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
730
+ resolve({ response: response, body: body });
731
+ } else {
732
+ reject(new HttpError(response, body, response.statusCode));
733
+ }
734
+ }
735
+ });
736
+ });
737
+ });
738
+ }
739
+ /**
740
+ *
741
+ * @summary Retrieves the offer with the provided ID
742
+ * @param id
743
+ * @param account
744
+ */
745
+ public async offersControllerFindone (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
746
+ const localVarPath = this.basePath + '/offers/{account}/{id}'
747
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
748
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
749
+ let localVarQueryParameters: any = {};
750
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
751
+ let localVarFormParams: any = {};
752
+
753
+ // verify required parameter 'id' is not null or undefined
754
+ if (id === null || id === undefined) {
755
+ throw new Error('Required parameter id was null or undefined when calling offersControllerFindone.');
756
+ }
757
+
758
+ // verify required parameter 'account' is not null or undefined
759
+ if (account === null || account === undefined) {
760
+ throw new Error('Required parameter account was null or undefined when calling offersControllerFindone.');
761
+ }
762
+
763
+ (<any>Object).assign(localVarHeaderParams, options.headers);
764
+
765
+ let localVarUseFormData = false;
766
+
767
+ let localVarRequestOptions: localVarRequest.Options = {
768
+ method: 'GET',
769
+ qs: localVarQueryParameters,
770
+ headers: localVarHeaderParams,
771
+ uri: localVarPath,
772
+ useQuerystring: this._useQuerystring,
773
+ json: true,
774
+ };
775
+
776
+ let authenticationPromise = Promise.resolve();
777
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
778
+
779
+ let interceptorPromise = authenticationPromise;
780
+ for (const interceptor of this.interceptors) {
781
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
782
+ }
783
+
784
+ return interceptorPromise.then(() => {
785
+ if (Object.keys(localVarFormParams).length) {
786
+ if (localVarUseFormData) {
787
+ (<any>localVarRequestOptions).formData = localVarFormParams;
788
+ } else {
789
+ localVarRequestOptions.form = localVarFormParams;
790
+ }
791
+ }
792
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
793
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
794
+ if (error) {
795
+ reject(error);
796
+ } else {
797
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
798
+ resolve({ response: response, body: body });
799
+ } else {
800
+ reject(new HttpError(response, body, response.statusCode));
801
+ }
802
+ }
803
+ });
804
+ });
805
+ });
806
+ }
807
+ /**
808
+ *
809
+ * @summary Locks the offer with the provided ID
810
+ * @param id
811
+ * @param account
812
+ */
813
+ public async offersControllerLock (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
814
+ const localVarPath = this.basePath + '/offers/{account}/{id}/lock'
815
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
816
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
817
+ let localVarQueryParameters: any = {};
818
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
819
+ let localVarFormParams: any = {};
820
+
821
+ // verify required parameter 'id' is not null or undefined
822
+ if (id === null || id === undefined) {
823
+ throw new Error('Required parameter id was null or undefined when calling offersControllerLock.');
824
+ }
825
+
826
+ // verify required parameter 'account' is not null or undefined
827
+ if (account === null || account === undefined) {
828
+ throw new Error('Required parameter account was null or undefined when calling offersControllerLock.');
829
+ }
830
+
831
+ (<any>Object).assign(localVarHeaderParams, options.headers);
832
+
833
+ let localVarUseFormData = false;
834
+
835
+ let localVarRequestOptions: localVarRequest.Options = {
836
+ method: 'PUT',
837
+ qs: localVarQueryParameters,
838
+ headers: localVarHeaderParams,
839
+ uri: localVarPath,
840
+ useQuerystring: this._useQuerystring,
841
+ json: true,
842
+ };
843
+
844
+ let authenticationPromise = Promise.resolve();
845
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
846
+
847
+ let interceptorPromise = authenticationPromise;
848
+ for (const interceptor of this.interceptors) {
849
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
850
+ }
851
+
852
+ return interceptorPromise.then(() => {
853
+ if (Object.keys(localVarFormParams).length) {
854
+ if (localVarUseFormData) {
855
+ (<any>localVarRequestOptions).formData = localVarFormParams;
856
+ } else {
857
+ localVarRequestOptions.form = localVarFormParams;
858
+ }
859
+ }
860
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
861
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
862
+ if (error) {
863
+ reject(error);
864
+ } else {
865
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
866
+ resolve({ response: response, body: body });
867
+ } else {
868
+ reject(new HttpError(response, body, response.statusCode));
869
+ }
870
+ }
871
+ });
872
+ });
873
+ });
874
+ }
875
+ /**
876
+ *
877
+ * @summary Reloads the offer with the provided ID
878
+ * @param id
879
+ * @param account
880
+ */
881
+ public async offersControllerReload (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
882
+ const localVarPath = this.basePath + '/offers/{account}/{id}/reload'
883
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
884
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
885
+ let localVarQueryParameters: any = {};
886
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
887
+ let localVarFormParams: any = {};
888
+
889
+ // verify required parameter 'id' is not null or undefined
890
+ if (id === null || id === undefined) {
891
+ throw new Error('Required parameter id was null or undefined when calling offersControllerReload.');
892
+ }
893
+
894
+ // verify required parameter 'account' is not null or undefined
895
+ if (account === null || account === undefined) {
896
+ throw new Error('Required parameter account was null or undefined when calling offersControllerReload.');
897
+ }
898
+
899
+ (<any>Object).assign(localVarHeaderParams, options.headers);
900
+
901
+ let localVarUseFormData = false;
902
+
903
+ let localVarRequestOptions: localVarRequest.Options = {
904
+ method: 'POST',
905
+ qs: localVarQueryParameters,
906
+ headers: localVarHeaderParams,
907
+ uri: localVarPath,
908
+ useQuerystring: this._useQuerystring,
909
+ json: true,
910
+ };
911
+
912
+ let authenticationPromise = Promise.resolve();
913
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
914
+
915
+ let interceptorPromise = authenticationPromise;
916
+ for (const interceptor of this.interceptors) {
917
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
918
+ }
919
+
920
+ return interceptorPromise.then(() => {
921
+ if (Object.keys(localVarFormParams).length) {
922
+ if (localVarUseFormData) {
923
+ (<any>localVarRequestOptions).formData = localVarFormParams;
924
+ } else {
925
+ localVarRequestOptions.form = localVarFormParams;
926
+ }
927
+ }
928
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
929
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
930
+ if (error) {
931
+ reject(error);
932
+ } else {
933
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
934
+ resolve({ response: response, body: body });
935
+ } else {
936
+ reject(new HttpError(response, body, response.statusCode));
937
+ }
938
+ }
939
+ });
940
+ });
941
+ });
942
+ }
943
+ /**
944
+ *
945
+ * @summary Removes the offer with the provided ID
946
+ * @param id
947
+ * @param account
948
+ */
949
+ public async offersControllerRemove (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
950
+ const localVarPath = this.basePath + '/offers/{account}/{id}'
951
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
952
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
953
+ let localVarQueryParameters: any = {};
954
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
955
+ let localVarFormParams: any = {};
956
+
957
+ // verify required parameter 'id' is not null or undefined
958
+ if (id === null || id === undefined) {
959
+ throw new Error('Required parameter id was null or undefined when calling offersControllerRemove.');
960
+ }
961
+
962
+ // verify required parameter 'account' is not null or undefined
963
+ if (account === null || account === undefined) {
964
+ throw new Error('Required parameter account was null or undefined when calling offersControllerRemove.');
965
+ }
966
+
967
+ (<any>Object).assign(localVarHeaderParams, options.headers);
968
+
969
+ let localVarUseFormData = false;
970
+
971
+ let localVarRequestOptions: localVarRequest.Options = {
972
+ method: 'DELETE',
973
+ qs: localVarQueryParameters,
974
+ headers: localVarHeaderParams,
975
+ uri: localVarPath,
976
+ useQuerystring: this._useQuerystring,
977
+ json: true,
978
+ };
979
+
980
+ let authenticationPromise = Promise.resolve();
981
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
982
+
983
+ let interceptorPromise = authenticationPromise;
984
+ for (const interceptor of this.interceptors) {
985
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
986
+ }
987
+
988
+ return interceptorPromise.then(() => {
989
+ if (Object.keys(localVarFormParams).length) {
990
+ if (localVarUseFormData) {
991
+ (<any>localVarRequestOptions).formData = localVarFormParams;
992
+ } else {
993
+ localVarRequestOptions.form = localVarFormParams;
994
+ }
995
+ }
996
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
997
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
998
+ if (error) {
999
+ reject(error);
1000
+ } else {
1001
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1002
+ resolve({ response: response, body: body });
1003
+ } else {
1004
+ reject(new HttpError(response, body, response.statusCode));
1005
+ }
1006
+ }
1007
+ });
1008
+ });
1009
+ });
1010
+ }
1011
+ /**
1012
+ *
1013
+ * @summary Sets deal id to the offer
1014
+ * @param id
1015
+ * @param account
1016
+ * @param body
1017
+ */
1018
+ public async offersControllerSetdealid (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
1019
+ const localVarPath = this.basePath + '/offers/{account}/{id}/deal-id'
1020
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
1021
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
1022
+ let localVarQueryParameters: any = {};
1023
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1024
+ let localVarFormParams: any = {};
1025
+
1026
+ // verify required parameter 'id' is not null or undefined
1027
+ if (id === null || id === undefined) {
1028
+ throw new Error('Required parameter id was null or undefined when calling offersControllerSetdealid.');
1029
+ }
1030
+
1031
+ // verify required parameter 'account' is not null or undefined
1032
+ if (account === null || account === undefined) {
1033
+ throw new Error('Required parameter account was null or undefined when calling offersControllerSetdealid.');
1034
+ }
1035
+
1036
+ // verify required parameter 'body' is not null or undefined
1037
+ if (body === null || body === undefined) {
1038
+ throw new Error('Required parameter body was null or undefined when calling offersControllerSetdealid.');
1039
+ }
1040
+
1041
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1042
+
1043
+ let localVarUseFormData = false;
1044
+
1045
+ let localVarRequestOptions: localVarRequest.Options = {
1046
+ method: 'PUT',
1047
+ qs: localVarQueryParameters,
1048
+ headers: localVarHeaderParams,
1049
+ uri: localVarPath,
1050
+ useQuerystring: this._useQuerystring,
1051
+ json: true,
1052
+ body: ObjectSerializer.serialize(body, "object")
1053
+ };
1054
+
1055
+ let authenticationPromise = Promise.resolve();
1056
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1057
+
1058
+ let interceptorPromise = authenticationPromise;
1059
+ for (const interceptor of this.interceptors) {
1060
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1061
+ }
1062
+
1063
+ return interceptorPromise.then(() => {
1064
+ if (Object.keys(localVarFormParams).length) {
1065
+ if (localVarUseFormData) {
1066
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1067
+ } else {
1068
+ localVarRequestOptions.form = localVarFormParams;
1069
+ }
1070
+ }
1071
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1072
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1073
+ if (error) {
1074
+ reject(error);
1075
+ } else {
1076
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1077
+ resolve({ response: response, body: body });
1078
+ } else {
1079
+ reject(new HttpError(response, body, response.statusCode));
1080
+ }
1081
+ }
1082
+ });
1083
+ });
1084
+ });
1085
+ }
1086
+ /**
1087
+ *
1088
+ * @summary Sets HS code to the offer
1089
+ * @param id
1090
+ * @param account
1091
+ * @param body
1092
+ */
1093
+ public async offersControllerSethscode (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
1094
+ const localVarPath = this.basePath + '/offers/{account}/{id}/hs-code'
1095
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
1096
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
1097
+ let localVarQueryParameters: any = {};
1098
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1099
+ let localVarFormParams: any = {};
1100
+
1101
+ // verify required parameter 'id' is not null or undefined
1102
+ if (id === null || id === undefined) {
1103
+ throw new Error('Required parameter id was null or undefined when calling offersControllerSethscode.');
1104
+ }
1105
+
1106
+ // verify required parameter 'account' is not null or undefined
1107
+ if (account === null || account === undefined) {
1108
+ throw new Error('Required parameter account was null or undefined when calling offersControllerSethscode.');
1109
+ }
1110
+
1111
+ // verify required parameter 'body' is not null or undefined
1112
+ if (body === null || body === undefined) {
1113
+ throw new Error('Required parameter body was null or undefined when calling offersControllerSethscode.');
1114
+ }
1115
+
1116
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1117
+
1118
+ let localVarUseFormData = false;
1119
+
1120
+ let localVarRequestOptions: localVarRequest.Options = {
1121
+ method: 'PUT',
1122
+ qs: localVarQueryParameters,
1123
+ headers: localVarHeaderParams,
1124
+ uri: localVarPath,
1125
+ useQuerystring: this._useQuerystring,
1126
+ json: true,
1127
+ body: ObjectSerializer.serialize(body, "object")
1128
+ };
1129
+
1130
+ let authenticationPromise = Promise.resolve();
1131
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1132
+
1133
+ let interceptorPromise = authenticationPromise;
1134
+ for (const interceptor of this.interceptors) {
1135
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1136
+ }
1137
+
1138
+ return interceptorPromise.then(() => {
1139
+ if (Object.keys(localVarFormParams).length) {
1140
+ if (localVarUseFormData) {
1141
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1142
+ } else {
1143
+ localVarRequestOptions.form = localVarFormParams;
1144
+ }
1145
+ }
1146
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1147
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1148
+ if (error) {
1149
+ reject(error);
1150
+ } else {
1151
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1152
+ resolve({ response: response, body: body });
1153
+ } else {
1154
+ reject(new HttpError(response, body, response.statusCode));
1155
+ }
1156
+ }
1157
+ });
1158
+ });
1159
+ });
1160
+ }
1161
+ /**
1162
+ *
1163
+ * @summary Unlocks the offer with the provided ID
1164
+ * @param id
1165
+ * @param account
1166
+ */
1167
+ public async offersControllerUnlock (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
1168
+ const localVarPath = this.basePath + '/offers/{account}/{id}/unlock'
1169
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
1170
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
1171
+ let localVarQueryParameters: any = {};
1172
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1173
+ let localVarFormParams: any = {};
1174
+
1175
+ // verify required parameter 'id' is not null or undefined
1176
+ if (id === null || id === undefined) {
1177
+ throw new Error('Required parameter id was null or undefined when calling offersControllerUnlock.');
1178
+ }
1179
+
1180
+ // verify required parameter 'account' is not null or undefined
1181
+ if (account === null || account === undefined) {
1182
+ throw new Error('Required parameter account was null or undefined when calling offersControllerUnlock.');
1183
+ }
1184
+
1185
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1186
+
1187
+ let localVarUseFormData = false;
1188
+
1189
+ let localVarRequestOptions: localVarRequest.Options = {
1190
+ method: 'PUT',
1191
+ qs: localVarQueryParameters,
1192
+ headers: localVarHeaderParams,
1193
+ uri: localVarPath,
1194
+ useQuerystring: this._useQuerystring,
1195
+ json: true,
1196
+ };
1197
+
1198
+ let authenticationPromise = Promise.resolve();
1199
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1200
+
1201
+ let interceptorPromise = authenticationPromise;
1202
+ for (const interceptor of this.interceptors) {
1203
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1204
+ }
1205
+
1206
+ return interceptorPromise.then(() => {
1207
+ if (Object.keys(localVarFormParams).length) {
1208
+ if (localVarUseFormData) {
1209
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1210
+ } else {
1211
+ localVarRequestOptions.form = localVarFormParams;
1212
+ }
1213
+ }
1214
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1215
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1216
+ if (error) {
1217
+ reject(error);
1218
+ } else {
1219
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1220
+ resolve({ response: response, body: body });
1221
+ } else {
1222
+ reject(new HttpError(response, body, response.statusCode));
1223
+ }
1224
+ }
1225
+ });
1226
+ });
1227
+ });
1228
+ }
1229
+ /**
1230
+ *
1231
+ * @summary Patches the offer with the provided ID
1232
+ * @param id
1233
+ * @param account
1234
+ * @param body
1235
+ */
1236
+ public async offersControllerUpdate (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
1237
+ const localVarPath = this.basePath + '/offers/{account}/{id}'
1238
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
1239
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
1240
+ let localVarQueryParameters: any = {};
1241
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1242
+ let localVarFormParams: any = {};
1243
+
1244
+ // verify required parameter 'id' is not null or undefined
1245
+ if (id === null || id === undefined) {
1246
+ throw new Error('Required parameter id was null or undefined when calling offersControllerUpdate.');
1247
+ }
1248
+
1249
+ // verify required parameter 'account' is not null or undefined
1250
+ if (account === null || account === undefined) {
1251
+ throw new Error('Required parameter account was null or undefined when calling offersControllerUpdate.');
1252
+ }
1253
+
1254
+ // verify required parameter 'body' is not null or undefined
1255
+ if (body === null || body === undefined) {
1256
+ throw new Error('Required parameter body was null or undefined when calling offersControllerUpdate.');
1257
+ }
1258
+
1259
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1260
+
1261
+ let localVarUseFormData = false;
1262
+
1263
+ let localVarRequestOptions: localVarRequest.Options = {
1264
+ method: 'PUT',
1265
+ qs: localVarQueryParameters,
1266
+ headers: localVarHeaderParams,
1267
+ uri: localVarPath,
1268
+ useQuerystring: this._useQuerystring,
1269
+ json: true,
1270
+ body: ObjectSerializer.serialize(body, "object")
1271
+ };
1272
+
1273
+ let authenticationPromise = Promise.resolve();
1274
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1275
+
1276
+ let interceptorPromise = authenticationPromise;
1277
+ for (const interceptor of this.interceptors) {
1278
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1279
+ }
1280
+
1281
+ return interceptorPromise.then(() => {
1282
+ if (Object.keys(localVarFormParams).length) {
1283
+ if (localVarUseFormData) {
1284
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1285
+ } else {
1286
+ localVarRequestOptions.form = localVarFormParams;
1287
+ }
1288
+ }
1289
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1290
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1291
+ if (error) {
1292
+ reject(error);
1293
+ } else {
1294
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1295
+ resolve({ response: response, body: body });
1296
+ } else {
1297
+ reject(new HttpError(response, body, response.statusCode));
1298
+ }
1299
+ }
1300
+ });
1301
+ });
1302
+ });
1303
+ }
1304
+ /**
1305
+ *
1306
+ * @summary Updates the offer status with the provided ID
1307
+ * @param account
1308
+ * @param body
1309
+ */
1310
+ public async offersControllerUpdatestatus (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
1311
+ const localVarPath = this.basePath + '/offers/{account}/status'
1312
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
1313
+ let localVarQueryParameters: any = {};
1314
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1315
+ let localVarFormParams: any = {};
1316
+
1317
+ // verify required parameter 'account' is not null or undefined
1318
+ if (account === null || account === undefined) {
1319
+ throw new Error('Required parameter account was null or undefined when calling offersControllerUpdatestatus.');
1320
+ }
1321
+
1322
+ // verify required parameter 'body' is not null or undefined
1323
+ if (body === null || body === undefined) {
1324
+ throw new Error('Required parameter body was null or undefined when calling offersControllerUpdatestatus.');
1325
+ }
1326
+
1327
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1328
+
1329
+ let localVarUseFormData = false;
1330
+
1331
+ let localVarRequestOptions: localVarRequest.Options = {
1332
+ method: 'PUT',
1333
+ qs: localVarQueryParameters,
1334
+ headers: localVarHeaderParams,
1335
+ uri: localVarPath,
1336
+ useQuerystring: this._useQuerystring,
1337
+ json: true,
1338
+ body: ObjectSerializer.serialize(body, "object")
1339
+ };
1340
+
1341
+ let authenticationPromise = Promise.resolve();
1342
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1343
+
1344
+ let interceptorPromise = authenticationPromise;
1345
+ for (const interceptor of this.interceptors) {
1346
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1347
+ }
1348
+
1349
+ return interceptorPromise.then(() => {
1350
+ if (Object.keys(localVarFormParams).length) {
1351
+ if (localVarUseFormData) {
1352
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1353
+ } else {
1354
+ localVarRequestOptions.form = localVarFormParams;
1355
+ }
1356
+ }
1357
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1358
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1359
+ if (error) {
1360
+ reject(error);
1361
+ } else {
1362
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1363
+ resolve({ response: response, body: body });
1364
+ } else {
1365
+ reject(new HttpError(response, body, response.statusCode));
1366
+ }
1367
+ }
1368
+ });
1369
+ });
1370
+ });
1371
+ }
1372
+ /**
1373
+ *
1374
+ * @summary Validate the status with the provided ID
1375
+ * @param account
1376
+ * @param body
1377
+ */
1378
+ public async offersControllerValidatestatus (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
1379
+ const localVarPath = this.basePath + '/offers/{account}/status/validate'
1380
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
1381
+ let localVarQueryParameters: any = {};
1382
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1383
+ let localVarFormParams: any = {};
1384
+
1385
+ // verify required parameter 'account' is not null or undefined
1386
+ if (account === null || account === undefined) {
1387
+ throw new Error('Required parameter account was null or undefined when calling offersControllerValidatestatus.');
1388
+ }
1389
+
1390
+ // verify required parameter 'body' is not null or undefined
1391
+ if (body === null || body === undefined) {
1392
+ throw new Error('Required parameter body was null or undefined when calling offersControllerValidatestatus.');
1393
+ }
1394
+
1395
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1396
+
1397
+ let localVarUseFormData = false;
1398
+
1399
+ let localVarRequestOptions: localVarRequest.Options = {
1400
+ method: 'POST',
1401
+ qs: localVarQueryParameters,
1402
+ headers: localVarHeaderParams,
1403
+ uri: localVarPath,
1404
+ useQuerystring: this._useQuerystring,
1405
+ json: true,
1406
+ body: ObjectSerializer.serialize(body, "object")
1407
+ };
1408
+
1409
+ let authenticationPromise = Promise.resolve();
1410
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1411
+
1412
+ let interceptorPromise = authenticationPromise;
1413
+ for (const interceptor of this.interceptors) {
1414
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1415
+ }
1416
+
1417
+ return interceptorPromise.then(() => {
1418
+ if (Object.keys(localVarFormParams).length) {
1419
+ if (localVarUseFormData) {
1420
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1421
+ } else {
1422
+ localVarRequestOptions.form = localVarFormParams;
1423
+ }
1424
+ }
1425
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1426
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1427
+ if (error) {
1428
+ reject(error);
1429
+ } else {
1430
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1431
+ resolve({ response: response, body: body });
1432
+ } else {
1433
+ reject(new HttpError(response, body, response.statusCode));
1434
+ }
1435
+ }
1436
+ });
1437
+ });
1438
+ });
1439
+ }
1440
+ }