Skip to content

feat(api): create invoice metadata param #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/orb/resources/invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Union, Iterable, Optional
from typing import Dict, List, Union, Iterable, Optional
from datetime import date, datetime
from typing_extensions import Literal

Expand Down Expand Up @@ -53,6 +53,7 @@ def create(
customer_id: Optional[str] | NotGiven = NOT_GIVEN,
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
memo: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
will_auto_issue: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -85,6 +86,10 @@ def create(

memo: An optional memo to attach to the invoice.

metadata: User-specified key/value pairs for the resource. Individual keys can be removed
by setting the value to `null`, and the entire metadata mapping can be cleared
by setting `metadata` to `null`.

will_auto_issue: When true, this invoice will automatically be issued upon creation. When false,
the resulting invoice will require manual review to issue. Defaulted to false.

Expand All @@ -109,6 +114,7 @@ def create(
"customer_id": customer_id,
"external_customer_id": external_customer_id,
"memo": memo,
"metadata": metadata,
"will_auto_issue": will_auto_issue,
},
invoice_create_params.InvoiceCreateParams,
Expand Down Expand Up @@ -464,6 +470,7 @@ async def create(
customer_id: Optional[str] | NotGiven = NOT_GIVEN,
external_customer_id: Optional[str] | NotGiven = NOT_GIVEN,
memo: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
will_auto_issue: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -496,6 +503,10 @@ async def create(

memo: An optional memo to attach to the invoice.

metadata: User-specified key/value pairs for the resource. Individual keys can be removed
by setting the value to `null`, and the entire metadata mapping can be cleared
by setting `metadata` to `null`.

will_auto_issue: When true, this invoice will automatically be issued upon creation. When false,
the resulting invoice will require manual review to issue. Defaulted to false.

Expand All @@ -520,6 +531,7 @@ async def create(
"customer_id": customer_id,
"external_customer_id": external_customer_id,
"memo": memo,
"metadata": metadata,
"will_auto_issue": will_auto_issue,
},
invoice_create_params.InvoiceCreateParams,
Expand Down
9 changes: 8 additions & 1 deletion src/orb/types/invoice_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Union, Iterable, Optional
from typing import Dict, Union, Iterable, Optional
from datetime import date, datetime
from typing_extensions import Literal, Required, Annotated, TypedDict

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

metadata: Optional[Dict[str, Optional[str]]]
"""User-specified key/value pairs for the resource.

Individual keys can be removed by setting the value to `null`, and the entire
metadata mapping can be cleared by setting `metadata` to `null`.
"""

will_auto_issue: bool
"""When true, this invoice will automatically be issued upon creation.

Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/test_invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None:
customer_id="4khy3nwzktxv7",
external_customer_id="external-customer-id",
memo="An optional memo for my invoice.",
metadata={"foo": "string"},
will_auto_issue=False,
)
assert_matches_type(Invoice, invoice, path=["response"])
Expand Down Expand Up @@ -532,6 +533,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No
customer_id="4khy3nwzktxv7",
external_customer_id="external-customer-id",
memo="An optional memo for my invoice.",
metadata={"foo": "string"},
will_auto_issue=False,
)
assert_matches_type(Invoice, invoice, path=["response"])
Expand Down