From 96e2738640fa6e5dd9f6a00c57bec3da48e42c5e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:28:00 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#93) --- .stats.yml | 2 +- src/resources/dashboards.ts | 49 +++++++------------------- tests/api-resources/dashboards.test.ts | 12 ++++--- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/.stats.yml b/.stats.yml index 91f715c..758bbda 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 90 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-c23134402bb47d1637feabf3d4058720571d9d5d90253a11e2ea818b3add064a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-531ea40f0371507ecead2f5ed9911002dab5d2667ea32a43b66c7b70b30f8819.yml diff --git a/src/resources/dashboards.ts b/src/resources/dashboards.ts index 7687cf8..294a7da 100644 --- a/src/resources/dashboards.ts +++ b/src/resources/dashboards.ts @@ -36,9 +36,10 @@ export interface DashboardGetEmbeddableURLParams { */ dashboard: 'invoices' | 'usage' | 'credits'; - bm_group_key_display_name_overrides?: DashboardGetEmbeddableURLParams.BmGroupKeyDisplayNameOverrides; - - bm_group_key_values_display_name_overrides?: DashboardGetEmbeddableURLParams.BmGroupKeyValuesDisplayNameOverrides; + /** + * Optional list of billable metric group key overrides + */ + bm_group_key_overrides?: Array; /** * Optional list of colors to override @@ -52,48 +53,22 @@ export interface DashboardGetEmbeddableURLParams { } export namespace DashboardGetEmbeddableURLParams { - export interface BmGroupKeyDisplayNameOverrides { + export interface BmGroupKeyOverride { /** - * The new display name for the group key. e.g. "Tenant ID" + * The name of the billable metric group key. */ - display_name?: string; + group_key_name: string; /** - * The current name of the group key. e.g. "tenant_id" + * The display name for the billable metric group key */ - group_key_name?: string; - } - - export interface BmGroupKeyValuesDisplayNameOverrides { - /** - * The actual value of the group key. e.g. "123-xyz-abc". If group key is not used, - * it is the BM's name. - */ - group_key_name?: string; - - /** - * An object containing the group key value and the new display name for the group - * key value. - */ - value_display_name?: BmGroupKeyValuesDisplayNameOverrides.ValueDisplayName; - } + display_name?: string; - export namespace BmGroupKeyValuesDisplayNameOverrides { /** - * An object containing the group key value and the new display name for the group - * key value. + * pairs of the billable metric group key values and their display + * names. e.g. {"a": "Asia", "b": "Euro"} */ - export interface ValueDisplayName { - /** - * The new display name for the group key value. e.g. "EU-Cluster-A" - */ - display_name?: string; - - /** - * The actual value of the group key. e.g. "123-xyz-abc" - */ - group_key_value?: string; - } + value_display_names?: Record; } export interface ColorOverride { diff --git a/tests/api-resources/dashboards.test.ts b/tests/api-resources/dashboards.test.ts index 22037eb..9786cdc 100644 --- a/tests/api-resources/dashboards.test.ts +++ b/tests/api-resources/dashboards.test.ts @@ -27,11 +27,13 @@ describe('resource dashboards', () => { const response = await client.dashboards.getEmbeddableURL({ customer_id: '4db51251-61de-4bfe-b9ce-495e244f3491', dashboard: 'invoices', - bm_group_key_display_name_overrides: { display_name: 'display_name', group_key_name: 'group_key_name' }, - bm_group_key_values_display_name_overrides: { - group_key_name: 'group_key_name', - value_display_name: { display_name: 'display_name', group_key_value: 'group_key_value' }, - }, + bm_group_key_overrides: [ + { + group_key_name: 'tenant_id', + display_name: 'Org ID', + value_display_names: { '48ecb18f358f': 'bar', e358f3ce242d: 'bar' }, + }, + ], color_overrides: [{ name: 'Gray_dark', value: '#ff0000' }], dashboard_options: [ { key: 'key', value: 'value' },