Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jun 28, 2024
1 parent 72ac25b commit 46da725
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.prism.log
node_modules
yarn-error.log
codegen.log
Expand Down
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 48
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-3aa1a571be1e0fb229fbd0c7fb1c9eb9dcbb1296613c7a07b3ebc16ac76aba44.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-1ba87fe3b31769922c40c192fab50b9bdda6518303b16c4c1821ea8ecefb5def.yml
9 changes: 6 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from './core';
import * as Errors from './error';
import { type Agent } from './_shims/index';
import * as Uploads from './uploads';
import { type Agent } from './_shims/index';
import * as qs from 'qs';
import * as Core from '@metronome/sdk/core';
import * as Pagination from '@metronome/sdk/pagination';
import * as API from '@metronome/sdk/resources/index';

Expand Down Expand Up @@ -76,7 +76,9 @@ export interface ClientOptions {
defaultQuery?: Core.DefaultQuery;
}

/** API Client for interfacing with the Metronome API. */
/**
* API Client for interfacing with the Metronome API.
*/
export class Metronome extends Core.APIClient {
bearerToken: string;
webhookSecret: string | null;
Expand Down Expand Up @@ -122,6 +124,7 @@ export class Metronome extends Core.APIClient {
maxRetries: options.maxRetries,
fetch: options.fetch,
});

this._options = options;

this.bearerToken = bearerToken;
Expand Down
2 changes: 1 addition & 1 deletion src/resources/alerts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import * as Core from '@metronome/sdk/core';
import * as AlertsAPI from '@metronome/sdk/resources/alerts';
import * as Shared from '@metronome/sdk/resources/shared';

Expand Down
2 changes: 1 addition & 1 deletion src/resources/audit-logs.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as AuditLogsAPI from '@metronome/sdk/resources/audit-logs';
import { CursorPage, type CursorPageParams } from '@metronome/sdk/pagination';

Expand Down
2 changes: 1 addition & 1 deletion src/resources/billable-metrics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as BillableMetricsAPI from '@metronome/sdk/resources/billable-metrics';
import * as Shared from '@metronome/sdk/resources/shared';
import { CursorPage, type CursorPageParams } from '@metronome/sdk/pagination';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/credit-grants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as CreditGrantsAPI from '@metronome/sdk/resources/credit-grants';
import * as Shared from '@metronome/sdk/resources/shared';
import { CursorPage, type CursorPageParams } from '@metronome/sdk/pagination';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/custom-fields.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as CustomFieldsAPI from '@metronome/sdk/resources/custom-fields';

export class CustomFields extends APIResource {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/customers/alerts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import * as Core from '@metronome/sdk/core';
import * as AlertsAPI from '@metronome/sdk/resources/customers/alerts';
import * as Shared from '@metronome/sdk/resources/shared';

Expand Down
2 changes: 1 addition & 1 deletion src/resources/customers/billing-config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import * as Core from '@metronome/sdk/core';
import * as BillingConfigAPI from '@metronome/sdk/resources/customers/billing-config';

export class BillingConfig extends APIResource {
Expand Down
8 changes: 6 additions & 2 deletions src/resources/customers/customers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as CustomersAPI from '@metronome/sdk/resources/customers/customers';
import * as Shared from '@metronome/sdk/resources/shared';
import * as AlertsAPI from '@metronome/sdk/resources/customers/alerts';
Expand Down Expand Up @@ -398,6 +398,9 @@ export interface CustomerSetNameResponse {
}

export interface CustomerCreateParams {
/**
* This will be truncated to 160 characters if the provided name is longer.
*/
name: string;

billing_config?: CustomerCreateParams.BillingConfig;
Expand Down Expand Up @@ -516,7 +519,8 @@ export interface CustomerSetIngestAliasesParams {

export interface CustomerSetNameParams {
/**
* The new name for the customer
* The new name for the customer. This will be truncated to 160 characters if the
* provided name is longer.
*/
name: string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/customers/invoices.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as InvoicesAPI from '@metronome/sdk/resources/customers/invoices';
import * as Shared from '@metronome/sdk/resources/shared';
import { CursorPage, type CursorPageParams } from '@metronome/sdk/pagination';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/customers/plans.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as PlansAPI from '@metronome/sdk/resources/customers/plans';
import * as Shared from '@metronome/sdk/resources/shared';
import { CursorPage, type CursorPageParams } from '@metronome/sdk/pagination';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/dashboards.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import * as Core from '@metronome/sdk/core';
import * as DashboardsAPI from '@metronome/sdk/resources/dashboards';

export class Dashboards extends APIResource {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/plans.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import { isRequestOptions } from '@metronome/sdk/core';
import * as Core from '@metronome/sdk/core';
import * as PlansAPI from '@metronome/sdk/resources/plans';
import * as Shared from '@metronome/sdk/resources/shared';
import * as CustomersAPI from '@metronome/sdk/resources/customers/customers';
Expand Down
2 changes: 1 addition & 1 deletion src/resources/services.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import * as Core from '@metronome/sdk/core';
import * as ServicesAPI from '@metronome/sdk/resources/services';

export class Services extends APIResource {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/usage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import * as Core from '@metronome/sdk/core';
import { APIResource } from '@metronome/sdk/resource';
import * as Core from '@metronome/sdk/core';
import * as UsageAPI from '@metronome/sdk/resources/usage';
import { CursorPage, type CursorPageParams } from '@metronome/sdk/pagination';

Expand Down
13 changes: 5 additions & 8 deletions tests/stringifyQuery.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { APIClient } from '@metronome/sdk/core';
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

const { stringifyQuery } = APIClient.prototype as any;
import { Metronome } from '@metronome/sdk';

describe('APIClient.stringifyQuery', () => {
const { stringifyQuery } = Metronome.prototype as any;

describe(stringifyQuery, () => {
for (const [input, expected] of [
[{ a: '1', b: 2, c: true }, 'a=1&b=2&c=true'],
[{ a: null, b: false, c: undefined }, 'a=&b=false'],
Expand All @@ -18,9 +20,4 @@ describe('APIClient.stringifyQuery', () => {
expect(stringifyQuery(input)).toEqual(expected);
});
}
for (const value of [[], {}, new Date()]) {
it(`${JSON.stringify(value)} -> <error>`, () => {
expect(() => stringifyQuery({ value })).toThrow(`Cannot stringify type ${typeof value}`);
});
}
});
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2820,9 +2820,9 @@ npm-run-path@^5.1.0:
path-key "^4.0.0"

object-inspect@^1.13.1:
version "1.13.1"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2"
integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==
version "1.13.2"
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff"
integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==

once@^1.3.0:
version "1.4.0"
Expand Down

0 comments on commit 46da725

Please sign in to comment.