orb-billing
Version:
The official TypeScript library for the Orb API
86 lines • 3.81 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LicenseListResponsesPage = exports.Licenses = void 0;
const resource_1 = require("../../resource.js");
const ExternalLicensesAPI = __importStar(require("./external-licenses.js"));
const external_licenses_1 = require("./external-licenses.js");
const UsageAPI = __importStar(require("./usage.js"));
const usage_1 = require("./usage.js");
const pagination_1 = require("../../pagination.js");
class Licenses extends resource_1.APIResource {
constructor() {
super(...arguments);
this.externalLicenses = new ExternalLicensesAPI.ExternalLicenses(this._client);
this.usage = new UsageAPI.Usage(this._client);
}
/**
* This endpoint is used to create a new license for a user.
*
* If a start date is provided, the license will be activated at the **start** of
* the specified date in the customer's timezone. Otherwise, the activation time
* will default to the **start** of the current day in the customer's timezone.
*/
create(body, options) {
return this._client.post('/licenses', { body, ...options });
}
/**
* This endpoint is used to fetch a license given an identifier.
*/
retrieve(licenseId, options) {
return this._client.get(`/licenses/${licenseId}`, options);
}
/**
* This endpoint returns a list of all licenses for a subscription.
*/
list(query, options) {
return this._client.getAPIList('/licenses', LicenseListResponsesPage, { query, ...options });
}
/**
* This endpoint is used to deactivate an existing license.
*
* If an end date is provided, the license will be deactivated at the **start** of
* the specified date in the customer's timezone. Otherwise, the deactivation time
* will default to the **end** of the current day in the customer's timezone.
*/
deactivate(licenseId, body, options) {
return this._client.post(`/licenses/${licenseId}/deactivate`, { body, ...options });
}
/**
* This endpoint is used to fetch a license given an external license identifier.
*/
retrieveByExternalId(externalLicenseId, query, options) {
return this._client.get(`/licenses/external_license_id/${externalLicenseId}`, { query, ...options });
}
}
exports.Licenses = Licenses;
class LicenseListResponsesPage extends pagination_1.Page {
}
exports.LicenseListResponsesPage = LicenseListResponsesPage;
Licenses.LicenseListResponsesPage = LicenseListResponsesPage;
Licenses.ExternalLicenses = external_licenses_1.ExternalLicenses;
Licenses.Usage = usage_1.Usage;
//# sourceMappingURL=licenses.js.map