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): OpenAPI spec update via Stainless API #114

Merged
merged 1 commit into from
Oct 4, 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-b0024765a98d3608014ecde441861bdb0b1f075cb56bd7c0967104fa7ee020ef.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-a89210f56e000a978cd97348ab656503553f7a93d055561792d012c4a70cd5da.yml
3 changes: 2 additions & 1 deletion src/resources/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export interface AlertCreateParams {
name: string;

/**
* Threshold value of the alert policy
* Threshold value of the alert policy. Depending upon the alert type, this number
* may represent a financial amount, the days remaining, or a percentage reached.
*/
threshold: number;

Expand Down
70 changes: 69 additions & 1 deletion src/resources/contracts/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,71 @@ export namespace ContractRetrieveRateScheduleResponse {

starting_at: string;

/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
commit_rate?: Data.CommitRate;

ending_before?: string;

override_rate?: Shared.Rate;

pricing_group_values?: Record<string, string>;
}

export namespace Data {
/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
export interface CommitRate {
rate_type:
| 'FLAT'
| 'flat'
| 'PERCENTAGE'
| 'percentage'
| 'SUBSCRIPTION'
| 'subscription'
| 'TIERED'
| 'tiered'
| 'CUSTOM'
| 'custom';

credit_type?: Shared.CreditType;

/**
* Commit rate proration configuration. Only valid for SUBSCRIPTION rate_type.
*/
is_prorated?: boolean;

/**
* Commit rate price. For FLAT rate_type, this must be >=0. For PERCENTAGE
* rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0
* and <=1.
*/
price?: number;

/**
* Commit rate quantity. For SUBSCRIPTION rate_type, this must be >=0.
*/
quantity?: number;

/**
* Only set for TIERED rate_type.
*/
tiers?: Array<Shared.Tier>;

/**
* Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
* using list prices rather than the standard rates for this product on the
* contract.
*/
use_list_prices?: boolean;
}
}
}

export interface ContractScheduleProServicesInvoiceResponse {
Expand Down Expand Up @@ -1265,10 +1324,19 @@ export namespace ContractCreateParams {
export interface UsageStatementSchedule {
frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';

/**
* Required when using CUSTOM_DATE. This option lets you set a historical billing
* anchor date, aligning future billing cycles with a chosen cadence. For example,
* if a contract starts on 2024-09-15 and you set the anchor date to 2024-09-10
* with a MONTHLY frequency, the first usage statement will cover 09-15 to 10-10.
* Subsequent statements will follow the 10th of each month.
*/
billing_anchor_date?: string;

/**
* If not provided, defaults to the first day of the month.
*/
day?: 'FIRST_OF_MONTH' | 'CONTRACT_START';
day?: 'FIRST_OF_MONTH' | 'CONTRACT_START' | 'CUSTOM_DATE' | 'custom_date';

/**
* The date Metronome should start generating usage invoices. If unspecified,
Expand Down
180 changes: 179 additions & 1 deletion src/resources/contracts/rate-cards/rate-cards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export class RateCards extends APIResource {
}

/**
* Get a specific rate schedule including all rate card entries
* Get all rates for a rate card from starting_at (either in perpetuity or until
* ending_before, if provided)
*/
retrieveRateSchedule(
params: RateCardRetrieveRateScheduleParams,
Expand Down Expand Up @@ -154,6 +155,13 @@ export namespace RateCardRetrieveResponse {

starting_at: string;

/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
commit_rate?: Update.CommitRate;

credit_type?: Shared.CreditType;

custom_rate?: Record<string, unknown>;
Expand All @@ -168,6 +176,58 @@ export namespace RateCardRetrieveResponse {

tiers?: Array<Shared.Tier>;
}

export namespace Update {
/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
export interface CommitRate {
rate_type:
| 'FLAT'
| 'flat'
| 'PERCENTAGE'
| 'percentage'
| 'SUBSCRIPTION'
| 'subscription'
| 'TIERED'
| 'tiered'
| 'CUSTOM'
| 'custom';

credit_type?: Shared.CreditType;

/**
* Commit rate proration configuration. Only valid for SUBSCRIPTION rate_type.
*/
is_prorated?: boolean;

/**
* Commit rate price. For FLAT rate_type, this must be >=0. For PERCENTAGE
* rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0
* and <=1.
*/
price?: number;

/**
* Commit rate quantity. For SUBSCRIPTION rate_type, this must be >=0.
*/
quantity?: number;

/**
* Only set for TIERED rate_type.
*/
tiers?: Array<Shared.Tier>;

/**
* Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
* using list prices rather than the standard rates for this product on the
* contract.
*/
use_list_prices?: boolean;
}
}
}

export interface Alias {
Expand Down Expand Up @@ -261,6 +321,13 @@ export namespace RateCardListResponse {

starting_at: string;

/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
commit_rate?: Update.CommitRate;

credit_type?: Shared.CreditType;

custom_rate?: Record<string, unknown>;
Expand All @@ -275,6 +342,58 @@ export namespace RateCardListResponse {

tiers?: Array<Shared.Tier>;
}

export namespace Update {
/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
export interface CommitRate {
rate_type:
| 'FLAT'
| 'flat'
| 'PERCENTAGE'
| 'percentage'
| 'SUBSCRIPTION'
| 'subscription'
| 'TIERED'
| 'tiered'
| 'CUSTOM'
| 'custom';

credit_type?: Shared.CreditType;

/**
* Commit rate proration configuration. Only valid for SUBSCRIPTION rate_type.
*/
is_prorated?: boolean;

/**
* Commit rate price. For FLAT rate_type, this must be >=0. For PERCENTAGE
* rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0
* and <=1.
*/
price?: number;

/**
* Commit rate quantity. For SUBSCRIPTION rate_type, this must be >=0.
*/
quantity?: number;

/**
* Only set for TIERED rate_type.
*/
tiers?: Array<Shared.Tier>;

/**
* Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
* using list prices rather than the standard rates for this product on the
* contract.
*/
use_list_prices?: boolean;
}
}
}

export interface Alias {
Expand Down Expand Up @@ -312,10 +431,69 @@ export namespace RateCardRetrieveRateScheduleResponse {

starting_at: string;

/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
commit_rate?: Data.CommitRate;

ending_before?: string;

pricing_group_values?: Record<string, string>;
}

export namespace Data {
/**
* The rate that will be used to rate a product when it is paid for by a commit.
* This feature requires opt-in before it can be used. Please contact Metronome
* support to enable this feature.
*/
export interface CommitRate {
rate_type:
| 'FLAT'
| 'flat'
| 'PERCENTAGE'
| 'percentage'
| 'SUBSCRIPTION'
| 'subscription'
| 'TIERED'
| 'tiered'
| 'CUSTOM'
| 'custom';

credit_type?: Shared.CreditType;

/**
* Commit rate proration configuration. Only valid for SUBSCRIPTION rate_type.
*/
is_prorated?: boolean;

/**
* Commit rate price. For FLAT rate_type, this must be >=0. For PERCENTAGE
* rate_type, this is a decimal fraction, e.g. use 0.1 for 10%; this must be >=0
* and <=1.
*/
price?: number;

/**
* Commit rate quantity. For SUBSCRIPTION rate_type, this must be >=0.
*/
quantity?: number;

/**
* Only set for TIERED rate_type.
*/
tiers?: Array<Shared.Tier>;

/**
* Only set for PERCENTAGE rate_type. Defaults to false. If true, rate is computed
* using list prices rather than the standard rates for this product on the
* contract.
*/
use_list_prices?: boolean;
}
}
}

export interface RateCardCreateParams {
Expand Down
Loading