Skip to content

Commit 3e7554d

Browse files
feat(api): api update
1 parent 121b76c commit 3e7554d

File tree

62 files changed

+572
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+572
-110
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 116
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-d631cebb768659e659427b08c22243b7993936c24214eb1fc837e172c11012c2.yml
3-
openapi_spec_hash: e025faa481e0ca183949cd81548197bf
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-62651294c6bdd7c8d1c183fe4e5ba844a7ac29d80bef9e150739354a9c431ab4.yml
3+
openapi_spec_hash: 46c5d7f541c0c2143b975be9725c9189
44
config_hash: 3c3524be9607afb24d2139ce26ce5389

src/orb/resources/plans/plans.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ def create(
6060
currency: str,
6161
name: str,
6262
prices: Iterable[plan_create_params.Price],
63+
adjustments: Optional[Iterable[plan_create_params.Adjustment]] | NotGiven = NOT_GIVEN,
6364
default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN,
6465
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
6566
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
6667
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
68+
plan_phases: Optional[Iterable[plan_create_params.PlanPhase]] | NotGiven = NOT_GIVEN,
6769
status: Literal["active", "draft"] | NotGiven = NOT_GIVEN,
6870
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6971
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -83,6 +85,9 @@ def create(
8385
prices: Prices for this plan. If the plan has phases, this includes prices across all
8486
phases of the plan.
8587
88+
adjustments: Adjustments for this plan. If the plan has phases, this includes adjustments
89+
across all phases of the plan.
90+
8691
default_invoice_memo: Free-form text which is available on the invoice PDF and the Orb invoice portal.
8792
8893
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
@@ -93,6 +98,9 @@ def create(
9398
date for the invoice. If you intend the invoice to be due on issue, set this
9499
to 0.
95100
101+
plan_phases: Configuration of pre-defined phases, each with their own prices and adjustments.
102+
Leave unspecified for plans with a single phase.
103+
96104
status: The status of the plan to create (either active or draft). If not specified,
97105
this defaults to active.
98106
@@ -113,10 +121,12 @@ def create(
113121
"currency": currency,
114122
"name": name,
115123
"prices": prices,
124+
"adjustments": adjustments,
116125
"default_invoice_memo": default_invoice_memo,
117126
"external_plan_id": external_plan_id,
118127
"metadata": metadata,
119128
"net_terms": net_terms,
129+
"plan_phases": plan_phases,
120130
"status": status,
121131
},
122132
plan_create_params.PlanCreateParams,
@@ -335,10 +345,12 @@ async def create(
335345
currency: str,
336346
name: str,
337347
prices: Iterable[plan_create_params.Price],
348+
adjustments: Optional[Iterable[plan_create_params.Adjustment]] | NotGiven = NOT_GIVEN,
338349
default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN,
339350
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
340351
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
341352
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
353+
plan_phases: Optional[Iterable[plan_create_params.PlanPhase]] | NotGiven = NOT_GIVEN,
342354
status: Literal["active", "draft"] | NotGiven = NOT_GIVEN,
343355
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
344356
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -358,6 +370,9 @@ async def create(
358370
prices: Prices for this plan. If the plan has phases, this includes prices across all
359371
phases of the plan.
360372
373+
adjustments: Adjustments for this plan. If the plan has phases, this includes adjustments
374+
across all phases of the plan.
375+
361376
default_invoice_memo: Free-form text which is available on the invoice PDF and the Orb invoice portal.
362377
363378
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
@@ -368,6 +383,9 @@ async def create(
368383
date for the invoice. If you intend the invoice to be due on issue, set this
369384
to 0.
370385
386+
plan_phases: Configuration of pre-defined phases, each with their own prices and adjustments.
387+
Leave unspecified for plans with a single phase.
388+
371389
status: The status of the plan to create (either active or draft). If not specified,
372390
this defaults to active.
373391
@@ -388,10 +406,12 @@ async def create(
388406
"currency": currency,
389407
"name": name,
390408
"prices": prices,
409+
"adjustments": adjustments,
391410
"default_invoice_memo": default_invoice_memo,
392411
"external_plan_id": external_plan_id,
393412
"metadata": metadata,
394413
"net_terms": net_terms,
414+
"plan_phases": plan_phases,
395415
"status": status,
396416
},
397417
plan_create_params.PlanCreateParams,

src/orb/types/plan_create_params.py

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
from typing import Dict, Union, Iterable, Optional
66
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

8+
from .shared_params.new_maximum import NewMaximum
9+
from .shared_params.new_minimum import NewMinimum
810
from .shared_params.new_plan_bps_price import NewPlanBPSPrice
11+
from .shared_params.new_usage_discount import NewUsageDiscount
12+
from .shared_params.new_amount_discount import NewAmountDiscount
913
from .shared_params.new_plan_bulk_price import NewPlanBulkPrice
1014
from .shared_params.new_plan_unit_price import NewPlanUnitPrice
15+
from .shared_params.new_allocation_price import NewAllocationPrice
1116
from .shared_params.new_plan_matrix_price import NewPlanMatrixPrice
1217
from .shared_params.new_plan_tiered_price import NewPlanTieredPrice
1318
from .shared_params.new_plan_package_price import NewPlanPackagePrice
19+
from .shared_params.new_percentage_discount import NewPercentageDiscount
1420
from .shared_params.new_plan_bulk_bps_price import NewPlanBulkBPSPrice
1521
from .shared_params.new_plan_tiered_bps_price import NewPlanTieredBPSPrice
1622
from .shared_params.new_plan_grouped_tiered_price import NewPlanGroupedTieredPrice
@@ -36,7 +42,7 @@
3642
NewPlanScalableMatrixWithTieredPricingPrice,
3743
)
3844

39-
__all__ = ["PlanCreateParams", "Price"]
45+
__all__ = ["PlanCreateParams", "Price", "PricePrice", "Adjustment", "AdjustmentAdjustment", "PlanPhase"]
4046

4147

4248
class PlanCreateParams(TypedDict, total=False):
@@ -54,6 +60,12 @@ class PlanCreateParams(TypedDict, total=False):
5460
If the plan has phases, this includes prices across all phases of the plan.
5561
"""
5662

63+
adjustments: Optional[Iterable[Adjustment]]
64+
"""Adjustments for this plan.
65+
66+
If the plan has phases, this includes adjustments across all phases of the plan.
67+
"""
68+
5769
default_invoice_memo: Optional[str]
5870
"""
5971
Free-form text which is available on the invoice PDF and the Orb invoice portal.
@@ -75,14 +87,20 @@ class PlanCreateParams(TypedDict, total=False):
7587
to 0.
7688
"""
7789

90+
plan_phases: Optional[Iterable[PlanPhase]]
91+
"""Configuration of pre-defined phases, each with their own prices and adjustments.
92+
93+
Leave unspecified for plans with a single phase.
94+
"""
95+
7896
status: Literal["active", "draft"]
7997
"""The status of the plan to create (either active or draft).
8098
8199
If not specified, this defaults to active.
82100
"""
83101

84102

85-
Price: TypeAlias = Union[
103+
PricePrice: TypeAlias = Union[
86104
NewPlanUnitPrice,
87105
NewPlanPackagePrice,
88106
NewPlanMatrixPrice,
@@ -112,3 +130,43 @@ class PlanCreateParams(TypedDict, total=False):
112130
NewPlanMatrixWithAllocationPrice,
113131
NewPlanGroupedTieredPrice,
114132
]
133+
134+
135+
class Price(TypedDict, total=False):
136+
allocation_price: Optional[NewAllocationPrice]
137+
"""The allocation price to add to the plan."""
138+
139+
plan_phase_order: Optional[int]
140+
"""The phase to add this price to."""
141+
142+
price: Optional[PricePrice]
143+
"""The price to add to the plan"""
144+
145+
146+
AdjustmentAdjustment: TypeAlias = Union[
147+
NewPercentageDiscount, NewUsageDiscount, NewAmountDiscount, NewMinimum, NewMaximum
148+
]
149+
150+
151+
class Adjustment(TypedDict, total=False):
152+
adjustment: Required[AdjustmentAdjustment]
153+
"""The definition of a new adjustment to create and add to the plan."""
154+
155+
plan_phase_order: Optional[int]
156+
"""The phase to add this adjustment to."""
157+
158+
159+
class PlanPhase(TypedDict, total=False):
160+
order: Required[int]
161+
"""Determines the ordering of the phase in a plan's lifecycle. 1 = first phase."""
162+
163+
align_billing_with_phase_start_date: Optional[bool]
164+
"""Align billing cycle day with phase start date."""
165+
166+
duration: Optional[int]
167+
"""How many terms of length `duration_unit` this phase is active for.
168+
169+
If null, this phase is evergreen and active indefinitely
170+
"""
171+
172+
duration_unit: Optional[Literal["daily", "monthly", "quarterly", "semi_annual", "annual"]]

src/orb/types/shared/new_plan_bps_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ class NewPlanBPSPrice(BaseModel):
9292
Individual keys can be removed by setting the value to `null`, and the entire
9393
metadata mapping can be cleared by setting `metadata` to `null`.
9494
"""
95+
96+
reference_id: Optional[str] = None
97+
"""
98+
A transient ID that can be used to reference this price when adding adjustments
99+
in the same API call.
100+
"""

src/orb/types/shared/new_plan_bulk_bps_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ class NewPlanBulkBPSPrice(BaseModel):
9292
Individual keys can be removed by setting the value to `null`, and the entire
9393
metadata mapping can be cleared by setting `metadata` to `null`.
9494
"""
95+
96+
reference_id: Optional[str] = None
97+
"""
98+
A transient ID that can be used to reference this price when adding adjustments
99+
in the same API call.
100+
"""

src/orb/types/shared/new_plan_bulk_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ class NewPlanBulkPrice(BaseModel):
9292
Individual keys can be removed by setting the value to `null`, and the entire
9393
metadata mapping can be cleared by setting `metadata` to `null`.
9494
"""
95+
96+
reference_id: Optional[str] = None
97+
"""
98+
A transient ID that can be used to reference this price when adding adjustments
99+
in the same API call.
100+
"""

src/orb/types/shared/new_plan_bulk_with_proration_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ class NewPlanBulkWithProrationPrice(BaseModel):
9191
Individual keys can be removed by setting the value to `null`, and the entire
9292
metadata mapping can be cleared by setting `metadata` to `null`.
9393
"""
94+
95+
reference_id: Optional[str] = None
96+
"""
97+
A transient ID that can be used to reference this price when adding adjustments
98+
in the same API call.
99+
"""

src/orb/types/shared/new_plan_cumulative_grouped_bulk_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ class NewPlanCumulativeGroupedBulkPrice(BaseModel):
9191
Individual keys can be removed by setting the value to `null`, and the entire
9292
metadata mapping can be cleared by setting `metadata` to `null`.
9393
"""
94+
95+
reference_id: Optional[str] = None
96+
"""
97+
A transient ID that can be used to reference this price when adding adjustments
98+
in the same API call.
99+
"""

src/orb/types/shared/new_plan_grouped_allocation_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ class NewPlanGroupedAllocationPrice(BaseModel):
9191
Individual keys can be removed by setting the value to `null`, and the entire
9292
metadata mapping can be cleared by setting `metadata` to `null`.
9393
"""
94+
95+
reference_id: Optional[str] = None
96+
"""
97+
A transient ID that can be used to reference this price when adding adjustments
98+
in the same API call.
99+
"""

src/orb/types/shared/new_plan_grouped_tiered_package_price.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,9 @@ class NewPlanGroupedTieredPackagePrice(BaseModel):
9191
Individual keys can be removed by setting the value to `null`, and the entire
9292
metadata mapping can be cleared by setting `metadata` to `null`.
9393
"""
94+
95+
reference_id: Optional[str] = None
96+
"""
97+
A transient ID that can be used to reference this price when adding adjustments
98+
in the same API call.
99+
"""

0 commit comments

Comments
 (0)