UNPKG

sdksio-postnl-ecommerce-apis-sdk

Version:

Collection of PostNL API's for ecommerce processes

49 lines 2.65 kB
"use strict"; /** * PostNL Ecommerce APIsLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ exports.__esModule = true; exports.ConfirmingController = void 0; var tslib_1 = require("tslib"); var confirmingMethodNotAllowedError_1 = require("../errors/confirmingMethodNotAllowedError"); var confirmingResponseError_1 = require("../errors/confirmingResponseError"); var confirmingResponseError1Error_1 = require("../errors/confirmingResponseError1Error"); var confirmingTooManyRequestError_1 = require("../errors/confirmingTooManyRequestError"); var confirmingUnauthorizedError_1 = require("../errors/confirmingUnauthorizedError"); var confirmingRequest_1 = require("../models/confirmingRequest"); var confirmingResponse_1 = require("../models/confirmingResponse"); var baseController_1 = require("./baseController"); var ConfirmingController = /** @class */ (function (_super) { tslib_1.__extends(ConfirmingController, _super); function ConfirmingController() { return _super !== null && _super.apply(this, arguments) || this; } /** * Confirm a shipment to PostNL * * @param body * @return Response from the API call */ ConfirmingController.prototype.confirmAShipmentToPostNL = function (body, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/shipment/v2/confirm'); mapped = req.prepareArgs({ body: [body, confirmingRequest_1.confirmingRequestSchema] }); req.header('Content-Type', 'application/json'); req.json(mapped.body); req.throwOn(400, confirmingResponseError_1.ConfirmingResponseError, 'Error payload'); req.throwOn(401, confirmingUnauthorizedError_1.ConfirmingUnauthorizedError, 'Invalid apikey'); req.throwOn(405, confirmingMethodNotAllowedError_1.ConfirmingMethodNotAllowedError, 'Method not allowed'); req.throwOn(429, confirmingTooManyRequestError_1.ConfirmingTooManyRequestError, 'Too many requests'); req.throwOn(500, confirmingResponseError1Error_1.ConfirmingResponseError1Error, 'Internal server error'); return [2 /*return*/, req.callAsJson(confirmingResponse_1.confirmingResponseSchema, requestOptions)]; }); }); }; return ConfirmingController; }(baseController_1.BaseController)); exports.ConfirmingController = ConfirmingController; //# sourceMappingURL=confirmingController.js.map