Skip to content

Commit bbb2b27

Browse files
committed
feat(api): add external_customer_id (#155)
1 parent aa82a7a commit bbb2b27

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/orb/resources/customers/customers.py

+20
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ def update(
308308
currency: Optional[str] | NotGiven = NOT_GIVEN,
309309
email: Optional[str] | NotGiven = NOT_GIVEN,
310310
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
311+
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
311312
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
312313
name: Optional[str] | NotGiven = NOT_GIVEN,
313314
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -344,6 +345,9 @@ def update(
344345
345346
email: A valid customer email, to be used for invoicing and notifications.
346347
348+
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
349+
past or current subscriptions.
350+
347351
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
348352
by setting the value to `null`, and the entire metadata mapping can be cleared
349353
by setting `metadata` to `null`.
@@ -470,6 +474,7 @@ def update(
470474
"currency": currency,
471475
"email": email,
472476
"email_delivery": email_delivery,
477+
"external_customer_id": external_customer_id,
473478
"metadata": metadata,
474479
"name": name,
475480
"payment_provider": payment_provider,
@@ -695,6 +700,7 @@ def update_by_external_id(
695700
currency: Optional[str] | NotGiven = NOT_GIVEN,
696701
email: Optional[str] | NotGiven = NOT_GIVEN,
697702
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
703+
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
698704
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
699705
name: Optional[str] | NotGiven = NOT_GIVEN,
700706
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -731,6 +737,9 @@ def update_by_external_id(
731737
732738
email: A valid customer email, to be used for invoicing and notifications.
733739
740+
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
741+
past or current subscriptions.
742+
734743
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
735744
by setting the value to `null`, and the entire metadata mapping can be cleared
736745
by setting `metadata` to `null`.
@@ -857,6 +866,7 @@ def update_by_external_id(
857866
"currency": currency,
858867
"email": email,
859868
"email_delivery": email_delivery,
869+
"external_customer_id": external_customer_id,
860870
"metadata": metadata,
861871
"name": name,
862872
"payment_provider": payment_provider,
@@ -1123,6 +1133,7 @@ async def update(
11231133
currency: Optional[str] | NotGiven = NOT_GIVEN,
11241134
email: Optional[str] | NotGiven = NOT_GIVEN,
11251135
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
1136+
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
11261137
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
11271138
name: Optional[str] | NotGiven = NOT_GIVEN,
11281139
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -1159,6 +1170,9 @@ async def update(
11591170
11601171
email: A valid customer email, to be used for invoicing and notifications.
11611172
1173+
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
1174+
past or current subscriptions.
1175+
11621176
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
11631177
by setting the value to `null`, and the entire metadata mapping can be cleared
11641178
by setting `metadata` to `null`.
@@ -1285,6 +1299,7 @@ async def update(
12851299
"currency": currency,
12861300
"email": email,
12871301
"email_delivery": email_delivery,
1302+
"external_customer_id": external_customer_id,
12881303
"metadata": metadata,
12891304
"name": name,
12901305
"payment_provider": payment_provider,
@@ -1510,6 +1525,7 @@ async def update_by_external_id(
15101525
currency: Optional[str] | NotGiven = NOT_GIVEN,
15111526
email: Optional[str] | NotGiven = NOT_GIVEN,
15121527
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
1528+
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
15131529
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
15141530
name: Optional[str] | NotGiven = NOT_GIVEN,
15151531
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
@@ -1546,6 +1562,9 @@ async def update_by_external_id(
15461562
15471563
email: A valid customer email, to be used for invoicing and notifications.
15481564
1565+
external_customer_id: The external customer ID. This can only be set if empty and the customer has no
1566+
past or current subscriptions.
1567+
15491568
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
15501569
by setting the value to `null`, and the entire metadata mapping can be cleared
15511570
by setting `metadata` to `null`.
@@ -1672,6 +1691,7 @@ async def update_by_external_id(
16721691
"currency": currency,
16731692
"email": email,
16741693
"email_delivery": email_delivery,
1694+
"external_customer_id": external_customer_id,
16751695
"metadata": metadata,
16761696
"name": name,
16771697
"payment_provider": payment_provider,

src/orb/types/customer_update_by_external_id_params.py

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False):
4545

4646
email_delivery: Optional[bool]
4747

48+
external_customer_id: Optional[str]
49+
"""The external customer ID.
50+
51+
This can only be set if empty and the customer has no past or current
52+
subscriptions.
53+
"""
54+
4855
metadata: Optional[Dict[str, Optional[str]]]
4956
"""User-specified key/value pairs for the resource.
5057

src/orb/types/customer_update_params.py

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ class CustomerUpdateParams(TypedDict, total=False):
4545

4646
email_delivery: Optional[bool]
4747

48+
external_customer_id: Optional[str]
49+
"""The external customer ID.
50+
51+
This can only be set if empty and the customer has no past or current
52+
subscriptions.
53+
"""
54+
4855
metadata: Optional[Dict[str, Optional[str]]]
4956
"""User-specified key/value pairs for the resource.
5057

tests/api_resources/test_customers.py

+6
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def test_method_update_with_all_params(self, client: Orb) -> None:
152152
currency="string",
153153
email="string",
154154
email_delivery=True,
155+
external_customer_id="string",
155156
metadata={"foo": "string"},
156157
name="string",
157158
payment_provider="quickbooks",
@@ -396,6 +397,7 @@ def test_method_update_by_external_id_with_all_params(self, client: Orb) -> None
396397
currency="string",
397398
email="string",
398399
email_delivery=True,
400+
external_customer_id="string",
399401
metadata={"foo": "string"},
400402
name="string",
401403
payment_provider="quickbooks",
@@ -446,6 +448,7 @@ def test_path_params_update_by_external_id(self, client: Orb) -> None:
446448
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
447449
client.customers.with_raw_response.update_by_external_id(
448450
"",
451+
external_customer_id="",
449452
)
450453

451454

@@ -583,6 +586,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOrb) -> No
583586
currency="string",
584587
email="string",
585588
email_delivery=True,
589+
external_customer_id="string",
586590
metadata={"foo": "string"},
587591
name="string",
588592
payment_provider="quickbooks",
@@ -827,6 +831,7 @@ async def test_method_update_by_external_id_with_all_params(self, async_client:
827831
currency="string",
828832
email="string",
829833
email_delivery=True,
834+
external_customer_id="string",
830835
metadata={"foo": "string"},
831836
name="string",
832837
payment_provider="quickbooks",
@@ -877,4 +882,5 @@ async def test_path_params_update_by_external_id(self, async_client: AsyncOrb) -
877882
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
878883
await async_client.customers.with_raw_response.update_by_external_id(
879884
"",
885+
external_customer_id="",
880886
)

0 commit comments

Comments
 (0)