UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

72 lines 2.14 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../core/resource.mjs"; import { Page } from "../core/pagination.mjs"; import { path } from "../internal/utils/path.mjs"; /** * 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. */ export class Items extends 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(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', (Page), { query, ...options }); } /** * Archive item * * @example * ```ts * const item = await client.items.archive('item_id'); * ``` */ archive(itemID, options) { return this._client.post(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(path `/items/${itemID}`, options); } } //# sourceMappingURL=items.mjs.map