Skip to content

Commit e0268df

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): api update (#441)
1 parent 790b52a commit e0268df

17 files changed

+1034
-15
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-40a4e23dd482299a046fb62fd2b5a1e03d455156cb8cd4573e92e4132d74b243.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-14d1c1e4560c65c7c62f23343268ece4476ae079cd01ba2e6b924efde5f97c3e.yml

src/orb/types/plan.py

+165-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Dict, List, Optional
3+
from typing import Dict, List, Union, Optional
44
from datetime import datetime
5-
from typing_extensions import Literal
5+
from typing_extensions import Literal, Annotated, TypeAlias
66

77
from .price import Price
8+
from .._utils import PropertyInfo
89
from .._models import BaseModel
910
from .shared.discount import Discount
1011

1112
__all__ = [
1213
"Plan",
14+
"Adjustment",
15+
"AdjustmentAmountDiscountAdjustment",
16+
"AdjustmentPercentageDiscountAdjustment",
17+
"AdjustmentUsageDiscountAdjustment",
18+
"AdjustmentMinimumAdjustment",
19+
"AdjustmentMaximumAdjustment",
1320
"BasePlan",
1421
"Maximum",
1522
"Minimum",
@@ -21,6 +28,156 @@
2128
]
2229

2330

31+
class AdjustmentAmountDiscountAdjustment(BaseModel):
32+
id: str
33+
34+
adjustment_type: Literal["amount_discount"]
35+
36+
amount_discount: str
37+
"""
38+
The amount by which to discount the prices this adjustment applies to in a given
39+
billing period.
40+
"""
41+
42+
applies_to_price_ids: List[str]
43+
"""The price IDs that this adjustment applies to."""
44+
45+
is_invoice_level: bool
46+
"""
47+
True for adjustments that apply to an entire invocice, false for adjustments
48+
that apply to only one price.
49+
"""
50+
51+
plan_phase_order: Optional[int] = None
52+
"""The plan phase in which this adjustment is active."""
53+
54+
reason: Optional[str] = None
55+
"""The reason for the adjustment."""
56+
57+
58+
class AdjustmentPercentageDiscountAdjustment(BaseModel):
59+
id: str
60+
61+
adjustment_type: Literal["percentage_discount"]
62+
63+
applies_to_price_ids: List[str]
64+
"""The price IDs that this adjustment applies to."""
65+
66+
is_invoice_level: bool
67+
"""
68+
True for adjustments that apply to an entire invocice, false for adjustments
69+
that apply to only one price.
70+
"""
71+
72+
percentage_discount: float
73+
"""
74+
The percentage (as a value between 0 and 1) by which to discount the price
75+
intervals this adjustment applies to in a given billing period.
76+
"""
77+
78+
plan_phase_order: Optional[int] = None
79+
"""The plan phase in which this adjustment is active."""
80+
81+
reason: Optional[str] = None
82+
"""The reason for the adjustment."""
83+
84+
85+
class AdjustmentUsageDiscountAdjustment(BaseModel):
86+
id: str
87+
88+
adjustment_type: Literal["usage_discount"]
89+
90+
applies_to_price_ids: List[str]
91+
"""The price IDs that this adjustment applies to."""
92+
93+
is_invoice_level: bool
94+
"""
95+
True for adjustments that apply to an entire invocice, false for adjustments
96+
that apply to only one price.
97+
"""
98+
99+
plan_phase_order: Optional[int] = None
100+
"""The plan phase in which this adjustment is active."""
101+
102+
reason: Optional[str] = None
103+
"""The reason for the adjustment."""
104+
105+
usage_discount: float
106+
"""
107+
The number of usage units by which to discount the price this adjustment applies
108+
to in a given billing period.
109+
"""
110+
111+
112+
class AdjustmentMinimumAdjustment(BaseModel):
113+
id: str
114+
115+
adjustment_type: Literal["minimum"]
116+
117+
applies_to_price_ids: List[str]
118+
"""The price IDs that this adjustment applies to."""
119+
120+
is_invoice_level: bool
121+
"""
122+
True for adjustments that apply to an entire invocice, false for adjustments
123+
that apply to only one price.
124+
"""
125+
126+
item_id: str
127+
"""The item ID that revenue from this minimum will be attributed to."""
128+
129+
minimum_amount: str
130+
"""
131+
The minimum amount to charge in a given billing period for the prices this
132+
adjustment applies to.
133+
"""
134+
135+
plan_phase_order: Optional[int] = None
136+
"""The plan phase in which this adjustment is active."""
137+
138+
reason: Optional[str] = None
139+
"""The reason for the adjustment."""
140+
141+
142+
class AdjustmentMaximumAdjustment(BaseModel):
143+
id: str
144+
145+
adjustment_type: Literal["maximum"]
146+
147+
applies_to_price_ids: List[str]
148+
"""The price IDs that this adjustment applies to."""
149+
150+
is_invoice_level: bool
151+
"""
152+
True for adjustments that apply to an entire invocice, false for adjustments
153+
that apply to only one price.
154+
"""
155+
156+
maximum_amount: str
157+
"""
158+
The maximum amount to charge in a given billing period for the prices this
159+
adjustment applies to.
160+
"""
161+
162+
plan_phase_order: Optional[int] = None
163+
"""The plan phase in which this adjustment is active."""
164+
165+
reason: Optional[str] = None
166+
"""The reason for the adjustment."""
167+
168+
169+
Adjustment: TypeAlias = Annotated[
170+
Union[
171+
AdjustmentAmountDiscountAdjustment,
172+
AdjustmentPercentageDiscountAdjustment,
173+
AdjustmentUsageDiscountAdjustment,
174+
AdjustmentMinimumAdjustment,
175+
AdjustmentMaximumAdjustment,
176+
],
177+
PropertyInfo(discriminator="adjustment_type"),
178+
]
179+
180+
24181
class BasePlan(BaseModel):
25182
id: Optional[str] = None
26183

@@ -124,6 +281,12 @@ class TrialConfig(BaseModel):
124281
class Plan(BaseModel):
125282
id: str
126283

284+
adjustments: List[Adjustment]
285+
"""Adjustments for this plan.
286+
287+
If the plan has phases, this includes adjustments across all phases of the plan.
288+
"""
289+
127290
base_plan: Optional[BasePlan] = None
128291

129292
base_plan_id: Optional[str] = None

src/orb/types/subscription.py

+55
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636

3737
class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel):
38+
id: str
39+
3840
adjustment_type: Literal["amount_discount"]
3941

