| // Code generated by @openmeter/typespec-go. DO NOT EDIT. | |
| package openmeter | |
| import "time" | |
| // Add-on allows extending subscriptions with compatible plans with additional | |
| // ratecards. | |
| type Addon 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 add-on. It is used to | |
| // reference the latest `active` version of the add-on and is unique with the | |
| // version number. | |
| Key string `json:"key"` | |
| // Version of the add-on. Incremented when the add-on is updated. | |
| Version int64 `json:"version"` | |
| // The InstanceType of the add-ons. Can be "single" or "multiple". | |
| InstanceType AddonInstanceType `json:"instance_type"` | |
| // The currency code of the add-on. | |
| Currency BillingCurrencyCode `json:"currency"` | |
| // The date and time when the add-on becomes effective. When not specified, the | |
| // add-on is a draft. | |
| EffectiveFrom *time.Time `json:"effective_from,omitempty"` | |
| // The date and time when the add-on is no longer effective. When not specified, | |
| // the add-on is effective indefinitely. | |
| EffectiveTo *time.Time `json:"effective_to,omitempty"` | |
| // The status of the add-on. Computed based on the effective start and end dates: | |
| // | |
| // - `draft`: `effective_from` is not set. | |
| // - `active`: `effective_from <= now` and (`effective_to` is not set or | |
| // `now < effective_to`). | |
| // - `archived`: `effective_to <= now`. | |
| Status AddonStatus `json:"status"` | |
| // The rate cards of the add-on. | |
| RateCards []RateCard `json:"rate_cards"` | |
| // List of validation errors. | |
| ValidationErrors []ProductCatalogValidationError `json:"validation_errors,omitempty"` | |
| } | |
| // The instanceType of the add-on. | |
| // | |
| // - `single`: Can be added to a subscription only once. | |
| // - `multiple`: Can be added to a subscription more than once. | |
| type AddonInstanceType string | |
| const ( | |
| AddonInstanceTypeSingle AddonInstanceType = "single" | |
| AddonInstanceTypeMultiple AddonInstanceType = "multiple" | |
| ) | |
| func (value AddonInstanceType) Valid() bool { | |
| switch value { | |
| case AddonInstanceTypeSingle, AddonInstanceTypeMultiple: | |
| return true | |
| default: | |
| return false | |
| } | |
| } | |
| // Page paginated response. | |
| type AddonPagePaginatedResponse struct { | |
| Data []Addon `json:"data"` | |
| Meta PaginatedMeta `json:"meta"` | |
| } | |
| // The status of the add-on defined by the `effective_from` and `effective_to` | |
| // properties. | |
| // | |
| // - `draft`: The add-on has not yet been published and can be edited. | |
| // - `active`: The add-on is published and available for use. | |
| // - `archived`: The add-on is no longer available for use. | |
| type AddonStatus string | |
| const ( | |
| AddonStatusDraft AddonStatus = "draft" | |
| AddonStatusActive AddonStatus = "active" | |
| AddonStatusArchived AddonStatus = "archived" | |
| ) | |
| func (value AddonStatus) Valid() bool { | |
| switch value { | |
| case AddonStatusDraft, AddonStatusActive, AddonStatusArchived: | |
| return true | |
| default: | |
| return false | |
| } | |
| } | |
| // Addon create request. | |
| type CreateAddonRequest 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 add-on. It is used to | |
| // reference the latest `active` version of the add-on and is unique with the | |
| // version number. | |
| Key string `json:"key"` | |
| // The InstanceType of the add-ons. Can be "single" or "multiple". | |
| InstanceType AddonInstanceType `json:"instance_type"` | |
| // The currency code of the add-on. | |
| Currency BillingCurrencyCode `json:"currency"` | |
| // The rate cards of the add-on. | |
| RateCards []RateCardInput `json:"rate_cards"` | |
| } | |
| // Addon upsert request. | |
| type UpsertAddonRequest 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"` | |
| // The InstanceType of the add-ons. Can be "single" or "multiple". | |
| InstanceType AddonInstanceType `json:"instance_type"` | |
| // The rate cards of the add-on. | |
| RateCards []RateCardInput `json:"rate_cards"` | |
| } | |