@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,1018 @@
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 MatchedOffersApiApiKeys {
30
+ }
31
+
32
+ export class MatchedOffersApi {
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: MatchedOffersApiApiKeys, value: string) {
81
+ (this.authentications as any)[MatchedOffersApiApiKeys[key]].apiKey = value;
82
+ }
83
+
84
+ public addInterceptor(interceptor: Interceptor) {
85
+ this.interceptors.push(interceptor);
86
+ }
87
+
88
+ /**
89
+ *
90
+ * @summary Adds bid to the matched offer with the provided ID
91
+ * @param id
92
+ * @param userId
93
+ * @param account
94
+ * @param body
95
+ */
96
+ public async matchedOffersControllerAddbid (id: string, userId: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
97
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}/{userId}/bid'
98
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
99
+ .replace('{' + 'userId' + '}', encodeURIComponent(String(userId)))
100
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
101
+ let localVarQueryParameters: any = {};
102
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
103
+ let localVarFormParams: any = {};
104
+
105
+ // verify required parameter 'id' is not null or undefined
106
+ if (id === null || id === undefined) {
107
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerAddbid.');
108
+ }
109
+
110
+ // verify required parameter 'userId' is not null or undefined
111
+ if (userId === null || userId === undefined) {
112
+ throw new Error('Required parameter userId was null or undefined when calling matchedOffersControllerAddbid.');
113
+ }
114
+
115
+ // verify required parameter 'account' is not null or undefined
116
+ if (account === null || account === undefined) {
117
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerAddbid.');
118
+ }
119
+
120
+ // verify required parameter 'body' is not null or undefined
121
+ if (body === null || body === undefined) {
122
+ throw new Error('Required parameter body was null or undefined when calling matchedOffersControllerAddbid.');
123
+ }
124
+
125
+ (<any>Object).assign(localVarHeaderParams, options.headers);
126
+
127
+ let localVarUseFormData = false;
128
+
129
+ let localVarRequestOptions: localVarRequest.Options = {
130
+ method: 'POST',
131
+ qs: localVarQueryParameters,
132
+ headers: localVarHeaderParams,
133
+ uri: localVarPath,
134
+ useQuerystring: this._useQuerystring,
135
+ json: true,
136
+ body: ObjectSerializer.serialize(body, "object")
137
+ };
138
+
139
+ let authenticationPromise = Promise.resolve();
140
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
141
+
142
+ let interceptorPromise = authenticationPromise;
143
+ for (const interceptor of this.interceptors) {
144
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
145
+ }
146
+
147
+ return interceptorPromise.then(() => {
148
+ if (Object.keys(localVarFormParams).length) {
149
+ if (localVarUseFormData) {
150
+ (<any>localVarRequestOptions).formData = localVarFormParams;
151
+ } else {
152
+ localVarRequestOptions.form = localVarFormParams;
153
+ }
154
+ }
155
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
156
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
157
+ if (error) {
158
+ reject(error);
159
+ } else {
160
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
161
+ resolve({ response: response, body: body });
162
+ } else {
163
+ reject(new HttpError(response, body, response.statusCode));
164
+ }
165
+ }
166
+ });
167
+ });
168
+ });
169
+ }
170
+ /**
171
+ *
172
+ * @summary Creates a new matched offer
173
+ * @param account
174
+ * @param body
175
+ */
176
+ public async matchedOffersControllerCreate (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
177
+ const localVarPath = this.basePath + '/matched-offers/{account}'
178
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
179
+ let localVarQueryParameters: any = {};
180
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
181
+ let localVarFormParams: any = {};
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 matchedOffersControllerCreate.');
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 matchedOffersControllerCreate.');
191
+ }
192
+
193
+ (<any>Object).assign(localVarHeaderParams, options.headers);
194
+
195
+ let localVarUseFormData = false;
196
+
197
+ let localVarRequestOptions: localVarRequest.Options = {
198
+ method: 'POST',
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 Sets all bids to inactive for the matched offer with the provided ID
241
+ * @param id
242
+ * @param userId
243
+ * @param account
244
+ */
245
+ public async matchedOffersControllerDeletebid (id: string, userId: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
246
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}/{userId}/bid'
247
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
248
+ .replace('{' + 'userId' + '}', encodeURIComponent(String(userId)))
249
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
250
+ let localVarQueryParameters: any = {};
251
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
252
+ let localVarFormParams: any = {};
253
+
254
+ // verify required parameter 'id' is not null or undefined
255
+ if (id === null || id === undefined) {
256
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerDeletebid.');
257
+ }
258
+
259
+ // verify required parameter 'userId' is not null or undefined
260
+ if (userId === null || userId === undefined) {
261
+ throw new Error('Required parameter userId was null or undefined when calling matchedOffersControllerDeletebid.');
262
+ }
263
+
264
+ // verify required parameter 'account' is not null or undefined
265
+ if (account === null || account === undefined) {
266
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerDeletebid.');
267
+ }
268
+
269
+ (<any>Object).assign(localVarHeaderParams, options.headers);
270
+
271
+ let localVarUseFormData = false;
272
+
273
+ let localVarRequestOptions: localVarRequest.Options = {
274
+ method: 'DELETE',
275
+ qs: localVarQueryParameters,
276
+ headers: localVarHeaderParams,
277
+ uri: localVarPath,
278
+ useQuerystring: this._useQuerystring,
279
+ json: true,
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 Retrieves a list of all matched offers by search criteria
316
+ * @param account
317
+ * @param skip
318
+ * @param limit
319
+ * @param sort
320
+ * @param body
321
+ */
322
+ public async matchedOffersControllerFilter (account: string, skip?: number, limit?: number, sort?: string, body?: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
323
+ const localVarPath = this.basePath + '/matched-offers/{account}/search'
324
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
325
+ let localVarQueryParameters: any = {};
326
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
327
+ let localVarFormParams: any = {};
328
+
329
+ // verify required parameter 'account' is not null or undefined
330
+ if (account === null || account === undefined) {
331
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerFilter.');
332
+ }
333
+
334
+ if (skip !== undefined) {
335
+ localVarQueryParameters['skip'] = ObjectSerializer.serialize(skip, "number");
336
+ }
337
+
338
+ if (limit !== undefined) {
339
+ localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
340
+ }
341
+
342
+ if (sort !== undefined) {
343
+ localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "string");
344
+ }
345
+
346
+ (<any>Object).assign(localVarHeaderParams, options.headers);
347
+
348
+ let localVarUseFormData = false;
349
+
350
+ let localVarRequestOptions: localVarRequest.Options = {
351
+ method: 'POST',
352
+ qs: localVarQueryParameters,
353
+ headers: localVarHeaderParams,
354
+ uri: localVarPath,
355
+ useQuerystring: this._useQuerystring,
356
+ json: true,
357
+ body: ObjectSerializer.serialize(body, "object")
358
+ };
359
+
360
+ let authenticationPromise = Promise.resolve();
361
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
362
+
363
+ let interceptorPromise = authenticationPromise;
364
+ for (const interceptor of this.interceptors) {
365
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
366
+ }
367
+
368
+ return interceptorPromise.then(() => {
369
+ if (Object.keys(localVarFormParams).length) {
370
+ if (localVarUseFormData) {
371
+ (<any>localVarRequestOptions).formData = localVarFormParams;
372
+ } else {
373
+ localVarRequestOptions.form = localVarFormParams;
374
+ }
375
+ }
376
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
377
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
378
+ if (error) {
379
+ reject(error);
380
+ } else {
381
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
382
+ resolve({ response: response, body: body });
383
+ } else {
384
+ reject(new HttpError(response, body, response.statusCode));
385
+ }
386
+ }
387
+ });
388
+ });
389
+ });
390
+ }
391
+ /**
392
+ *
393
+ * @summary Retrieves a list of all matched offers
394
+ * @param account
395
+ * @param body
396
+ * @param skip
397
+ * @param limit
398
+ * @param sort
399
+ */
400
+ public async matchedOffersControllerFindall (account: string, body: object, skip?: number, limit?: number, sort?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
401
+ const localVarPath = this.basePath + '/matched-offers/{account}'
402
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
403
+ let localVarQueryParameters: any = {};
404
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
405
+ let localVarFormParams: any = {};
406
+
407
+ // verify required parameter 'account' is not null or undefined
408
+ if (account === null || account === undefined) {
409
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerFindall.');
410
+ }
411
+
412
+ // verify required parameter 'body' is not null or undefined
413
+ if (body === null || body === undefined) {
414
+ throw new Error('Required parameter body was null or undefined when calling matchedOffersControllerFindall.');
415
+ }
416
+
417
+ if (skip !== undefined) {
418
+ localVarQueryParameters['skip'] = ObjectSerializer.serialize(skip, "number");
419
+ }
420
+
421
+ if (limit !== undefined) {
422
+ localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
423
+ }
424
+
425
+ if (sort !== undefined) {
426
+ localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "string");
427
+ }
428
+
429
+ (<any>Object).assign(localVarHeaderParams, options.headers);
430
+
431
+ let localVarUseFormData = false;
432
+
433
+ let localVarRequestOptions: localVarRequest.Options = {
434
+ method: 'GET',
435
+ qs: localVarQueryParameters,
436
+ headers: localVarHeaderParams,
437
+ uri: localVarPath,
438
+ useQuerystring: this._useQuerystring,
439
+ json: true,
440
+ body: ObjectSerializer.serialize(body, "object")
441
+ };
442
+
443
+ let authenticationPromise = Promise.resolve();
444
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
445
+
446
+ let interceptorPromise = authenticationPromise;
447
+ for (const interceptor of this.interceptors) {
448
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
449
+ }
450
+
451
+ return interceptorPromise.then(() => {
452
+ if (Object.keys(localVarFormParams).length) {
453
+ if (localVarUseFormData) {
454
+ (<any>localVarRequestOptions).formData = localVarFormParams;
455
+ } else {
456
+ localVarRequestOptions.form = localVarFormParams;
457
+ }
458
+ }
459
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
460
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
461
+ if (error) {
462
+ reject(error);
463
+ } else {
464
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
465
+ resolve({ response: response, body: body });
466
+ } else {
467
+ reject(new HttpError(response, body, response.statusCode));
468
+ }
469
+ }
470
+ });
471
+ });
472
+ });
473
+ }
474
+ /**
475
+ *
476
+ * @summary Retrieves a unique list of existing counties of matched offers
477
+ * @param account
478
+ */
479
+ public async matchedOffersControllerFindcountries (account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
480
+ const localVarPath = this.basePath + '/matched-offers/{account}/countries'
481
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
482
+ let localVarQueryParameters: any = {};
483
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
484
+ let localVarFormParams: any = {};
485
+
486
+ // verify required parameter 'account' is not null or undefined
487
+ if (account === null || account === undefined) {
488
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerFindcountries.');
489
+ }
490
+
491
+ (<any>Object).assign(localVarHeaderParams, options.headers);
492
+
493
+ let localVarUseFormData = false;
494
+
495
+ let localVarRequestOptions: localVarRequest.Options = {
496
+ method: 'GET',
497
+ qs: localVarQueryParameters,
498
+ headers: localVarHeaderParams,
499
+ uri: localVarPath,
500
+ useQuerystring: this._useQuerystring,
501
+ json: true,
502
+ };
503
+
504
+ let authenticationPromise = Promise.resolve();
505
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
506
+
507
+ let interceptorPromise = authenticationPromise;
508
+ for (const interceptor of this.interceptors) {
509
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
510
+ }
511
+
512
+ return interceptorPromise.then(() => {
513
+ if (Object.keys(localVarFormParams).length) {
514
+ if (localVarUseFormData) {
515
+ (<any>localVarRequestOptions).formData = localVarFormParams;
516
+ } else {
517
+ localVarRequestOptions.form = localVarFormParams;
518
+ }
519
+ }
520
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
521
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
522
+ if (error) {
523
+ reject(error);
524
+ } else {
525
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
526
+ resolve({ response: response, body: body });
527
+ } else {
528
+ reject(new HttpError(response, body, response.statusCode));
529
+ }
530
+ }
531
+ });
532
+ });
533
+ });
534
+ }
535
+ /**
536
+ *
537
+ * @summary Retrieves the matched offer with the provided ID
538
+ * @param id
539
+ * @param account
540
+ */
541
+ public async matchedOffersControllerFindone (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
542
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}'
543
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
544
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
545
+ let localVarQueryParameters: any = {};
546
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
547
+ let localVarFormParams: any = {};
548
+
549
+ // verify required parameter 'id' is not null or undefined
550
+ if (id === null || id === undefined) {
551
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerFindone.');
552
+ }
553
+
554
+ // verify required parameter 'account' is not null or undefined
555
+ if (account === null || account === undefined) {
556
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerFindone.');
557
+ }
558
+
559
+ (<any>Object).assign(localVarHeaderParams, options.headers);
560
+
561
+ let localVarUseFormData = false;
562
+
563
+ let localVarRequestOptions: localVarRequest.Options = {
564
+ method: 'GET',
565
+ qs: localVarQueryParameters,
566
+ headers: localVarHeaderParams,
567
+ uri: localVarPath,
568
+ useQuerystring: this._useQuerystring,
569
+ json: true,
570
+ };
571
+
572
+ let authenticationPromise = Promise.resolve();
573
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
574
+
575
+ let interceptorPromise = authenticationPromise;
576
+ for (const interceptor of this.interceptors) {
577
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
578
+ }
579
+
580
+ return interceptorPromise.then(() => {
581
+ if (Object.keys(localVarFormParams).length) {
582
+ if (localVarUseFormData) {
583
+ (<any>localVarRequestOptions).formData = localVarFormParams;
584
+ } else {
585
+ localVarRequestOptions.form = localVarFormParams;
586
+ }
587
+ }
588
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
589
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
590
+ if (error) {
591
+ reject(error);
592
+ } else {
593
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
594
+ resolve({ response: response, body: body });
595
+ } else {
596
+ reject(new HttpError(response, body, response.statusCode));
597
+ }
598
+ }
599
+ });
600
+ });
601
+ });
602
+ }
603
+ /**
604
+ *
605
+ * @summary Generates offer no. for the matched offer with the provided ID
606
+ * @param id
607
+ * @param account
608
+ */
609
+ public async matchedOffersControllerGenerateoffernumber (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
610
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}/generate/number'
611
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
612
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
613
+ let localVarQueryParameters: any = {};
614
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
615
+ let localVarFormParams: any = {};
616
+
617
+ // verify required parameter 'id' is not null or undefined
618
+ if (id === null || id === undefined) {
619
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerGenerateoffernumber.');
620
+ }
621
+
622
+ // verify required parameter 'account' is not null or undefined
623
+ if (account === null || account === undefined) {
624
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerGenerateoffernumber.');
625
+ }
626
+
627
+ (<any>Object).assign(localVarHeaderParams, options.headers);
628
+
629
+ let localVarUseFormData = false;
630
+
631
+ let localVarRequestOptions: localVarRequest.Options = {
632
+ method: 'PUT',
633
+ qs: localVarQueryParameters,
634
+ headers: localVarHeaderParams,
635
+ uri: localVarPath,
636
+ useQuerystring: this._useQuerystring,
637
+ json: true,
638
+ };
639
+
640
+ let authenticationPromise = Promise.resolve();
641
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
642
+
643
+ let interceptorPromise = authenticationPromise;
644
+ for (const interceptor of this.interceptors) {
645
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
646
+ }
647
+
648
+ return interceptorPromise.then(() => {
649
+ if (Object.keys(localVarFormParams).length) {
650
+ if (localVarUseFormData) {
651
+ (<any>localVarRequestOptions).formData = localVarFormParams;
652
+ } else {
653
+ localVarRequestOptions.form = localVarFormParams;
654
+ }
655
+ }
656
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
657
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
658
+ if (error) {
659
+ reject(error);
660
+ } else {
661
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
662
+ resolve({ response: response, body: body });
663
+ } else {
664
+ reject(new HttpError(response, body, response.statusCode));
665
+ }
666
+ }
667
+ });
668
+ });
669
+ });
670
+ }
671
+ /**
672
+ *
673
+ * @summary Removes the matched offer with the provided ID
674
+ * @param id
675
+ * @param account
676
+ */
677
+ public async matchedOffersControllerRemove (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
678
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}'
679
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
680
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
681
+ let localVarQueryParameters: any = {};
682
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
683
+ let localVarFormParams: any = {};
684
+
685
+ // verify required parameter 'id' is not null or undefined
686
+ if (id === null || id === undefined) {
687
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerRemove.');
688
+ }
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 matchedOffersControllerRemove.');
693
+ }
694
+
695
+ (<any>Object).assign(localVarHeaderParams, options.headers);
696
+
697
+ let localVarUseFormData = false;
698
+
699
+ let localVarRequestOptions: localVarRequest.Options = {
700
+ method: 'DELETE',
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 Set confirmation index for the matched offer with the provided ID
742
+ * @param id
743
+ * @param account
744
+ * @param body
745
+ */
746
+ public async matchedOffersControllerSetconfirmindex (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
747
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}/confirm/index'
748
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
749
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
750
+ let localVarQueryParameters: any = {};
751
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
752
+ let localVarFormParams: any = {};
753
+
754
+ // verify required parameter 'id' is not null or undefined
755
+ if (id === null || id === undefined) {
756
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerSetconfirmindex.');
757
+ }
758
+
759
+ // verify required parameter 'account' is not null or undefined
760
+ if (account === null || account === undefined) {
761
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerSetconfirmindex.');
762
+ }
763
+
764
+ // verify required parameter 'body' is not null or undefined
765
+ if (body === null || body === undefined) {
766
+ throw new Error('Required parameter body was null or undefined when calling matchedOffersControllerSetconfirmindex.');
767
+ }
768
+
769
+ (<any>Object).assign(localVarHeaderParams, options.headers);
770
+
771
+ let localVarUseFormData = false;
772
+
773
+ let localVarRequestOptions: localVarRequest.Options = {
774
+ method: 'PUT',
775
+ qs: localVarQueryParameters,
776
+ headers: localVarHeaderParams,
777
+ uri: localVarPath,
778
+ useQuerystring: this._useQuerystring,
779
+ json: true,
780
+ body: ObjectSerializer.serialize(body, "object")
781
+ };
782
+
783
+ let authenticationPromise = Promise.resolve();
784
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
785
+
786
+ let interceptorPromise = authenticationPromise;
787
+ for (const interceptor of this.interceptors) {
788
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
789
+ }
790
+
791
+ return interceptorPromise.then(() => {
792
+ if (Object.keys(localVarFormParams).length) {
793
+ if (localVarUseFormData) {
794
+ (<any>localVarRequestOptions).formData = localVarFormParams;
795
+ } else {
796
+ localVarRequestOptions.form = localVarFormParams;
797
+ }
798
+ }
799
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
800
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
801
+ if (error) {
802
+ reject(error);
803
+ } else {
804
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
805
+ resolve({ response: response, body: body });
806
+ } else {
807
+ reject(new HttpError(response, body, response.statusCode));
808
+ }
809
+ }
810
+ });
811
+ });
812
+ });
813
+ }
814
+ /**
815
+ *
816
+ * @summary Returns total amount of matched offers in the DB
817
+ * @param account
818
+ */
819
+ public async matchedOffersControllerTotal (account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
820
+ const localVarPath = this.basePath + '/matched-offers/{account}/total'
821
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
822
+ let localVarQueryParameters: any = {};
823
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
824
+ let localVarFormParams: any = {};
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 matchedOffersControllerTotal.');
829
+ }
830
+
831
+ (<any>Object).assign(localVarHeaderParams, options.headers);
832
+
833
+ let localVarUseFormData = false;
834
+
835
+ let localVarRequestOptions: localVarRequest.Options = {
836
+ method: 'GET',
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 Patches the matched offer with the provided ID
878
+ * @param id
879
+ * @param account
880
+ * @param body
881
+ */
882
+ public async matchedOffersControllerUpdate (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
883
+ const localVarPath = this.basePath + '/matched-offers/{account}/{id}'
884
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
885
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
886
+ let localVarQueryParameters: any = {};
887
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
888
+ let localVarFormParams: any = {};
889
+
890
+ // verify required parameter 'id' is not null or undefined
891
+ if (id === null || id === undefined) {
892
+ throw new Error('Required parameter id was null or undefined when calling matchedOffersControllerUpdate.');
893
+ }
894
+
895
+ // verify required parameter 'account' is not null or undefined
896
+ if (account === null || account === undefined) {
897
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerUpdate.');
898
+ }
899
+
900
+ // verify required parameter 'body' is not null or undefined
901
+ if (body === null || body === undefined) {
902
+ throw new Error('Required parameter body was null or undefined when calling matchedOffersControllerUpdate.');
903
+ }
904
+
905
+ (<any>Object).assign(localVarHeaderParams, options.headers);
906
+
907
+ let localVarUseFormData = false;
908
+
909
+ let localVarRequestOptions: localVarRequest.Options = {
910
+ method: 'PUT',
911
+ qs: localVarQueryParameters,
912
+ headers: localVarHeaderParams,
913
+ uri: localVarPath,
914
+ useQuerystring: this._useQuerystring,
915
+ json: true,
916
+ body: ObjectSerializer.serialize(body, "object")
917
+ };
918
+
919
+ let authenticationPromise = Promise.resolve();
920
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
921
+
922
+ let interceptorPromise = authenticationPromise;
923
+ for (const interceptor of this.interceptors) {
924
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
925
+ }
926
+
927
+ return interceptorPromise.then(() => {
928
+ if (Object.keys(localVarFormParams).length) {
929
+ if (localVarUseFormData) {
930
+ (<any>localVarRequestOptions).formData = localVarFormParams;
931
+ } else {
932
+ localVarRequestOptions.form = localVarFormParams;
933
+ }
934
+ }
935
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
936
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
937
+ if (error) {
938
+ reject(error);
939
+ } else {
940
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
941
+ resolve({ response: response, body: body });
942
+ } else {
943
+ reject(new HttpError(response, body, response.statusCode));
944
+ }
945
+ }
946
+ });
947
+ });
948
+ });
949
+ }
950
+ /**
951
+ *
952
+ * @summary Updates the matched offer status with the provided ID
953
+ * @param account
954
+ * @param body
955
+ */
956
+ public async matchedOffersControllerUpdatestatus (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
957
+ const localVarPath = this.basePath + '/matched-offers/{account}/status'
958
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
959
+ let localVarQueryParameters: any = {};
960
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
961
+ let localVarFormParams: any = {};
962
+
963
+ // verify required parameter 'account' is not null or undefined
964
+ if (account === null || account === undefined) {
965
+ throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerUpdatestatus.');
966
+ }
967
+
968
+ // verify required parameter 'body' is not null or undefined
969
+ if (body === null || body === undefined) {
970
+ throw new Error('Required parameter body was null or undefined when calling matchedOffersControllerUpdatestatus.');
971
+ }
972
+
973
+ (<any>Object).assign(localVarHeaderParams, options.headers);
974
+
975
+ let localVarUseFormData = false;
976
+
977
+ let localVarRequestOptions: localVarRequest.Options = {
978
+ method: 'PUT',
979
+ qs: localVarQueryParameters,
980
+ headers: localVarHeaderParams,
981
+ uri: localVarPath,
982
+ useQuerystring: this._useQuerystring,
983
+ json: true,
984
+ body: ObjectSerializer.serialize(body, "object")
985
+ };
986
+
987
+ let authenticationPromise = Promise.resolve();
988
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
989
+
990
+ let interceptorPromise = authenticationPromise;
991
+ for (const interceptor of this.interceptors) {
992
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
993
+ }
994
+
995
+ return interceptorPromise.then(() => {
996
+ if (Object.keys(localVarFormParams).length) {
997
+ if (localVarUseFormData) {
998
+ (<any>localVarRequestOptions).formData = localVarFormParams;
999
+ } else {
1000
+ localVarRequestOptions.form = localVarFormParams;
1001
+ }
1002
+ }
1003
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
1004
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1005
+ if (error) {
1006
+ reject(error);
1007
+ } else {
1008
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1009
+ resolve({ response: response, body: body });
1010
+ } else {
1011
+ reject(new HttpError(response, body, response.statusCode));
1012
+ }
1013
+ }
1014
+ });
1015
+ });
1016
+ });
1017
+ }
1018
+ }