@aurigma/ng-storefront-api-client 2.2.53

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,2861 @@
1
+ import { InjectionToken, ɵɵdefineInjectable, ɵɵinject, Injectable, Inject, Optional, NgModule } from '@angular/core';
2
+ import { __awaiter } from 'tslib';
3
+ import { mergeMap, catchError } from 'rxjs/operators';
4
+ import { from, throwError, Observable, of } from 'rxjs';
5
+ import { HttpHeaders, HttpResponseBase, HttpResponse, HttpClient } from '@angular/common/http';
6
+
7
+ const API_BASE_URL = new InjectionToken('API_BASE_URL');
8
+ class ApiClientConfiguration {
9
+ constructor() {
10
+ this.apiKey = 'ApiKey';
11
+ this.authorizationToken = null;
12
+ }
13
+ getAuthorizationToken() {
14
+ return __awaiter(this, void 0, void 0, function* () { return this.authorizationToken; });
15
+ }
16
+ ;
17
+ setAuthorizationToken(token) { this.authorizationToken = token; }
18
+ ;
19
+ }
20
+ class ApiClientBase {
21
+ constructor(configuration) {
22
+ this.configuration = configuration;
23
+ }
24
+ transformOptions(options) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const token = yield this.configuration.getAuthorizationToken();
27
+ if (token != null) {
28
+ options.headers = options.headers.append("authorization", "Bearer " + token);
29
+ }
30
+ else {
31
+ options.headers = options.headers.append("X-API-Key", this.configuration.apiKey);
32
+ }
33
+ //options = { ...options, transformResponse: (res) => res, responseType: 'json' };
34
+ return options;
35
+ });
36
+ }
37
+ getBaseUrl(defultUrl) {
38
+ return this.configuration.apiUrl;
39
+ }
40
+ transformResult(url, res, cb) {
41
+ return cb(res);
42
+ }
43
+ }
44
+ class BuildInfoApiClient extends ApiClientBase {
45
+ constructor(configuration, http, baseUrl) {
46
+ super(configuration);
47
+ this.jsonParseReviver = undefined;
48
+ this.http = http;
49
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
50
+ }
51
+ /**
52
+ * Gets assembly build info
53
+ * @return Success
54
+ */
55
+ headInfo() {
56
+ let url_ = this.baseUrl + "/api/storefront/v1/info";
57
+ url_ = url_.replace(/[?&]$/, "");
58
+ let options_ = {
59
+ observe: "response",
60
+ responseType: "blob",
61
+ headers: new HttpHeaders({})
62
+ };
63
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
64
+ return this.http.request("head", url_, transformedOptions_);
65
+ })).pipe(mergeMap((response_) => {
66
+ return this.transformResult(url_, response_, (r) => this.processHeadInfo(r));
67
+ })).pipe(catchError((response_) => {
68
+ if (response_ instanceof HttpResponseBase) {
69
+ try {
70
+ return this.transformResult(url_, response_, (r) => this.processHeadInfo(r));
71
+ }
72
+ catch (e) {
73
+ return throwError(e);
74
+ }
75
+ }
76
+ else
77
+ return throwError(response_);
78
+ }));
79
+ }
80
+ processHeadInfo(response) {
81
+ const status = response.status;
82
+ const responseBlob = response instanceof HttpResponse ? response.body :
83
+ response.error instanceof Blob ? response.error : undefined;
84
+ let _headers = {};
85
+ if (response.headers) {
86
+ for (let key of response.headers.keys()) {
87
+ _headers[key] = response.headers.get(key);
88
+ }
89
+ }
90
+ if (status === 200) {
91
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
92
+ return of(null);
93
+ }));
94
+ }
95
+ else if (status !== 200 && status !== 204) {
96
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
97
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
98
+ }));
99
+ }
100
+ return of(null);
101
+ }
102
+ /**
103
+ * Gets assembly build info
104
+ * @return Success
105
+ */
106
+ getInfo() {
107
+ let url_ = this.baseUrl + "/api/storefront/v1/info";
108
+ url_ = url_.replace(/[?&]$/, "");
109
+ let options_ = {
110
+ observe: "response",
111
+ responseType: "blob",
112
+ headers: new HttpHeaders({
113
+ "Accept": "text/plain"
114
+ })
115
+ };
116
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
117
+ return this.http.request("get", url_, transformedOptions_);
118
+ })).pipe(mergeMap((response_) => {
119
+ return this.transformResult(url_, response_, (r) => this.processGetInfo(r));
120
+ })).pipe(catchError((response_) => {
121
+ if (response_ instanceof HttpResponseBase) {
122
+ try {
123
+ return this.transformResult(url_, response_, (r) => this.processGetInfo(r));
124
+ }
125
+ catch (e) {
126
+ return throwError(e);
127
+ }
128
+ }
129
+ else
130
+ return throwError(response_);
131
+ }));
132
+ }
133
+ processGetInfo(response) {
134
+ const status = response.status;
135
+ const responseBlob = response instanceof HttpResponse ? response.body :
136
+ response.error instanceof Blob ? response.error : undefined;
137
+ let _headers = {};
138
+ if (response.headers) {
139
+ for (let key of response.headers.keys()) {
140
+ _headers[key] = response.headers.get(key);
141
+ }
142
+ }
143
+ if (status === 200) {
144
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
145
+ let result200 = null;
146
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
147
+ return of(result200);
148
+ }));
149
+ }
150
+ else if (status !== 200 && status !== 204) {
151
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
152
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
153
+ }));
154
+ }
155
+ return of(null);
156
+ }
157
+ }
158
+ BuildInfoApiClient.ɵprov = ɵɵdefineInjectable({ factory: function BuildInfoApiClient_Factory() { return new BuildInfoApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: BuildInfoApiClient, providedIn: "root" });
159
+ BuildInfoApiClient.decorators = [
160
+ { type: Injectable, args: [{
161
+ providedIn: 'root'
162
+ },] }
163
+ ];
164
+ BuildInfoApiClient.ctorParameters = () => [
165
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
166
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
167
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
168
+ ];
169
+ class ProductReferencesApiClient extends ApiClientBase {
170
+ constructor(configuration, http, baseUrl) {
171
+ super(configuration);
172
+ this.jsonParseReviver = undefined;
173
+ this.http = http;
174
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
175
+ }
176
+ /**
177
+ * Gets all storefront product references relevant to specified query parameters
178
+ * @param storefrontId Storefront identifier
179
+ * @param productReference (optional) Product reference filter. Product reference is an external reference to Customer's Canvas product specification, e.g online store product identifier
180
+ * @param productSpecificationId (optional) Cusomer's Canvas product specification filter
181
+ * @param skip (optional) Defines page start offset from beginning of sorted result list
182
+ * @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
183
+ * @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
184
+ * @param search (optional) Search string for partial match
185
+ * @param tenantId (optional) Tenant identifier
186
+ * @param userId (optional) User identifier
187
+ * @return Success
188
+ */
189
+ getAll(storefrontId, productReference, productSpecificationId, skip, take, sorting, search, tenantId, userId) {
190
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references?";
191
+ if (storefrontId === undefined || storefrontId === null)
192
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
193
+ else
194
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
195
+ if (productReference !== undefined && productReference !== null)
196
+ url_ += "productReference=" + encodeURIComponent("" + productReference) + "&";
197
+ if (productSpecificationId !== undefined && productSpecificationId !== null)
198
+ url_ += "productSpecificationId=" + encodeURIComponent("" + productSpecificationId) + "&";
199
+ if (skip !== undefined && skip !== null)
200
+ url_ += "skip=" + encodeURIComponent("" + skip) + "&";
201
+ if (take !== undefined && take !== null)
202
+ url_ += "take=" + encodeURIComponent("" + take) + "&";
203
+ if (sorting !== undefined && sorting !== null)
204
+ url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
205
+ if (search !== undefined && search !== null)
206
+ url_ += "search=" + encodeURIComponent("" + search) + "&";
207
+ if (tenantId !== undefined && tenantId !== null)
208
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
209
+ if (userId !== undefined && userId !== null)
210
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
211
+ url_ = url_.replace(/[?&]$/, "");
212
+ let options_ = {
213
+ observe: "response",
214
+ responseType: "blob",
215
+ headers: new HttpHeaders({
216
+ "Accept": "text/plain"
217
+ })
218
+ };
219
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
220
+ return this.http.request("get", url_, transformedOptions_);
221
+ })).pipe(mergeMap((response_) => {
222
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
223
+ })).pipe(catchError((response_) => {
224
+ if (response_ instanceof HttpResponseBase) {
225
+ try {
226
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
227
+ }
228
+ catch (e) {
229
+ return throwError(e);
230
+ }
231
+ }
232
+ else
233
+ return throwError(response_);
234
+ }));
235
+ }
236
+ processGetAll(response) {
237
+ const status = response.status;
238
+ const responseBlob = response instanceof HttpResponse ? response.body :
239
+ response.error instanceof Blob ? response.error : undefined;
240
+ let _headers = {};
241
+ if (response.headers) {
242
+ for (let key of response.headers.keys()) {
243
+ _headers[key] = response.headers.get(key);
244
+ }
245
+ }
246
+ if (status === 200) {
247
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
248
+ let result200 = null;
249
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
250
+ return of(result200);
251
+ }));
252
+ }
253
+ else if (status === 401) {
254
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
255
+ return throwException("Unauthorized", status, _responseText, _headers);
256
+ }));
257
+ }
258
+ else if (status === 403) {
259
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
260
+ return throwException("Forbidden", status, _responseText, _headers);
261
+ }));
262
+ }
263
+ else if (status !== 200 && status !== 204) {
264
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
265
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
266
+ }));
267
+ }
268
+ return of(null);
269
+ }
270
+ /**
271
+ * Creates new storefront product reference
272
+ * @param storefrontId Storefront identifier
273
+ * @param tenantId (optional) Tenant identifier
274
+ * @param userId (optional) User identifier
275
+ * @param body (optional) Create operation parameters
276
+ * @return Success
277
+ */
278
+ create(storefrontId, tenantId, userId, body) {
279
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references?";
280
+ if (storefrontId === undefined || storefrontId === null)
281
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
282
+ else
283
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
284
+ if (tenantId !== undefined && tenantId !== null)
285
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
286
+ if (userId !== undefined && userId !== null)
287
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
288
+ url_ = url_.replace(/[?&]$/, "");
289
+ const content_ = JSON.stringify(body);
290
+ let options_ = {
291
+ body: content_,
292
+ observe: "response",
293
+ responseType: "blob",
294
+ headers: new HttpHeaders({
295
+ "Content-Type": "application/json-patch+json",
296
+ "Accept": "text/plain"
297
+ })
298
+ };
299
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
300
+ return this.http.request("post", url_, transformedOptions_);
301
+ })).pipe(mergeMap((response_) => {
302
+ return this.transformResult(url_, response_, (r) => this.processCreate(r));
303
+ })).pipe(catchError((response_) => {
304
+ if (response_ instanceof HttpResponseBase) {
305
+ try {
306
+ return this.transformResult(url_, response_, (r) => this.processCreate(r));
307
+ }
308
+ catch (e) {
309
+ return throwError(e);
310
+ }
311
+ }
312
+ else
313
+ return throwError(response_);
314
+ }));
315
+ }
316
+ processCreate(response) {
317
+ const status = response.status;
318
+ const responseBlob = response instanceof HttpResponse ? response.body :
319
+ response.error instanceof Blob ? response.error : undefined;
320
+ let _headers = {};
321
+ if (response.headers) {
322
+ for (let key of response.headers.keys()) {
323
+ _headers[key] = response.headers.get(key);
324
+ }
325
+ }
326
+ if (status === 201) {
327
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
328
+ let result201 = null;
329
+ result201 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
330
+ return of(result201);
331
+ }));
332
+ }
333
+ else if (status === 404) {
334
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
335
+ let result404 = null;
336
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
337
+ return throwException("Not Found", status, _responseText, _headers, result404);
338
+ }));
339
+ }
340
+ else if (status === 401) {
341
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
342
+ return throwException("Unauthorized", status, _responseText, _headers);
343
+ }));
344
+ }
345
+ else if (status === 403) {
346
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
347
+ return throwException("Forbidden", status, _responseText, _headers);
348
+ }));
349
+ }
350
+ else if (status !== 200 && status !== 204) {
351
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
352
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
353
+ }));
354
+ }
355
+ return of(null);
356
+ }
357
+ /**
358
+ * Gets storefront product reference
359
+ * @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
360
+ * @param storefrontId Storefront identifier
361
+ * @param tenantId (optional) Tenant identifier
362
+ * @param userId (optional) User identifier
363
+ * @return Success
364
+ */
365
+ get(reference, storefrontId, tenantId, userId) {
366
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}?";
367
+ if (reference === undefined || reference === null)
368
+ throw new Error("The parameter 'reference' must be defined.");
369
+ url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
370
+ if (storefrontId === undefined || storefrontId === null)
371
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
372
+ else
373
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
374
+ if (tenantId !== undefined && tenantId !== null)
375
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
376
+ if (userId !== undefined && userId !== null)
377
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
378
+ url_ = url_.replace(/[?&]$/, "");
379
+ let options_ = {
380
+ observe: "response",
381
+ responseType: "blob",
382
+ headers: new HttpHeaders({
383
+ "Accept": "text/plain"
384
+ })
385
+ };
386
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
387
+ return this.http.request("get", url_, transformedOptions_);
388
+ })).pipe(mergeMap((response_) => {
389
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
390
+ })).pipe(catchError((response_) => {
391
+ if (response_ instanceof HttpResponseBase) {
392
+ try {
393
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
394
+ }
395
+ catch (e) {
396
+ return throwError(e);
397
+ }
398
+ }
399
+ else
400
+ return throwError(response_);
401
+ }));
402
+ }
403
+ processGet(response) {
404
+ const status = response.status;
405
+ const responseBlob = response instanceof HttpResponse ? response.body :
406
+ response.error instanceof Blob ? response.error : undefined;
407
+ let _headers = {};
408
+ if (response.headers) {
409
+ for (let key of response.headers.keys()) {
410
+ _headers[key] = response.headers.get(key);
411
+ }
412
+ }
413
+ if (status === 200) {
414
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
415
+ let result200 = null;
416
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
417
+ return of(result200);
418
+ }));
419
+ }
420
+ else if (status === 404) {
421
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
422
+ let result404 = null;
423
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
424
+ return throwException("Not Found", status, _responseText, _headers, result404);
425
+ }));
426
+ }
427
+ else if (status === 401) {
428
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
429
+ return throwException("Unauthorized", status, _responseText, _headers);
430
+ }));
431
+ }
432
+ else if (status === 403) {
433
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
434
+ return throwException("Forbidden", status, _responseText, _headers);
435
+ }));
436
+ }
437
+ else if (status !== 200 && status !== 204) {
438
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
439
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
440
+ }));
441
+ }
442
+ return of(null);
443
+ }
444
+ /**
445
+ * Deletes storefront product reference
446
+ * @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
447
+ * @param storefrontId Storefront identifier
448
+ * @param tenantId (optional) Tenant identifier
449
+ * @param userId (optional) User identifier
450
+ * @return Success
451
+ */
452
+ delete(reference, storefrontId, tenantId, userId) {
453
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}?";
454
+ if (reference === undefined || reference === null)
455
+ throw new Error("The parameter 'reference' must be defined.");
456
+ url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
457
+ if (storefrontId === undefined || storefrontId === null)
458
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
459
+ else
460
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
461
+ if (tenantId !== undefined && tenantId !== null)
462
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
463
+ if (userId !== undefined && userId !== null)
464
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
465
+ url_ = url_.replace(/[?&]$/, "");
466
+ let options_ = {
467
+ observe: "response",
468
+ responseType: "blob",
469
+ headers: new HttpHeaders({
470
+ "Accept": "text/plain"
471
+ })
472
+ };
473
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
474
+ return this.http.request("delete", url_, transformedOptions_);
475
+ })).pipe(mergeMap((response_) => {
476
+ return this.transformResult(url_, response_, (r) => this.processDelete(r));
477
+ })).pipe(catchError((response_) => {
478
+ if (response_ instanceof HttpResponseBase) {
479
+ try {
480
+ return this.transformResult(url_, response_, (r) => this.processDelete(r));
481
+ }
482
+ catch (e) {
483
+ return throwError(e);
484
+ }
485
+ }
486
+ else
487
+ return throwError(response_);
488
+ }));
489
+ }
490
+ processDelete(response) {
491
+ const status = response.status;
492
+ const responseBlob = response instanceof HttpResponse ? response.body :
493
+ response.error instanceof Blob ? response.error : undefined;
494
+ let _headers = {};
495
+ if (response.headers) {
496
+ for (let key of response.headers.keys()) {
497
+ _headers[key] = response.headers.get(key);
498
+ }
499
+ }
500
+ if (status === 200) {
501
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
502
+ let result200 = null;
503
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
504
+ return of(result200);
505
+ }));
506
+ }
507
+ else if (status === 404) {
508
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
509
+ let result404 = null;
510
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
511
+ return throwException("Not Found", status, _responseText, _headers, result404);
512
+ }));
513
+ }
514
+ else if (status === 401) {
515
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
516
+ return throwException("Unauthorized", status, _responseText, _headers);
517
+ }));
518
+ }
519
+ else if (status === 403) {
520
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
521
+ return throwException("Forbidden", status, _responseText, _headers);
522
+ }));
523
+ }
524
+ else if (status !== 200 && status !== 204) {
525
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
526
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
527
+ }));
528
+ }
529
+ return of(null);
530
+ }
531
+ /**
532
+ * Gets product specification by storefront product reference
533
+ * @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
534
+ * @param storefrontId Storefront identifier
535
+ * @param tenantId (optional) Tenant identifier
536
+ * @param userId (optional) User identifier
537
+ * @return Success
538
+ */
539
+ getProductSpecification(reference, storefrontId, tenantId, userId) {
540
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}/product-specification?";
541
+ if (reference === undefined || reference === null)
542
+ throw new Error("The parameter 'reference' must be defined.");
543
+ url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
544
+ if (storefrontId === undefined || storefrontId === null)
545
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
546
+ else
547
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
548
+ if (tenantId !== undefined && tenantId !== null)
549
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
550
+ if (userId !== undefined && userId !== null)
551
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
552
+ url_ = url_.replace(/[?&]$/, "");
553
+ let options_ = {
554
+ observe: "response",
555
+ responseType: "blob",
556
+ headers: new HttpHeaders({
557
+ "Accept": "text/plain"
558
+ })
559
+ };
560
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
561
+ return this.http.request("get", url_, transformedOptions_);
562
+ })).pipe(mergeMap((response_) => {
563
+ return this.transformResult(url_, response_, (r) => this.processGetProductSpecification(r));
564
+ })).pipe(catchError((response_) => {
565
+ if (response_ instanceof HttpResponseBase) {
566
+ try {
567
+ return this.transformResult(url_, response_, (r) => this.processGetProductSpecification(r));
568
+ }
569
+ catch (e) {
570
+ return throwError(e);
571
+ }
572
+ }
573
+ else
574
+ return throwError(response_);
575
+ }));
576
+ }
577
+ processGetProductSpecification(response) {
578
+ const status = response.status;
579
+ const responseBlob = response instanceof HttpResponse ? response.body :
580
+ response.error instanceof Blob ? response.error : undefined;
581
+ let _headers = {};
582
+ if (response.headers) {
583
+ for (let key of response.headers.keys()) {
584
+ _headers[key] = response.headers.get(key);
585
+ }
586
+ }
587
+ if (status === 200) {
588
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
589
+ let result200 = null;
590
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
591
+ return of(result200);
592
+ }));
593
+ }
594
+ else if (status === 404) {
595
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
596
+ let result404 = null;
597
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
598
+ return throwException("Not Found", status, _responseText, _headers, result404);
599
+ }));
600
+ }
601
+ else if (status === 401) {
602
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
603
+ return throwException("Unauthorized", status, _responseText, _headers);
604
+ }));
605
+ }
606
+ else if (status === 403) {
607
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
608
+ return throwException("Forbidden", status, _responseText, _headers);
609
+ }));
610
+ }
611
+ else if (status !== 200 && status !== 204) {
612
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
613
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
614
+ }));
615
+ }
616
+ return of(null);
617
+ }
618
+ /**
619
+ * Gets product configuration information by storefront product reference
620
+ * @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier
621
+ * @param storefrontId Storefront identifier
622
+ * @param tenantId (optional) Tenant identifier
623
+ * @param userId (optional) User identifier
624
+ * @return Success
625
+ */
626
+ getProductConfig(reference, storefrontId, tenantId, userId) {
627
+ let url_ = this.baseUrl + "/api/storefront/v1/product-references/{reference}/product-config?";
628
+ if (reference === undefined || reference === null)
629
+ throw new Error("The parameter 'reference' must be defined.");
630
+ url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
631
+ if (storefrontId === undefined || storefrontId === null)
632
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
633
+ else
634
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
635
+ if (tenantId !== undefined && tenantId !== null)
636
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
637
+ if (userId !== undefined && userId !== null)
638
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
639
+ url_ = url_.replace(/[?&]$/, "");
640
+ let options_ = {
641
+ observe: "response",
642
+ responseType: "blob",
643
+ headers: new HttpHeaders({
644
+ "Accept": "text/plain"
645
+ })
646
+ };
647
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
648
+ return this.http.request("get", url_, transformedOptions_);
649
+ })).pipe(mergeMap((response_) => {
650
+ return this.transformResult(url_, response_, (r) => this.processGetProductConfig(r));
651
+ })).pipe(catchError((response_) => {
652
+ if (response_ instanceof HttpResponseBase) {
653
+ try {
654
+ return this.transformResult(url_, response_, (r) => this.processGetProductConfig(r));
655
+ }
656
+ catch (e) {
657
+ return throwError(e);
658
+ }
659
+ }
660
+ else
661
+ return throwError(response_);
662
+ }));
663
+ }
664
+ processGetProductConfig(response) {
665
+ const status = response.status;
666
+ const responseBlob = response instanceof HttpResponse ? response.body :
667
+ response.error instanceof Blob ? response.error : undefined;
668
+ let _headers = {};
669
+ if (response.headers) {
670
+ for (let key of response.headers.keys()) {
671
+ _headers[key] = response.headers.get(key);
672
+ }
673
+ }
674
+ if (status === 200) {
675
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
676
+ let result200 = null;
677
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
678
+ return of(result200);
679
+ }));
680
+ }
681
+ else if (status === 404) {
682
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
683
+ let result404 = null;
684
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
685
+ return throwException("Not Found", status, _responseText, _headers, result404);
686
+ }));
687
+ }
688
+ else if (status === 401) {
689
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
690
+ return throwException("Unauthorized", status, _responseText, _headers);
691
+ }));
692
+ }
693
+ else if (status === 403) {
694
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
695
+ return throwException("Forbidden", status, _responseText, _headers);
696
+ }));
697
+ }
698
+ else if (status !== 200 && status !== 204) {
699
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
700
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
701
+ }));
702
+ }
703
+ return of(null);
704
+ }
705
+ }
706
+ ProductReferencesApiClient.ɵprov = ɵɵdefineInjectable({ factory: function ProductReferencesApiClient_Factory() { return new ProductReferencesApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: ProductReferencesApiClient, providedIn: "root" });
707
+ ProductReferencesApiClient.decorators = [
708
+ { type: Injectable, args: [{
709
+ providedIn: 'root'
710
+ },] }
711
+ ];
712
+ ProductReferencesApiClient.ctorParameters = () => [
713
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
714
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
715
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
716
+ ];
717
+ class ProductSpecificationsApiClient extends ApiClientBase {
718
+ constructor(configuration, http, baseUrl) {
719
+ super(configuration);
720
+ this.jsonParseReviver = undefined;
721
+ this.http = http;
722
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
723
+ }
724
+ /**
725
+ * Gets all product specifications relevant to specified query parameters
726
+ * @param skip (optional) Defines page start offset from beginning of sorted result list
727
+ * @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
728
+ * @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
729
+ * @param search (optional) Search string for partial match
730
+ * @param tenantId (optional) Tenant identifier
731
+ * @param userId (optional) User identifier
732
+ * @return Success
733
+ */
734
+ getAll(skip, take, sorting, search, tenantId, userId) {
735
+ let url_ = this.baseUrl + "/api/storefront/v1/product-specifications?";
736
+ if (skip !== undefined && skip !== null)
737
+ url_ += "skip=" + encodeURIComponent("" + skip) + "&";
738
+ if (take !== undefined && take !== null)
739
+ url_ += "take=" + encodeURIComponent("" + take) + "&";
740
+ if (sorting !== undefined && sorting !== null)
741
+ url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
742
+ if (search !== undefined && search !== null)
743
+ url_ += "search=" + encodeURIComponent("" + search) + "&";
744
+ if (tenantId !== undefined && tenantId !== null)
745
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
746
+ if (userId !== undefined && userId !== null)
747
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
748
+ url_ = url_.replace(/[?&]$/, "");
749
+ let options_ = {
750
+ observe: "response",
751
+ responseType: "blob",
752
+ headers: new HttpHeaders({
753
+ "Accept": "text/plain"
754
+ })
755
+ };
756
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
757
+ return this.http.request("get", url_, transformedOptions_);
758
+ })).pipe(mergeMap((response_) => {
759
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
760
+ })).pipe(catchError((response_) => {
761
+ if (response_ instanceof HttpResponseBase) {
762
+ try {
763
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
764
+ }
765
+ catch (e) {
766
+ return throwError(e);
767
+ }
768
+ }
769
+ else
770
+ return throwError(response_);
771
+ }));
772
+ }
773
+ processGetAll(response) {
774
+ const status = response.status;
775
+ const responseBlob = response instanceof HttpResponse ? response.body :
776
+ response.error instanceof Blob ? response.error : undefined;
777
+ let _headers = {};
778
+ if (response.headers) {
779
+ for (let key of response.headers.keys()) {
780
+ _headers[key] = response.headers.get(key);
781
+ }
782
+ }
783
+ if (status === 200) {
784
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
785
+ let result200 = null;
786
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
787
+ return of(result200);
788
+ }));
789
+ }
790
+ else if (status === 401) {
791
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
792
+ return throwException("Unauthorized", status, _responseText, _headers);
793
+ }));
794
+ }
795
+ else if (status === 403) {
796
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
797
+ return throwException("Forbidden", status, _responseText, _headers);
798
+ }));
799
+ }
800
+ else if (status !== 200 && status !== 204) {
801
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
802
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
803
+ }));
804
+ }
805
+ return of(null);
806
+ }
807
+ /**
808
+ * Gets product specification by id
809
+ * @param id Product specification identifier
810
+ * @param tenantId (optional) Tenant identifier
811
+ * @param userId (optional) User identifier
812
+ * @return Success
813
+ */
814
+ get(id, tenantId, userId) {
815
+ let url_ = this.baseUrl + "/api/storefront/v1/product-specifications/{id}?";
816
+ if (id === undefined || id === null)
817
+ throw new Error("The parameter 'id' must be defined.");
818
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
819
+ if (tenantId !== undefined && tenantId !== null)
820
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
821
+ if (userId !== undefined && userId !== null)
822
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
823
+ url_ = url_.replace(/[?&]$/, "");
824
+ let options_ = {
825
+ observe: "response",
826
+ responseType: "blob",
827
+ headers: new HttpHeaders({
828
+ "Accept": "text/plain"
829
+ })
830
+ };
831
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
832
+ return this.http.request("get", url_, transformedOptions_);
833
+ })).pipe(mergeMap((response_) => {
834
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
835
+ })).pipe(catchError((response_) => {
836
+ if (response_ instanceof HttpResponseBase) {
837
+ try {
838
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
839
+ }
840
+ catch (e) {
841
+ return throwError(e);
842
+ }
843
+ }
844
+ else
845
+ return throwError(response_);
846
+ }));
847
+ }
848
+ processGet(response) {
849
+ const status = response.status;
850
+ const responseBlob = response instanceof HttpResponse ? response.body :
851
+ response.error instanceof Blob ? response.error : undefined;
852
+ let _headers = {};
853
+ if (response.headers) {
854
+ for (let key of response.headers.keys()) {
855
+ _headers[key] = response.headers.get(key);
856
+ }
857
+ }
858
+ if (status === 200) {
859
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
860
+ let result200 = null;
861
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
862
+ return of(result200);
863
+ }));
864
+ }
865
+ else if (status === 404) {
866
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
867
+ let result404 = null;
868
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
869
+ return throwException("Not Found", status, _responseText, _headers, result404);
870
+ }));
871
+ }
872
+ else if (status === 401) {
873
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
874
+ return throwException("Unauthorized", status, _responseText, _headers);
875
+ }));
876
+ }
877
+ else if (status === 403) {
878
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
879
+ return throwException("Forbidden", status, _responseText, _headers);
880
+ }));
881
+ }
882
+ else if (status !== 200 && status !== 204) {
883
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
884
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
885
+ }));
886
+ }
887
+ return of(null);
888
+ }
889
+ /**
890
+ * Gets product configuration description by product specification id
891
+ * @param id Product specification identifier
892
+ * @param tenantId (optional) Tenant identifier
893
+ * @param userId (optional) User identifier
894
+ * @return Success
895
+ */
896
+ getConfiguration(id, tenantId, userId) {
897
+ let url_ = this.baseUrl + "/api/storefront/v1/product-specifications/{id}/config?";
898
+ if (id === undefined || id === null)
899
+ throw new Error("The parameter 'id' must be defined.");
900
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
901
+ if (tenantId !== undefined && tenantId !== null)
902
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
903
+ if (userId !== undefined && userId !== null)
904
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
905
+ url_ = url_.replace(/[?&]$/, "");
906
+ let options_ = {
907
+ observe: "response",
908
+ responseType: "blob",
909
+ headers: new HttpHeaders({
910
+ "Accept": "text/plain"
911
+ })
912
+ };
913
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
914
+ return this.http.request("get", url_, transformedOptions_);
915
+ })).pipe(mergeMap((response_) => {
916
+ return this.transformResult(url_, response_, (r) => this.processGetConfiguration(r));
917
+ })).pipe(catchError((response_) => {
918
+ if (response_ instanceof HttpResponseBase) {
919
+ try {
920
+ return this.transformResult(url_, response_, (r) => this.processGetConfiguration(r));
921
+ }
922
+ catch (e) {
923
+ return throwError(e);
924
+ }
925
+ }
926
+ else
927
+ return throwError(response_);
928
+ }));
929
+ }
930
+ processGetConfiguration(response) {
931
+ const status = response.status;
932
+ const responseBlob = response instanceof HttpResponse ? response.body :
933
+ response.error instanceof Blob ? response.error : undefined;
934
+ let _headers = {};
935
+ if (response.headers) {
936
+ for (let key of response.headers.keys()) {
937
+ _headers[key] = response.headers.get(key);
938
+ }
939
+ }
940
+ if (status === 200) {
941
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
942
+ let result200 = null;
943
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
944
+ return of(result200);
945
+ }));
946
+ }
947
+ else if (status === 404) {
948
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
949
+ let result404 = null;
950
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
951
+ return throwException("Not Found", status, _responseText, _headers, result404);
952
+ }));
953
+ }
954
+ else if (status === 401) {
955
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
956
+ return throwException("Unauthorized", status, _responseText, _headers);
957
+ }));
958
+ }
959
+ else if (status === 403) {
960
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
961
+ return throwException("Forbidden", status, _responseText, _headers);
962
+ }));
963
+ }
964
+ else if (status !== 200 && status !== 204) {
965
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
966
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
967
+ }));
968
+ }
969
+ return of(null);
970
+ }
971
+ }
972
+ ProductSpecificationsApiClient.ɵprov = ɵɵdefineInjectable({ factory: function ProductSpecificationsApiClient_Factory() { return new ProductSpecificationsApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: ProductSpecificationsApiClient, providedIn: "root" });
973
+ ProductSpecificationsApiClient.decorators = [
974
+ { type: Injectable, args: [{
975
+ providedIn: 'root'
976
+ },] }
977
+ ];
978
+ ProductSpecificationsApiClient.ctorParameters = () => [
979
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
980
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
981
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
982
+ ];
983
+ class ProjectsApiClient extends ApiClientBase {
984
+ constructor(configuration, http, baseUrl) {
985
+ super(configuration);
986
+ this.jsonParseReviver = undefined;
987
+ this.http = http;
988
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
989
+ }
990
+ /**
991
+ * Gets all projects relevant to specified query parameters
992
+ * @param storefrontId Storefront identifier
993
+ * @param ownerId (optional) Project owner (storefront user id) filter
994
+ * @param productReference (optional) Product reference filter
995
+ * @param status (optional) Project status filter
996
+ * @param datePeriod (optional) Project date period filter
997
+ * @param skip (optional) Defines page start offset from beginning of sorted result list
998
+ * @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
999
+ * @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
1000
+ * @param search (optional) Search string for partial match
1001
+ * @param tenantId (optional) Tenant identifier
1002
+ * @param userId (optional) User identifier
1003
+ * @return Success
1004
+ */
1005
+ getAll(storefrontId, ownerId, productReference, status, datePeriod, skip, take, sorting, search, tenantId, userId) {
1006
+ let url_ = this.baseUrl + "/api/storefront/v1/projects?";
1007
+ if (storefrontId === undefined || storefrontId === null)
1008
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
1009
+ else
1010
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
1011
+ if (ownerId !== undefined && ownerId !== null)
1012
+ url_ += "ownerId=" + encodeURIComponent("" + ownerId) + "&";
1013
+ if (productReference !== undefined && productReference !== null)
1014
+ url_ += "productReference=" + encodeURIComponent("" + productReference) + "&";
1015
+ if (status !== undefined && status !== null)
1016
+ url_ += "status=" + encodeURIComponent("" + status) + "&";
1017
+ if (datePeriod === null)
1018
+ throw new Error("The parameter 'datePeriod' cannot be null.");
1019
+ else if (datePeriod !== undefined)
1020
+ url_ += "datePeriod=" + encodeURIComponent("" + datePeriod) + "&";
1021
+ if (skip !== undefined && skip !== null)
1022
+ url_ += "skip=" + encodeURIComponent("" + skip) + "&";
1023
+ if (take !== undefined && take !== null)
1024
+ url_ += "take=" + encodeURIComponent("" + take) + "&";
1025
+ if (sorting !== undefined && sorting !== null)
1026
+ url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
1027
+ if (search !== undefined && search !== null)
1028
+ url_ += "search=" + encodeURIComponent("" + search) + "&";
1029
+ if (tenantId !== undefined && tenantId !== null)
1030
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1031
+ if (userId !== undefined && userId !== null)
1032
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1033
+ url_ = url_.replace(/[?&]$/, "");
1034
+ let options_ = {
1035
+ observe: "response",
1036
+ responseType: "blob",
1037
+ headers: new HttpHeaders({
1038
+ "Accept": "text/plain"
1039
+ })
1040
+ };
1041
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1042
+ return this.http.request("get", url_, transformedOptions_);
1043
+ })).pipe(mergeMap((response_) => {
1044
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
1045
+ })).pipe(catchError((response_) => {
1046
+ if (response_ instanceof HttpResponseBase) {
1047
+ try {
1048
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
1049
+ }
1050
+ catch (e) {
1051
+ return throwError(e);
1052
+ }
1053
+ }
1054
+ else
1055
+ return throwError(response_);
1056
+ }));
1057
+ }
1058
+ processGetAll(response) {
1059
+ const status = response.status;
1060
+ const responseBlob = response instanceof HttpResponse ? response.body :
1061
+ response.error instanceof Blob ? response.error : undefined;
1062
+ let _headers = {};
1063
+ if (response.headers) {
1064
+ for (let key of response.headers.keys()) {
1065
+ _headers[key] = response.headers.get(key);
1066
+ }
1067
+ }
1068
+ if (status === 200) {
1069
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1070
+ let result200 = null;
1071
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1072
+ return of(result200);
1073
+ }));
1074
+ }
1075
+ else if (status === 401) {
1076
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1077
+ return throwException("Unauthorized", status, _responseText, _headers);
1078
+ }));
1079
+ }
1080
+ else if (status === 403) {
1081
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1082
+ return throwException("Forbidden", status, _responseText, _headers);
1083
+ }));
1084
+ }
1085
+ else if (status !== 200 && status !== 204) {
1086
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1087
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1088
+ }));
1089
+ }
1090
+ return of(null);
1091
+ }
1092
+ /**
1093
+ * Creates new project
1094
+ * @param storefrontId Storefront identifier
1095
+ * @param tenantId (optional) Tenant identifier
1096
+ * @param userId (optional) User identifier
1097
+ * @param body (optional) Create operation parameters
1098
+ * @return Success
1099
+ */
1100
+ create(storefrontId, tenantId, userId, body) {
1101
+ let url_ = this.baseUrl + "/api/storefront/v1/projects?";
1102
+ if (storefrontId === undefined || storefrontId === null)
1103
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
1104
+ else
1105
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
1106
+ if (tenantId !== undefined && tenantId !== null)
1107
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1108
+ if (userId !== undefined && userId !== null)
1109
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1110
+ url_ = url_.replace(/[?&]$/, "");
1111
+ const content_ = JSON.stringify(body);
1112
+ let options_ = {
1113
+ body: content_,
1114
+ observe: "response",
1115
+ responseType: "blob",
1116
+ headers: new HttpHeaders({
1117
+ "Content-Type": "application/json-patch+json",
1118
+ "Accept": "text/plain"
1119
+ })
1120
+ };
1121
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1122
+ return this.http.request("post", url_, transformedOptions_);
1123
+ })).pipe(mergeMap((response_) => {
1124
+ return this.transformResult(url_, response_, (r) => this.processCreate(r));
1125
+ })).pipe(catchError((response_) => {
1126
+ if (response_ instanceof HttpResponseBase) {
1127
+ try {
1128
+ return this.transformResult(url_, response_, (r) => this.processCreate(r));
1129
+ }
1130
+ catch (e) {
1131
+ return throwError(e);
1132
+ }
1133
+ }
1134
+ else
1135
+ return throwError(response_);
1136
+ }));
1137
+ }
1138
+ processCreate(response) {
1139
+ const status = response.status;
1140
+ const responseBlob = response instanceof HttpResponse ? response.body :
1141
+ response.error instanceof Blob ? response.error : undefined;
1142
+ let _headers = {};
1143
+ if (response.headers) {
1144
+ for (let key of response.headers.keys()) {
1145
+ _headers[key] = response.headers.get(key);
1146
+ }
1147
+ }
1148
+ if (status === 201) {
1149
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1150
+ let result201 = null;
1151
+ result201 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1152
+ return of(result201);
1153
+ }));
1154
+ }
1155
+ else if (status === 409) {
1156
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1157
+ let result409 = null;
1158
+ result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1159
+ return throwException("Conflict", status, _responseText, _headers, result409);
1160
+ }));
1161
+ }
1162
+ else if (status === 401) {
1163
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1164
+ return throwException("Unauthorized", status, _responseText, _headers);
1165
+ }));
1166
+ }
1167
+ else if (status === 403) {
1168
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1169
+ return throwException("Forbidden", status, _responseText, _headers);
1170
+ }));
1171
+ }
1172
+ else if (status !== 200 && status !== 204) {
1173
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1174
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1175
+ }));
1176
+ }
1177
+ return of(null);
1178
+ }
1179
+ /**
1180
+ * Gets project by id
1181
+ * @param id Project identifier
1182
+ * @param tenantId (optional) Tenant identifier
1183
+ * @param userId (optional) User identifier
1184
+ * @return Success
1185
+ */
1186
+ get(id, tenantId, userId) {
1187
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}?";
1188
+ if (id === undefined || id === null)
1189
+ throw new Error("The parameter 'id' must be defined.");
1190
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1191
+ if (tenantId !== undefined && tenantId !== null)
1192
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1193
+ if (userId !== undefined && userId !== null)
1194
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1195
+ url_ = url_.replace(/[?&]$/, "");
1196
+ let options_ = {
1197
+ observe: "response",
1198
+ responseType: "blob",
1199
+ headers: new HttpHeaders({
1200
+ "Accept": "text/plain"
1201
+ })
1202
+ };
1203
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1204
+ return this.http.request("get", url_, transformedOptions_);
1205
+ })).pipe(mergeMap((response_) => {
1206
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
1207
+ })).pipe(catchError((response_) => {
1208
+ if (response_ instanceof HttpResponseBase) {
1209
+ try {
1210
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
1211
+ }
1212
+ catch (e) {
1213
+ return throwError(e);
1214
+ }
1215
+ }
1216
+ else
1217
+ return throwError(response_);
1218
+ }));
1219
+ }
1220
+ processGet(response) {
1221
+ const status = response.status;
1222
+ const responseBlob = response instanceof HttpResponse ? response.body :
1223
+ response.error instanceof Blob ? response.error : undefined;
1224
+ let _headers = {};
1225
+ if (response.headers) {
1226
+ for (let key of response.headers.keys()) {
1227
+ _headers[key] = response.headers.get(key);
1228
+ }
1229
+ }
1230
+ if (status === 200) {
1231
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1232
+ let result200 = null;
1233
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1234
+ return of(result200);
1235
+ }));
1236
+ }
1237
+ else if (status === 404) {
1238
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1239
+ let result404 = null;
1240
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1241
+ return throwException("Not Found", status, _responseText, _headers, result404);
1242
+ }));
1243
+ }
1244
+ else if (status === 401) {
1245
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1246
+ return throwException("Unauthorized", status, _responseText, _headers);
1247
+ }));
1248
+ }
1249
+ else if (status === 403) {
1250
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1251
+ return throwException("Forbidden", status, _responseText, _headers);
1252
+ }));
1253
+ }
1254
+ else if (status !== 200 && status !== 204) {
1255
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1256
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1257
+ }));
1258
+ }
1259
+ return of(null);
1260
+ }
1261
+ /**
1262
+ * Gets available project transitions
1263
+ * @param id Project identifier
1264
+ * @param tenantId (optional) Tenant identifier
1265
+ * @param userId (optional) User identifier
1266
+ * @return Success
1267
+ */
1268
+ getAvailableTransitions(id, tenantId, userId) {
1269
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/transitions?";
1270
+ if (id === undefined || id === null)
1271
+ throw new Error("The parameter 'id' must be defined.");
1272
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1273
+ if (tenantId !== undefined && tenantId !== null)
1274
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1275
+ if (userId !== undefined && userId !== null)
1276
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1277
+ url_ = url_.replace(/[?&]$/, "");
1278
+ let options_ = {
1279
+ observe: "response",
1280
+ responseType: "blob",
1281
+ headers: new HttpHeaders({
1282
+ "Accept": "text/plain"
1283
+ })
1284
+ };
1285
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1286
+ return this.http.request("get", url_, transformedOptions_);
1287
+ })).pipe(mergeMap((response_) => {
1288
+ return this.transformResult(url_, response_, (r) => this.processGetAvailableTransitions(r));
1289
+ })).pipe(catchError((response_) => {
1290
+ if (response_ instanceof HttpResponseBase) {
1291
+ try {
1292
+ return this.transformResult(url_, response_, (r) => this.processGetAvailableTransitions(r));
1293
+ }
1294
+ catch (e) {
1295
+ return throwError(e);
1296
+ }
1297
+ }
1298
+ else
1299
+ return throwError(response_);
1300
+ }));
1301
+ }
1302
+ processGetAvailableTransitions(response) {
1303
+ const status = response.status;
1304
+ const responseBlob = response instanceof HttpResponse ? response.body :
1305
+ response.error instanceof Blob ? response.error : undefined;
1306
+ let _headers = {};
1307
+ if (response.headers) {
1308
+ for (let key of response.headers.keys()) {
1309
+ _headers[key] = response.headers.get(key);
1310
+ }
1311
+ }
1312
+ if (status === 200) {
1313
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1314
+ let result200 = null;
1315
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1316
+ return of(result200);
1317
+ }));
1318
+ }
1319
+ else if (status === 400) {
1320
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1321
+ let result400 = null;
1322
+ result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1323
+ return throwException("Bad Request", status, _responseText, _headers, result400);
1324
+ }));
1325
+ }
1326
+ else if (status === 404) {
1327
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1328
+ let result404 = null;
1329
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1330
+ return throwException("Not Found", status, _responseText, _headers, result404);
1331
+ }));
1332
+ }
1333
+ else if (status === 409) {
1334
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1335
+ let result409 = null;
1336
+ result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1337
+ return throwException("Conflict", status, _responseText, _headers, result409);
1338
+ }));
1339
+ }
1340
+ else if (status === 401) {
1341
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1342
+ return throwException("Unauthorized", status, _responseText, _headers);
1343
+ }));
1344
+ }
1345
+ else if (status === 403) {
1346
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1347
+ return throwException("Forbidden", status, _responseText, _headers);
1348
+ }));
1349
+ }
1350
+ else if (status !== 200 && status !== 204) {
1351
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1352
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1353
+ }));
1354
+ }
1355
+ return of(null);
1356
+ }
1357
+ /**
1358
+ * Changes project status
1359
+ * @param id Project identifier
1360
+ * @param transition Transition identifying name
1361
+ * @param tenantId (optional) Tenant identifier
1362
+ * @param userId (optional) User identifier
1363
+ * @return Success
1364
+ */
1365
+ changeStatus(id, transition, tenantId, userId) {
1366
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/transitions/{transition}?";
1367
+ if (id === undefined || id === null)
1368
+ throw new Error("The parameter 'id' must be defined.");
1369
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1370
+ if (transition === undefined || transition === null)
1371
+ throw new Error("The parameter 'transition' must be defined.");
1372
+ url_ = url_.replace("{transition}", encodeURIComponent("" + transition));
1373
+ if (tenantId !== undefined && tenantId !== null)
1374
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1375
+ if (userId !== undefined && userId !== null)
1376
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1377
+ url_ = url_.replace(/[?&]$/, "");
1378
+ let options_ = {
1379
+ observe: "response",
1380
+ responseType: "blob",
1381
+ headers: new HttpHeaders({
1382
+ "Accept": "text/plain"
1383
+ })
1384
+ };
1385
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1386
+ return this.http.request("post", url_, transformedOptions_);
1387
+ })).pipe(mergeMap((response_) => {
1388
+ return this.transformResult(url_, response_, (r) => this.processChangeStatus(r));
1389
+ })).pipe(catchError((response_) => {
1390
+ if (response_ instanceof HttpResponseBase) {
1391
+ try {
1392
+ return this.transformResult(url_, response_, (r) => this.processChangeStatus(r));
1393
+ }
1394
+ catch (e) {
1395
+ return throwError(e);
1396
+ }
1397
+ }
1398
+ else
1399
+ return throwError(response_);
1400
+ }));
1401
+ }
1402
+ processChangeStatus(response) {
1403
+ const status = response.status;
1404
+ const responseBlob = response instanceof HttpResponse ? response.body :
1405
+ response.error instanceof Blob ? response.error : undefined;
1406
+ let _headers = {};
1407
+ if (response.headers) {
1408
+ for (let key of response.headers.keys()) {
1409
+ _headers[key] = response.headers.get(key);
1410
+ }
1411
+ }
1412
+ if (status === 200) {
1413
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1414
+ let result200 = null;
1415
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1416
+ return of(result200);
1417
+ }));
1418
+ }
1419
+ else if (status === 400) {
1420
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1421
+ let result400 = null;
1422
+ result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1423
+ return throwException("Bad Request", status, _responseText, _headers, result400);
1424
+ }));
1425
+ }
1426
+ else if (status === 404) {
1427
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1428
+ let result404 = null;
1429
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1430
+ return throwException("Not Found", status, _responseText, _headers, result404);
1431
+ }));
1432
+ }
1433
+ else if (status === 409) {
1434
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1435
+ let result409 = null;
1436
+ result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1437
+ return throwException("Conflict", status, _responseText, _headers, result409);
1438
+ }));
1439
+ }
1440
+ else if (status === 401) {
1441
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1442
+ return throwException("Unauthorized", status, _responseText, _headers);
1443
+ }));
1444
+ }
1445
+ else if (status === 403) {
1446
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1447
+ return throwException("Forbidden", status, _responseText, _headers);
1448
+ }));
1449
+ }
1450
+ else if (status !== 200 && status !== 204) {
1451
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1452
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1453
+ }));
1454
+ }
1455
+ return of(null);
1456
+ }
1457
+ /**
1458
+ * Force changes project status
1459
+ * @param id Project identifier
1460
+ * @param status Project status code
1461
+ * @param tenantId (optional) Tenant identifier
1462
+ * @param userId (optional) User identifier
1463
+ * @return Success
1464
+ */
1465
+ forceStatus(id, status, tenantId, userId) {
1466
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/statuses/{status}?";
1467
+ if (id === undefined || id === null)
1468
+ throw new Error("The parameter 'id' must be defined.");
1469
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1470
+ if (status === undefined || status === null)
1471
+ throw new Error("The parameter 'status' must be defined.");
1472
+ url_ = url_.replace("{status}", encodeURIComponent("" + status));
1473
+ if (tenantId !== undefined && tenantId !== null)
1474
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1475
+ if (userId !== undefined && userId !== null)
1476
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1477
+ url_ = url_.replace(/[?&]$/, "");
1478
+ let options_ = {
1479
+ observe: "response",
1480
+ responseType: "blob",
1481
+ headers: new HttpHeaders({
1482
+ "Accept": "text/plain"
1483
+ })
1484
+ };
1485
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1486
+ return this.http.request("post", url_, transformedOptions_);
1487
+ })).pipe(mergeMap((response_) => {
1488
+ return this.transformResult(url_, response_, (r) => this.processForceStatus(r));
1489
+ })).pipe(catchError((response_) => {
1490
+ if (response_ instanceof HttpResponseBase) {
1491
+ try {
1492
+ return this.transformResult(url_, response_, (r) => this.processForceStatus(r));
1493
+ }
1494
+ catch (e) {
1495
+ return throwError(e);
1496
+ }
1497
+ }
1498
+ else
1499
+ return throwError(response_);
1500
+ }));
1501
+ }
1502
+ processForceStatus(response) {
1503
+ const status = response.status;
1504
+ const responseBlob = response instanceof HttpResponse ? response.body :
1505
+ response.error instanceof Blob ? response.error : undefined;
1506
+ let _headers = {};
1507
+ if (response.headers) {
1508
+ for (let key of response.headers.keys()) {
1509
+ _headers[key] = response.headers.get(key);
1510
+ }
1511
+ }
1512
+ if (status === 200) {
1513
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1514
+ let result200 = null;
1515
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1516
+ return of(result200);
1517
+ }));
1518
+ }
1519
+ else if (status === 400) {
1520
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1521
+ let result400 = null;
1522
+ result400 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1523
+ return throwException("Bad Request", status, _responseText, _headers, result400);
1524
+ }));
1525
+ }
1526
+ else if (status === 404) {
1527
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1528
+ let result404 = null;
1529
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1530
+ return throwException("Not Found", status, _responseText, _headers, result404);
1531
+ }));
1532
+ }
1533
+ else if (status === 401) {
1534
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1535
+ return throwException("Unauthorized", status, _responseText, _headers);
1536
+ }));
1537
+ }
1538
+ else if (status === 403) {
1539
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1540
+ return throwException("Forbidden", status, _responseText, _headers);
1541
+ }));
1542
+ }
1543
+ else if (status !== 200 && status !== 204) {
1544
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1545
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1546
+ }));
1547
+ }
1548
+ return of(null);
1549
+ }
1550
+ /**
1551
+ * Gets all project statuses
1552
+ * @param tenantId (optional) Tenant identifier
1553
+ * @param userId (optional) User identifier
1554
+ * @return Success
1555
+ */
1556
+ getAllStatuses(tenantId, userId) {
1557
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/statuses?";
1558
+ if (tenantId !== undefined && tenantId !== null)
1559
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1560
+ if (userId !== undefined && userId !== null)
1561
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1562
+ url_ = url_.replace(/[?&]$/, "");
1563
+ let options_ = {
1564
+ observe: "response",
1565
+ responseType: "blob",
1566
+ headers: new HttpHeaders({
1567
+ "Accept": "text/plain"
1568
+ })
1569
+ };
1570
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1571
+ return this.http.request("get", url_, transformedOptions_);
1572
+ })).pipe(mergeMap((response_) => {
1573
+ return this.transformResult(url_, response_, (r) => this.processGetAllStatuses(r));
1574
+ })).pipe(catchError((response_) => {
1575
+ if (response_ instanceof HttpResponseBase) {
1576
+ try {
1577
+ return this.transformResult(url_, response_, (r) => this.processGetAllStatuses(r));
1578
+ }
1579
+ catch (e) {
1580
+ return throwError(e);
1581
+ }
1582
+ }
1583
+ else
1584
+ return throwError(response_);
1585
+ }));
1586
+ }
1587
+ processGetAllStatuses(response) {
1588
+ const status = response.status;
1589
+ const responseBlob = response instanceof HttpResponse ? response.body :
1590
+ response.error instanceof Blob ? response.error : undefined;
1591
+ let _headers = {};
1592
+ if (response.headers) {
1593
+ for (let key of response.headers.keys()) {
1594
+ _headers[key] = response.headers.get(key);
1595
+ }
1596
+ }
1597
+ if (status === 200) {
1598
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1599
+ let result200 = null;
1600
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1601
+ return of(result200);
1602
+ }));
1603
+ }
1604
+ else if (status === 401) {
1605
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1606
+ return throwException("Unauthorized", status, _responseText, _headers);
1607
+ }));
1608
+ }
1609
+ else if (status === 403) {
1610
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1611
+ return throwException("Forbidden", status, _responseText, _headers);
1612
+ }));
1613
+ }
1614
+ else if (status !== 200 && status !== 204) {
1615
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1616
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1617
+ }));
1618
+ }
1619
+ return of(null);
1620
+ }
1621
+ /**
1622
+ * Gets all project transitions
1623
+ * @param tenantId (optional) Tenant identifier
1624
+ * @param userId (optional) User identifier
1625
+ * @return Success
1626
+ */
1627
+ getAllTransitions(tenantId, userId) {
1628
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/transitions?";
1629
+ if (tenantId !== undefined && tenantId !== null)
1630
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1631
+ if (userId !== undefined && userId !== null)
1632
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1633
+ url_ = url_.replace(/[?&]$/, "");
1634
+ let options_ = {
1635
+ observe: "response",
1636
+ responseType: "blob",
1637
+ headers: new HttpHeaders({
1638
+ "Accept": "text/plain"
1639
+ })
1640
+ };
1641
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1642
+ return this.http.request("get", url_, transformedOptions_);
1643
+ })).pipe(mergeMap((response_) => {
1644
+ return this.transformResult(url_, response_, (r) => this.processGetAllTransitions(r));
1645
+ })).pipe(catchError((response_) => {
1646
+ if (response_ instanceof HttpResponseBase) {
1647
+ try {
1648
+ return this.transformResult(url_, response_, (r) => this.processGetAllTransitions(r));
1649
+ }
1650
+ catch (e) {
1651
+ return throwError(e);
1652
+ }
1653
+ }
1654
+ else
1655
+ return throwError(response_);
1656
+ }));
1657
+ }
1658
+ processGetAllTransitions(response) {
1659
+ const status = response.status;
1660
+ const responseBlob = response instanceof HttpResponse ? response.body :
1661
+ response.error instanceof Blob ? response.error : undefined;
1662
+ let _headers = {};
1663
+ if (response.headers) {
1664
+ for (let key of response.headers.keys()) {
1665
+ _headers[key] = response.headers.get(key);
1666
+ }
1667
+ }
1668
+ if (status === 200) {
1669
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1670
+ let result200 = null;
1671
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1672
+ return of(result200);
1673
+ }));
1674
+ }
1675
+ else if (status === 401) {
1676
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1677
+ return throwException("Unauthorized", status, _responseText, _headers);
1678
+ }));
1679
+ }
1680
+ else if (status === 403) {
1681
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1682
+ return throwException("Forbidden", status, _responseText, _headers);
1683
+ }));
1684
+ }
1685
+ else if (status !== 200 && status !== 204) {
1686
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1687
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1688
+ }));
1689
+ }
1690
+ return of(null);
1691
+ }
1692
+ /**
1693
+ * Gets project pdf url
1694
+ * @param id Project unique identifier
1695
+ * @param designUserId User identifier
1696
+ * @param designId Design identifier
1697
+ * @param tenantId (optional) Tenant identifier
1698
+ * @param userId (optional) User identifier
1699
+ * @return Success
1700
+ */
1701
+ getProjectPdfUrl(id, designUserId, designId, tenantId, userId) {
1702
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/project-pdf?";
1703
+ if (id === undefined || id === null)
1704
+ throw new Error("The parameter 'id' must be defined.");
1705
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1706
+ if (designUserId === undefined || designUserId === null)
1707
+ throw new Error("The parameter 'designUserId' must be defined and cannot be null.");
1708
+ else
1709
+ url_ += "designUserId=" + encodeURIComponent("" + designUserId) + "&";
1710
+ if (designId === undefined || designId === null)
1711
+ throw new Error("The parameter 'designId' must be defined and cannot be null.");
1712
+ else
1713
+ url_ += "designId=" + encodeURIComponent("" + designId) + "&";
1714
+ if (tenantId !== undefined && tenantId !== null)
1715
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1716
+ if (userId !== undefined && userId !== null)
1717
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1718
+ url_ = url_.replace(/[?&]$/, "");
1719
+ let options_ = {
1720
+ observe: "response",
1721
+ responseType: "blob",
1722
+ headers: new HttpHeaders({
1723
+ "Accept": "text/plain"
1724
+ })
1725
+ };
1726
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1727
+ return this.http.request("get", url_, transformedOptions_);
1728
+ })).pipe(mergeMap((response_) => {
1729
+ return this.transformResult(url_, response_, (r) => this.processGetProjectPdfUrl(r));
1730
+ })).pipe(catchError((response_) => {
1731
+ if (response_ instanceof HttpResponseBase) {
1732
+ try {
1733
+ return this.transformResult(url_, response_, (r) => this.processGetProjectPdfUrl(r));
1734
+ }
1735
+ catch (e) {
1736
+ return throwError(e);
1737
+ }
1738
+ }
1739
+ else
1740
+ return throwError(response_);
1741
+ }));
1742
+ }
1743
+ processGetProjectPdfUrl(response) {
1744
+ const status = response.status;
1745
+ const responseBlob = response instanceof HttpResponse ? response.body :
1746
+ response.error instanceof Blob ? response.error : undefined;
1747
+ let _headers = {};
1748
+ if (response.headers) {
1749
+ for (let key of response.headers.keys()) {
1750
+ _headers[key] = response.headers.get(key);
1751
+ }
1752
+ }
1753
+ if (status === 200) {
1754
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1755
+ let result200 = null;
1756
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1757
+ return of(result200);
1758
+ }));
1759
+ }
1760
+ else if (status === 401) {
1761
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1762
+ return throwException("Unauthorized", status, _responseText, _headers);
1763
+ }));
1764
+ }
1765
+ else if (status === 403) {
1766
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1767
+ return throwException("Forbidden", status, _responseText, _headers);
1768
+ }));
1769
+ }
1770
+ else if (status !== 200 && status !== 204) {
1771
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1772
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1773
+ }));
1774
+ }
1775
+ return of(null);
1776
+ }
1777
+ /**
1778
+ * Gets project pdf files in zip archive
1779
+ * @param id Project unique identifier
1780
+ * @param designUserId User identifier
1781
+ * @param designId Design identifier
1782
+ * @param attachment (optional) If set to 'true', file will be provided as an attachment with proper filename supplied (default value is 'false')
1783
+ * @param tenantId (optional) Tenant identifier
1784
+ * @param userId (optional) User identifier
1785
+ * @return Success
1786
+ */
1787
+ getProjectPdfZip(id, designUserId, designId, attachment, tenantId, userId) {
1788
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/project-pdf-zip?";
1789
+ if (id === undefined || id === null)
1790
+ throw new Error("The parameter 'id' must be defined.");
1791
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1792
+ if (designUserId === undefined || designUserId === null)
1793
+ throw new Error("The parameter 'designUserId' must be defined and cannot be null.");
1794
+ else
1795
+ url_ += "designUserId=" + encodeURIComponent("" + designUserId) + "&";
1796
+ if (designId === undefined || designId === null)
1797
+ throw new Error("The parameter 'designId' must be defined and cannot be null.");
1798
+ else
1799
+ url_ += "designId=" + encodeURIComponent("" + designId) + "&";
1800
+ if (attachment !== undefined && attachment !== null)
1801
+ url_ += "attachment=" + encodeURIComponent("" + attachment) + "&";
1802
+ if (tenantId !== undefined && tenantId !== null)
1803
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1804
+ if (userId !== undefined && userId !== null)
1805
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1806
+ url_ = url_.replace(/[?&]$/, "");
1807
+ let options_ = {
1808
+ observe: "response",
1809
+ responseType: "blob",
1810
+ headers: new HttpHeaders({
1811
+ "Accept": "application/octet-stream"
1812
+ })
1813
+ };
1814
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1815
+ return this.http.request("get", url_, transformedOptions_);
1816
+ })).pipe(mergeMap((response_) => {
1817
+ return this.transformResult(url_, response_, (r) => this.processGetProjectPdfZip(r));
1818
+ })).pipe(catchError((response_) => {
1819
+ if (response_ instanceof HttpResponseBase) {
1820
+ try {
1821
+ return this.transformResult(url_, response_, (r) => this.processGetProjectPdfZip(r));
1822
+ }
1823
+ catch (e) {
1824
+ return throwError(e);
1825
+ }
1826
+ }
1827
+ else
1828
+ return throwError(response_);
1829
+ }));
1830
+ }
1831
+ processGetProjectPdfZip(response) {
1832
+ const status = response.status;
1833
+ const responseBlob = response instanceof HttpResponse ? response.body :
1834
+ response.error instanceof Blob ? response.error : undefined;
1835
+ let _headers = {};
1836
+ if (response.headers) {
1837
+ for (let key of response.headers.keys()) {
1838
+ _headers[key] = response.headers.get(key);
1839
+ }
1840
+ }
1841
+ if (status === 200 || status === 206) {
1842
+ const contentDisposition = response.headers ? response.headers.get("content-disposition") : undefined;
1843
+ const fileNameMatch = contentDisposition ? /filename="?([^"]*?)"?(;|$)/g.exec(contentDisposition) : undefined;
1844
+ const fileName = fileNameMatch && fileNameMatch.length > 1 ? fileNameMatch[1] : undefined;
1845
+ return of({ fileName: fileName, data: responseBlob, status: status, headers: _headers });
1846
+ }
1847
+ else if (status === 404) {
1848
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1849
+ let result404 = null;
1850
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1851
+ return throwException("Not Found", status, _responseText, _headers, result404);
1852
+ }));
1853
+ }
1854
+ else if (status === 401) {
1855
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1856
+ return throwException("Unauthorized", status, _responseText, _headers);
1857
+ }));
1858
+ }
1859
+ else if (status === 403) {
1860
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1861
+ return throwException("Forbidden", status, _responseText, _headers);
1862
+ }));
1863
+ }
1864
+ else if (status !== 200 && status !== 204) {
1865
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1866
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1867
+ }));
1868
+ }
1869
+ return of(null);
1870
+ }
1871
+ /**
1872
+ * Gets project order data from ecommerce system
1873
+ * @param id Project identifier
1874
+ * @return Success
1875
+ */
1876
+ getProjectOrder(id) {
1877
+ let url_ = this.baseUrl + "/api/storefront/v1/projects/{id}/order";
1878
+ if (id === undefined || id === null)
1879
+ throw new Error("The parameter 'id' must be defined.");
1880
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
1881
+ url_ = url_.replace(/[?&]$/, "");
1882
+ let options_ = {
1883
+ observe: "response",
1884
+ responseType: "blob",
1885
+ headers: new HttpHeaders({
1886
+ "Accept": "application/json"
1887
+ })
1888
+ };
1889
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
1890
+ return this.http.request("get", url_, transformedOptions_);
1891
+ })).pipe(mergeMap((response_) => {
1892
+ return this.transformResult(url_, response_, (r) => this.processGetProjectOrder(r));
1893
+ })).pipe(catchError((response_) => {
1894
+ if (response_ instanceof HttpResponseBase) {
1895
+ try {
1896
+ return this.transformResult(url_, response_, (r) => this.processGetProjectOrder(r));
1897
+ }
1898
+ catch (e) {
1899
+ return throwError(e);
1900
+ }
1901
+ }
1902
+ else
1903
+ return throwError(response_);
1904
+ }));
1905
+ }
1906
+ processGetProjectOrder(response) {
1907
+ const status = response.status;
1908
+ const responseBlob = response instanceof HttpResponse ? response.body :
1909
+ response.error instanceof Blob ? response.error : undefined;
1910
+ let _headers = {};
1911
+ if (response.headers) {
1912
+ for (let key of response.headers.keys()) {
1913
+ _headers[key] = response.headers.get(key);
1914
+ }
1915
+ }
1916
+ if (status === 200) {
1917
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1918
+ let result200 = null;
1919
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1920
+ return of(result200);
1921
+ }));
1922
+ }
1923
+ else if (status === 404) {
1924
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1925
+ let result404 = null;
1926
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
1927
+ return throwException("Not Found", status, _responseText, _headers, result404);
1928
+ }));
1929
+ }
1930
+ else if (status === 401) {
1931
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1932
+ return throwException("Unauthorized", status, _responseText, _headers);
1933
+ }));
1934
+ }
1935
+ else if (status === 403) {
1936
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1937
+ return throwException("Forbidden", status, _responseText, _headers);
1938
+ }));
1939
+ }
1940
+ else if (status !== 200 && status !== 204) {
1941
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
1942
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
1943
+ }));
1944
+ }
1945
+ return of(null);
1946
+ }
1947
+ }
1948
+ ProjectsApiClient.ɵprov = ɵɵdefineInjectable({ factory: function ProjectsApiClient_Factory() { return new ProjectsApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: ProjectsApiClient, providedIn: "root" });
1949
+ ProjectsApiClient.decorators = [
1950
+ { type: Injectable, args: [{
1951
+ providedIn: 'root'
1952
+ },] }
1953
+ ];
1954
+ ProjectsApiClient.ctorParameters = () => [
1955
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
1956
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
1957
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
1958
+ ];
1959
+ class StorefrontsApiClient extends ApiClientBase {
1960
+ constructor(configuration, http, baseUrl) {
1961
+ super(configuration);
1962
+ this.jsonParseReviver = undefined;
1963
+ this.http = http;
1964
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
1965
+ }
1966
+ /**
1967
+ * Gets all storefronts relevant to specified query parameters
1968
+ * @param types (optional) Storefront type filter
1969
+ * @param skip (optional) Defines page start offset from beginning of sorted result list
1970
+ * @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
1971
+ * @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
1972
+ * @param search (optional) Search string for partial match
1973
+ * @param tenantId (optional) Tenant identifier
1974
+ * @param userId (optional) User identifier
1975
+ * @return Success
1976
+ */
1977
+ getAll(types, skip, take, sorting, search, tenantId, userId) {
1978
+ let url_ = this.baseUrl + "/api/storefront/v1/storefronts?";
1979
+ if (types !== undefined && types !== null)
1980
+ types && types.forEach(item => { url_ += "types=" + encodeURIComponent("" + item) + "&"; });
1981
+ if (skip !== undefined && skip !== null)
1982
+ url_ += "skip=" + encodeURIComponent("" + skip) + "&";
1983
+ if (take !== undefined && take !== null)
1984
+ url_ += "take=" + encodeURIComponent("" + take) + "&";
1985
+ if (sorting !== undefined && sorting !== null)
1986
+ url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
1987
+ if (search !== undefined && search !== null)
1988
+ url_ += "search=" + encodeURIComponent("" + search) + "&";
1989
+ if (tenantId !== undefined && tenantId !== null)
1990
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
1991
+ if (userId !== undefined && userId !== null)
1992
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
1993
+ url_ = url_.replace(/[?&]$/, "");
1994
+ let options_ = {
1995
+ observe: "response",
1996
+ responseType: "blob",
1997
+ headers: new HttpHeaders({
1998
+ "Accept": "text/plain"
1999
+ })
2000
+ };
2001
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2002
+ return this.http.request("get", url_, transformedOptions_);
2003
+ })).pipe(mergeMap((response_) => {
2004
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
2005
+ })).pipe(catchError((response_) => {
2006
+ if (response_ instanceof HttpResponseBase) {
2007
+ try {
2008
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
2009
+ }
2010
+ catch (e) {
2011
+ return throwError(e);
2012
+ }
2013
+ }
2014
+ else
2015
+ return throwError(response_);
2016
+ }));
2017
+ }
2018
+ processGetAll(response) {
2019
+ const status = response.status;
2020
+ const responseBlob = response instanceof HttpResponse ? response.body :
2021
+ response.error instanceof Blob ? response.error : undefined;
2022
+ let _headers = {};
2023
+ if (response.headers) {
2024
+ for (let key of response.headers.keys()) {
2025
+ _headers[key] = response.headers.get(key);
2026
+ }
2027
+ }
2028
+ if (status === 200) {
2029
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2030
+ let result200 = null;
2031
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2032
+ return of(result200);
2033
+ }));
2034
+ }
2035
+ else if (status === 401) {
2036
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2037
+ return throwException("Unauthorized", status, _responseText, _headers);
2038
+ }));
2039
+ }
2040
+ else if (status === 403) {
2041
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2042
+ return throwException("Forbidden", status, _responseText, _headers);
2043
+ }));
2044
+ }
2045
+ else if (status !== 200 && status !== 204) {
2046
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2047
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2048
+ }));
2049
+ }
2050
+ return of(null);
2051
+ }
2052
+ /**
2053
+ * Gets storefront
2054
+ * @param id Storefront identifier
2055
+ * @param tenantId (optional) Tenant identifier
2056
+ * @param userId (optional) User identifier
2057
+ * @return Success
2058
+ */
2059
+ get(id, tenantId, userId) {
2060
+ let url_ = this.baseUrl + "/api/storefront/v1/storefronts/{id}?";
2061
+ if (id === undefined || id === null)
2062
+ throw new Error("The parameter 'id' must be defined.");
2063
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
2064
+ if (tenantId !== undefined && tenantId !== null)
2065
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2066
+ if (userId !== undefined && userId !== null)
2067
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2068
+ url_ = url_.replace(/[?&]$/, "");
2069
+ let options_ = {
2070
+ observe: "response",
2071
+ responseType: "blob",
2072
+ headers: new HttpHeaders({
2073
+ "Accept": "text/plain"
2074
+ })
2075
+ };
2076
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2077
+ return this.http.request("get", url_, transformedOptions_);
2078
+ })).pipe(mergeMap((response_) => {
2079
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
2080
+ })).pipe(catchError((response_) => {
2081
+ if (response_ instanceof HttpResponseBase) {
2082
+ try {
2083
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
2084
+ }
2085
+ catch (e) {
2086
+ return throwError(e);
2087
+ }
2088
+ }
2089
+ else
2090
+ return throwError(response_);
2091
+ }));
2092
+ }
2093
+ processGet(response) {
2094
+ const status = response.status;
2095
+ const responseBlob = response instanceof HttpResponse ? response.body :
2096
+ response.error instanceof Blob ? response.error : undefined;
2097
+ let _headers = {};
2098
+ if (response.headers) {
2099
+ for (let key of response.headers.keys()) {
2100
+ _headers[key] = response.headers.get(key);
2101
+ }
2102
+ }
2103
+ if (status === 200) {
2104
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2105
+ let result200 = null;
2106
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2107
+ return of(result200);
2108
+ }));
2109
+ }
2110
+ else if (status === 404) {
2111
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2112
+ let result404 = null;
2113
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2114
+ return throwException("Not Found", status, _responseText, _headers, result404);
2115
+ }));
2116
+ }
2117
+ else if (status === 401) {
2118
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2119
+ return throwException("Unauthorized", status, _responseText, _headers);
2120
+ }));
2121
+ }
2122
+ else if (status === 403) {
2123
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2124
+ return throwException("Forbidden", status, _responseText, _headers);
2125
+ }));
2126
+ }
2127
+ else if (status !== 200 && status !== 204) {
2128
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2129
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2130
+ }));
2131
+ }
2132
+ return of(null);
2133
+ }
2134
+ }
2135
+ StorefrontsApiClient.ɵprov = ɵɵdefineInjectable({ factory: function StorefrontsApiClient_Factory() { return new StorefrontsApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: StorefrontsApiClient, providedIn: "root" });
2136
+ StorefrontsApiClient.decorators = [
2137
+ { type: Injectable, args: [{
2138
+ providedIn: 'root'
2139
+ },] }
2140
+ ];
2141
+ StorefrontsApiClient.ctorParameters = () => [
2142
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
2143
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
2144
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
2145
+ ];
2146
+ class StorefrontUsersApiClient extends ApiClientBase {
2147
+ constructor(configuration, http, baseUrl) {
2148
+ super(configuration);
2149
+ this.jsonParseReviver = undefined;
2150
+ this.http = http;
2151
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
2152
+ }
2153
+ /**
2154
+ * Gets all storefront users relevant to specified query parameters
2155
+ * @param storefrontId Storefront identifier
2156
+ * @param storefrontUserId (optional) Storefront user identifier
2157
+ * @param skip (optional) Defines page start offset from beginning of sorted result list
2158
+ * @param take (optional) Defines page length (how much consequent items of sorted result list should be taken)
2159
+ * @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC"
2160
+ * @param search (optional) Search string for partial match
2161
+ * @param tenantId (optional) Tenant identifier
2162
+ * @param userId (optional) User identifier
2163
+ * @return Success
2164
+ */
2165
+ getAll(storefrontId, storefrontUserId, skip, take, sorting, search, tenantId, userId) {
2166
+ let url_ = this.baseUrl + "/api/storefront/v1/storefront-users?";
2167
+ if (storefrontId === undefined || storefrontId === null)
2168
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
2169
+ else
2170
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
2171
+ if (storefrontUserId !== undefined && storefrontUserId !== null)
2172
+ url_ += "storefrontUserId=" + encodeURIComponent("" + storefrontUserId) + "&";
2173
+ if (skip !== undefined && skip !== null)
2174
+ url_ += "skip=" + encodeURIComponent("" + skip) + "&";
2175
+ if (take !== undefined && take !== null)
2176
+ url_ += "take=" + encodeURIComponent("" + take) + "&";
2177
+ if (sorting !== undefined && sorting !== null)
2178
+ url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
2179
+ if (search !== undefined && search !== null)
2180
+ url_ += "search=" + encodeURIComponent("" + search) + "&";
2181
+ if (tenantId !== undefined && tenantId !== null)
2182
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2183
+ if (userId !== undefined && userId !== null)
2184
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2185
+ url_ = url_.replace(/[?&]$/, "");
2186
+ let options_ = {
2187
+ observe: "response",
2188
+ responseType: "blob",
2189
+ headers: new HttpHeaders({
2190
+ "Accept": "text/plain"
2191
+ })
2192
+ };
2193
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2194
+ return this.http.request("get", url_, transformedOptions_);
2195
+ })).pipe(mergeMap((response_) => {
2196
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
2197
+ })).pipe(catchError((response_) => {
2198
+ if (response_ instanceof HttpResponseBase) {
2199
+ try {
2200
+ return this.transformResult(url_, response_, (r) => this.processGetAll(r));
2201
+ }
2202
+ catch (e) {
2203
+ return throwError(e);
2204
+ }
2205
+ }
2206
+ else
2207
+ return throwError(response_);
2208
+ }));
2209
+ }
2210
+ processGetAll(response) {
2211
+ const status = response.status;
2212
+ const responseBlob = response instanceof HttpResponse ? response.body :
2213
+ response.error instanceof Blob ? response.error : undefined;
2214
+ let _headers = {};
2215
+ if (response.headers) {
2216
+ for (let key of response.headers.keys()) {
2217
+ _headers[key] = response.headers.get(key);
2218
+ }
2219
+ }
2220
+ if (status === 200) {
2221
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2222
+ let result200 = null;
2223
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2224
+ return of(result200);
2225
+ }));
2226
+ }
2227
+ else if (status === 401) {
2228
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2229
+ return throwException("Unauthorized", status, _responseText, _headers);
2230
+ }));
2231
+ }
2232
+ else if (status === 403) {
2233
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2234
+ return throwException("Forbidden", status, _responseText, _headers);
2235
+ }));
2236
+ }
2237
+ else if (status !== 200 && status !== 204) {
2238
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2239
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2240
+ }));
2241
+ }
2242
+ return of(null);
2243
+ }
2244
+ /**
2245
+ * Creates new storefront user
2246
+ * @param storefrontId Storefront identifier
2247
+ * @param tenantId (optional) Tenant identifier
2248
+ * @param userId (optional) User identifier
2249
+ * @param body (optional) Create operation parameters
2250
+ * @return Success
2251
+ */
2252
+ create(storefrontId, tenantId, userId, body) {
2253
+ let url_ = this.baseUrl + "/api/storefront/v1/storefront-users?";
2254
+ if (storefrontId === undefined || storefrontId === null)
2255
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
2256
+ else
2257
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
2258
+ if (tenantId !== undefined && tenantId !== null)
2259
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2260
+ if (userId !== undefined && userId !== null)
2261
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2262
+ url_ = url_.replace(/[?&]$/, "");
2263
+ const content_ = JSON.stringify(body);
2264
+ let options_ = {
2265
+ body: content_,
2266
+ observe: "response",
2267
+ responseType: "blob",
2268
+ headers: new HttpHeaders({
2269
+ "Content-Type": "application/json-patch+json",
2270
+ "Accept": "text/plain"
2271
+ })
2272
+ };
2273
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2274
+ return this.http.request("post", url_, transformedOptions_);
2275
+ })).pipe(mergeMap((response_) => {
2276
+ return this.transformResult(url_, response_, (r) => this.processCreate(r));
2277
+ })).pipe(catchError((response_) => {
2278
+ if (response_ instanceof HttpResponseBase) {
2279
+ try {
2280
+ return this.transformResult(url_, response_, (r) => this.processCreate(r));
2281
+ }
2282
+ catch (e) {
2283
+ return throwError(e);
2284
+ }
2285
+ }
2286
+ else
2287
+ return throwError(response_);
2288
+ }));
2289
+ }
2290
+ processCreate(response) {
2291
+ const status = response.status;
2292
+ const responseBlob = response instanceof HttpResponse ? response.body :
2293
+ response.error instanceof Blob ? response.error : undefined;
2294
+ let _headers = {};
2295
+ if (response.headers) {
2296
+ for (let key of response.headers.keys()) {
2297
+ _headers[key] = response.headers.get(key);
2298
+ }
2299
+ }
2300
+ if (status === 201) {
2301
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2302
+ let result201 = null;
2303
+ result201 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2304
+ return of(result201);
2305
+ }));
2306
+ }
2307
+ else if (status === 401) {
2308
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2309
+ return throwException("Unauthorized", status, _responseText, _headers);
2310
+ }));
2311
+ }
2312
+ else if (status === 403) {
2313
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2314
+ return throwException("Forbidden", status, _responseText, _headers);
2315
+ }));
2316
+ }
2317
+ else if (status !== 200 && status !== 204) {
2318
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2319
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2320
+ }));
2321
+ }
2322
+ return of(null);
2323
+ }
2324
+ /**
2325
+ * Gets storefront user by id
2326
+ * @param id Storefront user identifier
2327
+ * @param storefrontId Storefront identifier
2328
+ * @param tenantId (optional) Tenant identifier
2329
+ * @param userId (optional) User identifier
2330
+ * @return Success
2331
+ */
2332
+ get(id, storefrontId, tenantId, userId) {
2333
+ let url_ = this.baseUrl + "/api/storefront/v1/storefront-users/{id}?";
2334
+ if (id === undefined || id === null)
2335
+ throw new Error("The parameter 'id' must be defined.");
2336
+ url_ = url_.replace("{id}", encodeURIComponent("" + id));
2337
+ if (storefrontId === undefined || storefrontId === null)
2338
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
2339
+ else
2340
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
2341
+ if (tenantId !== undefined && tenantId !== null)
2342
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2343
+ if (userId !== undefined && userId !== null)
2344
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2345
+ url_ = url_.replace(/[?&]$/, "");
2346
+ let options_ = {
2347
+ observe: "response",
2348
+ responseType: "blob",
2349
+ headers: new HttpHeaders({
2350
+ "Accept": "text/plain"
2351
+ })
2352
+ };
2353
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2354
+ return this.http.request("get", url_, transformedOptions_);
2355
+ })).pipe(mergeMap((response_) => {
2356
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
2357
+ })).pipe(catchError((response_) => {
2358
+ if (response_ instanceof HttpResponseBase) {
2359
+ try {
2360
+ return this.transformResult(url_, response_, (r) => this.processGet(r));
2361
+ }
2362
+ catch (e) {
2363
+ return throwError(e);
2364
+ }
2365
+ }
2366
+ else
2367
+ return throwError(response_);
2368
+ }));
2369
+ }
2370
+ processGet(response) {
2371
+ const status = response.status;
2372
+ const responseBlob = response instanceof HttpResponse ? response.body :
2373
+ response.error instanceof Blob ? response.error : undefined;
2374
+ let _headers = {};
2375
+ if (response.headers) {
2376
+ for (let key of response.headers.keys()) {
2377
+ _headers[key] = response.headers.get(key);
2378
+ }
2379
+ }
2380
+ if (status === 200) {
2381
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2382
+ let result200 = null;
2383
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2384
+ return of(result200);
2385
+ }));
2386
+ }
2387
+ else if (status === 404) {
2388
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2389
+ let result404 = null;
2390
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2391
+ return throwException("Not Found", status, _responseText, _headers, result404);
2392
+ }));
2393
+ }
2394
+ else if (status === 401) {
2395
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2396
+ return throwException("Unauthorized", status, _responseText, _headers);
2397
+ }));
2398
+ }
2399
+ else if (status === 403) {
2400
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2401
+ return throwException("Forbidden", status, _responseText, _headers);
2402
+ }));
2403
+ }
2404
+ else if (status !== 200 && status !== 204) {
2405
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2406
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2407
+ }));
2408
+ }
2409
+ return of(null);
2410
+ }
2411
+ /**
2412
+ * Merges anonymous storefront user data to regular storefront user account
2413
+ * @param storefrontId Storefront identifier
2414
+ * @param tenantId (optional) Tenant identifier
2415
+ * @param userId (optional) User identifier
2416
+ * @param body (optional) Merge operation parameters
2417
+ * @return Success
2418
+ */
2419
+ mergeAnonymous(storefrontId, tenantId, userId, body) {
2420
+ let url_ = this.baseUrl + "/api/storefront/v1/storefront-users/merge-anonymous?";
2421
+ if (storefrontId === undefined || storefrontId === null)
2422
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
2423
+ else
2424
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
2425
+ if (tenantId !== undefined && tenantId !== null)
2426
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2427
+ if (userId !== undefined && userId !== null)
2428
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2429
+ url_ = url_.replace(/[?&]$/, "");
2430
+ const content_ = JSON.stringify(body);
2431
+ let options_ = {
2432
+ body: content_,
2433
+ observe: "response",
2434
+ responseType: "blob",
2435
+ headers: new HttpHeaders({
2436
+ "Content-Type": "application/json-patch+json",
2437
+ })
2438
+ };
2439
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2440
+ return this.http.request("post", url_, transformedOptions_);
2441
+ })).pipe(mergeMap((response_) => {
2442
+ return this.transformResult(url_, response_, (r) => this.processMergeAnonymous(r));
2443
+ })).pipe(catchError((response_) => {
2444
+ if (response_ instanceof HttpResponseBase) {
2445
+ try {
2446
+ return this.transformResult(url_, response_, (r) => this.processMergeAnonymous(r));
2447
+ }
2448
+ catch (e) {
2449
+ return throwError(e);
2450
+ }
2451
+ }
2452
+ else
2453
+ return throwError(response_);
2454
+ }));
2455
+ }
2456
+ processMergeAnonymous(response) {
2457
+ const status = response.status;
2458
+ const responseBlob = response instanceof HttpResponse ? response.body :
2459
+ response.error instanceof Blob ? response.error : undefined;
2460
+ let _headers = {};
2461
+ if (response.headers) {
2462
+ for (let key of response.headers.keys()) {
2463
+ _headers[key] = response.headers.get(key);
2464
+ }
2465
+ }
2466
+ if (status === 200) {
2467
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2468
+ return of(null);
2469
+ }));
2470
+ }
2471
+ else if (status === 404) {
2472
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2473
+ let result404 = null;
2474
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2475
+ return throwException("Not Found", status, _responseText, _headers, result404);
2476
+ }));
2477
+ }
2478
+ else if (status === 409) {
2479
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2480
+ let result409 = null;
2481
+ result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2482
+ return throwException("Conflict", status, _responseText, _headers, result409);
2483
+ }));
2484
+ }
2485
+ else if (status === 401) {
2486
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2487
+ return throwException("Unauthorized", status, _responseText, _headers);
2488
+ }));
2489
+ }
2490
+ else if (status === 403) {
2491
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2492
+ return throwException("Forbidden", status, _responseText, _headers);
2493
+ }));
2494
+ }
2495
+ else if (status !== 200 && status !== 204) {
2496
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2497
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2498
+ }));
2499
+ }
2500
+ return of(null);
2501
+ }
2502
+ /**
2503
+ * Gets storefront user token
2504
+ * @param storefrontUserId Storefront user identifier
2505
+ * @param storefrontId Storefront identifier
2506
+ * @param tenantId (optional) Tenant identifier
2507
+ * @param userId (optional) User identifier
2508
+ * @return Success
2509
+ */
2510
+ getToken(storefrontUserId, storefrontId, tenantId, userId) {
2511
+ let url_ = this.baseUrl + "/api/storefront/v1/storefront-users/token?";
2512
+ if (storefrontUserId === undefined || storefrontUserId === null)
2513
+ throw new Error("The parameter 'storefrontUserId' must be defined and cannot be null.");
2514
+ else
2515
+ url_ += "storefrontUserId=" + encodeURIComponent("" + storefrontUserId) + "&";
2516
+ if (storefrontId === undefined || storefrontId === null)
2517
+ throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
2518
+ else
2519
+ url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
2520
+ if (tenantId !== undefined && tenantId !== null)
2521
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2522
+ if (userId !== undefined && userId !== null)
2523
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2524
+ url_ = url_.replace(/[?&]$/, "");
2525
+ let options_ = {
2526
+ observe: "response",
2527
+ responseType: "blob",
2528
+ headers: new HttpHeaders({})
2529
+ };
2530
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2531
+ return this.http.request("get", url_, transformedOptions_);
2532
+ })).pipe(mergeMap((response_) => {
2533
+ return this.transformResult(url_, response_, (r) => this.processGetToken(r));
2534
+ })).pipe(catchError((response_) => {
2535
+ if (response_ instanceof HttpResponseBase) {
2536
+ try {
2537
+ return this.transformResult(url_, response_, (r) => this.processGetToken(r));
2538
+ }
2539
+ catch (e) {
2540
+ return throwError(e);
2541
+ }
2542
+ }
2543
+ else
2544
+ return throwError(response_);
2545
+ }));
2546
+ }
2547
+ processGetToken(response) {
2548
+ const status = response.status;
2549
+ const responseBlob = response instanceof HttpResponse ? response.body :
2550
+ response.error instanceof Blob ? response.error : undefined;
2551
+ let _headers = {};
2552
+ if (response.headers) {
2553
+ for (let key of response.headers.keys()) {
2554
+ _headers[key] = response.headers.get(key);
2555
+ }
2556
+ }
2557
+ if (status === 201) {
2558
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2559
+ return of(null);
2560
+ }));
2561
+ }
2562
+ else if (status === 404) {
2563
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2564
+ let result404 = null;
2565
+ result404 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2566
+ return throwException("Not Found", status, _responseText, _headers, result404);
2567
+ }));
2568
+ }
2569
+ else if (status === 409) {
2570
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2571
+ let result409 = null;
2572
+ result409 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2573
+ return throwException("Conflict", status, _responseText, _headers, result409);
2574
+ }));
2575
+ }
2576
+ else if (status === 401) {
2577
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2578
+ return throwException("Unauthorized", status, _responseText, _headers);
2579
+ }));
2580
+ }
2581
+ else if (status === 403) {
2582
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2583
+ return throwException("Forbidden", status, _responseText, _headers);
2584
+ }));
2585
+ }
2586
+ else if (status !== 200 && status !== 204) {
2587
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2588
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2589
+ }));
2590
+ }
2591
+ return of(null);
2592
+ }
2593
+ }
2594
+ StorefrontUsersApiClient.ɵprov = ɵɵdefineInjectable({ factory: function StorefrontUsersApiClient_Factory() { return new StorefrontUsersApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: StorefrontUsersApiClient, providedIn: "root" });
2595
+ StorefrontUsersApiClient.decorators = [
2596
+ { type: Injectable, args: [{
2597
+ providedIn: 'root'
2598
+ },] }
2599
+ ];
2600
+ StorefrontUsersApiClient.ctorParameters = () => [
2601
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
2602
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
2603
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
2604
+ ];
2605
+ class TenantInfoApiClient extends ApiClientBase {
2606
+ constructor(configuration, http, baseUrl) {
2607
+ super(configuration);
2608
+ this.jsonParseReviver = undefined;
2609
+ this.http = http;
2610
+ this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : this.getBaseUrl("");
2611
+ }
2612
+ /**
2613
+ * Gets information about tenant applications
2614
+ * @param tenantId (optional) Tenant identifier
2615
+ * @param userId (optional) User identifier
2616
+ * @return Success
2617
+ */
2618
+ getApplicationsInfo(tenantId, userId) {
2619
+ let url_ = this.baseUrl + "/api/storefront/v1/tenant-info/applications?";
2620
+ if (tenantId !== undefined && tenantId !== null)
2621
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2622
+ if (userId !== undefined && userId !== null)
2623
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2624
+ url_ = url_.replace(/[?&]$/, "");
2625
+ let options_ = {
2626
+ observe: "response",
2627
+ responseType: "blob",
2628
+ headers: new HttpHeaders({
2629
+ "Accept": "text/plain"
2630
+ })
2631
+ };
2632
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2633
+ return this.http.request("get", url_, transformedOptions_);
2634
+ })).pipe(mergeMap((response_) => {
2635
+ return this.transformResult(url_, response_, (r) => this.processGetApplicationsInfo(r));
2636
+ })).pipe(catchError((response_) => {
2637
+ if (response_ instanceof HttpResponseBase) {
2638
+ try {
2639
+ return this.transformResult(url_, response_, (r) => this.processGetApplicationsInfo(r));
2640
+ }
2641
+ catch (e) {
2642
+ return throwError(e);
2643
+ }
2644
+ }
2645
+ else
2646
+ return throwError(response_);
2647
+ }));
2648
+ }
2649
+ processGetApplicationsInfo(response) {
2650
+ const status = response.status;
2651
+ const responseBlob = response instanceof HttpResponse ? response.body :
2652
+ response.error instanceof Blob ? response.error : undefined;
2653
+ let _headers = {};
2654
+ if (response.headers) {
2655
+ for (let key of response.headers.keys()) {
2656
+ _headers[key] = response.headers.get(key);
2657
+ }
2658
+ }
2659
+ if (status === 200) {
2660
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2661
+ let result200 = null;
2662
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2663
+ return of(result200);
2664
+ }));
2665
+ }
2666
+ else if (status === 401) {
2667
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2668
+ return throwException("Unauthorized", status, _responseText, _headers);
2669
+ }));
2670
+ }
2671
+ else if (status === 403) {
2672
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2673
+ return throwException("Forbidden", status, _responseText, _headers);
2674
+ }));
2675
+ }
2676
+ else if (status !== 200 && status !== 204) {
2677
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2678
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2679
+ }));
2680
+ }
2681
+ return of(null);
2682
+ }
2683
+ /**
2684
+ * Gets information about tenant
2685
+ * @param tenantId (optional) Tenant identifier
2686
+ * @param userId (optional) User identifier
2687
+ * @return Success
2688
+ */
2689
+ getInfo(tenantId, userId) {
2690
+ let url_ = this.baseUrl + "/api/storefront/v1/tenant-info?";
2691
+ if (tenantId !== undefined && tenantId !== null)
2692
+ url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
2693
+ if (userId !== undefined && userId !== null)
2694
+ url_ += "userId=" + encodeURIComponent("" + userId) + "&";
2695
+ url_ = url_.replace(/[?&]$/, "");
2696
+ let options_ = {
2697
+ observe: "response",
2698
+ responseType: "blob",
2699
+ headers: new HttpHeaders({
2700
+ "Accept": "text/plain"
2701
+ })
2702
+ };
2703
+ return from(this.transformOptions(options_)).pipe(mergeMap(transformedOptions_ => {
2704
+ return this.http.request("get", url_, transformedOptions_);
2705
+ })).pipe(mergeMap((response_) => {
2706
+ return this.transformResult(url_, response_, (r) => this.processGetInfo(r));
2707
+ })).pipe(catchError((response_) => {
2708
+ if (response_ instanceof HttpResponseBase) {
2709
+ try {
2710
+ return this.transformResult(url_, response_, (r) => this.processGetInfo(r));
2711
+ }
2712
+ catch (e) {
2713
+ return throwError(e);
2714
+ }
2715
+ }
2716
+ else
2717
+ return throwError(response_);
2718
+ }));
2719
+ }
2720
+ processGetInfo(response) {
2721
+ const status = response.status;
2722
+ const responseBlob = response instanceof HttpResponse ? response.body :
2723
+ response.error instanceof Blob ? response.error : undefined;
2724
+ let _headers = {};
2725
+ if (response.headers) {
2726
+ for (let key of response.headers.keys()) {
2727
+ _headers[key] = response.headers.get(key);
2728
+ }
2729
+ }
2730
+ if (status === 200) {
2731
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2732
+ let result200 = null;
2733
+ result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver);
2734
+ return of(result200);
2735
+ }));
2736
+ }
2737
+ else if (status === 401) {
2738
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2739
+ return throwException("Unauthorized", status, _responseText, _headers);
2740
+ }));
2741
+ }
2742
+ else if (status === 403) {
2743
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2744
+ return throwException("Forbidden", status, _responseText, _headers);
2745
+ }));
2746
+ }
2747
+ else if (status !== 200 && status !== 204) {
2748
+ return blobToText(responseBlob).pipe(mergeMap(_responseText => {
2749
+ return throwException("An unexpected server error occurred.", status, _responseText, _headers);
2750
+ }));
2751
+ }
2752
+ return of(null);
2753
+ }
2754
+ }
2755
+ TenantInfoApiClient.ɵprov = ɵɵdefineInjectable({ factory: function TenantInfoApiClient_Factory() { return new TenantInfoApiClient(ɵɵinject(ApiClientConfiguration), ɵɵinject(HttpClient), ɵɵinject(API_BASE_URL, 8)); }, token: TenantInfoApiClient, providedIn: "root" });
2756
+ TenantInfoApiClient.decorators = [
2757
+ { type: Injectable, args: [{
2758
+ providedIn: 'root'
2759
+ },] }
2760
+ ];
2761
+ TenantInfoApiClient.ctorParameters = () => [
2762
+ { type: ApiClientConfiguration, decorators: [{ type: Inject, args: [ApiClientConfiguration,] }] },
2763
+ { type: HttpClient, decorators: [{ type: Inject, args: [HttpClient,] }] },
2764
+ { type: String, decorators: [{ type: Optional }, { type: Inject, args: [API_BASE_URL,] }] }
2765
+ ];
2766
+ /** Available date period filter values for queries */
2767
+ var DatePeriod;
2768
+ (function (DatePeriod) {
2769
+ DatePeriod["All"] = "All";
2770
+ DatePeriod["Today"] = "Today";
2771
+ DatePeriod["Last7Days"] = "Last7Days";
2772
+ DatePeriod["Last30Days"] = "Last30Days";
2773
+ })(DatePeriod || (DatePeriod = {}));
2774
+ /** Storefront types */
2775
+ var StorefrontType;
2776
+ (function (StorefrontType) {
2777
+ StorefrontType["Custom"] = "Custom";
2778
+ StorefrontType["Shopify"] = "Shopify";
2779
+ StorefrontType["DocketManager"] = "DocketManager";
2780
+ StorefrontType["Auth0Saml"] = "Auth0Saml";
2781
+ })(StorefrontType || (StorefrontType = {}));
2782
+ class ApiException extends Error {
2783
+ constructor(message, status, response, headers, result) {
2784
+ super();
2785
+ this.isApiException = true;
2786
+ this.message = message;
2787
+ this.status = status;
2788
+ this.response = response;
2789
+ this.headers = headers;
2790
+ this.result = result;
2791
+ }
2792
+ static isApiException(obj) {
2793
+ return obj.isApiException === true;
2794
+ }
2795
+ }
2796
+ function throwException(message, status, response, headers, result) {
2797
+ if (result !== null && result !== undefined)
2798
+ return throwError(result);
2799
+ else
2800
+ return throwError(new ApiException(message, status, response, headers, null));
2801
+ }
2802
+ function blobToText(blob) {
2803
+ return new Observable((observer) => {
2804
+ if (!blob) {
2805
+ observer.next("");
2806
+ observer.complete();
2807
+ }
2808
+ else {
2809
+ let reader = new FileReader();
2810
+ reader.onload = event => {
2811
+ observer.next(event.target.result);
2812
+ observer.complete();
2813
+ };
2814
+ reader.readAsText(blob);
2815
+ }
2816
+ });
2817
+ }
2818
+
2819
+ // @dynamic
2820
+ function CreateApiClientConfiguration(token, apiUrl, apiKey = 'ApiKey') {
2821
+ const apiConf = new ApiClientConfiguration();
2822
+ apiConf.apiKey = apiKey;
2823
+ apiConf.apiUrl = apiUrl;
2824
+ apiConf.setAuthorizationToken(token);
2825
+ return apiConf;
2826
+ }
2827
+ class StorefrontModule {
2828
+ static forRoot(token, apiUrl, apiKey = 'ApiKey') {
2829
+ return {
2830
+ ngModule: StorefrontModule,
2831
+ providers: [
2832
+ {
2833
+ provide: API_BASE_URL,
2834
+ useValue: apiUrl
2835
+ },
2836
+ {
2837
+ provide: ApiClientConfiguration,
2838
+ useFactory: CreateApiClientConfiguration.bind(this, token, apiUrl, apiKey)
2839
+ },
2840
+ ]
2841
+ };
2842
+ }
2843
+ }
2844
+ StorefrontModule.decorators = [
2845
+ { type: NgModule, args: [{
2846
+ declarations: [],
2847
+ imports: [],
2848
+ exports: []
2849
+ },] }
2850
+ ];
2851
+
2852
+ /*
2853
+ * Public API Surface of client
2854
+ */
2855
+
2856
+ /**
2857
+ * Generated bundle index. Do not edit.
2858
+ */
2859
+
2860
+ export { API_BASE_URL, ApiClientBase, ApiClientConfiguration, ApiException, BuildInfoApiClient, CreateApiClientConfiguration, DatePeriod, ProductReferencesApiClient, ProductSpecificationsApiClient, ProjectsApiClient, StorefrontModule, StorefrontType, StorefrontUsersApiClient, StorefrontsApiClient, TenantInfoApiClient };
2861
+ //# sourceMappingURL=aurigma-ng-storefront-api-client.js.map