@tradecafe/offer-service-sdk 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,16 @@
1
- .gitignore
2
- .openapi-generator-ignore
3
- api.ts
4
- api/apis.ts
5
- api/futureBidsApi.ts
6
- api/healthApi.ts
7
- api/matchedOffersApi.ts
8
- api/offersApi.ts
9
- git_push.sh
10
- model/healthControllerPing200Response.ts
11
- model/healthControllerPing200ResponseInfoValue.ts
12
- model/healthControllerPing503Response.ts
13
- model/models.ts
14
- package.json
15
- tsconfig.json
1
+ .gitignore
2
+ .openapi-generator-ignore
3
+ api.ts
4
+ api/apis.ts
5
+ api/automatedOffersApi.ts
6
+ api/futureBidsApi.ts
7
+ api/healthApi.ts
8
+ api/matchedOffersApi.ts
9
+ api/offersApi.ts
10
+ git_push.sh
11
+ model/healthControllerPing200Response.ts
12
+ model/healthControllerPing200ResponseInfoValue.ts
13
+ model/healthControllerPing503Response.ts
14
+ model/models.ts
15
+ package.json
16
+ tsconfig.json
package/api/apis.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './automatedOffersApi';
2
+ import { AutomatedOffersApi } from './automatedOffersApi';
1
3
  export * from './futureBidsApi';
2
4
  import { FutureBidsApi } from './futureBidsApi';
3
5
  export * from './healthApi';
