UNPKG

@maxio-com/advanced-billing-sdk

Version:

Ultimate billing and pricing flexibility for B2B SaaS. Maxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments.

250 lines 15.3 kB
"use strict"; /** * AdvancedBilling * * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). */ Object.defineProperty(exports, "__esModule", { value: true }); exports.APIExportsController = void 0; var tslib_1 = require("tslib"); var core_js_1 = require("../core.js"); var batchJobResponse_js_1 = require("../models/batchJobResponse.js"); var invoice_js_1 = require("../models/invoice.js"); var proformaInvoice_js_1 = require("../models/proformaInvoice.js"); var subscription_js_1 = require("../models/subscription.js"); var schema_js_1 = require("../schema.js"); var baseController_js_1 = require("./baseController.js"); var core_1 = require("@apimatic/core"); var singleErrorResponseError_js_1 = require("../errors/singleErrorResponseError.js"); var APIExportsController = /** @class */ (function (_super) { tslib_1.__extends(APIExportsController, _super); function APIExportsController() { return _super !== null && _super.apply(this, arguments) || this; } /** * This API returns an array of exported proforma invoices for a provided `batch_id`. Pay close * attention to pagination in order to control responses from the server. * * Example: `GET https://{subdomain}.chargify.com/api_exports/proforma_invoices/123/rows? * per_page=10000&page=1`. * * @param batchId Id of a Batch Job. * @param perPage This parameter indicates how many records to fetch in each request. Default value is * 100. The maximum allowed values is 10000; any per_page value over 10000 will be changed * to 10000. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You can start * navigating through the pages to consume the results. You do this by passing in a page * parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no * results to return, then an empty result set will be returned. Use in query `page=1`. * @return Response from the API call */ APIExportsController.prototype.listExportedProformaInvoices = function (_a, requestOptions_1) { return tslib_1.__awaiter(this, arguments, void 0, function (_b, requestOptions) { var req, mapped; var batchId = _b.batchId, perPage = _b.perPage, page = _b.page; return tslib_1.__generator(this, function (_c) { req = this.createRequest('GET'); mapped = req.prepareArgs({ batchId: [batchId, (0, schema_js_1.string)()], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.query('page', mapped.page, core_js_1.commaPrefix); req.appendTemplatePath(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["/api_exports/proforma_invoices/", "/rows.json"], ["/api_exports/proforma_invoices/", "/rows.json"])), mapped.batchId); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson((0, schema_js_1.array)(proformaInvoice_js_1.proformaInvoiceSchema), requestOptions)]; }); }); }; /** * This API returns an array of exported invoices for a provided `batch_id`. Pay close attention to * pagination in order to control responses from the server. * * Example: `GET https://{subdomain}.chargify.com/api_exports/invoices/123/rows?per_page=10000&page=1`. * * @param batchId Id of a Batch Job. * @param perPage This parameter indicates how many records to fetch in each request. Default value is * 100. The maximum allowed values is 10000; any per_page value over 10000 will be changed * to 10000. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You can start * navigating through the pages to consume the results. You do this by passing in a page * parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no * results to return, then an empty result set will be returned. Use in query `page=1`. * @return Response from the API call */ APIExportsController.prototype.listExportedInvoices = function (_a, requestOptions_1) { return tslib_1.__awaiter(this, arguments, void 0, function (_b, requestOptions) { var req, mapped; var batchId = _b.batchId, perPage = _b.perPage, page = _b.page; return tslib_1.__generator(this, function (_c) { req = this.createRequest('GET'); mapped = req.prepareArgs({ batchId: [batchId, (0, schema_js_1.string)()], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.query('page', mapped.page, core_js_1.commaPrefix); req.appendTemplatePath(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["/api_exports/invoices/", "/rows.json"], ["/api_exports/invoices/", "/rows.json"])), mapped.batchId); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson((0, schema_js_1.array)(invoice_js_1.invoiceSchema), requestOptions)]; }); }); }; /** * This API returns an array of exported subscriptions for a provided `batch_id`. Pay close attention * to pagination in order to control responses from the server. * * Example: `GET https://{subdomain}.chargify.com/api_exports/subscriptions/123/rows? * per_page=200&page=1`. * * @param batchId Id of a Batch Job. * @param perPage This parameter indicates how many records to fetch in each request. Default value is * 100. The maximum allowed values is 10000; any per_page value over 10000 will be changed * to 10000. * @param page Result records are organized in pages. By default, the first page of results is * displayed. The page parameter specifies a page number of results to fetch. You can start * navigating through the pages to consume the results. You do this by passing in a page * parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no * results to return, then an empty result set will be returned. Use in query `page=1`. * @return Response from the API call */ APIExportsController.prototype.listExportedSubscriptions = function (_a, requestOptions_1) { return tslib_1.__awaiter(this, arguments, void 0, function (_b, requestOptions) { var req, mapped; var batchId = _b.batchId, perPage = _b.perPage, page = _b.page; return tslib_1.__generator(this, function (_c) { req = this.createRequest('GET'); mapped = req.prepareArgs({ batchId: [batchId, (0, schema_js_1.string)()], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.query('page', mapped.page, core_js_1.commaPrefix); req.appendTemplatePath(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["/api_exports/subscriptions/", "/rows.json"], ["/api_exports/subscriptions/", "/rows.json"])), mapped.batchId); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson((0, schema_js_1.array)(subscription_js_1.subscriptionSchema), requestOptions)]; }); }); }; /** * This API creates a proforma invoices export and returns a batchjob object. * * It is only available for Relationship Invoicing architecture. * * @return Response from the API call */ APIExportsController.prototype.exportProformaInvoices = function (requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/api_exports/proforma_invoices.json'); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.throwOn(409, singleErrorResponseError_js_1.SingleErrorResponseError, true, "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'."); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(batchJobResponse_js_1.batchJobResponseSchema, requestOptions)]; }); }); }; /** * This API creates an invoices export and returns a batchjob object. * * @return Response from the API call */ APIExportsController.prototype.exportInvoices = function (requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/api_exports/invoices.json'); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.throwOn(409, singleErrorResponseError_js_1.SingleErrorResponseError, true, "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'."); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(batchJobResponse_js_1.batchJobResponseSchema, requestOptions)]; }); }); }; /** * This API creates a subscriptions export and returns a batchjob object. * * @return Response from the API call */ APIExportsController.prototype.exportSubscriptions = function (requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req; return tslib_1.__generator(this, function (_a) { req = this.createRequest('POST', '/api_exports/subscriptions.json'); req.throwOn(409, singleErrorResponseError_js_1.SingleErrorResponseError, true, "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'."); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(batchJobResponse_js_1.batchJobResponseSchema, requestOptions)]; }); }); }; /** * This API returns a batchjob object for proforma invoices export. * * @param batchId Id of a Batch Job. * @return Response from the API call */ APIExportsController.prototype.readProformaInvoicesExport = function (batchId, 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'); mapped = req.prepareArgs({ batchId: [batchId, (0, schema_js_1.string)()] }); req.appendTemplatePath(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["/api_exports/proforma_invoices/", ".json"], ["/api_exports/proforma_invoices/", ".json"])), mapped.batchId); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(batchJobResponse_js_1.batchJobResponseSchema, requestOptions)]; }); }); }; /** * This API returns a batchjob object for invoices export. * * @param batchId Id of a Batch Job. * @return Response from the API call */ APIExportsController.prototype.readInvoicesExport = function (batchId, 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'); mapped = req.prepareArgs({ batchId: [batchId, (0, schema_js_1.string)()] }); req.appendTemplatePath(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["/api_exports/invoices/", ".json"], ["/api_exports/invoices/", ".json"])), mapped.batchId); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(batchJobResponse_js_1.batchJobResponseSchema, requestOptions)]; }); }); }; /** * This API returns a batchjob object for subscriptions export. * * @param batchId Id of a Batch Job. * @return Response from the API call */ APIExportsController.prototype.readSubscriptionsExport = function (batchId, 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'); mapped = req.prepareArgs({ batchId: [batchId, (0, schema_js_1.string)()] }); req.appendTemplatePath(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["/api_exports/subscriptions/", ".json"], ["/api_exports/subscriptions/", ".json"])), mapped.batchId); req.throwOn(404, core_1.ApiError, true, "Not Found:'{$response.body}'"); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(batchJobResponse_js_1.batchJobResponseSchema, requestOptions)]; }); }); }; return APIExportsController; }(baseController_js_1.BaseController)); exports.APIExportsController = APIExportsController; var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6; //# sourceMappingURL=aPIExportsController.js.map