dhl-express-api-client
Version:
DHL express API client
588 lines • 45.6 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
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);
};
return function (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 __awaiter = (this && this.__awaiter) || function (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());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "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 (_) 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 };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShipmentApiResponseProcessor = exports.ShipmentApiRequestFactory = void 0;
var baseapi_1 = require("./baseapi");
var http_1 = require("../http/http");
var ObjectSerializer_1 = require("../models/ObjectSerializer");
var exception_1 = require("./exception");
var util_1 = require("../util");
var ShipmentApiRequestFactory = (function (_super) {
__extends(ShipmentApiRequestFactory, _super);
function ShipmentApiRequestFactory() {
return _super !== null && _super.apply(this, arguments) || this;
}
ShipmentApiRequestFactory.prototype.expApiShipments = function (supermodelIoLogisticsExpressCreateShipmentRequest, messageReference, messageReferenceDate, pluginName, pluginVersion, shippingSystemPlatformName, shippingSystemPlatformVersion, webstorePlatformName, webstorePlatformVersion, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_config = _options || this.configuration;
if (supermodelIoLogisticsExpressCreateShipmentRequest === null || supermodelIoLogisticsExpressCreateShipmentRequest === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipments", "supermodelIoLogisticsExpressCreateShipmentRequest");
}
localVarPath = '/shipments';
requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
requestContext.setHeaderParam("Message-Reference", ObjectSerializer_1.ObjectSerializer.serialize(messageReference, "string", ""));
requestContext.setHeaderParam("Message-Reference-Date", ObjectSerializer_1.ObjectSerializer.serialize(messageReferenceDate, "string", ""));
requestContext.setHeaderParam("Plugin-Name", ObjectSerializer_1.ObjectSerializer.serialize(pluginName, "string", ""));
requestContext.setHeaderParam("Plugin-Version", ObjectSerializer_1.ObjectSerializer.serialize(pluginVersion, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformName, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformVersion, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformName, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformVersion, "string", ""));
contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(supermodelIoLogisticsExpressCreateShipmentRequest, "SupermodelIoLogisticsExpressCreateShipmentRequest", ""), contentType);
requestContext.setBody(serializedBody);
authMethod = _config.authMethods["basicAuth"];
if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2];
return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))];
case 1:
_d.sent();
_d.label = 2;
case 2:
defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4];
return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))];
case 3:
_d.sent();
_d.label = 4;
case 4: return [2, requestContext];
}
});
});
};
ShipmentApiRequestFactory.prototype.expApiShipmentsDocumentimage = function (shipmentTrackingNumber, shipperAccountNumber, typeCode, pickupYearAndMonth, encodingFormat, allInOnePDF, compressedPackage, messageReference, messageReferenceDate, pluginName, pluginVersion, shippingSystemPlatformName, shippingSystemPlatformVersion, webstorePlatformName, webstorePlatformVersion, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var _config, localVarPath, requestContext, authMethod, defaultAuth;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_config = _options || this.configuration;
if (shipmentTrackingNumber === null || shipmentTrackingNumber === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsDocumentimage", "shipmentTrackingNumber");
}
if (shipperAccountNumber === null || shipperAccountNumber === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsDocumentimage", "shipperAccountNumber");
}
if (typeCode === null || typeCode === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsDocumentimage", "typeCode");
}
if (pickupYearAndMonth === null || pickupYearAndMonth === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsDocumentimage", "pickupYearAndMonth");
}
localVarPath = '/shipments/{shipmentTrackingNumber}/get-image'
.replace('{' + 'shipmentTrackingNumber' + '}', encodeURIComponent(String(shipmentTrackingNumber)));
requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (shipperAccountNumber !== undefined) {
requestContext.setQueryParam("shipperAccountNumber", ObjectSerializer_1.ObjectSerializer.serialize(shipperAccountNumber, "string", ""));
}
if (typeCode !== undefined) {
requestContext.setQueryParam("typeCode", ObjectSerializer_1.ObjectSerializer.serialize(typeCode, "'waybill' | 'commercial-invoice' | 'customs-entry'", ""));
}
if (pickupYearAndMonth !== undefined) {
requestContext.setQueryParam("pickupYearAndMonth", ObjectSerializer_1.ObjectSerializer.serialize(pickupYearAndMonth, "string", ""));
}
if (encodingFormat !== undefined) {
requestContext.setQueryParam("encodingFormat", ObjectSerializer_1.ObjectSerializer.serialize(encodingFormat, "'pdf' | 'tiff'", ""));
}
if (allInOnePDF !== undefined) {
requestContext.setQueryParam("allInOnePDF", ObjectSerializer_1.ObjectSerializer.serialize(allInOnePDF, "boolean", ""));
}
if (compressedPackage !== undefined) {
requestContext.setQueryParam("compressedPackage", ObjectSerializer_1.ObjectSerializer.serialize(compressedPackage, "boolean", ""));
}
requestContext.setHeaderParam("Message-Reference", ObjectSerializer_1.ObjectSerializer.serialize(messageReference, "string", ""));
requestContext.setHeaderParam("Message-Reference-Date", ObjectSerializer_1.ObjectSerializer.serialize(messageReferenceDate, "string", ""));
requestContext.setHeaderParam("Plugin-Name", ObjectSerializer_1.ObjectSerializer.serialize(pluginName, "string", ""));
requestContext.setHeaderParam("Plugin-Version", ObjectSerializer_1.ObjectSerializer.serialize(pluginVersion, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformName, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformVersion, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformName, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformVersion, "string", ""));
authMethod = _config.authMethods["basicAuth"];
if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2];
return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))];
case 1:
_d.sent();
_d.label = 2;
case 2:
defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4];
return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))];
case 3:
_d.sent();
_d.label = 4;
case 4: return [2, requestContext];
}
});
});
};
ShipmentApiRequestFactory.prototype.expApiShipmentsEpod = function (shipmentTrackingNumber, shipperAccountNumber, content, messageReference, messageReferenceDate, pluginName, pluginVersion, shippingSystemPlatformName, shippingSystemPlatformVersion, webstorePlatformName, webstorePlatformVersion, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var _config, localVarPath, requestContext, authMethod, defaultAuth;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_config = _options || this.configuration;
if (shipmentTrackingNumber === null || shipmentTrackingNumber === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsEpod", "shipmentTrackingNumber");
}
localVarPath = '/shipments/{shipmentTrackingNumber}/proof-of-delivery'
.replace('{' + 'shipmentTrackingNumber' + '}', encodeURIComponent(String(shipmentTrackingNumber)));
requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (shipperAccountNumber !== undefined) {
requestContext.setQueryParam("shipperAccountNumber", ObjectSerializer_1.ObjectSerializer.serialize(shipperAccountNumber, "string", ""));
}
if (content !== undefined) {
requestContext.setQueryParam("content", ObjectSerializer_1.ObjectSerializer.serialize(content, "'epod-detail' | 'epod-summary' | 'epod-detail-esig' | 'epod-summary-esig' | 'epod-table'", ""));
}
requestContext.setHeaderParam("Message-Reference", ObjectSerializer_1.ObjectSerializer.serialize(messageReference, "string", ""));
requestContext.setHeaderParam("Message-Reference-Date", ObjectSerializer_1.ObjectSerializer.serialize(messageReferenceDate, "string", ""));
requestContext.setHeaderParam("Plugin-Name", ObjectSerializer_1.ObjectSerializer.serialize(pluginName, "string", ""));
requestContext.setHeaderParam("Plugin-Version", ObjectSerializer_1.ObjectSerializer.serialize(pluginVersion, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformName, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformVersion, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformName, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformVersion, "string", ""));
authMethod = _config.authMethods["basicAuth"];
if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2];
return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))];
case 1:
_d.sent();
_d.label = 2;
case 2:
defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4];
return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))];
case 3:
_d.sent();
_d.label = 4;
case 4: return [2, requestContext];
}
});
});
};
ShipmentApiRequestFactory.prototype.expApiShipmentsImgUpload = function (shipmentTrackingNumber, supermodelIoLogisticsExpressImageUploadRequest, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_config = _options || this.configuration;
if (shipmentTrackingNumber === null || shipmentTrackingNumber === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsImgUpload", "shipmentTrackingNumber");
}
if (supermodelIoLogisticsExpressImageUploadRequest === null || supermodelIoLogisticsExpressImageUploadRequest === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsImgUpload", "supermodelIoLogisticsExpressImageUploadRequest");
}
localVarPath = '/shipments/{shipmentTrackingNumber}/upload-image'
.replace('{' + 'shipmentTrackingNumber' + '}', encodeURIComponent(String(shipmentTrackingNumber)));
requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(supermodelIoLogisticsExpressImageUploadRequest, "SupermodelIoLogisticsExpressImageUploadRequest", ""), contentType);
requestContext.setBody(serializedBody);
authMethod = _config.authMethods["basicAuth"];
if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2];
return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))];
case 1:
_d.sent();
_d.label = 2;
case 2:
defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4];
return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))];
case 3:
_d.sent();
_d.label = 4;
case 4: return [2, requestContext];
}
});
});
};
ShipmentApiRequestFactory.prototype.expApiShipmentsInvoiceDataAwb = function (shipmentTrackingNumber, supermodelIoLogisticsExpressUploadInvoiceDataRequest, messageReference, messageReferenceDate, pluginName, pluginVersion, shippingSystemPlatformName, shippingSystemPlatformVersion, webstorePlatformName, webstorePlatformVersion, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function () {
var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_config = _options || this.configuration;
if (shipmentTrackingNumber === null || shipmentTrackingNumber === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsInvoiceDataAwb", "shipmentTrackingNumber");
}
if (supermodelIoLogisticsExpressUploadInvoiceDataRequest === null || supermodelIoLogisticsExpressUploadInvoiceDataRequest === undefined) {
throw new baseapi_1.RequiredError("ShipmentApi", "expApiShipmentsInvoiceDataAwb", "supermodelIoLogisticsExpressUploadInvoiceDataRequest");
}
localVarPath = '/shipments/{shipmentTrackingNumber}/upload-invoice-data'
.replace('{' + 'shipmentTrackingNumber' + '}', encodeURIComponent(String(shipmentTrackingNumber)));
requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
requestContext.setHeaderParam("Message-Reference", ObjectSerializer_1.ObjectSerializer.serialize(messageReference, "string", ""));
requestContext.setHeaderParam("Message-Reference-Date", ObjectSerializer_1.ObjectSerializer.serialize(messageReferenceDate, "string", ""));
requestContext.setHeaderParam("Plugin-Name", ObjectSerializer_1.ObjectSerializer.serialize(pluginName, "string", ""));
requestContext.setHeaderParam("Plugin-Version", ObjectSerializer_1.ObjectSerializer.serialize(pluginVersion, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformName, "string", ""));
requestContext.setHeaderParam("Shipping-System-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(shippingSystemPlatformVersion, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Name", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformName, "string", ""));
requestContext.setHeaderParam("Webstore-Platform-Version", ObjectSerializer_1.ObjectSerializer.serialize(webstorePlatformVersion, "string", ""));
contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(supermodelIoLogisticsExpressUploadInvoiceDataRequest, "SupermodelIoLogisticsExpressUploadInvoiceDataRequest", ""), contentType);
requestContext.setBody(serializedBody);
authMethod = _config.authMethods["basicAuth"];
if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2];
return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))];
case 1:
_d.sent();
_d.label = 2;
case 2:
defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4];
return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))];
case 3:
_d.sent();
_d.label = 4;
case 4: return [2, requestContext];
}
});
});
};
return ShipmentApiRequestFactory;
}(baseapi_1.BaseAPIRequestFactory));
exports.ShipmentApiRequestFactory = ShipmentApiRequestFactory;
var ShipmentApiResponseProcessor = (function () {
function ShipmentApiResponseProcessor() {
}
ShipmentApiResponseProcessor.prototype.expApiShipments = function (response) {
return __awaiter(this, void 0, void 0, function () {
var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, body, _s, _t, _u, _v, _w, _x;
return __generator(this, function (_y) {
switch (_y.label) {
case 0:
contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (!(0, util_1.isCodeInRange)("201", response.httpStatusCode)) return [3, 2];
_b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize;
_d = (_c = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 1:
body = _b.apply(_a, [_d.apply(_c, [_y.sent(), contentType]),
"SupermodelIoLogisticsExpressCreateShipmentResponse", ""]);
return [2, body];
case 2:
if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 4];
_f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize;
_h = (_g = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 3:
body = _f.apply(_e, [_h.apply(_g, [_y.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Wrong input parameters", body, response.headers);
case 4:
if (!(0, util_1.isCodeInRange)("422", response.httpStatusCode)) return [3, 6];
_k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize;
_m = (_l = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 5:
body = _k.apply(_j, [_m.apply(_l, [_y.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Wrong input parameters", body, response.headers);
case 6:
if (!(0, util_1.isCodeInRange)("500", response.httpStatusCode)) return [3, 8];
_p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize;
_r = (_q = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 7:
body = _p.apply(_o, [_r.apply(_q, [_y.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Process errors", body, response.headers);
case 8:
if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 10];
_t = (_s = ObjectSerializer_1.ObjectSerializer).deserialize;
_v = (_u = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 9:
body = _t.apply(_s, [_v.apply(_u, [_y.sent(), contentType]),
"SupermodelIoLogisticsExpressCreateShipmentResponse", ""]);
return [2, body];
case 10:
_w = exception_1.ApiException.bind;
_x = [void 0, response.httpStatusCode, "Unknown API Status Code!"];
return [4, response.getBodyAsAny()];
case 11: throw new (_w.apply(exception_1.ApiException, _x.concat([_y.sent(), response.headers])))();
}
});
});
};
ShipmentApiResponseProcessor.prototype.expApiShipmentsDocumentimage = function (response) {
return __awaiter(this, void 0, void 0, function () {
var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, _s, _t;
return __generator(this, function (_u) {
switch (_u.label) {
case 0:
contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2];
_b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize;
_d = (_c = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 1:
body = _b.apply(_a, [_d.apply(_c, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressDocumentImageResponse", ""]);
return [2, body];
case 2:
if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 4];
_f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize;
_h = (_g = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 3:
body = _f.apply(_e, [_h.apply(_g, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Wrong input parameters", body, response.headers);
case 4:
if (!(0, util_1.isCodeInRange)("404", response.httpStatusCode)) return [3, 6];
_k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize;
_m = (_l = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 5:
body = _k.apply(_j, [_m.apply(_l, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "No document image found", body, response.headers);
case 6:
if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 8];
_p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize;
_r = (_q = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 7:
body = _p.apply(_o, [_r.apply(_q, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressDocumentImageResponse", ""]);
return [2, body];
case 8:
_s = exception_1.ApiException.bind;
_t = [void 0, response.httpStatusCode, "Unknown API Status Code!"];
return [4, response.getBodyAsAny()];
case 9: throw new (_s.apply(exception_1.ApiException, _t.concat([_u.sent(), response.headers])))();
}
});
});
};
ShipmentApiResponseProcessor.prototype.expApiShipmentsEpod = function (response) {
return __awaiter(this, void 0, void 0, function () {
var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, _s, _t;
return __generator(this, function (_u) {
switch (_u.label) {
case 0:
contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2];
_b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize;
_d = (_c = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 1:
body = _b.apply(_a, [_d.apply(_c, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressEPODResponse", ""]);
return [2, body];
case 2:
if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 4];
_f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize;
_h = (_g = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 3:
body = _f.apply(_e, [_h.apply(_g, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Wrong input parameters", body, response.headers);
case 4:
if (!(0, util_1.isCodeInRange)("404", response.httpStatusCode)) return [3, 6];
_k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize;
_m = (_l = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 5:
body = _k.apply(_j, [_m.apply(_l, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "No electronic proof of delivery found", body, response.headers);
case 6:
if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 8];
_p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize;
_r = (_q = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 7:
body = _p.apply(_o, [_r.apply(_q, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressEPODResponse", ""]);
return [2, body];
case 8:
_s = exception_1.ApiException.bind;
_t = [void 0, response.httpStatusCode, "Unknown API Status Code!"];
return [4, response.getBodyAsAny()];
case 9: throw new (_s.apply(exception_1.ApiException, _t.concat([_u.sent(), response.headers])))();
}
});
});
};
ShipmentApiResponseProcessor.prototype.expApiShipmentsImgUpload = function (response) {
return __awaiter(this, void 0, void 0, function () {
var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, _s, _t;
return __generator(this, function (_u) {
switch (_u.label) {
case 0:
contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
return [2];
}
if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 2];
_b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize;
_d = (_c = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 1:
body = _b.apply(_a, [_d.apply(_c, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Wrong input parameters", body, response.headers);
case 2:
if (!(0, util_1.isCodeInRange)("404", response.httpStatusCode)) return [3, 4];
_f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize;
_h = (_g = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 3:
body = _f.apply(_e, [_h.apply(_g, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "No shipment details found", body, response.headers);
case 4:
if (!(0, util_1.isCodeInRange)("422", response.httpStatusCode)) return [3, 6];
_k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize;
_m = (_l = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 5:
body = _k.apply(_j, [_m.apply(_l, [_u.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Unprocessable Entity", body, response.headers);
case 6:
if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 8];
_p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize;
_r = (_q = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 7:
body = _p.apply(_o, [_r.apply(_q, [_u.sent(), contentType]),
"void", ""]);
return [2, body];
case 8:
_s = exception_1.ApiException.bind;
_t = [void 0, response.httpStatusCode, "Unknown API Status Code!"];
return [4, response.getBodyAsAny()];
case 9: throw new (_s.apply(exception_1.ApiException, _t.concat([_u.sent(), response.headers])))();
}
});
});
};
ShipmentApiResponseProcessor.prototype.expApiShipmentsInvoiceDataAwb = function (response) {
return __awaiter(this, void 0, void 0, function () {
var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, _o, _p;
return __generator(this, function (_q) {
switch (_q.label) {
case 0:
contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
return [2];
}
if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 2];
_b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize;
_d = (_c = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 1:
body = _b.apply(_a, [_d.apply(_c, [_q.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Wrong input parameters", body, response.headers);
case 2:
if (!(0, util_1.isCodeInRange)("422", response.httpStatusCode)) return [3, 4];
_f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize;
_h = (_g = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 3:
body = _f.apply(_e, [_h.apply(_g, [_q.sent(), contentType]),
"SupermodelIoLogisticsExpressErrorResponse", ""]);
throw new exception_1.ApiException(response.httpStatusCode, "Unprocessable Entity", body, response.headers);
case 4:
if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 6];
_k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize;
_m = (_l = ObjectSerializer_1.ObjectSerializer).parse;
return [4, response.body.text()];
case 5:
body = _k.apply(_j, [_m.apply(_l, [_q.sent(), contentType]),
"void", ""]);
return [2, body];
case 6:
_o = exception_1.ApiException.bind;
_p = [void 0, response.httpStatusCode, "Unknown API Status Code!"];
return [4, response.getBodyAsAny()];
case 7: throw new (_o.apply(exception_1.ApiException, _p.concat([_q.sent(), response.headers])))();
}
});
});
};
return ShipmentApiResponseProcessor;
}());
exports.ShipmentApiResponseProcessor = ShipmentApiResponseProcessor;
//# sourceMappingURL=ShipmentApi.js.map