UNPKG

sdksio-postnl-ecommerce-apis-sdk

Version:

Collection of PostNL API's for ecommerce processes

65 lines 3.52 kB
"use strict"; /** * PostNL Ecommerce APIsLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ exports.__esModule = true; exports.PostalcodeCheckController = void 0; var tslib_1 = require("tslib"); var checkoutPostalCodecheckMethodNotAllowedError_1 = require("../errors/checkoutPostalCodecheckMethodNotAllowedError"); var checkoutPostalCodecheckTooManyRequestError_1 = require("../errors/checkoutPostalCodecheckTooManyRequestError"); var checkoutPostalCodecheckUnauthorizedError_1 = require("../errors/checkoutPostalCodecheckUnauthorizedError"); var cpcResponseError_1 = require("../errors/cpcResponseError"); var cpcResponseInvalidError_1 = require("../errors/cpcResponseInvalidError"); var cpcResponse_1 = require("../models/cpcResponse"); var schema_1 = require("../schema"); var baseController_1 = require("./baseController"); var PostalcodeCheckController = /** @class */ (function (_super) { tslib_1.__extends(PostalcodeCheckController, _super); function PostalcodeCheckController() { return _super !== null && _super.apply(this, arguments) || this; } /** * Please note that this API is not available on the sandbox environment. * * Request example: * ``` * curl -X GET "https://api.postnl.nl/shipment/checkout/v1/postalcodecheck?postalcode=3571ZZ& * housenumber=74&housenumberaddition=bis" \ * -H "Accept: application/json" \ * -H "apikey: APIKEY-HERE" * ``` * * * @param postalcode * @param housenumber * @param housenumberaddition * @return Response from the API call */ PostalcodeCheckController.prototype.checkoutPostalcodeCheck = function (postalcode, housenumber, housenumberaddition, requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req, mapped; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET', '/shipment/checkout/v1/postalcodecheck'); mapped = req.prepareArgs({ postalcode: [postalcode, (0, schema_1.string)()], housenumber: [housenumber, (0, schema_1.number)()], housenumberaddition: [housenumberaddition, (0, schema_1.optional)((0, schema_1.string)())] }); req.query('postalcode', mapped.postalcode); req.query('housenumber', mapped.housenumber); req.query('housenumberaddition', mapped.housenumberaddition); req.throwOn(400, cpcResponseInvalidError_1.CpcResponseInvalidError, 'Bad request'); req.throwOn(401, checkoutPostalCodecheckUnauthorizedError_1.CheckoutPostalCodecheckUnauthorizedError, 'Invalid apikey'); req.throwOn(405, checkoutPostalCodecheckMethodNotAllowedError_1.CheckoutPostalCodecheckMethodNotAllowedError, 'Method not allowed'); req.throwOn(429, checkoutPostalCodecheckTooManyRequestError_1.CheckoutPostalCodecheckTooManyRequestError, 'Too many requests'); req.throwOn(500, cpcResponseError_1.CpcResponseError, 'Internal server error'); return [2 /*return*/, req.callAsJson((0, schema_1.array)(cpcResponse_1.cpcResponseSchema), requestOptions)]; }); }); }; return PostalcodeCheckController; }(baseController_1.BaseController)); exports.PostalcodeCheckController = PostalcodeCheckController; //# sourceMappingURL=postalcodeCheckController.js.map