UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

76 lines 2.33 kB
"use strict"; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. Object.defineProperty(exports, "__esModule", { value: true }); exports.Items = void 0; const resource_1 = require("../core/resource.js"); const pagination_1 = require("../core/pagination.js"); const path_1 = require("../internal/utils/path.js"); /** * The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, * and prices and are used for defining external sync behavior for invoices and tax calculation purposes. */ class Items extends resource_1.APIResource { /** * This endpoint is used to create an [Item](/core-concepts#item). * * @example * ```ts * const item = await client.items.create({ * name: 'API requests', * }); * ``` */ create(body, options) { return this._client.post('/items', { body, ...options }); } /** * This endpoint can be used to update properties on the Item. * * @example * ```ts * const item = await client.items.update('item_id'); * ``` */ update(itemID, body, options) { return this._client.put((0, path_1.path) `/items/${itemID}`, { body, ...options }); } /** * This endpoint returns a list of all Items, ordered in descending order by * creation time. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const item of client.items.list()) { * // ... * } * ``` */ list(query = {}, options) { return this._client.getAPIList('/items', (pagination_1.Page), { query, ...options }); } /** * Archive item * * @example * ```ts * const item = await client.items.archive('item_id'); * ``` */ archive(itemID, options) { return this._client.post((0, path_1.path) `/items/${itemID}/archive`, options); } /** * This endpoint returns an item identified by its item_id. * * @example * ```ts * const item = await client.items.fetch('item_id'); * ``` */ fetch(itemID, options) { return this._client.get((0, path_1.path) `/items/${itemID}`, options); } } exports.Items = Items; //# sourceMappingURL=items.js.map