Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): api update #131

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 91
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-ebf6ec71381ac4de43a238b439ff137f915f48cdb2533b8422d069cebece35c2.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-d04cc2dc5a1f1bd278783a02c8bbf246f850ce53fe63d7d43cb9df69fae02429.yml
19 changes: 18 additions & 1 deletion src/resources/billable-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ export namespace BillableMetricRetrieveResponse {
*/
aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';

/**
* RFC 3339 timestamp indicating when the billable metric was archived. If not
* provided, the billable metric is not archived.
*/
archived_at?: string;

custom_fields?: Record<string, string>;

/**
Expand Down Expand Up @@ -146,6 +152,12 @@ export interface BillableMetricListResponse {
*/
aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';

/**
* RFC 3339 timestamp indicating when the billable metric was archived. If not
* provided, the billable metric is not archived.
*/
archived_at?: string;

custom_fields?: Record<string, string>;

/**
Expand Down Expand Up @@ -229,7 +241,12 @@ export interface BillableMetricRetrieveParams {
billable_metric_id: string;
}

export interface BillableMetricListParams extends CursorPageParams {}
export interface BillableMetricListParams extends CursorPageParams {
/**
* If true, the list of returned metrics will include archived metrics
*/
include_archived?: boolean;
}

export interface BillableMetricArchiveParams {
id: string;
Expand Down
11 changes: 11 additions & 0 deletions src/resources/customers/customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ export interface CustomerListBillableMetricsResponse {
*/
aggregation_type?: 'COUNT' | 'LATEST' | 'MAX' | 'SUM' | 'UNIQUE';

/**
* RFC 3339 timestamp indicating when the billable metric was archived. If not
* provided, the billable metric is not archived.
*/
archived_at?: string;

custom_fields?: Record<string, string>;

/**
Expand Down Expand Up @@ -498,6 +504,11 @@ export interface CustomerListBillableMetricsParams extends CursorPageParams {
*/
customer_id: string;

/**
* Query param: If true, the list of returned metrics will include archived metrics
*/
include_archived?: boolean;

/**
* Query param: If true, the list of metrics will be filtered to just ones that are
* on the customer's current plan
Expand Down
5 changes: 4 additions & 1 deletion tests/api-resources/billable-metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ describe('resource billableMetrics', () => {
test('list: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.billableMetrics.list({ limit: 1, next_page: 'next_page' }, { path: '/_stainless_unknown_path' }),
client.billableMetrics.list(
{ include_archived: true, limit: 1, next_page: 'next_page' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Metronome.NotFoundError);
});

Expand Down
1 change: 1 addition & 0 deletions tests/api-resources/customers/customers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ describe('resource customers', () => {
test('listBillableMetrics: required and optional params', async () => {
const response = await client.customers.listBillableMetrics({
customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
include_archived: true,
limit: 1,
next_page: 'next_page',
on_current_plan: true,
Expand Down