orb-billing
Version:
The official TypeScript library for the Orb API
81 lines • 3.91 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.DimensionalPriceGroupsPage = exports.DimensionalPriceGroups = void 0;
const resource_1 = require("../../resource.js");
const core_1 = require("../../core.js");
const ExternalDimensionalPriceGroupIDAPI = __importStar(require("./external-dimensional-price-group-id.js"));
const external_dimensional_price_group_id_1 = require("./external-dimensional-price-group-id.js");
const pagination_1 = require("../../pagination.js");
class DimensionalPriceGroups extends resource_1.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 ((0, core_1.isRequestOptions)(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/dimensional_price_groups', DimensionalPriceGroupsPage, {
query,
...options,
});
}
}
exports.DimensionalPriceGroups = DimensionalPriceGroups;
class DimensionalPriceGroupsPage extends pagination_1.Page {
}
exports.DimensionalPriceGroupsPage = DimensionalPriceGroupsPage;
DimensionalPriceGroups.DimensionalPriceGroupsPage = DimensionalPriceGroupsPage;
DimensionalPriceGroups.ExternalDimensionalPriceGroupID = external_dimensional_price_group_id_1.ExternalDimensionalPriceGroupID;
//# sourceMappingURL=dimensional-price-groups.js.map