Skip to content

Commit

Permalink
feat(api): support multiple ids in ledger retrieve/list endpo…
Browse files Browse the repository at this point in the history
…ints (#174)
  • Loading branch information
stainless-bot authored and cleb11 committed Aug 15, 2023
1 parent 72e1329 commit a6939c6
Show file tree
Hide file tree
Showing 27 changed files with 269 additions and 671 deletions.
9 changes: 0 additions & 9 deletions src/modern_treasury/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import httpx

from . import resources
from ._qs import Querystring
from .types import PingResponse
from ._types import (
NOT_GIVEN,
Expand Down Expand Up @@ -188,10 +187,6 @@ def __init__(
self.webhooks = resources.Webhooks(self)
self.virtual_accounts = resources.VirtualAccounts(self)

@property
def qs(self) -> Querystring:
return Querystring(array_format="repeat")

@property
def auth_headers(self) -> dict[str, str]:
credentials = f"{self.organization_id}:{self.api_key}".encode("ascii")
Expand Down Expand Up @@ -422,10 +417,6 @@ def __init__(
self.webhooks = resources.AsyncWebhooks(self)
self.virtual_accounts = resources.AsyncVirtualAccounts(self)

@property
def qs(self) -> Querystring:
return Querystring(array_format="repeat")

@property
def auth_headers(self) -> dict[str, str]:
credentials = f"{self.organization_id}:{self.api_key}".encode("ascii")
Expand Down
52 changes: 48 additions & 4 deletions src/modern_treasury/resources/invoices/invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def create(
currency: shared_params.Currency | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
invoicer_address: Optional[invoice_create_params.InvoicerAddress] | NotGiven = NOT_GIVEN,
notification_email_addresses: List[str] | NotGiven = NOT_GIVEN,
notifications_enabled: bool | NotGiven = NOT_GIVEN,
payment_effective_date: Union[str, date] | NotGiven = NOT_GIVEN,
payment_method: Literal["ui", "manual", "automatic"] | NotGiven = NOT_GIVEN,
payment_type: Literal[
Expand Down Expand Up @@ -99,6 +101,13 @@ def create(
invoicer_address: The invoice issuer's business address.
notification_email_addresses: Emails in addition to the counterparty email to send invoice status
notifications to. At least one email is required if notifications are enabled
and the counterparty doesn't have an email.
notifications_enabled: If true, the invoice will send email notifications to the invoice recipients
about invoice status changes.
payment_effective_date: Date transactions are to be posted to the participants' account. Defaults to the
current business day or the next business day if the current day is a bank
holiday or weekend. Format: yyyy-mm-dd.
Expand Down Expand Up @@ -138,6 +147,8 @@ def create(
"currency": currency,
"description": description,
"invoicer_address": invoicer_address,
"notification_email_addresses": notification_email_addresses,
"notifications_enabled": notifications_enabled,
"payment_effective_date": payment_effective_date,
"payment_method": payment_method,
"payment_type": payment_type,
Expand Down Expand Up @@ -199,6 +210,8 @@ def update(
description: str | NotGiven = NOT_GIVEN,
due_date: Union[str, datetime] | NotGiven = NOT_GIVEN,
invoicer_address: Optional[invoice_update_params.InvoicerAddress] | NotGiven = NOT_GIVEN,
notification_email_addresses: List[str] | NotGiven = NOT_GIVEN,
notifications_enabled: bool | NotGiven = NOT_GIVEN,
originating_account_id: str | NotGiven = NOT_GIVEN,
payment_effective_date: Union[str, date] | NotGiven = NOT_GIVEN,
payment_method: Literal["ui", "manual", "automatic"] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -252,6 +265,13 @@ def update(
invoicer_address: The invoice issuer's business address.
notification_email_addresses: Emails in addition to the counterparty email to send invoice status
notifications to. At least one email is required if notifications are enabled
and the counterparty doesn't have an email.
notifications_enabled: If true, the invoice will send email notifications to the invoice recipients
about invoice status changes.
originating_account_id: The ID of the internal account the invoice should be paid to.
payment_effective_date: Date transactions are to be posted to the participants' account. Defaults to the
Expand All @@ -271,8 +291,8 @@ def update(
receiving_account_id: The receiving account ID. Can be an `external_account`.
status: Invoice status must be updated in a `PATCH` request that does not modify any
other invoice attributes. Valid state transitions are `draft` to `unpaid` and
`draft` or `unpaid` to `voided`.
other invoice attributes. Valid state transitions are `draft` to `unpaid`,
`draft` or `unpaid` to `voided`, and `draft` or `unpaid` to `paid`.
extra_headers: Send extra headers
Expand All @@ -296,6 +316,8 @@ def update(
"description": description,
"due_date": due_date,
"invoicer_address": invoicer_address,
"notification_email_addresses": notification_email_addresses,
"notifications_enabled": notifications_enabled,
"originating_account_id": originating_account_id,
"payment_effective_date": payment_effective_date,
"payment_method": payment_method,
Expand Down Expand Up @@ -379,6 +401,8 @@ async def create(
currency: shared_params.Currency | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
invoicer_address: Optional[invoice_create_params.InvoicerAddress] | NotGiven = NOT_GIVEN,
notification_email_addresses: List[str] | NotGiven = NOT_GIVEN,
notifications_enabled: bool | NotGiven = NOT_GIVEN,
payment_effective_date: Union[str, date] | NotGiven = NOT_GIVEN,
payment_method: Literal["ui", "manual", "automatic"] | NotGiven = NOT_GIVEN,
payment_type: Literal[
Expand Down Expand Up @@ -432,6 +456,13 @@ async def create(
invoicer_address: The invoice issuer's business address.
notification_email_addresses: Emails in addition to the counterparty email to send invoice status
notifications to. At least one email is required if notifications are enabled
and the counterparty doesn't have an email.
notifications_enabled: If true, the invoice will send email notifications to the invoice recipients
about invoice status changes.
payment_effective_date: Date transactions are to be posted to the participants' account. Defaults to the
current business day or the next business day if the current day is a bank
holiday or weekend. Format: yyyy-mm-dd.
Expand Down Expand Up @@ -471,6 +502,8 @@ async def create(
"currency": currency,
"description": description,
"invoicer_address": invoicer_address,
"notification_email_addresses": notification_email_addresses,
"notifications_enabled": notifications_enabled,
"payment_effective_date": payment_effective_date,
"payment_method": payment_method,
"payment_type": payment_type,
Expand Down Expand Up @@ -532,6 +565,8 @@ async def update(
description: str | NotGiven = NOT_GIVEN,
due_date: Union[str, datetime] | NotGiven = NOT_GIVEN,
invoicer_address: Optional[invoice_update_params.InvoicerAddress] | NotGiven = NOT_GIVEN,
notification_email_addresses: List[str] | NotGiven = NOT_GIVEN,
notifications_enabled: bool | NotGiven = NOT_GIVEN,
originating_account_id: str | NotGiven = NOT_GIVEN,
payment_effective_date: Union[str, date] | NotGiven = NOT_GIVEN,
payment_method: Literal["ui", "manual", "automatic"] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -585,6 +620,13 @@ async def update(
invoicer_address: The invoice issuer's business address.
notification_email_addresses: Emails in addition to the counterparty email to send invoice status
notifications to. At least one email is required if notifications are enabled
and the counterparty doesn't have an email.
notifications_enabled: If true, the invoice will send email notifications to the invoice recipients
about invoice status changes.
originating_account_id: The ID of the internal account the invoice should be paid to.
payment_effective_date: Date transactions are to be posted to the participants' account. Defaults to the
Expand All @@ -604,8 +646,8 @@ async def update(
receiving_account_id: The receiving account ID. Can be an `external_account`.
status: Invoice status must be updated in a `PATCH` request that does not modify any
other invoice attributes. Valid state transitions are `draft` to `unpaid` and
`draft` or `unpaid` to `voided`.
other invoice attributes. Valid state transitions are `draft` to `unpaid`,
`draft` or `unpaid` to `voided`, and `draft` or `unpaid` to `paid`.
extra_headers: Send extra headers
Expand All @@ -629,6 +671,8 @@ async def update(
"description": description,
"due_date": due_date,
"invoicer_address": invoicer_address,
"notification_email_addresses": notification_email_addresses,
"notifications_enabled": notifications_enabled,
"originating_account_id": originating_account_id,
"payment_effective_date": payment_effective_date,
"payment_method": payment_method,
Expand Down
Loading

0 comments on commit a6939c6

Please sign in to comment.