Skip to content

Commit e3c12c7

Browse files
feat(api): api update (#549)
1 parent 8a41ae9 commit e3c12c7

11 files changed

Lines changed: 187 additions & 1 deletion

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-99ab2def905df4700d0555a61c3e6f3e378664df85756fc0ff604aed8f8c5f8b.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-097aa5c0e1408d7bd31c15caded400b84f45c0296aebdf67a1dc1a4013f371dd.yml

src/orb/resources/customers/customers.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def create(
9999
currency: Optional[str] | NotGiven = NOT_GIVEN,
100100
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
101101
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
102+
hierarchy: Optional[customer_create_params.Hierarchy] | NotGiven = NOT_GIVEN,
102103
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
103104
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
104105
| NotGiven = NOT_GIVEN,
@@ -151,6 +152,8 @@ def create(
151152
system as an alias for this Customer. Use this field to identify a customer by
152153
an existing identifier in your system.
153154
155+
hierarchy: The hierarchical relationships for this customer.
156+
154157
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
155158
by setting the value to `null`, and the entire metadata mapping can be cleared
156159
by setting `metadata` to `null`.
@@ -295,6 +298,7 @@ def create(
295298
"currency": currency,
296299
"email_delivery": email_delivery,
297300
"external_customer_id": external_customer_id,
301+
"hierarchy": hierarchy,
298302
"metadata": metadata,
299303
"payment_provider": payment_provider,
300304
"payment_provider_id": payment_provider_id,
@@ -329,6 +333,7 @@ def update(
329333
email: Optional[str] | NotGiven = NOT_GIVEN,
330334
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
331335
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
336+
hierarchy: Optional[customer_update_params.Hierarchy] | NotGiven = NOT_GIVEN,
332337
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
333338
name: Optional[str] | NotGiven = NOT_GIVEN,
334339
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -369,6 +374,8 @@ def update(
369374
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
370375
past or current subscriptions.
371376
377+
hierarchy: The hierarchical relationships for this customer.
378+
372379
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
373380
by setting the value to `null`, and the entire metadata mapping can be cleared
374381
by setting `metadata` to `null`.
@@ -516,6 +523,7 @@ def update(
516523
"email": email,
517524
"email_delivery": email_delivery,
518525
"external_customer_id": external_customer_id,
526+
"hierarchy": hierarchy,
519527
"metadata": metadata,
520528
"name": name,
521529
"payment_provider": payment_provider,
@@ -839,6 +847,7 @@ def update_by_external_id(
839847
email: Optional[str] | NotGiven = NOT_GIVEN,
840848
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
841849
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
850+
hierarchy: Optional[customer_update_by_external_id_params.Hierarchy] | NotGiven = NOT_GIVEN,
842851
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
843852
name: Optional[str] | NotGiven = NOT_GIVEN,
844853
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -879,6 +888,8 @@ def update_by_external_id(
879888
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
880889
past or current subscriptions.
881890
891+
hierarchy: The hierarchical relationships for this customer.
892+
882893
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
883894
by setting the value to `null`, and the entire metadata mapping can be cleared
884895
by setting `metadata` to `null`.
@@ -1026,6 +1037,7 @@ def update_by_external_id(
10261037
"email": email,
10271038
"email_delivery": email_delivery,
10281039
"external_customer_id": external_customer_id,
1040+
"hierarchy": hierarchy,
10291041
"metadata": metadata,
10301042
"name": name,
10311043
"payment_provider": payment_provider,
@@ -1093,6 +1105,7 @@ async def create(
10931105
currency: Optional[str] | NotGiven = NOT_GIVEN,
10941106
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
10951107
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
1108+
hierarchy: Optional[customer_create_params.Hierarchy] | NotGiven = NOT_GIVEN,
10961109
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
10971110
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
10981111
| NotGiven = NOT_GIVEN,
@@ -1145,6 +1158,8 @@ async def create(
11451158
system as an alias for this Customer. Use this field to identify a customer by
11461159
an existing identifier in your system.
11471160
1161+
hierarchy: The hierarchical relationships for this customer.
1162+
11481163
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
11491164
by setting the value to `null`, and the entire metadata mapping can be cleared
11501165
by setting `metadata` to `null`.
@@ -1289,6 +1304,7 @@ async def create(
12891304
"currency": currency,
12901305
"email_delivery": email_delivery,
12911306
"external_customer_id": external_customer_id,
1307+
"hierarchy": hierarchy,
12921308
"metadata": metadata,
12931309
"payment_provider": payment_provider,
12941310
"payment_provider_id": payment_provider_id,
@@ -1323,6 +1339,7 @@ async def update(
13231339
email: Optional[str] | NotGiven = NOT_GIVEN,
13241340
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
13251341
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
1342+
hierarchy: Optional[customer_update_params.Hierarchy] | NotGiven = NOT_GIVEN,
13261343
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
13271344
name: Optional[str] | NotGiven = NOT_GIVEN,
13281345
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -1363,6 +1380,8 @@ async def update(
13631380
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
13641381
past or current subscriptions.
13651382
1383+
hierarchy: The hierarchical relationships for this customer.
1384+
13661385
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
13671386
by setting the value to `null`, and the entire metadata mapping can be cleared
13681387
by setting `metadata` to `null`.
@@ -1510,6 +1529,7 @@ async def update(
15101529
"email": email,
15111530
"email_delivery": email_delivery,
15121531
"external_customer_id": external_customer_id,
1532+
"hierarchy": hierarchy,
15131533
"metadata": metadata,
15141534
"name": name,
15151535
"payment_provider": payment_provider,
@@ -1833,6 +1853,7 @@ async def update_by_external_id(
18331853
email: Optional[str] | NotGiven = NOT_GIVEN,
18341854
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
18351855
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
1856+
hierarchy: Optional[customer_update_by_external_id_params.Hierarchy] | NotGiven = NOT_GIVEN,
18361857
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
18371858
name: Optional[str] | NotGiven = NOT_GIVEN,
18381859
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -1873,6 +1894,8 @@ async def update_by_external_id(
18731894
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
18741895
past or current subscriptions.
18751896
1897+
hierarchy: The hierarchical relationships for this customer.
1898+
18761899
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
18771900
by setting the value to `null`, and the entire metadata mapping can be cleared
18781901
by setting `metadata` to `null`.
@@ -2020,6 +2043,7 @@ async def update_by_external_id(
20202043
"email": email,
20212044
"email_delivery": email_delivery,
20222045
"external_customer_id": external_customer_id,
2046+
"hierarchy": hierarchy,
20232047
"metadata": metadata,
20242048
"name": name,
20252049
"payment_provider": payment_provider,

src/orb/resources/subscriptions.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def create(
110110
replace_prices: Optional[Iterable[subscription_create_params.ReplacePrice]] | NotGiven = NOT_GIVEN,
111111
start_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
112112
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
113+
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
113114
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
114115
# The extra values given here take precedence over values defined on the client or passed to this method.
115116
extra_headers: Headers | None = None,
@@ -442,6 +443,13 @@ def create(
442443
value specified in the plan. If `0` is provided, the trial on the plan will be
443444
skipped.
444445
446+
usage_customer_ids: A list of customer IDs whose usage events will be aggregated and billed under
447+
this subscription. By default, a subscription only considers usage events
448+
associated with its attached customer's customer_id. When usage_customer_ids is
449+
provided, the subscription includes usage events from the specified customers
450+
only. Provided usage_customer_ids must be either the customer for this
451+
subscription itself, or any of that customer's children.
452+
445453
extra_headers: Send extra headers
446454
447455
extra_query: Add additional query parameters to the request
@@ -486,6 +494,7 @@ def create(
486494
"replace_prices": replace_prices,
487495
"start_date": start_date,
488496
"trial_duration_days": trial_duration_days,
497+
"usage_customer_ids": usage_customer_ids,
489498
},
490499
subscription_create_params.SubscriptionCreateParams,
491500
),
@@ -1382,6 +1391,7 @@ def schedule_plan_change(
13821391
replace_prices: Optional[Iterable[subscription_schedule_plan_change_params.ReplacePrice]]
13831392
| NotGiven = NOT_GIVEN,
13841393
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
1394+
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
13851395
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
13861396
# The extra values given here take precedence over values defined on the client or passed to this method.
13871397
extra_headers: Headers | None = None,
@@ -1648,6 +1658,13 @@ def schedule_plan_change(
16481658
value specified in the plan. If `0` is provided, the trial on the plan will be
16491659
skipped.
16501660
1661+
usage_customer_ids: A list of customer IDs whose usage events will be aggregated and billed under
1662+
this subscription. By default, a subscription only considers usage events
1663+
associated with its attached customer's customer_id. When usage_customer_ids is
1664+
provided, the subscription includes usage events from the specified customers
1665+
only. Provided usage_customer_ids must be either the customer for this
1666+
subscription itself, or any of that customer's children.
1667+
16511668
extra_headers: Send extra headers
16521669
16531670
extra_query: Add additional query parameters to the request
@@ -1689,6 +1706,7 @@ def schedule_plan_change(
16891706
"replace_adjustments": replace_adjustments,
16901707
"replace_prices": replace_prices,
16911708
"trial_duration_days": trial_duration_days,
1709+
"usage_customer_ids": usage_customer_ids,
16921710
},
16931711
subscription_schedule_plan_change_params.SubscriptionSchedulePlanChangeParams,
16941712
),
@@ -2106,6 +2124,7 @@ async def create(
21062124
replace_prices: Optional[Iterable[subscription_create_params.ReplacePrice]] | NotGiven = NOT_GIVEN,
21072125
start_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
21082126
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
2127+
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
21092128
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
21102129
# The extra values given here take precedence over values defined on the client or passed to this method.
21112130
extra_headers: Headers | None = None,
@@ -2438,6 +2457,13 @@ async def create(
24382457
value specified in the plan. If `0` is provided, the trial on the plan will be
24392458
skipped.
24402459
2460+
usage_customer_ids: A list of customer IDs whose usage events will be aggregated and billed under
2461+
this subscription. By default, a subscription only considers usage events
2462+
associated with its attached customer's customer_id. When usage_customer_ids is
2463+
provided, the subscription includes usage events from the specified customers
2464+
only. Provided usage_customer_ids must be either the customer for this
2465+
subscription itself, or any of that customer's children.
2466+
24412467
extra_headers: Send extra headers
24422468
24432469
extra_query: Add additional query parameters to the request
@@ -2482,6 +2508,7 @@ async def create(
24822508
"replace_prices": replace_prices,
24832509
"start_date": start_date,
24842510
"trial_duration_days": trial_duration_days,
2511+
"usage_customer_ids": usage_customer_ids,
24852512
},
24862513
subscription_create_params.SubscriptionCreateParams,
24872514
),
@@ -3378,6 +3405,7 @@ async def schedule_plan_change(
33783405
replace_prices: Optional[Iterable[subscription_schedule_plan_change_params.ReplacePrice]]
33793406
| NotGiven = NOT_GIVEN,
33803407
trial_duration_days: Optional[int] | NotGiven = NOT_GIVEN,
3408+
usage_customer_ids: Optional[List[str]] | NotGiven = NOT_GIVEN,
33813409
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
33823410
# The extra values given here take precedence over values defined on the client or passed to this method.
33833411
extra_headers: Headers | None = None,
@@ -3644,6 +3672,13 @@ async def schedule_plan_change(
36443672
value specified in the plan. If `0` is provided, the trial on the plan will be
36453673
skipped.
36463674
3675+
usage_customer_ids: A list of customer IDs whose usage events will be aggregated and billed under
3676+
this subscription. By default, a subscription only considers usage events
3677+
associated with its attached customer's customer_id. When usage_customer_ids is
3678+
provided, the subscription includes usage events from the specified customers
3679+
only. Provided usage_customer_ids must be either the customer for this
3680+
subscription itself, or any of that customer's children.
3681+
36473682
extra_headers: Send extra headers
36483683
36493684
extra_query: Add additional query parameters to the request
@@ -3685,6 +3720,7 @@ async def schedule_plan_change(
36853720
"replace_adjustments": replace_adjustments,
36863721
"replace_prices": replace_prices,
36873722
"trial_duration_days": trial_duration_days,
3723+
"usage_customer_ids": usage_customer_ids,
36883724
},
36893725
subscription_schedule_plan_change_params.SubscriptionSchedulePlanChangeParams,
36903726
),

src/orb/types/customer.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
__all__ = [
1010
"Customer",
1111
"BillingAddress",
12+
"Hierarchy",
13+
"HierarchyChild",
14+
"HierarchyParent",
1215
"ShippingAddress",
1316
"TaxID",
1417
"AccountingSyncConfiguration",
@@ -31,6 +34,24 @@ class BillingAddress(BaseModel):
3134
state: Optional[str] = None
3235

3336

37+
class HierarchyChild(BaseModel):
38+
id: str
39+
40+
external_customer_id: Optional[str] = None
41+
42+
43+
class HierarchyParent(BaseModel):
44+
id: str
45+
46+
external_customer_id: Optional[str] = None
47+
48+
49+
class Hierarchy(BaseModel):
50+
children: List[HierarchyChild]
51+
52+
parent: Optional[HierarchyParent] = None
53+
54+
3455
class ShippingAddress(BaseModel):
3556
city: Optional[str] = None
3657

@@ -254,6 +275,9 @@ class Customer(BaseModel):
254275
an existing identifier in your system.
255276
"""
256277

278+
hierarchy: Hierarchy
279+
"""The hierarchical relationships for this customer."""
280+
257281
metadata: Dict[str, str]
258282
"""User specified key-value pairs for the resource.
259283

src/orb/types/customer_create_params.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"AccountingSyncConfiguration",
1111
"AccountingSyncConfigurationAccountingProvider",
1212
"BillingAddress",
13+
"Hierarchy",
1314
"ReportingConfiguration",
1415
"ShippingAddress",
1516
"TaxConfiguration",
@@ -62,6 +63,9 @@ class CustomerCreateParams(TypedDict, total=False):
6263
an existing identifier in your system.
6364
"""
6465

66+
hierarchy: Optional[Hierarchy]
67+
"""The hierarchical relationships for this customer."""
68+
6569
metadata: Optional[Dict[str, Optional[str]]]
6670
"""User-specified key/value pairs for the resource.
6771
@@ -231,6 +235,20 @@ class BillingAddress(TypedDict, total=False):
231235
state: Optional[str]
232236

233237

238+
class Hierarchy(TypedDict, total=False):
239+
child_customer_ids: List[str]
240+
"""A list of child customer IDs to add to the hierarchy.
241+
242+
The desired child customers must not already be part of another hierarchy.
243+
"""
244+
245+
parent_customer_id: Optional[str]
246+
"""The ID of the parent customer in the hierarchy.
247+
248+
The desired parent customer must not be a child of another customer.
249+
"""
250+
251+
234252
class ReportingConfiguration(TypedDict, total=False):
235253
exempt: Required[bool]
236254

src/orb/types/customer_update_by_external_id_params.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"AccountingSyncConfiguration",
1111
"AccountingSyncConfigurationAccountingProvider",
1212
"BillingAddress",
13+
"Hierarchy",
1314
"ReportingConfiguration",
1415
"ShippingAddress",
1516
"TaxConfiguration",
@@ -55,6 +56,9 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False):
5556
subscriptions.
5657
"""
5758

59+
hierarchy: Optional[Hierarchy]
60+
"""The hierarchical relationships for this customer."""
61+
5862
metadata: Optional[Dict[str, Optional[str]]]
5963
"""User-specified key/value pairs for the resource.
6064
@@ -224,6 +228,20 @@ class BillingAddress(TypedDict, total=False):
224228
state: Optional[str]
225229

226230

231+
class Hierarchy(TypedDict, total=False):
232+
child_customer_ids: List[str]
233+
"""A list of child customer IDs to add to the hierarchy.
234+
235+
The desired child customers must not already be part of another hierarchy.
236+
"""
237+
238+
parent_customer_id: Optional[str]
239+
"""The ID of the parent customer in the hierarchy.
240+
241+
The desired parent customer must not be a child of another customer.
242+
"""
243+
244+
227245
class ReportingConfiguration(TypedDict, total=False):
228246
exempt: Required[bool]
229247

0 commit comments

Comments
 (0)