File size: 3,668 Bytes
1477a90 | 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 144 145 146 147 148 149 150 151 | import "../productcatalog/addon.tsp";
import "../productcatalog/ratecard.tsp";
namespace Subscriptions;
/**
* Addon purchased with a subscription.
*/
#suppress "@openmeter/api-spec-aip/repeated-prefix-grouping" "active_from and active_to should not be grouped"
@friendlyName("SubscriptionAddon")
model SubscriptionAddon {
...OmitProperties<Shared.Resource, "name" | "description">;
/**
* Display name of the resource.
*
* Between 1 and 256 characters.
*/
@visibility(Lifecycle.Read)
@minLength(1)
@maxLength(256)
name: string;
/**
* Optional description of the resource.
*
* Maximum 1024 characters.
*/
@maxLength(1024)
@visibility(Lifecycle.Read)
description?: string;
/**
* The add-on associated with the subscription.
*/
@summary("Add-on")
@visibility(Lifecycle.Read, Lifecycle.Create)
addon: Shared.ResourceReference<ProductCatalog.Addon>;
/**
* The quantity of the add-on. Always 1 for single instance add-ons.
*/
@summary("Quantity")
@visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update)
@minValue(1)
quantity: integer;
/**
* An ISO-8601 timestamp representation of which point in time the quantity was
* resolved to.
*/
@visibility(Lifecycle.Read)
quantity_at: Shared.DateTime;
/**
* An ISO-8601 timestamp representation of the cadence start of the resource.
*/
@visibility(Lifecycle.Read)
active_from: Shared.DateTime;
/**
* An ISO-8601 timestamp representation of the cadence end of the resource.
*/
@visibility(Lifecycle.Read)
active_to?: Shared.DateTime;
/**
* The timing of the operation. After the create or update, a new entry will be
* created in the timeline.
*/
@summary("Timing")
@visibility(Lifecycle.Create, Lifecycle.Update)
timing: SubscriptionEditTiming;
/**
* The timeline of the add-on. The returned periods are sorted and continuous.
*/
@visibility(Lifecycle.Read)
@summary("Timeline")
@example(#[
#{
quantity: 1,
active_from: Shared.DateTime.fromISO("2025-01-01T00:00:00Z"),
active_to: Shared.DateTime.fromISO("2025-01-02T00:00:00Z"),
},
#{
quantity: 0,
active_from: Shared.DateTime.fromISO("2025-01-02T00:00:00Z"),
active_to: Shared.DateTime.fromISO("2025-01-03T00:00:00Z"),
},
#{
quantity: 1,
active_from: Shared.DateTime.fromISO("2025-01-03T00:00:00Z"),
}
])
timeline: SubscriptionAddonTimelineSegment[];
/**
* The rate cards of the add-on.
*/
@visibility(Lifecycle.Read)
@summary("Rate cards")
rate_cards: SubscriptionAddonRateCard[];
}
/**
* A rate card for a subscription add-on.
*/
@friendlyName("SubscriptionAddonRateCard")
model SubscriptionAddonRateCard {
/**
* The rate card.
*/
@summary("Rate card")
rate_card: ProductCatalog.RateCard;
/**
* The IDs of the subscription items that this rate card belongs to.
*/
@summary("Affected subscription item IDs")
@visibility(Lifecycle.Read)
affected_subscription_item_ids: Shared.ULID[];
}
/**
* A subscription add-on event.
*/
@friendlyName("SubscriptionAddonTimelineSegment")
model SubscriptionAddonTimelineSegment {
/**
* An ISO-8601 timestamp representation of the cadence start of the resource.
*/
@visibility(Lifecycle.Read)
active_from: Shared.DateTime;
/**
* An ISO-8601 timestamp representation of the cadence end of the resource.
*/
@visibility(Lifecycle.Read)
active_to?: Shared.DateTime;
/**
* The quantity of the add-on for the given period.
*/
@summary("Quantity")
@visibility(Lifecycle.Read)
@example(1)
@minValue(0)
quantity: integer;
}
|