4042
amount_discount: str
@@ -46,32 +48,63 @@ class AdjustmentIntervalAdjustmentAmountDiscountAdjustment(BaseModel):
4648
applies_to_price_ids: List[str]
4749
"""The price IDs that this adjustment applies to."""
4850

51+
is_invoice_level: bool
52+
"""
53+
True for adjustments that apply to an entire invocice, false for adjustments
54+
that apply to only one price.
55+
"""
56+
57+
plan_phase_order: Optional[int] = None
58+
"""The plan phase in which this adjustment is active."""
59+
4960
reason: Optional[str] = None
5061
"""The reason for the adjustment."""
5162

5263

5364
class AdjustmentIntervalAdjustmentPercentageDiscountAdjustment(BaseModel):
65+
id: str
66+
5467
adjustment_type: Literal["percentage_discount"]
5568

5669
applies_to_price_ids: List[str]
5770
"""The price IDs that this adjustment applies to."""
5871

72+
is_invoice_level: bool
73+
"""
74+
True for adjustments that apply to an entire invocice, false for adjustments
75+
that apply to only one price.
76+
"""
77+
5978
percentage_discount: float
6079
"""
6180
The percentage (as a value between 0 and 1) by which to discount the price
6281
intervals this adjustment applies to in a given billing period.
6382
"""
6483

84+
plan_phase_order: Optional[int] = None
85+
"""The plan phase in which this adjustment is active."""
86+
6587
reason: Optional[str] = None
6688
"""The reason for the adjustment."""
6789

6890

6991
class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel):
92+
id: str
93+
7094
adjustment_type: Literal["usage_discount"]
7195

7296
applies_to_price_ids: List[str]
7397
"""The price IDs that this adjustment applies to."""
7498

99+
is_invoice_level: bool
100+
"""
101+
True for adjustments that apply to an entire invocice, false for adjustments
102+
that apply to only one price.
103+
"""
104+
105+
plan_phase_order: Optional[int] = None
106+
"""The plan phase in which this adjustment is active."""
107+
75108
reason: Optional[str] = None
76109
"""The reason for the adjustment."""
77110

@@ -83,11 +116,19 @@ class AdjustmentIntervalAdjustmentUsageDiscountAdjustment(BaseModel):
83116

84117

85118
class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel):
119+
id: str
120+
86121
adjustment_type: Literal["minimum"]
87122

88123
applies_to_price_ids: List[str]
89124
"""The price IDs that this adjustment applies to."""
90125

126+
is_invoice_level: bool
127+
"""
128+
True for adjustments that apply to an entire invocice, false for adjustments
129+
that apply to only one price.
130+
"""
131+
91132
item_id: str
92133
"""The item ID that revenue from this minimum will be attributed to."""
93134

@@ -97,22 +138,36 @@ class AdjustmentIntervalAdjustmentMinimumAdjustment(BaseModel):
97138
adjustment applies to.
98139
"""
99140

141+
plan_phase_order: Optional[int] = None
142+
"""The plan phase in which this adjustment is active."""
143+
100144
reason: Optional[str] = None
101145
"""The reason for the adjustment."""
102146

103147

104148
class AdjustmentIntervalAdjustmentMaximumAdjustment(BaseModel):
149+
id: str
150+
105151
adjustment_type: Literal["maximum"]
106152

107153
applies_to_price_ids: List[str]
108154
"""The price IDs that this adjustment applies to."""
109155

156+
is_invoice_level: bool
157+
"""
158+
True for adjustments that apply to an entire invocice, false for adjustments
159+
that apply to only one price.
160+
"""
161+
110162
maximum_amount: str
111163
"""
112164
The maximum amount to charge in a given billing period for the prices this
113165
adjustment applies to.
114166
"""
115167

168+
plan_phase_order: Optional[int] = None
169+
"""The plan phase in which this adjustment is active."""
170+
116171
reason: Optional[str] = None
117172
"""The reason for the adjustment."""
118173

0 commit comments

Comments
 (0)