openmeter / api /v3 /client /models_plans.go
Leon4gr45's picture
Upload folder using huggingface_hub (part 3)
04f1444 verified
Raw
History Blame Contribute Delete
6.8 kB
// Code generated by @openmeter/typespec-go. DO NOT EDIT.
package openmeter
import "time"
// Plan create request.
type CreatePlanRequest struct {
// Display name of the resource.
//
// Between 1 and 256 characters.
Name string `json:"name"`
// Optional description of the resource.
//
// Maximum 1024 characters.
Description *string `json:"description,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
// A key is a semi-unique string that is used to identify the plan. It is used to
// reference the latest `active` version of the plan and is unique with the version
// number.
Key string `json:"key"`
// The currency code of the plan.
Currency string `json:"currency"`
// The billing cadence for subscriptions using this plan.
BillingCadence string `json:"billing_cadence"`
// Whether pro-rating is enabled for this plan.
ProRatingEnabled *bool `json:"pro_rating_enabled,omitempty"`
// The plan phases define the pricing ramp for a subscription. A phase switch
// occurs only at the end of a billing period. At least one phase is required.
Phases []PlanPhaseInput `json:"phases"`
}
// Plans provide a template for subscriptions.
type Plan struct {
ID string `json:"id"`
// Display name of the resource.
//
// Between 1 and 256 characters.
Name string `json:"name"`
// Optional description of the resource.
//
// Maximum 1024 characters.
Description *string `json:"description,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
// An ISO-8601 timestamp representation of entity creation date.
CreatedAt time.Time `json:"created_at"`
// An ISO-8601 timestamp representation of entity last update date.
UpdatedAt time.Time `json:"updated_at"`
// An ISO-8601 timestamp representation of entity deletion date.
DeletedAt *time.Time `json:"deleted_at,omitempty"`
// A key is a semi-unique string that is used to identify the plan. It is used to
// reference the latest `active` version of the plan and is unique with the version
// number.
Key string `json:"key"`
// Plans are versioned to allow you to make changes without affecting running
// subscriptions.
Version int64 `json:"version"`
// The currency code of the plan.
Currency string `json:"currency"`
// The billing cadence for subscriptions using this plan.
BillingCadence string `json:"billing_cadence"`
// Whether pro-rating is enabled for this plan.
ProRatingEnabled *bool `json:"pro_rating_enabled,omitempty"`
// The date and time when the plan becomes `active`. When not specified, the plan
// is in `draft` status.
EffectiveFrom *time.Time `json:"effective_from,omitempty"`
// A scheduled date and time when the plan becomes `archived`. When not specified,
// the plan is in `active` status indefinitely.
EffectiveTo *time.Time `json:"effective_to,omitempty"`
// The status of the plan. Computed based on the effective start and end dates:
//
// - `draft`: `effective_from` is not set.
// - `scheduled`: `now < effective_from`.
// - `active`: `effective_from <= now` and (`effective_to` is not set or
// `now < effective_to`).
// - `archived`: `effective_to <= now`.
Status PlanStatus `json:"status"`
// The plan phases define the pricing ramp for a subscription. A phase switch
// occurs only at the end of a billing period. At least one phase is required.
Phases []PlanPhase `json:"phases"`
// Settlement mode for plan.
//
// Values:
//
// - `credit_then_invoice`: Credits are applied first, then any remainder is
// invoiced.
// - `credit_only`: Usage is settled exclusively against credits.
SettlementMode *SettlementMode `json:"settlement_mode,omitempty"`
// List of validation errors in `draft` state that prevent the plan from being
// published.
ValidationErrors []ProductCatalogValidationError `json:"validation_errors,omitempty"`
}
// Page paginated response.
type PlanPagePaginatedResponse struct {
Data []Plan `json:"data"`
Meta PaginatedMeta `json:"meta"`
}
// The plan phase or pricing ramp allows changing a plan's rate cards over time as
// a subscription progresses.
type PlanPhase struct {
// Display name of the resource.
//
// Between 1 and 256 characters.
Name string `json:"name"`
// Optional description of the resource.
//
// Maximum 1024 characters.
Description *string `json:"description,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Key string `json:"key"`
// The duration of the phase. When not specified, the phase runs indefinitely. Only
// the last phase may omit the duration.
Duration *string `json:"duration,omitempty"`
// The rate cards of the plan.
RateCards []RateCard `json:"rate_cards"`
}
// The plan phase or pricing ramp allows changing a plan's rate cards over time as
// a subscription progresses.
type PlanPhaseInput struct {
// Display name of the resource.
//
// Between 1 and 256 characters.
Name string `json:"name"`
// Optional description of the resource.
//
// Maximum 1024 characters.
Description *string `json:"description,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
Key string `json:"key"`
// The duration of the phase. When not specified, the phase runs indefinitely. Only
// the last phase may omit the duration.
Duration *string `json:"duration,omitempty"`
// The rate cards of the plan.
RateCards []RateCardInput `json:"rate_cards"`
}
// The status of a plan.
//
// - `draft`: The plan has not yet been published and can be edited.
// - `active`: The plan is published and can be used in subscriptions.
// - `archived`: The plan is no longer available for use.
// - `scheduled`: The plan is scheduled to be published at a future date.
type PlanStatus string
const (
PlanStatusDraft PlanStatus = "draft"
PlanStatusActive PlanStatus = "active"
PlanStatusArchived PlanStatus = "archived"
PlanStatusScheduled PlanStatus = "scheduled"
)
func (value PlanStatus) Valid() bool {
switch value {
case PlanStatusDraft, PlanStatusActive, PlanStatusArchived, PlanStatusScheduled:
return true
default:
return false
}
}
// Plan upsert request.
type UpsertPlanRequest struct {
// Display name of the resource.
//
// Between 1 and 256 characters.
Name string `json:"name"`
// Optional description of the resource.
//
// Maximum 1024 characters.
Description *string `json:"description,omitempty"`
Labels *map[string]string `json:"labels,omitempty"`
// Whether pro-rating is enabled for this plan.
ProRatingEnabled *bool `json:"pro_rating_enabled,omitempty"`
// The plan phases define the pricing ramp for a subscription. A phase switch
// occurs only at the end of a billing period. At least one phase is required.
Phases []PlanPhaseInput `json:"phases"`
}