File size: 4,880 Bytes
04f1444 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | // 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"`
}
|