Skip to content

Commit e5504a6

Browse files
feat(api): create invoice metadata param (#195)
1 parent 2c04868 commit e5504a6

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/orb/resources/invoices.py

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

33
from __future__ import annotations
44

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

@@ -53,6 +53,7 @@ def create(
5353
customer_id: Optional[str] | NotGiven = NOT_GIVEN,
5454
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
5555
memo: Optional[str] | NotGiven = NOT_GIVEN,
56+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
5657
will_auto_issue: bool | NotGiven = NOT_GIVEN,
5758
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5859
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -85,6 +86,10 @@ def create(
8586
8687
memo: An optional memo to attach to the invoice.
8788
89+
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
90+
by setting the value to `null`, and the entire metadata mapping can be cleared
91+
by setting `metadata` to `null`.
92+
8893
will_auto_issue: When true, this invoice will automatically be issued upon creation. When false,
8994
the resulting invoice will require manual review to issue. Defaulted to false.
9095
@@ -109,6 +114,7 @@ def create(
109114
"customer_id": customer_id,
110115
"external_customer_id": external_customer_id,
111116
"memo": memo,
117+
"metadata": metadata,
112118
"will_auto_issue": will_auto_issue,
113119
},
114120
invoice_create_params.InvoiceCreateParams,
@@ -464,6 +470,7 @@ async def create(
464470
customer_id: Optional[str] | NotGiven = NOT_GIVEN,
465471
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
466472
memo: Optional[str] | NotGiven = NOT_GIVEN,
473+
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
467474
will_auto_issue: bool | NotGiven = NOT_GIVEN,
468475
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
469476
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -496,6 +503,10 @@ async def create(
496503
497504
memo: An optional memo to attach to the invoice.
498505
506+
metadata: User-specified key/value pairs for the resource. Individual keys can be removed
507+
by setting the value to `null`, and the entire metadata mapping can be cleared
508+
by setting `metadata` to `null`.
509+
499510
will_auto_issue: When true, this invoice will automatically be issued upon creation. When false,
500511
the resulting invoice will require manual review to issue. Defaulted to false.
501512
@@ -520,6 +531,7 @@ async def create(
520531
"customer_id": customer_id,
521532
"external_customer_id": external_customer_id,
522533
"memo": memo,
534+
"metadata": metadata,
523535
"will_auto_issue": will_auto_issue,
524536
},
525537
invoice_create_params.InvoiceCreateParams,

src/orb/types/invoice_create_params.py

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

33
from __future__ import annotations
44

5-
from typing import Union, Iterable, Optional
5+
from typing import Dict, Union, Iterable, Optional
66
from datetime import date, datetime
77
from typing_extensions import Literal, Required, Annotated, TypedDict
88

@@ -50,6 +50,13 @@ class InvoiceCreateParams(TypedDict, total=False):
5050
memo: Optional[str]
5151
"""An optional memo to attach to the invoice."""
5252

53+
metadata: Optional[Dict[str, Optional[str]]]
54+
"""User-specified key/value pairs for the resource.
55+
56+
Individual keys can be removed by setting the value to `null`, and the entire
57+
metadata mapping can be cleared by setting `metadata` to `null`.
58+
"""
59+
5360
will_auto_issue: bool
5461
"""When true, this invoice will automatically be issued upon creation.
5562

tests/api_resources/test_invoices.py

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None:
107107
customer_id="4khy3nwzktxv7",
108108
external_customer_id="external-customer-id",
109109
memo="An optional memo for my invoice.",
110+
metadata={"foo": "string"},
110111
will_auto_issue=False,
111112
)
112113
assert_matches_type(Invoice, invoice, path=["response"])
@@ -532,6 +533,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No
532533
customer_id="4khy3nwzktxv7",
533534
external_customer_id="external-customer-id",
534535
memo="An optional memo for my invoice.",
536+
metadata={"foo": "string"},
535537
will_auto_issue=False,
536538
)
537539
assert_matches_type(Invoice, invoice, path=["response"])

0 commit comments

Comments
 (0)