Skip to content

Commit 052d15d

Browse files
feat(api): api update (#511)
1 parent 15852c1 commit 052d15d

File tree

6 files changed

+388
-6
lines changed

6 files changed

+388
-6
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 101
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7fca89ba5a0b4997358c25e6cdfb616a1d8b93a6820e25078f3fa5f61110bfe6.yml
1+
configured_endpoints: 103
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-326205df28a52e9ad57c34d7ed1ec85fadd67f9a041df2882ebaa65f6de09930.yml

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ Methods:
7575
- <code title="delete /customers/{customer_id}">client.customers.<a href="./src/orb/resources/customers/customers.py">delete</a>(customer_id) -> None</code>
7676
- <code title="get /customers/{customer_id}">client.customers.<a href="./src/orb/resources/customers/customers.py">fetch</a>(customer_id) -> <a href="./src/orb/types/customer.py">Customer</a></code>
7777
- <code title="get /customers/external_customer_id/{external_customer_id}">client.customers.<a href="./src/orb/resources/customers/customers.py">fetch_by_external_id</a>(external_customer_id) -> <a href="./src/orb/types/customer.py">Customer</a></code>
78+
- <code title="post /customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway">client.customers.<a href="./src/orb/resources/customers/customers.py">sync_payment_methods_from_gateway</a>(external_customer_id) -> None</code>
79+
- <code title="post /customers/{customer_id}/sync_payment_methods_from_gateway">client.customers.<a href="./src/orb/resources/customers/customers.py">sync_payment_methods_from_gateway_by_external_customer_id</a>(customer_id) -> None</code>
7880
- <code title="put /customers/external_customer_id/{external_customer_id}">client.customers.<a href="./src/orb/resources/customers/customers.py">update_by_external_id</a>(id, \*\*<a href="src/orb/types/customer_update_by_external_id_params.py">params</a>) -> <a href="./src/orb/types/customer.py">Customer</a></code>
7981

8082
## Costs

src/orb/resources/customers/customers.py

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,100 @@ def fetch_by_external_id(
732732
cast_to=Customer,
733733
)
734734

735+
def sync_payment_methods_from_gateway(
736+
self,
737+
external_customer_id: str,
738+
*,
739+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
740+
# The extra values given here take precedence over values defined on the client or passed to this method.
741+
extra_headers: Headers | None = None,
742+
extra_query: Query | None = None,
743+
extra_body: Body | None = None,
744+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
745+
idempotency_key: str | None = None,
746+
) -> None:
747+
"""
748+
Sync Orb's payment methods for the customer with their gateway.
749+
750+
This method can be called before taking an action that may cause the customer to
751+
be charged, ensuring that the most up-to-date payment method is charged.
752+
753+
**Note**: This functionality is currently only available for Stripe.
754+
755+
Args:
756+
extra_headers: Send extra headers
757+
758+
extra_query: Add additional query parameters to the request
759+
760+
extra_body: Add additional JSON properties to the request
761+
762+
timeout: Override the client-level default timeout for this request, in seconds
763+
764+
idempotency_key: Specify a custom idempotency key for this request
765+
"""
766+
if not external_customer_id:
767+
raise ValueError(
768+
f"Expected a non-empty value for `external_customer_id` but received {external_customer_id!r}"
769+
)
770+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
771+
return self._post(
772+
f"/customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway",
773+
options=make_request_options(
774+
extra_headers=extra_headers,
775+
extra_query=extra_query,
776+
extra_body=extra_body,
777+
timeout=timeout,
778+
idempotency_key=idempotency_key,
779+
),
780+
cast_to=NoneType,
781+
)
782+
783+
def sync_payment_methods_from_gateway_by_external_customer_id(
784+
self,
785+
customer_id: str,
786+
*,
787+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
788+
# The extra values given here take precedence over values defined on the client or passed to this method.
789+
extra_headers: Headers | None = None,
790+
extra_query: Query | None = None,
791+
extra_body: Body | None = None,
792+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
793+
idempotency_key: str | None = None,
794+
) -> None:
795+
"""
796+
Sync Orb's payment methods for the customer with their gateway.
797+
798+
This method can be called before taking an action that may cause the customer to
799+
be charged, ensuring that the most up-to-date payment method is charged.
800+
801+
**Note**: This functionality is currently only available for Stripe.
802+
803+
Args:
804+
extra_headers: Send extra headers
805+
806+
extra_query: Add additional query parameters to the request
807+
808+
extra_body: Add additional JSON properties to the request
809+
810+
timeout: Override the client-level default timeout for this request, in seconds
811+
812+
idempotency_key: Specify a custom idempotency key for this request
813+
"""
814+
if not customer_id:
815+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
816+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
817+
return self._post(
818+
f"/customers/{customer_id}/sync_payment_methods_from_gateway",
819+
options=make_request_options(
820+
extra_headers=extra_headers,
821+
extra_query=extra_query,
822+
extra_body=extra_body,
823+
timeout=timeout,
824+
idempotency_key=idempotency_key,
825+
),
826+
cast_to=NoneType,
827+
)
828+
735829
def update_by_external_id(
736830
self,
737831
id: str,
@@ -1632,6 +1726,100 @@ async def fetch_by_external_id(
16321726
cast_to=Customer,
16331727
)
16341728

1729+
async def sync_payment_methods_from_gateway(
1730+
self,
1731+
external_customer_id: str,
1732+
*,
1733+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1734+
# The extra values given here take precedence over values defined on the client or passed to this method.
1735+
extra_headers: Headers | None = None,
1736+
extra_query: Query | None = None,
1737+
extra_body: Body | None = None,
1738+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1739+
idempotency_key: str | None = None,
1740+
) -> None:
1741+
"""
1742+
Sync Orb's payment methods for the customer with their gateway.
1743+
1744+
This method can be called before taking an action that may cause the customer to
1745+
be charged, ensuring that the most up-to-date payment method is charged.
1746+
1747+
**Note**: This functionality is currently only available for Stripe.
1748+
1749+
Args:
1750+
extra_headers: Send extra headers
1751+
1752+
extra_query: Add additional query parameters to the request
1753+
1754+
extra_body: Add additional JSON properties to the request
1755+
1756+
timeout: Override the client-level default timeout for this request, in seconds
1757+
1758+
idempotency_key: Specify a custom idempotency key for this request
1759+
"""
1760+
if not external_customer_id:
1761+
raise ValueError(
1762+
f"Expected a non-empty value for `external_customer_id` but received {external_customer_id!r}"
1763+
)
1764+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1765+
return await self._post(
1766+
f"/customers/external_customer_id/{external_customer_id}/sync_payment_methods_from_gateway",
1767+
options=make_request_options(
1768+
extra_headers=extra_headers,
1769+
extra_query=extra_query,
1770+
extra_body=extra_body,
1771+
timeout=timeout,
1772+
idempotency_key=idempotency_key,
1773+
),
1774+
cast_to=NoneType,
1775+
)
1776+
1777+
async def sync_payment_methods_from_gateway_by_external_customer_id(
1778+
self,
1779+
customer_id: str,
1780+
*,
1781+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1782+
# The extra values given here take precedence over values defined on the client or passed to this method.
1783+
extra_headers: Headers | None = None,
1784+
extra_query: Query | None = None,
1785+
extra_body: Body | None = None,
1786+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1787+
idempotency_key: str | None = None,
1788+
) -> None:
1789+
"""
1790+
Sync Orb's payment methods for the customer with their gateway.
1791+
1792+
This method can be called before taking an action that may cause the customer to
1793+
be charged, ensuring that the most up-to-date payment method is charged.
1794+
1795+
**Note**: This functionality is currently only available for Stripe.
1796+
1797+
Args:
1798+
extra_headers: Send extra headers
1799+
1800+
extra_query: Add additional query parameters to the request
1801+
1802+
extra_body: Add additional JSON properties to the request
1803+
1804+
timeout: Override the client-level default timeout for this request, in seconds
1805+
1806+
idempotency_key: Specify a custom idempotency key for this request
1807+
"""
1808+
if not customer_id:
1809+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
1810+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1811+
return await self._post(
1812+
f"/customers/{customer_id}/sync_payment_methods_from_gateway",
1813+
options=make_request_options(
1814+
extra_headers=extra_headers,
1815+
extra_query=extra_query,
1816+
extra_body=extra_body,
1817+
timeout=timeout,
1818+
idempotency_key=idempotency_key,
1819+
),
1820+
cast_to=NoneType,
1821+
)
1822+
16351823
async def update_by_external_id(
16361824
self,
16371825
id: str,
@@ -1876,6 +2064,12 @@ def __init__(self, customers: Customers) -> None:
18762064
self.fetch_by_external_id = _legacy_response.to_raw_response_wrapper(
18772065
customers.fetch_by_external_id,
18782066
)
2067+
self.sync_payment_methods_from_gateway = _legacy_response.to_raw_response_wrapper(
2068+
customers.sync_payment_methods_from_gateway,
2069+
)
2070+
self.sync_payment_methods_from_gateway_by_external_customer_id = _legacy_response.to_raw_response_wrapper(
2071+
customers.sync_payment_methods_from_gateway_by_external_customer_id,
2072+
)
18792073
self.update_by_external_id = _legacy_response.to_raw_response_wrapper(
18802074
customers.update_by_external_id,
18812075
)
@@ -1915,6 +2109,12 @@ def __init__(self, customers: AsyncCustomers) -> None:
19152109
self.fetch_by_external_id = _legacy_response.async_to_raw_response_wrapper(
19162110
customers.fetch_by_external_id,
19172111
)
2112+
self.sync_payment_methods_from_gateway = _legacy_response.async_to_raw_response_wrapper(
2113+
customers.sync_payment_methods_from_gateway,
2114+
)
2115+
self.sync_payment_methods_from_gateway_by_external_customer_id = _legacy_response.async_to_raw_response_wrapper(
2116+
customers.sync_payment_methods_from_gateway_by_external_customer_id,
2117+
)
19182118
self.update_by_external_id = _legacy_response.async_to_raw_response_wrapper(
19192119
customers.update_by_external_id,
19202120
)
@@ -1954,6 +2154,12 @@ def __init__(self, customers: Customers) -> None:
19542154
self.fetch_by_external_id = to_streamed_response_wrapper(
19552155
customers.fetch_by_external_id,
19562156
)
2157+
self.sync_payment_methods_from_gateway = to_streamed_response_wrapper(
2158+
customers.sync_payment_methods_from_gateway,
2159+
)
2160+
self.sync_payment_methods_from_gateway_by_external_customer_id = to_streamed_response_wrapper(
2161+
customers.sync_payment_methods_from_gateway_by_external_customer_id,
2162+
)
19572163
self.update_by_external_id = to_streamed_response_wrapper(
19582164
customers.update_by_external_id,
19592165
)
@@ -1993,6 +2199,12 @@ def __init__(self, customers: AsyncCustomers) -> None:
19932199
self.fetch_by_external_id = async_to_streamed_response_wrapper(
19942200
customers.fetch_by_external_id,
19952201
)
2202+
self.sync_payment_methods_from_gateway = async_to_streamed_response_wrapper(
2203+
customers.sync_payment_methods_from_gateway,
2204+
)
2205+
self.sync_payment_methods_from_gateway_by_external_customer_id = async_to_streamed_response_wrapper(
2206+
customers.sync_payment_methods_from_gateway_by_external_customer_id,
2207+
)
19962208
self.update_by_external_id = async_to_streamed_response_wrapper(
19972209
customers.update_by_external_id,
19982210
)

src/orb/types/invoice.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,11 @@ class Invoice(BaseModel):
706706

707707
discounts: List[InvoiceLevelDiscount]
708708

709-
due_date: datetime
710-
"""When the invoice payment is due."""
709+
due_date: Optional[datetime] = None
710+
"""When the invoice payment is due.
711+
712+
The due date is null if the invoice is not yet finalized.
713+
"""
711714

712715
eligible_to_issue_at: Optional[datetime] = None
713716
"""

src/orb/types/invoice_fetch_upcoming_response.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,11 @@ class InvoiceFetchUpcomingResponse(BaseModel):
706706

707707
discounts: List[InvoiceLevelDiscount]
708708

709-
due_date: datetime
710-
"""When the invoice payment is due."""
709+
due_date: Optional[datetime] = None
710+
"""When the invoice payment is due.
711+
712+
The due date is null if the invoice is not yet finalized.
713+
"""
711714

712715
eligible_to_issue_at: Optional[datetime] = None
713716
"""

0 commit comments

Comments
 (0)