@aurigma/ng-backoffice-api-client
Version:
Angular API Client for BackOffice API service of Customer's Canvas web-to-print system.
5,503 lines • 284 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/operators'), require('rxjs'), require('@angular/common/http')) :
typeof define === 'function' && define.amd ? define('@aurigma/ng-backoffice-api-client', ['exports', '@angular/core', 'rxjs/operators', 'rxjs', '@angular/common/http'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.aurigma = global.aurigma || {}, global.aurigma['ng-backoffice-api-client'] = {}), global.ng.core, global.rxjs.operators, global.rxjs, global.ng.common.http));
}(this, (function (exports, i0, operators, rxjs, i1) { 'use strict';
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b)
if (Object.prototype.hasOwnProperty.call(b, p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); };
}
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function")
throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn)
context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access)
context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done)
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0)
continue;
if (result === null || typeof result !== "object")
throw new TypeError("Object expected");
if (_ = accept(result.get))
descriptor.get = _;
if (_ = accept(result.set))
descriptor.set = _;
if (_ = accept(result.init))
initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field")
initializers.unshift(_);
else
descriptor[key] = _;
}
}
if (target)
Object.defineProperty(target, contextIn.name, descriptor);
done = true;
}
;
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
}
;
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
}
;
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol")
name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
}
;
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try {
step(generator.next(value));
}
catch (e) {
reject(e);
} }
function rejected(value) { try {
step(generator["throw"](value));
}
catch (e) {
reject(e);
} }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function () { if (t[0] & 1)
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f)
throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _)
try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
return t;
if (y = 0, t)
op = [op[0] & 2, t.value];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2])
_.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
}
catch (e) {
op = [6, e];
y = 0;
}
finally {
f = t = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
}
var __createBinding = Object.create ? (function (o, m, k, k2) {
if (k2 === undefined)
k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function () { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function (o, m, k, k2) {
if (k2 === undefined)
k2 = k;
o[k2] = m[k];
});
function __exportStar(m, o) {
for (var p in m)
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
__createBinding(o, m, p);
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m)
return m.call(o);
if (o && typeof o.length === "number")
return {
next: function () {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
ar.push(r.value);
}
catch (error) {
e = { error: error };
}
finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
}
finally {
if (e)
throw e.error;
}
}
return ar;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2)
for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar)
ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) {
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); };
if (f)
i[n] = f(i[n]);
} }
function resume(n, v) { try {
step(g[n](v));
}
catch (e) {
settle(q[0][3], e);
} }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length)
resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator)
throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
}
else {
cooked.raw = raw;
}
return cooked;
}
;
var __setModuleDefault = Object.create ? (function (o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function (o, v) {
o["default"] = v;
};
var ownKeys = function (o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o)
if (Object.prototype.hasOwnProperty.call(o, k))
ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
function __importStar(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null)
for (var k = ownKeys(mod), i = 0; i < k.length; i++)
if (k[i] !== "default")
__createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function")
throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose)
throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose)
throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async)
inner = dispose;
}
if (typeof dispose !== "function")
throw new TypeError("Object not disposable.");
if (inner)
dispose = function () { try {
inner.call(this);
}
catch (e) {
return Promise.reject(e);
} };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1)
return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async)
return s |= 2, Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
}
else
s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1)
return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError)
throw env.error;
}
return next();
}
function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
var tslib_es6 = {
__extends: __extends,
__assign: __assign,
__rest: __rest,
__decorate: __decorate,
__param: __param,
__esDecorate: __esDecorate,
__runInitializers: __runInitializers,
__propKey: __propKey,
__setFunctionName: __setFunctionName,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__createBinding: __createBinding,
__exportStar: __exportStar,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__spreadArray: __spreadArray,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet,
__classPrivateFieldIn: __classPrivateFieldIn,
__addDisposableResource: __addDisposableResource,
__disposeResources: __disposeResources,
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
};
var API_BASE_URL = new i0.InjectionToken('API_BASE_URL');
var ApiClientConfiguration = /** @class */ (function () {
function ApiClientConfiguration() {
this.apiKey = 'ApiKey';
this.authorizationToken = null;
}
ApiClientConfiguration.prototype.getAuthorizationToken = function () {
return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2 /*return*/, this.authorizationToken];
}); });
};
;
ApiClientConfiguration.prototype.setAuthorizationToken = function (token) { this.authorizationToken = token; };
;
return ApiClientConfiguration;
}());
var ApiClientBase = /** @class */ (function () {
function ApiClientBase(configuration) {
this.configuration = configuration;
}
ApiClientBase.prototype.transformOptions = function (options) {
return __awaiter(this, void 0, void 0, function () {
var token;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.configuration.getAuthorizationToken()];
case 1:
token = _a.sent();
if (token != null) {
options.headers = options.headers.append("authorization", "Bearer " + token);
}
else {
options.headers = options.headers.append("X-API-Key", this.configuration.apiKey);
}
//options = { ...options, transformResponse: (res) => res, responseType: 'json' };
return [2 /*return*/, options];
}
});
});
};
ApiClientBase.prototype.getBaseUrl = function (defultUrl) {
return this.configuration.apiUrl;
};
ApiClientBase.prototype.transformResult = function (url, res, cb) {
return cb(res);
};
return ApiClientBase;
}());
var BuildInfoApiClient = /** @class */ (function (_super) {
__extends(BuildInfoApiClient, _super);
function BuildInfoApiClient(configuration, http, baseUrl) {
var _this = _super.call(this, configuration) || this;
_this.jsonParseReviver = undefined;
_this.http = http;
_this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : _this.getBaseUrl("");
return _this;
}
/**
* Returns assembly build info.
* @return Success
*/
BuildInfoApiClient.prototype.headInfo = function () {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/info";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("head", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processHeadInfo(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processHeadInfo(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
BuildInfoApiClient.prototype.processHeadInfo = function (response) {
var e_1, _a;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns assembly build info.
* @return Success
*/
BuildInfoApiClient.prototype.getInfo = function () {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/info";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetInfo(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetInfo(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
BuildInfoApiClient.prototype.processGetInfo = function (response) {
var e_2, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
return BuildInfoApiClient;
}(ApiClientBase));
BuildInfoApiClient.ɵprov = i0.ɵɵdefineInjectable({ factory: function BuildInfoApiClient_Factory() { return new BuildInfoApiClient(i0.ɵɵinject(ApiClientConfiguration), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(API_BASE_URL, 8)); }, token: BuildInfoApiClient, providedIn: "root" });
BuildInfoApiClient.decorators = [
{ type: i0.Injectable, args: [{
providedIn: 'root'
},] }
];
BuildInfoApiClient.ctorParameters = function () { return [
{ type: ApiClientConfiguration, decorators: [{ type: i0.Inject, args: [ApiClientConfiguration,] }] },
{ type: i1.HttpClient, decorators: [{ type: i0.Inject, args: [i1.HttpClient,] }] },
{ type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [API_BASE_URL,] }] }
]; };
var ProductReferencesManagementApiClient = /** @class */ (function (_super) {
__extends(ProductReferencesManagementApiClient, _super);
function ProductReferencesManagementApiClient(configuration, http, baseUrl) {
var _this = _super.call(this, configuration) || this;
_this.jsonParseReviver = undefined;
_this.http = http;
_this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : _this.getBaseUrl("");
return _this;
}
/**
* Returns all storefront product references relevant to the specified query parameters.
* @param storefrontId Storefront identifier.
* @param productReference (optional) Product reference filter.
Product reference is an external reference to Customer's Canvas product, e.g online store product identifier.
* @param productSpecificationId (optional) Customer's Canvas product specification filter.
* @param productId (optional) Customer's Canvas product filter.
* @param productLinkId (optional) Customer's Canvas product link filter.
* @param productBundleId (optional) Customer's Canvas product bundle filter.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC".
* @param search (optional) Search string for partial match.
* @param sku (optional) SKU filter.
* @param tags (optional) List of tags that product should have.
* @param customFields (optional) Serialized custom fields dictionary filter. For example: {"public":"true","name":"my item"}.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductReferencesManagementApiClient.prototype.getAll = function (storefrontId, productReference, productSpecificationId, productId, productLinkId, productBundleId, skip, take, sorting, search, sku, tags, customFields, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/product-references?";
if (storefrontId === undefined || storefrontId === null)
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
else
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
if (productReference !== undefined && productReference !== null)
url_ += "productReference=" + encodeURIComponent("" + productReference) + "&";
if (productSpecificationId !== undefined && productSpecificationId !== null)
url_ += "productSpecificationId=" + encodeURIComponent("" + productSpecificationId) + "&";
if (productId !== undefined && productId !== null)
url_ += "productId=" + encodeURIComponent("" + productId) + "&";
if (productLinkId !== undefined && productLinkId !== null)
url_ += "productLinkId=" + encodeURIComponent("" + productLinkId) + "&";
if (productBundleId === null)
throw new Error("The parameter 'productBundleId' cannot be null.");
else if (productBundleId !== undefined)
url_ += "productBundleId=" + encodeURIComponent("" + productBundleId) + "&";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (sorting !== undefined && sorting !== null)
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (sku !== undefined && sku !== null)
url_ += "sku=" + encodeURIComponent("" + sku) + "&";
if (tags !== undefined && tags !== null)
tags && tags.forEach(function (item) { url_ += "tags=" + encodeURIComponent("" + item) + "&"; });
if (customFields !== undefined && customFields !== null)
url_ += "customFields=" + encodeURIComponent("" + customFields) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAll(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAll(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductReferencesManagementApiClient.prototype.processGetAll = function (response) {
var e_3, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates a new storefront product reference.
* @param storefrontId Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Create operation parameters.
* @return Success
*/
ProductReferencesManagementApiClient.prototype.create = function (storefrontId, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/product-references?";
if (storefrontId === undefined || storefrontId === null)
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
else
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreate(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreate(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductReferencesManagementApiClient.prototype.processCreate = function (response) {
var e_4, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
}
if (status === 201) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result201 = null;
result201 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result201);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a storefront product reference.
* @param reference An external reference to Customer's Canvas product, e.g online store product identifier.
* @param storefrontId Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductReferencesManagementApiClient.prototype.get = function (reference, storefrontId, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/product-references/{reference}?";
if (reference === undefined || reference === null)
throw new Error("The parameter 'reference' must be defined.");
url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
if (storefrontId === undefined || storefrontId === null)
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
else
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGet(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGet(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductReferencesManagementApiClient.prototype.processGet = function (response) {
var e_5, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_5) throw e_5.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Deletes the storefront product reference.
* @param reference Product reference - external reference to Customer's Canvas product specification, e.g online store product identifier.
* @param storefrontId Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductReferencesManagementApiClient.prototype.delete = function (reference, storefrontId, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/product-references/{reference}?";
if (reference === undefined || reference === null)
throw new Error("The parameter 'reference' must be defined.");
url_ = url_.replace("{reference}", encodeURIComponent("" + reference));
if (storefrontId === undefined || storefrontId === null)
throw new Error("The parameter 'storefrontId' must be defined and cannot be null.");
else
url_ += "storefrontId=" + encodeURIComponent("" + storefrontId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processDelete(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processDelete(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductReferencesManagementApiClient.prototype.processDelete = function (response) {
var e_6, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_6) throw e_6.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
return ProductReferencesManagementApiClient;
}(ApiClientBase));
ProductReferencesManagementApiClient.ɵprov = i0.ɵɵdefineInjectable({ factory: function ProductReferencesManagementApiClient_Factory() { return new ProductReferencesManagementApiClient(i0.ɵɵinject(ApiClientConfiguration), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(API_BASE_URL, 8)); }, token: ProductReferencesManagementApiClient, providedIn: "root" });
ProductReferencesManagementApiClient.decorators = [
{ type: i0.Injectable, args: [{
providedIn: 'root'
},] }
];
ProductReferencesManagementApiClient.ctorParameters = function () { return [
{ type: ApiClientConfiguration, decorators: [{ type: i0.Inject, args: [ApiClientConfiguration,] }] },
{ type: i1.HttpClient, decorators: [{ type: i0.Inject, args: [i1.HttpClient,] }] },
{ type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [API_BASE_URL,] }] }
]; };
var ProductsManagementApiClient = /** @class */ (function (_super) {
__extends(ProductsManagementApiClient, _super);
function ProductsManagementApiClient(configuration, http, baseUrl) {
var _this = _super.call(this, configuration) || this;
_this.jsonParseReviver = undefined;
_this.http = http;
_this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : _this.getBaseUrl("");
return _this;
}
/**
* Returns all products, relevant to the specified query parameters.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC".
* @param search (optional) Search string for partial match.
* @param sku (optional) SKU of linked ecommerce product.
* @param tags (optional) List of tags that product should have.
* @param customFields (optional) Serialized custom fields dictionary filter. For example: {"public":"true","name":"my item"}.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getAllProducts = function (skip, take, sorting, search, sku, tags, customFields, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products?";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (sorting !== undefined && sorting !== null)
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (sku !== undefined && sku !== null)
url_ += "sku=" + encodeURIComponent("" + sku) + "&";
if (tags !== undefined && tags !== null)
tags && tags.forEach(function (item) { url_ += "tags=" + encodeURIComponent("" + item) + "&"; });
if (customFields !== undefined && customFields !== null)
url_ += "customFields=" + encodeURIComponent("" + customFields) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAllProducts(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAllProducts(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetAllProducts = function (response) {
var e_7, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_7_1) { e_7 = { error: e_7_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_7) throw e_7.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates a new product and returns its description.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.createProduct = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateProduct(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateProduct(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processCreateProduct = function (response) {
var e_8, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_8_1) { e_8 = { error: e_8_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_8) throw e_8.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a product by its identifier.
* @param id Product identifier.
* @param productVersionId (optional) Product version identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProduct = function (id, productVersionId, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProduct(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProduct(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProduct = function (response) {
var e_9, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_9_1) { e_9 = { error: e_9_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_9) throw e_9.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Deletes a product by its identifier.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.deleteProduct = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processDeleteProduct(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processDeleteProduct(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processDeleteProduct = function (response) {
var e_10, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_10_1) { e_10 = { error: e_10_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_10) throw e_10.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a list of product options.
* @param id Product identifier.
* @param productVersionId (optional) Product version identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProductOptions = function (id, productVersionId, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/options?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductOptions(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductOptions(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProductOptions = function (response) {
var e_11, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_11_1) { e_11 = { error: e_11_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_11) throw e_11.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a list of product variants.
* @param id Product identifier.
* @param productVersionId (optional) Product version identifier.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param options (optional) Defines options filter e.g.: "{ "opt1_id": "opt1_val1_id, opt1_val2_id", "opt2_id": "opt2_val1_id" }".
* @param productFilterId (optional) Defines special filter based on product filter with specified identifier.
* @param takeAvailableOnly (optional) Defines special filter for available product variants.
* @param sku (optional) SKU of linked ecommerce product.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProductVariants = function (id, productVersionId, skip, take, options, productFilterId, takeAvailableOnly, sku, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/variants?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (options !== undefined && options !== null)
url_ += "options=" + encodeURIComponent("" + options) + "&";
if (productFilterId !== undefined && productFilterId !== null)
url_ += "productFilterId=" + encodeURIComponent("" + productFilterId) + "&";
if (takeAvailableOnly !== undefined && takeAvailableOnly !== null)
url_ += "takeAvailableOnly=" + encodeURIComponent("" + takeAvailableOnly) + "&";
if (sku !== undefined && sku !== null)
url_ += "sku=" + encodeURIComponent("" + sku) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariants(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariants(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProductVariants = function (response) {
var e_12, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_12_1) { e_12 = { error: e_12_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_12) throw e_12.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a product variant.
* @param id Product identifier.
* @param productVariantId Product variant identifier.
* @param productVersionId (optional) Product version identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProductVariant = function (id, productVariantId, productVersionId, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/variants/{productVariantId}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVariantId === undefined || productVariantId === null)
throw new Error("The parameter 'productVariantId' must be defined.");
url_ = url_.replace("{productVariantId}", encodeURIComponent("" + productVariantId));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariant(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariant(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProductVariant = function (response) {
var e_13, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_13_1) { e_13 = { error: e_13_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_13) throw e_13.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a list of product variant designs.
* @param id Product identifier.
* @param productVersionId (optional) Product version identifier.
* @param productVariantId (optional) Product variant identifier.
* @param search (optional) Search string for design name partial match.
* @param designCustomFields (optional) Custom attributes dictionary filter for designs. For example: {"public":"true","name":"my item"}
* @param designPath (optional) Path filter for designs. Subfolders included by default.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param options (optional) Defines options filter e.g.: "{ "opt1_id": "opt1_val1_id, opt1_val2_id", "opt2_id": "opt2_val1_id" }".
* @param productFilterId (optional) Defines special filter based on product filter with specified identifier.
* @param takeAvailableOnly (optional) Defines special filter for available product variants.
* @param sku (optional) SKU of linked ecommerce product.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProductVariantDesigns = function (id, productVersionId, productVariantId, search, designCustomFields, designPath, skip, take, options, productFilterId, takeAvailableOnly, sku, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/variant-designs?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (productVariantId !== undefined && productVariantId !== null)
url_ += "productVariantId=" + encodeURIComponent("" + productVariantId) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (designCustomFields !== undefined && designCustomFields !== null)
url_ += "designCustomFields=" + encodeURIComponent("" + designCustomFields) + "&";
if (designPath !== undefined && designPath !== null)
url_ += "designPath=" + encodeURIComponent("" + designPath) + "&";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (options !== undefined && options !== null)
url_ += "options=" + encodeURIComponent("" + options) + "&";
if (productFilterId !== undefined && productFilterId !== null)
url_ += "productFilterId=" + encodeURIComponent("" + productFilterId) + "&";
if (takeAvailableOnly !== undefined && takeAvailableOnly !== null)
url_ += "takeAvailableOnly=" + encodeURIComponent("" + takeAvailableOnly) + "&";
if (sku !== undefined && sku !== null)
url_ += "sku=" + encodeURIComponent("" + sku) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariantDesigns(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariantDesigns(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProductVariantDesigns = function (response) {
var e_14, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_14_1) { e_14 = { error: e_14_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_14) throw e_14.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a list of product variant mockups.
* @param id Product identifier.
* @param productVersionId (optional) Product version identifier.
* @param productVariantId (optional) Product variant identifier.
* @param search (optional) Search string for design name partial match.
* @param mockupCustomFields (optional) Custom attributes dictionary filter for mockups. For example: {"public":"true","name":"my item"}
* @param mockupPath (optional) Path filter for mockups. Subfolders included by default.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param options (optional) Defines options filter e.g.: "{ "opt1_id": "opt1_val1_id, opt1_val2_id", "opt2_id": "opt2_val1_id" }".
* @param productFilterId (optional) Defines special filter based on product filter with specified identifier.
* @param takeAvailableOnly (optional) Defines special filter for available product variants.
* @param sku (optional) SKU of linked ecommerce product.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProductVariantMockups = function (id, productVersionId, productVariantId, search, mockupCustomFields, mockupPath, skip, take, options, productFilterId, takeAvailableOnly, sku, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/variant-mockups?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (productVariantId !== undefined && productVariantId !== null)
url_ += "productVariantId=" + encodeURIComponent("" + productVariantId) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (mockupCustomFields !== undefined && mockupCustomFields !== null)
url_ += "mockupCustomFields=" + encodeURIComponent("" + mockupCustomFields) + "&";
if (mockupPath !== undefined && mockupPath !== null)
url_ += "mockupPath=" + encodeURIComponent("" + mockupPath) + "&";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (options !== undefined && options !== null)
url_ += "options=" + encodeURIComponent("" + options) + "&";
if (productFilterId !== undefined && productFilterId !== null)
url_ += "productFilterId=" + encodeURIComponent("" + productFilterId) + "&";
if (takeAvailableOnly !== undefined && takeAvailableOnly !== null)
url_ += "takeAvailableOnly=" + encodeURIComponent("" + takeAvailableOnly) + "&";
if (sku !== undefined && sku !== null)
url_ += "sku=" + encodeURIComponent("" + sku) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariantMockups(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariantMockups(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProductVariantMockups = function (response) {
var e_15, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_15_1) { e_15 = { error: e_15_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_15) throw e_15.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a list of product variant documents.
* @param id Product identifier.
* @param productVersionId (optional) Product version identifier.
* @param productVariantId (optional) Product variant identifier.
* @param search (optional) Search string for document name partial match.
* @param documentCustomFields (optional) Custom attributes dictionary filter for documents. For example: {"public":"true","name":"my item"}
* @param documentPath (optional) Path filter for documents. Subfolders included by default.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param options (optional) Defines options filter e.g.: "{ "opt1_id": "opt1_val1_id, opt1_val2_id", "opt2_id": "opt2_val1_id" }".
* @param productFilterId (optional) Defines special filter based on product filter with specified identifier.
* @param takeAvailableOnly (optional) Defines special filter for available product variants.
* @param sku (optional) SKU of linked ecommerce product.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getProductVariantDocuments = function (id, productVersionId, productVariantId, search, documentCustomFields, documentPath, skip, take, options, productFilterId, takeAvailableOnly, sku, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/variant-documents?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (productVariantId !== undefined && productVariantId !== null)
url_ += "productVariantId=" + encodeURIComponent("" + productVariantId) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (documentCustomFields !== undefined && documentCustomFields !== null)
url_ += "documentCustomFields=" + encodeURIComponent("" + documentCustomFields) + "&";
if (documentPath !== undefined && documentPath !== null)
url_ += "documentPath=" + encodeURIComponent("" + documentPath) + "&";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (options !== undefined && options !== null)
url_ += "options=" + encodeURIComponent("" + options) + "&";
if (productFilterId !== undefined && productFilterId !== null)
url_ += "productFilterId=" + encodeURIComponent("" + productFilterId) + "&";
if (takeAvailableOnly !== undefined && takeAvailableOnly !== null)
url_ += "takeAvailableOnly=" + encodeURIComponent("" + takeAvailableOnly) + "&";
if (sku !== undefined && sku !== null)
url_ += "sku=" + encodeURIComponent("" + sku) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariantDocuments(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetProductVariantDocuments(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetProductVariantDocuments = function (response) {
var e_16, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_16_1) { e_16 = { error: e_16_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_16) throw e_16.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Set product variants price. Variants identifiers will be changed.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Set product variants price operation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.setProductVariantPrice = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/set-variant-price?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductVariantPrice(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductVariantPrice(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processSetProductVariantPrice = function (response) {
var e_17, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_17_1) { e_17 = { error: e_17_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_17) throw e_17.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Set product variants availability. Variants identifiers will be changed.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Set product variants availability operation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.setProductVariantAvailability = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/set-variant-availability?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductVariantAvailability(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductVariantAvailability(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processSetProductVariantAvailability = function (response) {
var e_18, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_18_1) { e_18 = { error: e_18_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_18) throw e_18.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Set product variants SKU. Variants identifiers will be changed.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Set product variants SKU operation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.setProductVariantSku = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/set-variant-sku?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductVariantSku(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductVariantSku(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processSetProductVariantSku = function (response) {
var e_19, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_19_1) { e_19 = { error: e_19_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_19) throw e_19.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Imports products from a specific CSV file and returns a list of imported products descriptions.
* @param tenantId (optional) Tenant identifier.
* @param file (optional)
* @return Success
*/
ProductsManagementApiClient.prototype.importProducts = function (tenantId, file) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/import?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = new FormData();
if (file !== null && file !== undefined)
content_.append("file", file.data, file.fileName ? file.fileName : "file");
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processImportProducts(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processImportProducts(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processImportProducts = function (response) {
var e_20, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_20_1) { e_20 = { error: e_20_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_20) throw e_20.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new designs connections for a specified product.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product designs connections creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.createDesignsConnections = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/design-connections?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateDesignsConnections(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateDesignsConnections(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processCreateDesignsConnections = function (response) {
var e_21, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_21_1) { e_21 = { error: e_21_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_21) throw e_21.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Removes designs connections for a specified product.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product designs connections creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.removeDesignsConnections = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/design-connections?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processRemoveDesignsConnections(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processRemoveDesignsConnections(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processRemoveDesignsConnections = function (response) {
var e_22, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_22_1) { e_22 = { error: e_22_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_22) throw e_22.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new mockups connections for a specified product.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product mockups connections creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.createMockupsConnections = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/mockup-connections?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateMockupsConnections(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateMockupsConnections(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processCreateMockupsConnections = function (response) {
var e_23, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_23_1) { e_23 = { error: e_23_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_23) throw e_23.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Removes mockups connections for a specified product.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product mockups connections creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.removeMockupsConnections = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/mockup-connections?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processRemoveMockupsConnections(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processRemoveMockupsConnections(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processRemoveMockupsConnections = function (response) {
var e_24, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_24_1) { e_24 = { error: e_24_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_24) throw e_24.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new documents connections for a specified product.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product documents connections creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.createDocumentsConnections = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/document-connections?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateDocumentsConnections(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateDocumentsConnections(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processCreateDocumentsConnections = function (response) {
var e_25, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_25_1) { e_25 = { error: e_25_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_25) throw e_25.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Removes documents connections for a specified product.
* @param id Product identifier.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Product documents connections creation parameters.
* @return Success
*/
ProductsManagementApiClient.prototype.removeDocumentsConnections = function (id, tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/document-connections?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processRemoveDocumentsConnections(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processRemoveDocumentsConnections(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processRemoveDocumentsConnections = function (response) {
var e_26, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_26_1) { e_26 = { error: e_26_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_26) throw e_26.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Set a thumbnail image for an existing product.
* @param id Product identifier.
* @param productVersionId (optional)
* @param tenantId (optional) Tenant identifier.
* @param file (optional)
* @return Success
*/
ProductsManagementApiClient.prototype.setProductImage = function (id, productVersionId, tenantId, file) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/{id}/set-image?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (productVersionId !== undefined && productVersionId !== null)
url_ += "productVersionId=" + encodeURIComponent("" + productVersionId) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = new FormData();
if (file !== null && file !== undefined)
content_.append("file", file.data, file.fileName ? file.fileName : "file");
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductImage(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processSetProductImage(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processSetProductImage = function (response) {
var e_27, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_27_1) { e_27 = { error: e_27_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_27) throw e_27.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns all available product personalization workflows.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param search (optional) Search string for partial by personalization workflow name.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getAvailablePersonalizationWorkflows = function (skip, take, search, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/available-workflows?";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAvailablePersonalizationWorkflows(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAvailablePersonalizationWorkflows(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetAvailablePersonalizationWorkflows = function (response) {
var e_28, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_28_1) { e_28 = { error: e_28_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_28) throw e_28.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns all available product processing pipelines.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param search (optional) Search string for partial by processing pipeline name.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
ProductsManagementApiClient.prototype.getAvailableProcessingPipelines = function (skip, take, search, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/products/available-pipelines?";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAvailableProcessingPipelines(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAvailableProcessingPipelines(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
ProductsManagementApiClient.prototype.processGetAvailableProcessingPipelines = function (response) {
var e_29, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_29_1) { e_29 = { error: e_29_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_29) throw e_29.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
return ProductsManagementApiClient;
}(ApiClientBase));
ProductsManagementApiClient.ɵprov = i0.ɵɵdefineInjectable({ factory: function ProductsManagementApiClient_Factory() { return new ProductsManagementApiClient(i0.ɵɵinject(ApiClientConfiguration), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(API_BASE_URL, 8)); }, token: ProductsManagementApiClient, providedIn: "root" });
ProductsManagementApiClient.decorators = [
{ type: i0.Injectable, args: [{
providedIn: 'root'
},] }
];
ProductsManagementApiClient.ctorParameters = function () { return [
{ type: ApiClientConfiguration, decorators: [{ type: i0.Inject, args: [ApiClientConfiguration,] }] },
{ type: i1.HttpClient, decorators: [{ type: i0.Inject, args: [i1.HttpClient,] }] },
{ type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [API_BASE_URL,] }] }
]; };
var StorefrontsManagementApiClient = /** @class */ (function (_super) {
__extends(StorefrontsManagementApiClient, _super);
function StorefrontsManagementApiClient(configuration, http, baseUrl) {
var _this = _super.call(this, configuration) || this;
_this.jsonParseReviver = undefined;
_this.http = http;
_this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : _this.getBaseUrl("");
return _this;
}
/**
* Returns all storefronts, relevant to the specified query parameters.
* @param types (optional) Storefront type filter.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC".
* @param search (optional) Search string for partial match.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.getAll = function (types, skip, take, sorting, search, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts?";
if (types !== undefined && types !== null)
types && types.forEach(function (item) { url_ += "types=" + encodeURIComponent("" + item) + "&"; });
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (sorting !== undefined && sorting !== null)
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAll(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAll(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGetAll = function (response) {
var e_30, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_30_1) { e_30 = { error: e_30_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_30) throw e_30.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a storefront by identifier.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.get = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGet(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGet(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGet = function (response) {
var e_31, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_31_1) { e_31 = { error: e_31_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_31) throw e_31.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Deletes an existing storefront by its identifier.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.delete = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processDelete(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processDelete(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processDelete = function (response) {
var e_32, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_32_1) { e_32 = { error: e_32_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_32) throw e_32.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new custom storefront.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Custom storefront creation model.
* @return Success
*/
StorefrontsManagementApiClient.prototype.createCustomStorefront = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/custom?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateCustomStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateCustomStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processCreateCustomStorefront = function (response) {
var e_33, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_33_1) { e_33 = { error: e_33_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_33) throw e_33.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns extended information about custom storefront.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.getCustomStorefront = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/custom/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetCustomStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetCustomStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGetCustomStorefront = function (response) {
var e_34, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_34_1) { e_34 = { error: e_34_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_34) throw e_34.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new NopCommerce storefront.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) NopCommerce storefront creation model.
* @return Success
*/
StorefrontsManagementApiClient.prototype.createNopCommerceStorefront = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/nopcommerce?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateNopCommerceStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateNopCommerceStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processCreateNopCommerceStorefront = function (response) {
var e_35, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_35_1) { e_35 = { error: e_35_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_35) throw e_35.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns extended information about NopCommerce storefront.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.getNopCommerceStorefront = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/nopcommerce/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetNopCommerceStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetNopCommerceStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGetNopCommerceStorefront = function (response) {
var e_36, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_36_1) { e_36 = { error: e_36_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_36) throw e_36.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new WooCommerce storefront.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) WooCommerce storefront creation model.
* @return Success
*/
StorefrontsManagementApiClient.prototype.createWooCommerceStorefront = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/woocommerce?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateWooCommerceStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateWooCommerceStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processCreateWooCommerceStorefront = function (response) {
var e_37, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_37_1) { e_37 = { error: e_37_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_37) throw e_37.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns extended information about WooCommerce storefront.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.getWooCommerceStorefront = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/woocommerce/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetWooCommerceStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetWooCommerceStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGetWooCommerceStorefront = function (response) {
var e_38, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_38_1) { e_38 = { error: e_38_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_38) throw e_38.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new Magento storefront.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) Magento storefront creation model.
* @return Success
*/
StorefrontsManagementApiClient.prototype.createMagentoStorefront = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/magento?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateMagentoStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateMagentoStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processCreateMagentoStorefront = function (response) {
var e_39, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_39_1) { e_39 = { error: e_39_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_39) throw e_39.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns extended information about Magento storefront.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.getMagentoStorefront = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/magento/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetMagentoStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetMagentoStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGetMagentoStorefront = function (response) {
var e_40, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_40_1) { e_40 = { error: e_40_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_40) throw e_40.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates new BigCommerce storefront.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) BigCommerce storefront creation model.
* @return Success
*/
StorefrontsManagementApiClient.prototype.createBigCommerceStorefront = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/bigcommerce?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateBigCommerceStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreateBigCommerceStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processCreateBigCommerceStorefront = function (response) {
var e_41, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_41_1) { e_41 = { error: e_41_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_41) throw e_41.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 400) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result400 = null;
result400 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Bad Request", status, _responseText, _headers, result400);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns extended information about BigCommerce storefront.
* @param id Storefront identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
StorefrontsManagementApiClient.prototype.getBigCommerceStorefront = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/storefronts/bigcommerce/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetBigCommerceStorefront(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetBigCommerceStorefront(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
StorefrontsManagementApiClient.prototype.processGetBigCommerceStorefront = function (response) {
var e_42, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_42_1) { e_42 = { error: e_42_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_42) throw e_42.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
return StorefrontsManagementApiClient;
}(ApiClientBase));
StorefrontsManagementApiClient.ɵprov = i0.ɵɵdefineInjectable({ factory: function StorefrontsManagementApiClient_Factory() { return new StorefrontsManagementApiClient(i0.ɵɵinject(ApiClientConfiguration), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(API_BASE_URL, 8)); }, token: StorefrontsManagementApiClient, providedIn: "root" });
StorefrontsManagementApiClient.decorators = [
{ type: i0.Injectable, args: [{
providedIn: 'root'
},] }
];
StorefrontsManagementApiClient.ctorParameters = function () { return [
{ type: ApiClientConfiguration, decorators: [{ type: i0.Inject, args: [ApiClientConfiguration,] }] },
{ type: i1.HttpClient, decorators: [{ type: i0.Inject, args: [i1.HttpClient,] }] },
{ type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [API_BASE_URL,] }] }
]; };
var UsersManagementApiClient = /** @class */ (function (_super) {
__extends(UsersManagementApiClient, _super);
function UsersManagementApiClient(configuration, http, baseUrl) {
var _this = _super.call(this, configuration) || this;
_this.jsonParseReviver = undefined;
_this.http = http;
_this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : _this.getBaseUrl("");
return _this;
}
/**
* Returns a tenant users list.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
UsersManagementApiClient.prototype.getAll = function (tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/users?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAll(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAll(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
UsersManagementApiClient.prototype.processGetAll = function (response) {
var e_43, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_43_1) { e_43 = { error: e_43_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_43) throw e_43.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Creates a new tenant user.
* @param tenantId (optional) Tenant identifier.
* @param body (optional) User creation model.
* @return Success
*/
UsersManagementApiClient.prototype.create = function (tenantId, body) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/users?";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var content_ = JSON.stringify(body);
var options_ = {
body: content_,
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("post", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processCreate(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processCreate(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
UsersManagementApiClient.prototype.processCreate = function (response) {
var e_44, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_44_1) { e_44 = { error: e_44_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_44) throw e_44.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 409) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result409 = null;
result409 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Conflict", status, _responseText, _headers, result409);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns a tenant user by user identifier.
* @param id User identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
UsersManagementApiClient.prototype.get = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/users/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGet(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGet(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
UsersManagementApiClient.prototype.processGet = function (response) {
var e_45, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_45_1) { e_45 = { error: e_45_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_45) throw e_45.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 404) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result404 = null;
result404 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return throwException("Not Found", status, _responseText, _headers, result404);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Deletes an existing tenant user.
* @param id User identifier.
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
UsersManagementApiClient.prototype.delete = function (id, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/users/{id}?";
if (id === undefined || id === null)
throw new Error("The parameter 'id' must be defined.");
url_ = url_.replace("{id}", encodeURIComponent("" + id));
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("delete", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processDelete(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processDelete(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
UsersManagementApiClient.prototype.processDelete = function (response) {
var e_46, _a;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_46_1) { e_46 = { error: e_46_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_46) throw e_46.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return rxjs.of(null);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
/**
* Returns all tenant user roles, relevant to the specified query parameters.
* @param search (optional) Search string for partial match.
* @param skip (optional) Defines page start offset from beginning of sorted result list.
* @param take (optional) Defines page length (how many consequent items of sorted result list should be taken).
* @param sorting (optional) Defines sorting order of result list e.g.: "Title ASC, LastModified DESC".
* @param tenantId (optional) Tenant identifier.
* @return Success
*/
UsersManagementApiClient.prototype.getAllRoles = function (search, skip, take, sorting, tenantId) {
var _this = this;
var url_ = this.baseUrl + "/api/backoffice/v1/users/roles?";
if (search !== undefined && search !== null)
url_ += "search=" + encodeURIComponent("" + search) + "&";
if (skip !== undefined && skip !== null)
url_ += "skip=" + encodeURIComponent("" + skip) + "&";
if (take !== undefined && take !== null)
url_ += "take=" + encodeURIComponent("" + take) + "&";
if (sorting !== undefined && sorting !== null)
url_ += "sorting=" + encodeURIComponent("" + sorting) + "&";
if (tenantId !== undefined && tenantId !== null)
url_ += "tenantId=" + encodeURIComponent("" + tenantId) + "&";
url_ = url_.replace(/[?&]$/, "");
var options_ = {
observe: "response",
responseType: "blob",
headers: new i1.HttpHeaders({
"Accept": "application/json"
})
};
return rxjs.from(this.transformOptions(options_)).pipe(operators.mergeMap(function (transformedOptions_) {
return _this.http.request("get", url_, transformedOptions_);
})).pipe(operators.mergeMap(function (response_) {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAllRoles(r); });
})).pipe(operators.catchError(function (response_) {
if (response_ instanceof i1.HttpResponseBase) {
try {
return _this.transformResult(url_, response_, function (r) { return _this.processGetAllRoles(r); });
}
catch (e) {
return rxjs.throwError(e);
}
}
else
return rxjs.throwError(response_);
}));
};
UsersManagementApiClient.prototype.processGetAllRoles = function (response) {
var e_47, _a;
var _this = this;
var status = response.status;
var responseBlob = response instanceof i1.HttpResponse ? response.body :
response.error instanceof Blob ? response.error : undefined;
var _headers = {};
if (response.headers) {
try {
for (var _b = __values(response.headers.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_headers[key] = response.headers.get(key);
}
}
catch (e_47_1) { e_47 = { error: e_47_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_47) throw e_47.error; }
}
}
if (status === 200) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
var result200 = null;
result200 = _responseText === "" ? null : JSON.parse(_responseText, _this.jsonParseReviver);
return rxjs.of(result200);
}));
}
else if (status === 401) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Unauthorized", status, _responseText, _headers);
}));
}
else if (status === 403) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("Forbidden", status, _responseText, _headers);
}));
}
else if (status !== 200 && status !== 204) {
return blobToText(responseBlob).pipe(operators.mergeMap(function (_responseText) {
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}));
}
return rxjs.of(null);
};
return UsersManagementApiClient;
}(ApiClientBase));
UsersManagementApiClient.ɵprov = i0.ɵɵdefineInjectable({ factory: function UsersManagementApiClient_Factory() { return new UsersManagementApiClient(i0.ɵɵinject(ApiClientConfiguration), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(API_BASE_URL, 8)); }, token: UsersManagementApiClient, providedIn: "root" });
UsersManagementApiClient.decorators = [
{ type: i0.Injectable, args: [{
providedIn: 'root'
},] }
];
UsersManagementApiClient.ctorParameters = function () { return [
{ type: ApiClientConfiguration, decorators: [{ type: i0.Inject, args: [ApiClientConfiguration,] }] },
{ type: i1.HttpClient, decorators: [{ type: i0.Inject, args: [i1.HttpClient,] }] },
{ type: String, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [API_BASE_URL,] }] }
]; };
(function (ProductReferenceType) {
ProductReferenceType["ProductSpecification"] = "ProductSpecification";
ProductReferenceType["Product"] = "Product";
ProductReferenceType["ProductLink"] = "ProductLink";
ProductReferenceType["ProductBundle"] = "ProductBundle";
})(exports.ProductReferenceType || (exports.ProductReferenceType = {}));
(function (ConflictType) {
ConflictType["NameConflict"] = "NameConflict";
ConflictType["FolderOverwriteConflict"] = "FolderOverwriteConflict";
ConflictType["IdConflict"] = "IdConflict";
ConflictType["GeneralConflict"] = "GeneralConflict";
})(exports.ConflictType || (exports.ConflictType = {}));
(function (OptionType) {
OptionType["Simple"] = "Simple";
OptionType["Size"] = "Size";
OptionType["PageCount"] = "PageCount";
})(exports.OptionType || (exports.OptionType = {}));
(function (AppearanceDataType) {
AppearanceDataType["Radio"] = "Radio";
AppearanceDataType["Dropdown"] = "Dropdown";
AppearanceDataType["Chips"] = "Chips";
AppearanceDataType["ColorGrid"] = "ColorGrid";
AppearanceDataType["ColorList"] = "ColorList";
AppearanceDataType["ImageGrid"] = "ImageGrid";
AppearanceDataType["ImageList"] = "ImageList";
})(exports.AppearanceDataType || (exports.AppearanceDataType = {}));
(function (ProductVariantResourceType) {
ProductVariantResourceType["Preview"] = "Preview";
ProductVariantResourceType["EditorModel"] = "EditorModel";
ProductVariantResourceType["Custom"] = "Custom";
})(exports.ProductVariantResourceType || (exports.ProductVariantResourceType = {}));
(function (ProductVariantMockupType) {
ProductVariantMockupType["Thumbnail"] = "Thumbnail";
ProductVariantMockupType["Editor"] = "Editor";
ProductVariantMockupType["Preview"] = "Preview";
})(exports.ProductVariantMockupType || (exports.ProductVariantMockupType = {}));
(function (SurfaceUsageType) {
SurfaceUsageType["Individual"] = "Individual";
SurfaceUsageType["Custom"] = "Custom";
SurfaceUsageType["All"] = "All";
})(exports.SurfaceUsageType || (exports.SurfaceUsageType = {}));
(function (ProductMockupType) {
ProductMockupType["Thumbnail"] = "Thumbnail";
ProductMockupType["Editor"] = "Editor";
ProductMockupType["Preview"] = "Preview";
})(exports.ProductMockupType || (exports.ProductMockupType = {}));
(function (WorkflowType) {
WorkflowType["UIFramework"] = "UIFramework";
WorkflowType["SimpleEditor"] = "SimpleEditor";
WorkflowType["DesignEditor"] = "DesignEditor";
WorkflowType["WorkflowElements"] = "WorkflowElements";
})(exports.WorkflowType || (exports.WorkflowType = {}));
(function (StorefrontType) {
StorefrontType["Custom"] = "Custom";
StorefrontType["ShopifyLegacy"] = "ShopifyLegacy";
StorefrontType["DocketManager"] = "DocketManager";
StorefrontType["CustomSaml"] = "CustomSaml";
StorefrontType["NopCommerce"] = "NopCommerce";
StorefrontType["WooCommerce"] = "WooCommerce";
StorefrontType["Magento"] = "Magento";
StorefrontType["BigCommerce"] = "BigCommerce";
StorefrontType["Shopify"] = "Shopify";
StorefrontType["ShopifyCustom"] = "ShopifyCustom";
})(exports.StorefrontType || (exports.StorefrontType = {}));
var ApiException = /** @class */ (function (_super) {
__extends(ApiException, _super);
function ApiException(message, status, response, headers, result) {
var _this = _super.call(this) || this;
_this.isApiException = true;
_this.message = message;
_this.status = status;
_this.response = response;
_this.headers = headers;
_this.result = result;
return _this;
}
ApiException.isApiException = function (obj) {
return obj.isApiException === true;
};
return ApiException;
}(Error));
function throwException(message, status, response, headers, result) {
return rxjs.throwError(new ApiException(message, status, response, headers, result));
}
function blobToText(blob) {
return new rxjs.Observable(function (observer) {
if (!blob) {
observer.next("");
observer.complete();
}
else {
var reader = new FileReader();
reader.onload = function (event) {
observer.next(event.target.result);
observer.complete();
};
reader.readAsText(blob);
}
});
}
// @dynamic
function CreateApiClientConfiguration(token, apiUrl, apiKey) {
if (apiKey === void 0) { apiKey = 'ApiKey'; }
var apiConf = new ApiClientConfiguration();
apiConf.apiKey = apiKey;
apiConf.apiUrl = apiUrl;
apiConf.setAuthorizationToken(token);
return apiConf;
}
var BackOfficeModule = /** @class */ (function () {
function BackOfficeModule() {
}
BackOfficeModule.forRoot = function (token, apiUrl, apiKey) {
if (apiKey === void 0) { apiKey = 'ApiKey'; }
return {
ngModule: BackOfficeModule,
providers: [
{
provide: API_BASE_URL,
useValue: apiUrl
},
{
provide: ApiClientConfiguration,
useFactory: CreateApiClientConfiguration.bind(this, token, apiUrl, apiKey)
},
]
};
};
return BackOfficeModule;
}());
BackOfficeModule.decorators = [
{ type: i0.NgModule, args: [{
declarations: [],
imports: [],
exports: []
},] }
];
/*
* Public API Surface of client
*/
/**
* Generated bundle index. Do not edit.
*/
exports.API_BASE_URL = API_BASE_URL;
exports.ApiClientBase = ApiClientBase;
exports.ApiClientConfiguration = ApiClientConfiguration;
exports.ApiException = ApiException;
exports.BackOfficeModule = BackOfficeModule;
exports.BuildInfoApiClient = BuildInfoApiClient;
exports.CreateApiClientConfiguration = CreateApiClientConfiguration;
exports.ProductReferencesManagementApiClient = ProductReferencesManagementApiClient;
exports.ProductsManagementApiClient = ProductsManagementApiClient;
exports.StorefrontsManagementApiClient = StorefrontsManagementApiClient;
exports.UsersManagementApiClient = UsersManagementApiClient;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=aurigma-ng-backoffice-api-client.umd.js.map