Skip to content

Commit dbfb455

Browse files
feat(api): updates (#55)
1 parent 04d5ca5 commit dbfb455

34 files changed

+319
-180
lines changed

src/orb/resources/customers/credits/ledger.py

+45-45
Large diffs are not rendered by default.

src/orb/resources/customers/customers.py

+13-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, List, Union, Optional
5+
from typing import TYPE_CHECKING, Dict, List, Union, Optional
66
from datetime import datetime
77
from typing_extensions import Literal
88

@@ -70,7 +70,7 @@ def create(
7070
currency: Optional[str] | NotGiven = NOT_GIVEN,
7171
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
7272
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
73-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
73+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
7474
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
7575
| NotGiven = NOT_GIVEN,
7676
payment_provider_id: Optional[str] | NotGiven = NOT_GIVEN,
@@ -121,8 +121,7 @@ def create(
121121
system as an alias for this Customer. Use this field to identify a customer by
122122
an existing identifier in your system.
123123
124-
metadata: User-specified key value pairs, often useful for referencing internal resources
125-
or IDs. Returned as-is in the customer resource.
124+
metadata: User-specified key/value pairs for the resource.
126125
127126
payment_provider: This is used for creating charges or invoices in an external system via Orb.
128127
When not in test mode, the connection must first be configured in the Orb
@@ -275,7 +274,7 @@ def update(
275274
currency: Optional[str] | NotGiven = NOT_GIVEN,
276275
email: Optional[str] | NotGiven = NOT_GIVEN,
277276
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
278-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
277+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
279278
name: Optional[str] | NotGiven = NOT_GIVEN,
280279
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
281280
| NotGiven = NOT_GIVEN,
@@ -311,8 +310,7 @@ def update(
311310
312311
email: A valid customer email, to be used for invoicing and notifications.
313312
314-
metadata: User-specified key value pairs, often useful for referencing internal resources
315-
or IDs. Returned as-is in the customer resource.
313+
metadata: User-specified key/value pairs for the resource.
316314
317315
name: The full name of the customer
318316
@@ -650,7 +648,7 @@ def update_by_external_id(
650648
currency: Optional[str] | NotGiven = NOT_GIVEN,
651649
email: Optional[str] | NotGiven = NOT_GIVEN,
652650
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
653-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
651+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
654652
name: Optional[str] | NotGiven = NOT_GIVEN,
655653
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
656654
| NotGiven = NOT_GIVEN,
@@ -686,8 +684,7 @@ def update_by_external_id(
686684
687685
email: A valid customer email, to be used for invoicing and notifications.
688686
689-
metadata: User-specified key value pairs, often useful for referencing internal resources
690-
or IDs. Returned as-is in the customer resource.
687+
metadata: User-specified key/value pairs for the resource.
691688
692689
name: The full name of the customer
693690
@@ -857,7 +854,7 @@ async def create(
857854
currency: Optional[str] | NotGiven = NOT_GIVEN,
858855
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
859856
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
860-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
857+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
861858
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
862859
| NotGiven = NOT_GIVEN,
863860
payment_provider_id: Optional[str] | NotGiven = NOT_GIVEN,
@@ -908,8 +905,7 @@ async def create(
908905
system as an alias for this Customer. Use this field to identify a customer by
909906
an existing identifier in your system.
910907
911-
metadata: User-specified key value pairs, often useful for referencing internal resources
912-
or IDs. Returned as-is in the customer resource.
908+
metadata: User-specified key/value pairs for the resource.
913909
914910
payment_provider: This is used for creating charges or invoices in an external system via Orb.
915911
When not in test mode, the connection must first be configured in the Orb
@@ -1062,7 +1058,7 @@ async def update(
10621058
currency: Optional[str] | NotGiven = NOT_GIVEN,
10631059
email: Optional[str] | NotGiven = NOT_GIVEN,
10641060
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
1065-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
1061+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
10661062
name: Optional[str] | NotGiven = NOT_GIVEN,
10671063
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
10681064
| NotGiven = NOT_GIVEN,
@@ -1098,8 +1094,7 @@ async def update(
10981094
10991095
email: A valid customer email, to be used for invoicing and notifications.
11001096
1101-
metadata: User-specified key value pairs, often useful for referencing internal resources
1102-
or IDs. Returned as-is in the customer resource.
1097+
metadata: User-specified key/value pairs for the resource.
11031098
11041099
name: The full name of the customer
11051100
@@ -1437,7 +1432,7 @@ async def update_by_external_id(
14371432
currency: Optional[str] | NotGiven = NOT_GIVEN,
14381433
email: Optional[str] | NotGiven = NOT_GIVEN,
14391434
email_delivery: Optional[bool] | NotGiven = NOT_GIVEN,
1440-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
1435+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
14411436
name: Optional[str] | NotGiven = NOT_GIVEN,
14421437
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
14431438
| NotGiven = NOT_GIVEN,
@@ -1473,8 +1468,7 @@ async def update_by_external_id(
14731468
14741469
email: A valid customer email, to be used for invoicing and notifications.
14751470
1476-
metadata: User-specified key value pairs, often useful for referencing internal resources
1477-
or IDs. Returned as-is in the customer resource.
1471+
metadata: User-specified key/value pairs for the resource.
14781472
14791473
name: The full name of the customer
14801474

src/orb/resources/metrics.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, Union, Optional
5+
from typing import TYPE_CHECKING, Dict, Union, Optional
66
from datetime import datetime
77

88
import httpx
@@ -41,7 +41,7 @@ def create(
4141
item_id: str,
4242
name: str,
4343
sql: str,
44-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
44+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
4545
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
4646
# The extra values given here take precedence over values defined on the client or passed to this method.
4747
extra_headers: Headers | None = None,
@@ -65,8 +65,7 @@ def create(
6565
6666
sql: A sql string defining the metric.
6767
68-
metadata: User-specified key value pairs, often useful for referencing internal resources
69-
or IDs. Returned as-is in the metric resource.
68+
metadata: User-specified key/value pairs for the resource.
7069
7170
extra_headers: Send extra headers
7271
@@ -206,7 +205,7 @@ async def create(
206205
item_id: str,
207206
name: str,
208207
sql: str,
209-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
208+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
210209
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211210
# The extra values given here take precedence over values defined on the client or passed to this method.
212211
extra_headers: Headers | None = None,
@@ -230,8 +229,7 @@ async def create(
230229
231230
sql: A sql string defining the metric.
232231
233-
metadata: User-specified key value pairs, often useful for referencing internal resources
234-
or IDs. Returned as-is in the metric resource.
232+
metadata: User-specified key/value pairs for the resource.
235233
236234
extra_headers: Send extra headers
237235

src/orb/resources/plans/external_plan_id.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, Optional
5+
from typing import TYPE_CHECKING, Dict, Optional
66

77
import httpx
88

@@ -32,7 +32,7 @@ def update(
3232
other_external_plan_id: str,
3333
*,
3434
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
35-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
35+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
3636
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
3737
# The extra values given here take precedence over values defined on the client or passed to this method.
3838
extra_headers: Headers | None = None,
@@ -60,6 +60,8 @@ def update(
6060
as an alias for this Plan. Use this field to identify a plan by an existing
6161
identifier in your system.
6262
63+
metadata: User-specified key/value pairs for the resource.
64+
6365
extra_headers: Send extra headers
6466
6567
extra_query: Add additional query parameters to the request
@@ -144,7 +146,7 @@ async def update(
144146
other_external_plan_id: str,
145147
*,
146148
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
147-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
149+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
148150
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
149151
# The extra values given here take precedence over values defined on the client or passed to this method.
150152
extra_headers: Headers | None = None,
@@ -172,6 +174,8 @@ async def update(
172174
as an alias for this Plan. Use this field to identify a plan by an existing
173175
identifier in your system.
174176
177+
metadata: User-specified key/value pairs for the resource.
178+
175179
extra_headers: Send extra headers
176180
177181
extra_query: Add additional query parameters to the request

src/orb/resources/plans/plans.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, List, Union, Optional
5+
from typing import TYPE_CHECKING, Dict, List, Union, Optional
66
from datetime import datetime
77
from typing_extensions import Literal
88

@@ -45,7 +45,7 @@ def create(
4545
prices: List[plan_create_params.Price],
4646
default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN,
4747
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
48-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
48+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
4949
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
5050
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5151
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -67,6 +67,8 @@ def create(
6767
6868
default_invoice_memo: Free-form text which is available on the invoice PDF and the Orb invoice portal.
6969
70+
metadata: User-specified key/value pairs for the resource.
71+
7072
net_terms: The net terms determines the difference between the invoice date and the issue
7173
date for the invoice. If you intend the invoice to be due on issue, set this
7274
to 0.
@@ -110,7 +112,7 @@ def update(
110112
plan_id: str,
111113
*,
112114
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
113-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
115+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
114116
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
115117
# The extra values given here take precedence over values defined on the client or passed to this method.
116118
extra_headers: Headers | None = None,
@@ -130,6 +132,8 @@ def update(
130132
as an alias for this Plan. Use this field to identify a plan by an existing
131133
identifier in your system.
132134
135+
metadata: User-specified key/value pairs for the resource.
136+
133137
extra_headers: Send extra headers
134138
135139
extra_query: Add additional query parameters to the request
@@ -288,7 +292,7 @@ async def create(
288292
prices: List[plan_create_params.Price],
289293
default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN,
290294
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
291-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
295+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
292296
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
293297
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
294298
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -310,6 +314,8 @@ async def create(
310314
311315
default_invoice_memo: Free-form text which is available on the invoice PDF and the Orb invoice portal.
312316
317+
metadata: User-specified key/value pairs for the resource.
318+
313319
net_terms: The net terms determines the difference between the invoice date and the issue
314320
date for the invoice. If you intend the invoice to be due on issue, set this
315321
to 0.
@@ -353,7 +359,7 @@ async def update(
353359
plan_id: str,
354360
*,
355361
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
356-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
362+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
357363
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
358364
# The extra values given here take precedence over values defined on the client or passed to this method.
359365
extra_headers: Headers | None = None,
@@ -373,6 +379,8 @@ async def update(
373379
as an alias for this Plan. Use this field to identify a plan by an existing
374380
identifier in your system.
375381
382+
metadata: User-specified key/value pairs for the resource.
383+
376384
extra_headers: Send extra headers
377385
378386
extra_query: Add additional query parameters to the request

src/orb/resources/subscriptions.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import TYPE_CHECKING, Any, List, Union, Optional, cast
5+
from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast
66
from datetime import date, datetime
77
from typing_extensions import Literal
88

@@ -62,7 +62,7 @@ def create(
6262
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
6363
initial_phase_order: Optional[int] | NotGiven = NOT_GIVEN,
6464
invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN,
65-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
65+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
6666
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
6767
per_credit_overage_amount: Optional[str] | NotGiven = NOT_GIVEN,
6868
plan_id: Optional[str] | NotGiven = NOT_GIVEN,
@@ -473,6 +473,8 @@ def create(
473473
external_plan_id: The external_plan_id of the plan that the given subscription should be switched
474474
to. Note that either this property or `plan_id` must be specified.
475475
476+
metadata: User-specified key/value pairs for the resource.
477+
476478
plan_id: The plan that the given subscription should be switched to. Note that either
477479
this property or `external_plan_id` must be specified.
478480
@@ -1665,7 +1667,7 @@ async def create(
16651667
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
16661668
initial_phase_order: Optional[int] | NotGiven = NOT_GIVEN,
16671669
invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN,
1668-
metadata: Optional[object] | NotGiven = NOT_GIVEN,
1670+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
16691671
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
16701672
per_credit_overage_amount: Optional[str] | NotGiven = NOT_GIVEN,
16711673
plan_id: Optional[str] | NotGiven = NOT_GIVEN,
@@ -2076,6 +2078,8 @@ async def create(
20762078
external_plan_id: The external_plan_id of the plan that the given subscription should be switched
20772079
to. Note that either this property or `plan_id` must be specified.
20782080
2081+
metadata: User-specified key/value pairs for the resource.
2082+
20792083
plan_id: The plan that the given subscription should be switched to. Note that either
20802084
this property or `external_plan_id` must be specified.
20812085

src/orb/types/customer.py

+4
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ class Customer(BaseModel):
215215
"""
216216

217217
metadata: Dict[str, str]
218+
"""User specified key-value pairs.
219+
220+
If not provided, this defaults to an empty dictionary.
221+
"""
218222

219223
name: str
220224
"""The full name of the customer"""

src/orb/types/customer_create_params.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import Dict, List, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

88
__all__ = [
@@ -59,11 +59,8 @@ class CustomerCreateParams(TypedDict, total=False):
5959
an existing identifier in your system.
6060
"""
6161

62-
metadata: Optional[object]
63-
"""
64-
User-specified key value pairs, often useful for referencing internal resources
65-
or IDs. Returned as-is in the customer resource.
66-
"""
62+
metadata: Optional[Dict[str, Optional[str]]]
63+
"""User-specified key/value pairs for the resource."""
6764

6865
payment_provider: Optional[Literal["quickbooks", "bill.com", "stripe_charge", "stripe_invoice", "netsuite"]]
6966
"""This is used for creating charges or invoices in an external system via Orb.

src/orb/types/customer_update_by_external_id_params.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List, Optional
5+
from typing import Dict, List, Optional
66
from typing_extensions import Literal, Required, TypedDict
77

88
__all__ = [
@@ -45,11 +45,8 @@ class CustomerUpdateByExternalIDParams(TypedDict, total=False):
4545

4646
email_delivery: Optional[bool]
4747

48-
metadata: Optional[object]
49-
"""
50-
User-specified key value pairs, often useful for referencing internal resources
51-
or IDs. Returned as-is in the customer resource.
52-
"""
48+
metadata: Optional[Dict[str, Optional[str]]]
49+
"""User-specified key/value pairs for the resource."""
5350

5451
name: Optional[str]
5552
"""The full name of the customer"""

0 commit comments

Comments
 (0)