orb-billing
Version:
The official TypeScript library for the Orb API
39 lines • 1.59 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../resource.mjs";
import { isRequestOptions } from "../core.mjs";
import { Page } from "../pagination.mjs";
export class Metrics extends APIResource {
/**
* This endpoint is used to create a [metric](/core-concepts###metric) using a SQL
* string. See [SQL support](/extensibility/advanced-metrics#sql-support) for a
* description of constructing SQL queries with examples.
*/
create(body, options) {
return this._client.post('/metrics', { body, ...options });
}
/**
* This endpoint allows you to update the `metadata` property on a metric. If you
* pass `null` for the metadata value, it will clear any existing metadata for that
* invoice.
*/
update(metricId, body, options) {
return this._client.put(`/metrics/${metricId}`, { body, ...options });
}
list(query = {}, options) {
if (isRequestOptions(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/metrics', BillableMetricsPage, { query, ...options });
}
/**
* This endpoint is used to list [metrics](/core-concepts#metric). It returns
* information about the metrics including its name, description, and item.
*/
fetch(metricId, options) {
return this._client.get(`/metrics/${metricId}`, options);
}
}
export class BillableMetricsPage extends Page {
}
Metrics.BillableMetricsPage = BillableMetricsPage;
//# sourceMappingURL=metrics.mjs.map