@@ -17,4 +19,4 @@ export class HttpError extends Error {
17
19
 
18
20
  export { RequestFile } from '../model/models';
19
21
 
20
- export const APIS = [FutureBidsApi, HealthApi, MatchedOffersApi, OffersApi];
22
+ export const APIS = [AutomatedOffersApi, FutureBidsApi, HealthApi, MatchedOffersApi, OffersApi];
@@ -0,0 +1,450 @@
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 AutomatedOffersApiApiKeys {
30
+ }
31
+
32
+ export class AutomatedOffersApi {
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: AutomatedOffersApiApiKeys, value: string) {
81
+ (this.authentications as any)[AutomatedOffersApiApiKeys[key]].apiKey = value;
82
+ }
83
+
84
+ public addInterceptor(interceptor: Interceptor) {
85
+ this.interceptors.push(interceptor);
86
+ }
87
+
88
+ /**
89
+ *
90
+ * @summary Creates a new automated offers
91
+ * @param account
92
+ * @param body
93
+ */
94
+ public async automatedOffersControllerCreate (account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
95
+ const localVarPath = this.basePath + '/automated-offers/{account}'
96
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
97
+ let localVarQueryParameters: any = {};
98
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
99
+ let localVarFormParams: any = {};
100
+
101
+ // verify required parameter 'account' is not null or undefined
102
+ if (account === null || account === undefined) {
103
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerCreate.');
104
+ }
105
+
106
+ // verify required parameter 'body' is not null or undefined
107
+ if (body === null || body === undefined) {
108
+ throw new Error('Required parameter body was null or undefined when calling automatedOffersControllerCreate.');
109
+ }
110
+
111
+ (<any>Object).assign(localVarHeaderParams, options.headers);
112
+
113
+ let localVarUseFormData = false;
114
+
115
+ let localVarRequestOptions: localVarRequest.Options = {
116
+ method: 'POST',
117
+ qs: localVarQueryParameters,
118
+ headers: localVarHeaderParams,
119
+ uri: localVarPath,
120
+ useQuerystring: this._useQuerystring,
121
+ json: true,
122
+ body: ObjectSerializer.serialize(body, "object")
123
+ };
124
+
125
+ let authenticationPromise = Promise.resolve();
126
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
127
+
128
+ let interceptorPromise = authenticationPromise;
129
+ for (const interceptor of this.interceptors) {
130
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
131
+ }
132
+
133
+ return interceptorPromise.then(() => {
134
+ if (Object.keys(localVarFormParams).length) {
135
+ if (localVarUseFormData) {
136
+ (<any>localVarRequestOptions).formData = localVarFormParams;
137
+ } else {
138
+ localVarRequestOptions.form = localVarFormParams;
139
+ }
140
+ }
141
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
142
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
143
+ if (error) {
144
+ reject(error);
145
+ } else {
146
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
147
+ resolve({ response: response, body: body });
148
+ } else {
149
+ reject(new HttpError(response, body, response.statusCode));
150
+ }
151
+ }
152
+ });
153
+ });
154
+ });
155
+ }
156
+ /**
157
+ *
158
+ * @summary Retrieves a list of all automated offer
159
+ * @param account
160
+ * @param body
161
+ * @param skip
162
+ * @param limit
163
+ * @param sort
164
+ */
165
+ public async automatedOffersControllerFindall (account: string, body: object, skip?: number, limit?: number, sort?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
166
+ const localVarPath = this.basePath + '/automated-offers/{account}'
167
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
168
+ let localVarQueryParameters: any = {};
169
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
170
+ let localVarFormParams: any = {};
171
+
172
+ // verify required parameter 'account' is not null or undefined
173
+ if (account === null || account === undefined) {
174
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerFindall.');
175
+ }
176
+
177
+ // verify required parameter 'body' is not null or undefined
178
+ if (body === null || body === undefined) {
179
+ throw new Error('Required parameter body was null or undefined when calling automatedOffersControllerFindall.');
180
+ }
181
+
182
+ if (skip !== undefined) {
183
+ localVarQueryParameters['skip'] = ObjectSerializer.serialize(skip, "number");
184
+ }
185
+
186
+ if (limit !== undefined) {
187
+ localVarQueryParameters['limit'] = ObjectSerializer.serialize(limit, "number");
188
+ }
189
+
190
+ if (sort !== undefined) {
191
+ localVarQueryParameters['sort'] = ObjectSerializer.serialize(sort, "string");
192
+ }
193
+
194
+ (<any>Object).assign(localVarHeaderParams, options.headers);
195
+
196
+ let localVarUseFormData = false;
197
+
198
+ let localVarRequestOptions: localVarRequest.Options = {
199
+ method: 'GET',
200
+ qs: localVarQueryParameters,
201
+ headers: localVarHeaderParams,
202
+ uri: localVarPath,
203
+ useQuerystring: this._useQuerystring,
204
+ json: true,
205
+ body: ObjectSerializer.serialize(body, "object")
206
+ };
207
+
208
+ let authenticationPromise = Promise.resolve();
209
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
210
+
211
+ let interceptorPromise = authenticationPromise;
212
+ for (const interceptor of this.interceptors) {
213
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
214
+ }
215
+
216
+ return interceptorPromise.then(() => {
217
+ if (Object.keys(localVarFormParams).length) {
218
+ if (localVarUseFormData) {
219
+ (<any>localVarRequestOptions).formData = localVarFormParams;
220
+ } else {
221
+ localVarRequestOptions.form = localVarFormParams;
222
+ }
223
+ }
224
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
225
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
226
+ if (error) {
227
+ reject(error);
228
+ } else {
229
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
230
+ resolve({ response: response, body: body });
231
+ } else {
232
+ reject(new HttpError(response, body, response.statusCode));
233
+ }
234
+ }
235
+ });
236
+ });
237
+ });
238
+ }
239
+ /**
240
+ *
241
+ * @summary Retrieves the automated offer with the provided ID
242
+ * @param id
243
+ * @param account
244
+ */
245
+ public async automatedOffersControllerFindone (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
246
+ const localVarPath = this.basePath + '/automated-offers/{account}/{id}'
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 automatedOffersControllerFindone.');
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 automatedOffersControllerFindone.');
261
+ }
262
+
263
+ (<any>Object).assign(localVarHeaderParams, options.headers);
264
+
265
+ let localVarUseFormData = false;
266
+
267
+ let localVarRequestOptions: localVarRequest.Options = {
268
+ method: 'GET',
269
+ qs: localVarQueryParameters,
270
+ headers: localVarHeaderParams,
271
+ uri: localVarPath,
272
+ useQuerystring: this._useQuerystring,
273
+ json: true,
274
+ };
275
+
276
+ let authenticationPromise = Promise.resolve();
277
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
278
+
279
+ let interceptorPromise = authenticationPromise;
280
+ for (const interceptor of this.interceptors) {
281
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
282
+ }
283
+
284
+ return interceptorPromise.then(() => {
285
+ if (Object.keys(localVarFormParams).length) {
286
+ if (localVarUseFormData) {
287
+ (<any>localVarRequestOptions).formData = localVarFormParams;
288
+ } else {
289
+ localVarRequestOptions.form = localVarFormParams;
290
+ }
291
+ }
292
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
293
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
294
+ if (error) {
295
+ reject(error);
296
+ } else {
297
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
298
+ resolve({ response: response, body: body });
299
+ } else {
300
+ reject(new HttpError(response, body, response.statusCode));
301
+ }
302
+ }
303
+ });
304
+ });
305
+ });
306
+ }
307
+ /**
308
+ *
309
+ * @summary Removes the automated offer with the provided ID
310
+ * @param id
311
+ * @param account
312
+ */
313
+ public async automatedOffersControllerRemove (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
314
+ const localVarPath = this.basePath + '/automated-offers/{account}/{id}'
315
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
316
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
317
+ let localVarQueryParameters: any = {};
318
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
319
+ let localVarFormParams: any = {};
320
+
321
+ // verify required parameter 'id' is not null or undefined
322
+ if (id === null || id === undefined) {
323
+ throw new Error('Required parameter id was null or undefined when calling automatedOffersControllerRemove.');
324
+ }
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 automatedOffersControllerRemove.');
329
+ }
330
+
331
+ (<any>Object).assign(localVarHeaderParams, options.headers);
332
+
333
+ let localVarUseFormData = false;
334
+
335
+ let localVarRequestOptions: localVarRequest.Options = {
336
+ method: 'DELETE',
337
+ qs: localVarQueryParameters,
338
+ headers: localVarHeaderParams,
339
+ uri: localVarPath,
340
+ useQuerystring: this._useQuerystring,
341
+ json: true,
342
+ };
343
+
344
+ let authenticationPromise = Promise.resolve();
345
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
346
+
347
+ let interceptorPromise = authenticationPromise;
348
+ for (const interceptor of this.interceptors) {
349
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
350
+ }
351
+
352
+ return interceptorPromise.then(() => {
353
+ if (Object.keys(localVarFormParams).length) {
354
+ if (localVarUseFormData) {
355
+ (<any>localVarRequestOptions).formData = localVarFormParams;
356
+ } else {
357
+ localVarRequestOptions.form = localVarFormParams;
358
+ }
359
+ }
360
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
361
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
362
+ if (error) {
363
+ reject(error);
364
+ } else {
365
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
366
+ resolve({ response: response, body: body });
367
+ } else {
368
+ reject(new HttpError(response, body, response.statusCode));
369
+ }
370
+ }
371
+ });
372
+ });
373
+ });
374
+ }
375
+ /**
376
+ *
377
+ * @summary Updates the automated offer with the provided ID
378
+ * @param id
379
+ * @param account
380
+ * @param body
381
+ */
382
+ public async automatedOffersControllerUpdate (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
383
+ const localVarPath = this.basePath + '/automated-offers/{account}/{id}'
384
+ .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
385
+ .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
386
+ let localVarQueryParameters: any = {};
387
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
388
+ let localVarFormParams: any = {};
389
+
390
+ // verify required parameter 'id' is not null or undefined
391
+ if (id === null || id === undefined) {
392
+ throw new Error('Required parameter id was null or undefined when calling automatedOffersControllerUpdate.');
393
+ }
394
+
395
+ // verify required parameter 'account' is not null or undefined
396
+ if (account === null || account === undefined) {
397
+ throw new Error('Required parameter account was null or undefined when calling automatedOffersControllerUpdate.');
398
+ }
399
+
400
+ // verify required parameter 'body' is not null or undefined
401
+ if (body === null || body === undefined) {
402
+ throw new Error('Required parameter body was null or undefined when calling automatedOffersControllerUpdate.');
403
+ }
404
+
405
+ (<any>Object).assign(localVarHeaderParams, options.headers);
406
+
407
+ let localVarUseFormData = false;
408
+
409
+ let localVarRequestOptions: localVarRequest.Options = {
410
+ method: 'PUT',
411
+ qs: localVarQueryParameters,
412
+ headers: localVarHeaderParams,
413
+ uri: localVarPath,
414
+ useQuerystring: this._useQuerystring,
415
+ json: true,
416
+ body: ObjectSerializer.serialize(body, "object")
417
+ };
418
+
419
+ let authenticationPromise = Promise.resolve();
420
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
421
+
422
+ let interceptorPromise = authenticationPromise;
423
+ for (const interceptor of this.interceptors) {
424
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
425
+ }
426
+
427
+ return interceptorPromise.then(() => {
428
+ if (Object.keys(localVarFormParams).length) {
429
+ if (localVarUseFormData) {
430
+ (<any>localVarRequestOptions).formData = localVarFormParams;
431
+ } else {
432
+ localVarRequestOptions.form = localVarFormParams;
433
+ }
434
+ }
435
+ return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
436
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
437
+ if (error) {
438
+ reject(error);
439
+ } else {
440
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
441
+ resolve({ response: response, body: body });
442
+ } else {
443
+ reject(new HttpError(response, body, response.statusCode));
444
+ }
445
+ }
446
+ });
447
+ });
448
+ });
449
+ }
450
+ }
@@ -673,8 +673,9 @@ export class MatchedOffersApi {
673
673
  * @summary Logs a user\'s view of a matched offer
674
674
  * @param id
675
675
  * @param account
676
+ * @param body
676
677
  */
677
- public async matchedOffersControllerLogview (id: string, account: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
678
+ public async matchedOffersControllerLogview (id: string, account: string, body: object, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
678
679
  const localVarPath = this.basePath + '/matched-offers/{account}/{id}/view'
679
680
  .replace('{' + 'id' + '}', encodeURIComponent(String(id)))
680
681
  .replace('{' + 'account' + '}', encodeURIComponent(String(account)));
@@ -692,6 +693,11 @@ export class MatchedOffersApi {
692
693
  throw new Error('Required parameter account was null or undefined when calling matchedOffersControllerLogview.');
693
694
  }
694
695
 
696
+ // verify required parameter 'body' is not null or undefined
697
+ if (body === null || body === undefined) {
698
+ throw new Error('Required parameter body was null or undefined when calling matchedOffersControllerLogview.');
699
+ }
700
+
695
701
  (<any>Object).assign(localVarHeaderParams, options.headers);
696
702
 
697
703
  let localVarUseFormData = false;
@@ -703,6 +709,7 @@ export class MatchedOffersApi {
703
709
  uri: localVarPath,
704
710
  useQuerystring: this._useQuerystring,
705
711
  json: true,
712
+ body: ObjectSerializer.serialize(body, "object")
706
713
  };
707
714
 
708
715
  let authenticationPromise = Promise.resolve();
@@ -1,18 +1,20 @@
1
- /// <reference types="node" />
2
- export * from './futureBidsApi';
3
- import { FutureBidsApi } from './futureBidsApi';
4
- export * from './healthApi';
5
- import { HealthApi } from './healthApi';
6
- export * from './matchedOffersApi';
7
- import { MatchedOffersApi } from './matchedOffersApi';
8
- export * from './offersApi';
9
- import { OffersApi } from './offersApi';
10
- import * as http from 'http';
11
- export declare class HttpError extends Error {
12
- response: http.IncomingMessage;
13
- body: any;
14
- statusCode?: number | undefined;
15
- constructor(response: http.IncomingMessage, body: any, statusCode?: number | undefined);
16
- }
17
- export { RequestFile } from '../model/models';
18
- export declare const APIS: (typeof FutureBidsApi | typeof HealthApi | typeof MatchedOffersApi | typeof OffersApi)[];
1
+ /// <reference types="node" />
2
+ export * from './automatedOffersApi';
3
+ import { AutomatedOffersApi } from './automatedOffersApi';
4
+ export * from './futureBidsApi';
5
+ import { FutureBidsApi } from './futureBidsApi';
6
+ export * from './healthApi';
7
+ import { HealthApi } from './healthApi';
8
+ export * from './matchedOffersApi';
9
+ import { MatchedOffersApi } from './matchedOffersApi';
10
+ export * from './offersApi';
11
+ import { OffersApi } from './offersApi';
12
+ import * as http from 'http';
13
+ export declare class HttpError extends Error {
14
+ response: http.IncomingMessage;
15
+ body: any;
16
+ statusCode?: number | undefined;
17
+ constructor(response: http.IncomingMessage, body: any, statusCode?: number | undefined);
18
+ }
19
+ export { RequestFile } from '../model/models';
20
+ export declare const APIS: (typeof AutomatedOffersApi | typeof FutureBidsApi | typeof HealthApi | typeof MatchedOffersApi | typeof OffersApi)[];