UNPKG

orb-billing

Version:

The official TypeScript library for the Orb API

53 lines 2.53 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../resource.mjs"; import { isRequestOptions } from "../../core.mjs"; import * as ExternalDimensionalPriceGroupIDAPI from "./external-dimensional-price-group-id.mjs"; import { ExternalDimensionalPriceGroupID, } from "./external-dimensional-price-group-id.mjs"; import { Page } from "../../pagination.mjs"; export class DimensionalPriceGroups extends APIResource { constructor() { super(...arguments); this.externalDimensionalPriceGroupId = new ExternalDimensionalPriceGroupIDAPI.ExternalDimensionalPriceGroupID(this._client); } /** * A dimensional price group is used to partition the result of a billable metric * by a set of dimensions. Prices in a price group must specify the partition used * to derive their usage. * * For example, suppose we have a billable metric that measures the number of * widgets used and we want to charge differently depending on the color of the * widget. We can create a price group with a dimension "color" and two prices: one * that charges \$10 per red widget and one that charges \$20 per blue widget. */ create(body, options) { return this._client.post('/dimensional_price_groups', { body, ...options }); } /** * Fetch dimensional price group */ retrieve(dimensionalPriceGroupId, options) { return this._client.get(`/dimensional_price_groups/${dimensionalPriceGroupId}`, options); } /** * This endpoint can be used to update the `external_dimensional_price_group_id` * and `metadata` of an existing dimensional price group. Other fields on a * dimensional price group are currently immutable. */ update(dimensionalPriceGroupId, body, options) { return this._client.put(`/dimensional_price_groups/${dimensionalPriceGroupId}`, { body, ...options }); } list(query = {}, options) { if (isRequestOptions(query)) { return this.list({}, query); } return this._client.getAPIList('/dimensional_price_groups', DimensionalPriceGroupsPage, { query, ...options, }); } } export class DimensionalPriceGroupsPage extends Page { } DimensionalPriceGroups.DimensionalPriceGroupsPage = DimensionalPriceGroupsPage; DimensionalPriceGroups.ExternalDimensionalPriceGroupID = ExternalDimensionalPriceGroupID; //# sourceMappingURL=dimensional-price-groups.mjs.map