Skip to content

Commit

Permalink
feat(api): api update (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Oct 31, 2024
1 parent 5ee5774 commit 306626e
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 1 deletion.
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-037e2c312f68e8c20a89b2be8e1745dd0e5dd3e43677349ea971233287c0e6cb.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/metronome%2Fmetronome-b84ae14053713dcb9bed31b22b072ae44659936b582ca7c2bda56632f079445c.yml
9 changes: 9 additions & 0 deletions aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,15 @@ const OverrideRateTypeTiered = shared.OverrideRateTypeTiered
// This is an alias to an internal value.
const OverrideRateTypeCustom = shared.OverrideRateTypeCustom

// This is an alias to an internal type.
type OverrideTarget = shared.OverrideTarget

// This is an alias to an internal value.
const OverrideTargetCommitRate = shared.OverrideTargetCommitRate

// This is an alias to an internal value.
const OverrideTargetListRate = shared.OverrideTargetListRate

// This is an alias to an internal type.
type OverrideType = shared.OverrideType

Expand Down
70 changes: 70 additions & 0 deletions contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,9 @@ type ContractNewParamsCommit struct {
RateType param.Field[ContractNewParamsCommitsRateType] `json:"rate_type"`
// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
RolloverFraction param.Field[float64] `json:"rollover_fraction"`
// A temporary ID for the commit that can be used to reference the commit for
// commit specific overrides.
TemporaryID param.Field[string] `json:"temporary_id"`
}

func (r ContractNewParamsCommit) MarshalJSON() (data []byte, err error) {
Expand Down Expand Up @@ -1442,6 +1445,10 @@ type ContractNewParamsOverride struct {
// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
Entitled param.Field[bool] `json:"entitled"`
// Indicates whether the override should only apply to commits. Defaults to
// `false`. If `true`, you can specify relevant commits in `override_specifiers` by
// passing `commit_ids`.
IsCommitSpecific param.Field[bool] `json:"is_commit_specific"`
// Required for MULTIPLIER type. Must be >=0.
Multiplier param.Field[float64] `json:"multiplier"`
// Cannot be used in conjunction with product_id or applicable_product_tags. If
Expand All @@ -1456,6 +1463,10 @@ type ContractNewParamsOverride struct {
Priority param.Field[float64] `json:"priority"`
// ID of the product whose rate is being overridden
ProductID param.Field[string] `json:"product_id" format:"uuid"`
// Indicates whether the override applies to commit rates or list rates. Can only
// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
// `"LIST_RATE"`.
Target param.Field[ContractNewParamsOverridesTarget] `json:"target"`
// Required for TIERED type. Must have at least one tier.
Tiers param.Field[[]ContractNewParamsOverridesTier] `json:"tiers"`
// Overwrites are prioritized over multipliers and tiered overrides.
Expand All @@ -1467,6 +1478,10 @@ func (r ContractNewParamsOverride) MarshalJSON() (data []byte, err error) {
}

type ContractNewParamsOverridesOverrideSpecifier struct {
// If provided, the override will only apply to the specified commits. Can only be
// used for commit specific overrides. If not provided, the override will apply to
// all commits.
CommitIDs param.Field[[]string] `json:"commit_ids"`
// A map of group names to values. The override will only apply to line items with
// the specified presentation group values. Can only be used for multiplier
// overrides.
Expand Down Expand Up @@ -1525,6 +1540,26 @@ func (r ContractNewParamsOverridesOverwriteRateRateType) IsKnown() bool {
return false
}

// Indicates whether the override applies to commit rates or list rates. Can only
// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
// `"LIST_RATE"`.
type ContractNewParamsOverridesTarget string

const (
ContractNewParamsOverridesTargetCommitRate ContractNewParamsOverridesTarget = "COMMIT_RATE"

Check failure on line 1549 in contract.go

View workflow job for this annotation

GitHub Actions / lint

other declaration of ContractNewParamsOverridesTargetCommitRate

Check failure on line 1549 in contract.go

View workflow job for this annotation

GitHub Actions / test

other declaration of ContractNewParamsOverridesTargetCommitRate
ContractNewParamsOverridesTargetCommitRate ContractNewParamsOverridesTarget = "commit_rate"

Check failure on line 1550 in contract.go

View workflow job for this annotation

GitHub Actions / lint

ContractNewParamsOverridesTargetCommitRate redeclared in this block

Check failure on line 1550 in contract.go

View workflow job for this annotation

GitHub Actions / test

ContractNewParamsOverridesTargetCommitRate redeclared in this block
ContractNewParamsOverridesTargetListRate ContractNewParamsOverridesTarget = "LIST_RATE"

Check failure on line 1551 in contract.go

View workflow job for this annotation

GitHub Actions / lint

other declaration of ContractNewParamsOverridesTargetListRate

Check failure on line 1551 in contract.go

View workflow job for this annotation

GitHub Actions / test

other declaration of ContractNewParamsOverridesTargetListRate
ContractNewParamsOverridesTargetListRate ContractNewParamsOverridesTarget = "list_rate"

Check failure on line 1552 in contract.go

View workflow job for this annotation

GitHub Actions / lint

ContractNewParamsOverridesTargetListRate redeclared in this block

Check failure on line 1552 in contract.go

View workflow job for this annotation

GitHub Actions / test

ContractNewParamsOverridesTargetListRate redeclared in this block
)

func (r ContractNewParamsOverridesTarget) IsKnown() bool {
switch r {
case ContractNewParamsOverridesTargetCommitRate, ContractNewParamsOverridesTargetCommitRate, ContractNewParamsOverridesTargetListRate, ContractNewParamsOverridesTargetListRate:
return true
}
return false
}

type ContractNewParamsOverridesTier struct {
Multiplier param.Field[float64] `json:"multiplier,required"`
Size param.Field[float64] `json:"size"`
Expand Down Expand Up @@ -1965,6 +2000,9 @@ type ContractAmendParamsCommit struct {
RateType param.Field[ContractAmendParamsCommitsRateType] `json:"rate_type"`
// Fraction of unused segments that will be rolled over. Must be between 0 and 1.
RolloverFraction param.Field[float64] `json:"rollover_fraction"`
// A temporary ID for the commit that can be used to reference the commit for
// commit specific overrides.
TemporaryID param.Field[string] `json:"temporary_id"`
}

func (r ContractAmendParamsCommit) MarshalJSON() (data []byte, err error) {
Expand Down Expand Up @@ -2296,6 +2334,10 @@ type ContractAmendParamsOverride struct {
// RFC 3339 timestamp indicating when the override will stop applying (exclusive)
EndingBefore param.Field[time.Time] `json:"ending_before" format:"date-time"`
Entitled param.Field[bool] `json:"entitled"`
// Indicates whether the override should only apply to commits. Defaults to
// `false`. If `true`, you can specify relevant commits in `override_specifiers` by
// passing `commit_ids`.
IsCommitSpecific param.Field[bool] `json:"is_commit_specific"`
// Required for MULTIPLIER type. Must be >=0.
Multiplier param.Field[float64] `json:"multiplier"`
// Cannot be used in conjunction with product_id or applicable_product_tags. If
Expand All @@ -2310,6 +2352,10 @@ type ContractAmendParamsOverride struct {
Priority param.Field[float64] `json:"priority"`
// ID of the product whose rate is being overridden
ProductID param.Field[string] `json:"product_id" format:"uuid"`
// Indicates whether the override applies to commit rates or list rates. Can only
// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
// `"LIST_RATE"`.
Target param.Field[ContractAmendParamsOverridesTarget] `json:"target"`
// Required for TIERED type. Must have at least one tier.
Tiers param.Field[[]ContractAmendParamsOverridesTier] `json:"tiers"`
// Overwrites are prioritized over multipliers and tiered overrides.
Expand All @@ -2321,6 +2367,10 @@ func (r ContractAmendParamsOverride) MarshalJSON() (data []byte, err error) {
}

type ContractAmendParamsOverridesOverrideSpecifier struct {
// If provided, the override will only apply to the specified commits. Can only be
// used for commit specific overrides. If not provided, the override will apply to
// all commits.
CommitIDs param.Field[[]string] `json:"commit_ids"`
// A map of group names to values. The override will only apply to line items with
// the specified presentation group values. Can only be used for multiplier
// overrides.
Expand Down Expand Up @@ -2379,6 +2429,26 @@ func (r ContractAmendParamsOverridesOverwriteRateRateType) IsKnown() bool {
return false
}

// Indicates whether the override applies to commit rates or list rates. Can only
// be used for overrides that have `is_commit_specific` set to `true`. Defaults to
// `"LIST_RATE"`.
type ContractAmendParamsOverridesTarget string

const (
ContractAmendParamsOverridesTargetCommitRate ContractAmendParamsOverridesTarget = "COMMIT_RATE"
ContractAmendParamsOverridesTargetCommitRate ContractAmendParamsOverridesTarget = "commit_rate"
ContractAmendParamsOverridesTargetListRate ContractAmendParamsOverridesTarget = "LIST_RATE"
ContractAmendParamsOverridesTargetListRate ContractAmendParamsOverridesTarget = "list_rate"
)

func (r ContractAmendParamsOverridesTarget) IsKnown() bool {
switch r {
case ContractAmendParamsOverridesTargetCommitRate, ContractAmendParamsOverridesTargetCommitRate, ContractAmendParamsOverridesTargetListRate, ContractAmendParamsOverridesTargetListRate:
return true
}
return false
}

type ContractAmendParamsOverridesTier struct {
Multiplier param.Field[float64] `json:"multiplier,required"`
Size param.Field[float64] `json:"size"`
Expand Down
Loading

0 comments on commit 306626e

Please sign in to comment.