orb-billing
Version:
The official TypeScript library for the Orb API
58 lines • 2.48 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../resource.mjs";
import * as ExternalLicensesAPI from "./external-licenses.mjs";
import { ExternalLicenses, } from "./external-licenses.mjs";
import * as UsageAPI from "./usage.mjs";
import { Usage, } from "./usage.mjs";
import { Page } from "../../pagination.mjs";
export class Licenses extends 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 });
}
}
export class LicenseListResponsesPage extends Page {
}
Licenses.LicenseListResponsesPage = LicenseListResponsesPage;
Licenses.ExternalLicenses = ExternalLicenses;
Licenses.Usage = Usage;
//# sourceMappingURL=licenses.mjs.map