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.

114 lines 6.1 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.SitesController = void 0; var tslib_1 = require("tslib"); var core_js_1 = require("../core.js"); var cleanupScope_js_1 = require("../models/cleanupScope.js"); var listPublicKeysResponse_js_1 = require("../models/listPublicKeysResponse.js"); var siteResponse_js_1 = require("../models/siteResponse.js"); var schema_js_1 = require("../schema.js"); var baseController_js_1 = require("./baseController.js"); var SitesController = /** @class */ (function (_super) { tslib_1.__extends(SitesController, _super); function SitesController() { return _super !== null && _super.apply(this, arguments) || this; } /** * This endpoint allows you to fetch some site data. * * Full documentation on Sites in the Advanced Billing UI can be located [here](https://maxio.zendesk. * com/hc/en-us/sections/24250550707085-Sites). * * Specifically, the [Clearing Site Data](https://maxio.zendesk.com/hc/en-us/articles/24250617028365- * Clearing-Site-Data) section is extremely relevant to this endpoint documentation. * * #### Relationship invoicing enabled * If site has RI enabled then you will see more settings like: * * "customer_hierarchy_enabled": true, * "whopays_enabled": true, * "whopays_default_payer": "self" * You can read more about these settings here: * [Who Pays & Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer- * Hierarchies-WhoPays) * * @return Response from the API call */ SitesController.prototype.readSite = function (requestOptions) { return tslib_1.__awaiter(this, void 0, void 0, function () { var req; return tslib_1.__generator(this, function (_a) { req = this.createRequest('GET', '/site.json'); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(siteResponse_js_1.siteResponseSchema, requestOptions)]; }); }); }; /** * This call is asynchronous and there may be a delay before the site data is fully deleted. If you are * clearing site data for an automated test, you will need to build in a delay and/or check that there * are no products, etc., in the site before proceeding. * * **This functionality will only work on sites in TEST mode. Attempts to perform this on sites in * “live” mode will result in a response of 403 FORBIDDEN.** * * * @param cleanupScope `all`: Will clear all products, customers, and related subscriptions from * the site. `customers`: Will clear only customers and related subscriptions * (leaving the products untouched) for the site. Revenue will also be reset to * 0. Use in query `cleanup_scope=all`. * @return Response from the API call */ SitesController.prototype.clearSite = function (cleanupScope, 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', '/sites/clear_data.json'); mapped = req.prepareArgs({ cleanupScope: [cleanupScope, (0, schema_js_1.optional)(cleanupScope_js_1.cleanupScopeSchema)], }); req.query('cleanup_scope', mapped.cleanupScope, core_js_1.commaPrefix); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.call(requestOptions)]; }); }); }; /** * This endpoint returns public keys used for Chargify.js. * * @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`. * @param perPage This parameter indicates how many records to fetch in each request. Default value is 20. * The maximum allowed values is 200; any per_page value over 200 will be changed to 200. * Use in query `per_page=200`. * @return Response from the API call */ SitesController.prototype.listChargifyJsPublicKeys = function (_a, requestOptions_1) { return tslib_1.__awaiter(this, arguments, void 0, function (_b, requestOptions) { var req, mapped; var page = _b.page, perPage = _b.perPage; return tslib_1.__generator(this, function (_c) { req = this.createRequest('GET', '/chargify_js_keys.json'); mapped = req.prepareArgs({ page: [page, (0, schema_js_1.optional)((0, schema_js_1.number)())], perPage: [perPage, (0, schema_js_1.optional)((0, schema_js_1.number)())], }); req.query('page', mapped.page, core_js_1.commaPrefix); req.query('per_page', mapped.perPage, core_js_1.commaPrefix); req.authenticate([{ basicAuth: true }]); return [2 /*return*/, req.callAsJson(listPublicKeysResponse_js_1.listPublicKeysResponseSchema, requestOptions)]; }); }); }; return SitesController; }(baseController_js_1.BaseController)); exports.SitesController = SitesController; //# sourceMappingURL=sitesController.js.map