From 227ebb67ae932a03d9b980ad92f6242e95593f37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:29:01 +0000 Subject: [PATCH 01/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f2f2901..32611ed 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 55 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-773c90f079c54155b39d84d7cf37ff7a2b89c74865c56a6cf86db730c36751a2.yml -openapi_spec_hash: 95129e670c6a3e832a1ea3fc64c07b11 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-19f0642858b5537a23dc875c556cd6abd968815d9dbc927c255e41bde22ed753.yml +openapi_spec_hash: d88f2e2afaebc84441674d45cc1f5097 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 4b6609f84e3e048414a0b8019365a972f751c1bc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 02:29:00 +0000 Subject: [PATCH 02/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 32611ed..762796f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 55 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-19f0642858b5537a23dc875c556cd6abd968815d9dbc927c255e41bde22ed753.yml -openapi_spec_hash: d88f2e2afaebc84441674d45cc1f5097 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-92a66af6fef5f39e087989800b36f9aea84d800e62246dbb7c5ee6e4f0722a00.yml +openapi_spec_hash: 45371d634f2c23298c321558a0dd271a config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 2731abef79e83cce1b9fd6c3897feab7c633ad84 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 09:28:58 +0000 Subject: [PATCH 03/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 762796f..200ad8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 55 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-92a66af6fef5f39e087989800b36f9aea84d800e62246dbb7c5ee6e4f0722a00.yml -openapi_spec_hash: 45371d634f2c23298c321558a0dd271a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-56705fba64d00c91d3d89ac170be12575ef8999c47b0a81f3aa462d76bd28798.yml +openapi_spec_hash: 3ffb865c9463cb9d3f9e09c2140c986e config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 59a7a78b6e534d5e3acb42824220a1e11c9c3a60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 00:53:11 +0000 Subject: [PATCH 04/34] chore(ci): skip uploading artifacts on stainless-internal branches --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d3070d..bec92b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,18 @@ jobs: run: rye build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/slash-sdk-python' + if: |- + github.repository == 'stainless-sdks/slash-sdk-python' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball - if: github.repository == 'stainless-sdks/slash-sdk-python' + if: |- + github.repository == 'stainless-sdks/slash-sdk-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From 68fa0aeac982ca051911fb116fc585f60ec8d3b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 06:28:58 +0000 Subject: [PATCH 05/34] feat(api): api update --- .stats.yml | 4 ++-- src/slash_sdk/resources/card/card.py | 12 ++++++++++++ src/slash_sdk/types/card/card.py | 21 +++++++++++++++++++-- src/slash_sdk/types/card_list_params.py | 7 +++++++ tests/api_resources/test_card.py | 2 ++ 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 200ad8c..7abc3c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 55 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-56705fba64d00c91d3d89ac170be12575ef8999c47b0a81f3aa462d76bd28798.yml -openapi_spec_hash: 3ffb865c9463cb9d3f9e09c2140c986e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-62e0ecbf9abf418e10c527bccf36a2a3c77707685903bc19d7a9078f8d7e4fad.yml +openapi_spec_hash: 0120c1e1e2afcf773355da2fab0489aa config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 diff --git a/src/slash_sdk/resources/card/card.py b/src/slash_sdk/resources/card/card.py index 9dd53d1..d0f689e 100644 --- a/src/slash_sdk/resources/card/card.py +++ b/src/slash_sdk/resources/card/card.py @@ -246,6 +246,7 @@ def list( filter_card_group_id: str | Omit = omit, filter_card_group_name: str | Omit = omit, filter_legal_entity_id: str | Omit = omit, + filter_modifier: str | Omit = omit, filter_status: Literal["active", "paused", "closed", "inactive"] | Omit = omit, filter_virtual_account_id: str | Omit = omit, sort: Literal["createdAt", "name"] | Omit = omit, @@ -274,6 +275,10 @@ def list( filter_legal_entity_id: Pass in a legal entity ID to filter for cards in accounts under a specific legal entity. + filter_modifier: Filter cards by modifier. Format is "modifier_name:value" (e.g., + "only_allow_recurring_payments:true"). Returns cards where the specified + modifier has the given value. + filter_status: Returns all cards matching the status passed in. filter_virtual_account_id: Pass in a virtual account ID to filter for cards under a specific virtual @@ -305,6 +310,7 @@ def list( "filter_card_group_id": filter_card_group_id, "filter_card_group_name": filter_card_group_name, "filter_legal_entity_id": filter_legal_entity_id, + "filter_modifier": filter_modifier, "filter_status": filter_status, "filter_virtual_account_id": filter_virtual_account_id, "sort": sort, @@ -560,6 +566,7 @@ async def list( filter_card_group_id: str | Omit = omit, filter_card_group_name: str | Omit = omit, filter_legal_entity_id: str | Omit = omit, + filter_modifier: str | Omit = omit, filter_status: Literal["active", "paused", "closed", "inactive"] | Omit = omit, filter_virtual_account_id: str | Omit = omit, sort: Literal["createdAt", "name"] | Omit = omit, @@ -588,6 +595,10 @@ async def list( filter_legal_entity_id: Pass in a legal entity ID to filter for cards in accounts under a specific legal entity. + filter_modifier: Filter cards by modifier. Format is "modifier_name:value" (e.g., + "only_allow_recurring_payments:true"). Returns cards where the specified + modifier has the given value. + filter_status: Returns all cards matching the status passed in. filter_virtual_account_id: Pass in a virtual account ID to filter for cards under a specific virtual @@ -619,6 +630,7 @@ async def list( "filter_card_group_id": filter_card_group_id, "filter_card_group_name": filter_card_group_name, "filter_legal_entity_id": filter_legal_entity_id, + "filter_modifier": filter_modifier, "filter_status": filter_status, "filter_virtual_account_id": filter_virtual_account_id, "sort": sort, diff --git a/src/slash_sdk/types/card/card.py b/src/slash_sdk/types/card/card.py index 5e41ef7..81613ef 100644 --- a/src/slash_sdk/types/card/card.py +++ b/src/slash_sdk/types/card/card.py @@ -1,7 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -9,7 +10,17 @@ from ..card_status import CardStatus from .spending_constraint import SpendingConstraint -__all__ = ["Card"] +__all__ = ["Card", "Modifier"] + + +class Modifier(BaseModel): + name: Literal["only_allow_recurring_payments"] + + value: bool + """Whether to only allow recurring payments. + + The default value for newly created cards is false. + """ class Card(BaseModel): @@ -60,6 +71,12 @@ class Card(BaseModel): drops """ + modifiers: Optional[List[Modifier]] = None + """The modifiers applied to this card. + + Modifiers control card behavior like restricting to recurring payments only. + """ + pan: Optional[str] = None """ This field contains the full PAN which will only be sent on a request for a diff --git a/src/slash_sdk/types/card_list_params.py b/src/slash_sdk/types/card_list_params.py index 9f11d3b..37513ca 100644 --- a/src/slash_sdk/types/card_list_params.py +++ b/src/slash_sdk/types/card_list_params.py @@ -34,6 +34,13 @@ class CardListParams(TypedDict, total=False): entity. """ + filter_modifier: Annotated[str, PropertyInfo(alias="filter:modifier")] + """Filter cards by modifier. + + Format is "modifier_name:value" (e.g., "only_allow_recurring_payments:true"). + Returns cards where the specified modifier has the given value. + """ + filter_status: Annotated[Literal["active", "paused", "closed", "inactive"], PropertyInfo(alias="filter:status")] """Returns all cards matching the status passed in.""" diff --git a/tests/api_resources/test_card.py b/tests/api_resources/test_card.py index a43001b..9259478 100644 --- a/tests/api_resources/test_card.py +++ b/tests/api_resources/test_card.py @@ -270,6 +270,7 @@ def test_method_list_with_all_params(self, client: SlashSDK) -> None: filter_card_group_id="filter:cardGroupId", filter_card_group_name="filter:cardGroupName", filter_legal_entity_id="filter:legalEntityId", + filter_modifier="filter:modifier", filter_status="active", filter_virtual_account_id="filter:virtualAccountId", sort="createdAt", @@ -596,6 +597,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSlashSDK) -> filter_card_group_id="filter:cardGroupId", filter_card_group_name="filter:cardGroupName", filter_legal_entity_id="filter:legalEntityId", + filter_modifier="filter:modifier", filter_status="active", filter_virtual_account_id="filter:virtualAccountId", sort="createdAt", From f7f6586c71d14eb448fc37f934b1f37a0c9d328f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 02:28:50 +0000 Subject: [PATCH 06/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7abc3c4..4bab32e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 55 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-62e0ecbf9abf418e10c527bccf36a2a3c77707685903bc19d7a9078f8d7e4fad.yml -openapi_spec_hash: 0120c1e1e2afcf773355da2fab0489aa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-17929cf020855a06e89cd77f79318e3e3e80226efae7e9926b32449f27d38b27.yml +openapi_spec_hash: e4b68fcae6d0ef6fba49eaf6762e50c0 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 403ce72fe8450996c6eec0b12d18605d6fd1ba10 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 02:30:13 +0000 Subject: [PATCH 07/34] feat(api): api update --- .stats.yml | 6 +- api.md | 25 -- src/slash_sdk/_client.py | 76 ----- src/slash_sdk/resources/__init__.py | 28 -- src/slash_sdk/resources/pay.py | 270 ------------------ src/slash_sdk/resources/slash_handle.py | 173 ----------- src/slash_sdk/types/__init__.py | 5 - src/slash_sdk/types/pay_send_params.py | 34 --- src/slash_sdk/types/pay_send_response.py | 23 -- src/slash_sdk/types/slash_handle.py | 23 -- .../types/slash_handle_list_params.py | 12 - .../types/slash_handle_list_response.py | 16 -- tests/api_resources/test_pay.py | 176 ------------ tests/api_resources/test_slash_handle.py | 96 ------- 14 files changed, 3 insertions(+), 960 deletions(-) delete mode 100644 src/slash_sdk/resources/pay.py delete mode 100644 src/slash_sdk/resources/slash_handle.py delete mode 100644 src/slash_sdk/types/pay_send_params.py delete mode 100644 src/slash_sdk/types/pay_send_response.py delete mode 100644 src/slash_sdk/types/slash_handle.py delete mode 100644 src/slash_sdk/types/slash_handle_list_params.py delete mode 100644 src/slash_sdk/types/slash_handle_list_response.py delete mode 100644 tests/api_resources/test_pay.py delete mode 100644 tests/api_resources/test_slash_handle.py diff --git a/.stats.yml b/.stats.yml index 4bab32e..dacec26 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 55 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-17929cf020855a06e89cd77f79318e3e3e80226efae7e9926b32449f27d38b27.yml -openapi_spec_hash: e4b68fcae6d0ef6fba49eaf6762e50c0 +configured_endpoints: 52 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-5f96f1193e2d0809bc7cdf7b04368f1d3acca07405784cc46087a01daf4c362f.yml +openapi_spec_hash: 6929a4ff6ab1460410822068a7975f9d config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 diff --git a/api.md b/api.md index 3f8e5fd..f185e28 100644 --- a/api.md +++ b/api.md @@ -146,31 +146,6 @@ Methods: - client.card_product.list(\*\*params) -> CardProductListResponse -# SlashHandle - -Types: - -```python -from slash_sdk.types import SlashHandleListResponse -``` - -Methods: - -- client.slash_handle.list(\*\*params) -> SlashHandleListResponse - -# Pay - -Types: - -```python -from slash_sdk.types import SlashHandle, PaySendResponse -``` - -Methods: - -- client.pay.retrieve() -> SlashHandle -- client.pay.send(\*\*params) -> PaySendResponse - # Webhook Types: diff --git a/src/slash_sdk/_client.py b/src/slash_sdk/_client.py index 6df78c0..b3e8e61 100644 --- a/src/slash_sdk/_client.py +++ b/src/slash_sdk/_client.py @@ -35,7 +35,6 @@ if TYPE_CHECKING: from .resources import ( fdx, - pay, card, crypto, oauth2, @@ -48,13 +47,11 @@ transaction, card_product, legal_entity, - slash_handle, virtual_account, developer_account, merchant_category, developer_application, ) - from .resources.pay import PayResource, AsyncPayResource from .resources.crypto import CryptoResource, AsyncCryptoResource from .resources.account import AccountResource, AsyncAccountResource from .resources.fdx.fdx import FdxResource, AsyncFdxResource @@ -66,7 +63,6 @@ from .resources.transaction import TransactionResource, AsyncTransactionResource from .resources.card_product import CardProductResource, AsyncCardProductResource from .resources.legal_entity import LegalEntityResource, AsyncLegalEntityResource - from .resources.slash_handle import SlashHandleResource, AsyncSlashHandleResource from .resources.oauth2.oauth2 import Oauth2Resource, AsyncOauth2Resource from .resources.virtual_account import VirtualAccountResource, AsyncVirtualAccountResource from .resources.developer_account import DeveloperAccountResource, AsyncDeveloperAccountResource @@ -207,18 +203,6 @@ def card_product(self) -> CardProductResource: return CardProductResource(self) - @cached_property - def slash_handle(self) -> SlashHandleResource: - from .resources.slash_handle import SlashHandleResource - - return SlashHandleResource(self) - - @cached_property - def pay(self) -> PayResource: - from .resources.pay import PayResource - - return PayResource(self) - @cached_property def webhook(self) -> WebhookResource: from .resources.webhook import WebhookResource @@ -548,18 +532,6 @@ def card_product(self) -> AsyncCardProductResource: return AsyncCardProductResource(self) - @cached_property - def slash_handle(self) -> AsyncSlashHandleResource: - from .resources.slash_handle import AsyncSlashHandleResource - - return AsyncSlashHandleResource(self) - - @cached_property - def pay(self) -> AsyncPayResource: - from .resources.pay import AsyncPayResource - - return AsyncPayResource(self) - @cached_property def webhook(self) -> AsyncWebhookResource: from .resources.webhook import AsyncWebhookResource @@ -822,18 +794,6 @@ def card_product(self) -> card_product.CardProductResourceWithRawResponse: return CardProductResourceWithRawResponse(self._client.card_product) - @cached_property - def slash_handle(self) -> slash_handle.SlashHandleResourceWithRawResponse: - from .resources.slash_handle import SlashHandleResourceWithRawResponse - - return SlashHandleResourceWithRawResponse(self._client.slash_handle) - - @cached_property - def pay(self) -> pay.PayResourceWithRawResponse: - from .resources.pay import PayResourceWithRawResponse - - return PayResourceWithRawResponse(self._client.pay) - @cached_property def webhook(self) -> webhook.WebhookResourceWithRawResponse: from .resources.webhook import WebhookResourceWithRawResponse @@ -943,18 +903,6 @@ def card_product(self) -> card_product.AsyncCardProductResourceWithRawResponse: return AsyncCardProductResourceWithRawResponse(self._client.card_product) - @cached_property - def slash_handle(self) -> slash_handle.AsyncSlashHandleResourceWithRawResponse: - from .resources.slash_handle import AsyncSlashHandleResourceWithRawResponse - - return AsyncSlashHandleResourceWithRawResponse(self._client.slash_handle) - - @cached_property - def pay(self) -> pay.AsyncPayResourceWithRawResponse: - from .resources.pay import AsyncPayResourceWithRawResponse - - return AsyncPayResourceWithRawResponse(self._client.pay) - @cached_property def webhook(self) -> webhook.AsyncWebhookResourceWithRawResponse: from .resources.webhook import AsyncWebhookResourceWithRawResponse @@ -1064,18 +1012,6 @@ def card_product(self) -> card_product.CardProductResourceWithStreamingResponse: return CardProductResourceWithStreamingResponse(self._client.card_product) - @cached_property - def slash_handle(self) -> slash_handle.SlashHandleResourceWithStreamingResponse: - from .resources.slash_handle import SlashHandleResourceWithStreamingResponse - - return SlashHandleResourceWithStreamingResponse(self._client.slash_handle) - - @cached_property - def pay(self) -> pay.PayResourceWithStreamingResponse: - from .resources.pay import PayResourceWithStreamingResponse - - return PayResourceWithStreamingResponse(self._client.pay) - @cached_property def webhook(self) -> webhook.WebhookResourceWithStreamingResponse: from .resources.webhook import WebhookResourceWithStreamingResponse @@ -1185,18 +1121,6 @@ def card_product(self) -> card_product.AsyncCardProductResourceWithStreamingResp return AsyncCardProductResourceWithStreamingResponse(self._client.card_product) - @cached_property - def slash_handle(self) -> slash_handle.AsyncSlashHandleResourceWithStreamingResponse: - from .resources.slash_handle import AsyncSlashHandleResourceWithStreamingResponse - - return AsyncSlashHandleResourceWithStreamingResponse(self._client.slash_handle) - - @cached_property - def pay(self) -> pay.AsyncPayResourceWithStreamingResponse: - from .resources.pay import AsyncPayResourceWithStreamingResponse - - return AsyncPayResourceWithStreamingResponse(self._client.pay) - @cached_property def webhook(self) -> webhook.AsyncWebhookResourceWithStreamingResponse: from .resources.webhook import AsyncWebhookResourceWithStreamingResponse diff --git a/src/slash_sdk/resources/__init__.py b/src/slash_sdk/resources/__init__.py index 30052e3..e33636b 100644 --- a/src/slash_sdk/resources/__init__.py +++ b/src/slash_sdk/resources/__init__.py @@ -8,14 +8,6 @@ FdxResourceWithStreamingResponse, AsyncFdxResourceWithStreamingResponse, ) -from .pay import ( - PayResource, - AsyncPayResource, - PayResourceWithRawResponse, - AsyncPayResourceWithRawResponse, - PayResourceWithStreamingResponse, - AsyncPayResourceWithStreamingResponse, -) from .card import ( CardResource, AsyncCardResource, @@ -112,14 +104,6 @@ LegalEntityResourceWithStreamingResponse, AsyncLegalEntityResourceWithStreamingResponse, ) -from .slash_handle import ( - SlashHandleResource, - AsyncSlashHandleResource, - SlashHandleResourceWithRawResponse, - AsyncSlashHandleResourceWithRawResponse, - SlashHandleResourceWithStreamingResponse, - AsyncSlashHandleResourceWithStreamingResponse, -) from .virtual_account import ( VirtualAccountResource, AsyncVirtualAccountResource, @@ -202,18 +186,6 @@ "AsyncCardProductResourceWithRawResponse", "CardProductResourceWithStreamingResponse", "AsyncCardProductResourceWithStreamingResponse", - "SlashHandleResource", - "AsyncSlashHandleResource", - "SlashHandleResourceWithRawResponse", - "AsyncSlashHandleResourceWithRawResponse", - "SlashHandleResourceWithStreamingResponse", - "AsyncSlashHandleResourceWithStreamingResponse", - "PayResource", - "AsyncPayResource", - "PayResourceWithRawResponse", - "AsyncPayResourceWithRawResponse", - "PayResourceWithStreamingResponse", - "AsyncPayResourceWithStreamingResponse", "WebhookResource", "AsyncWebhookResource", "WebhookResourceWithRawResponse", diff --git a/src/slash_sdk/resources/pay.py b/src/slash_sdk/resources/pay.py deleted file mode 100644 index c8bbc12..0000000 --- a/src/slash_sdk/resources/pay.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Any, cast - -import httpx - -from ..types import pay_send_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.slash_handle import SlashHandle -from ..types.pay_send_response import PaySendResponse - -__all__ = ["PayResource", "AsyncPayResource"] - - -class PayResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> PayResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#accessing-raw-response-data-eg-headers - """ - return PayResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> PayResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#with_streaming_response - """ - return PayResourceWithStreamingResponse(self) - - def retrieve( - self, - *, - # 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SlashHandle: - """Retrieve your pay by slash information.""" - return self._get( - "/pay", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SlashHandle, - ) - - def send( - self, - *, - amount_cents: float, - slash_handle: str, - legal_entity_id: str | Omit = omit, - source_slash_handle_id: str | Omit = omit, - # 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaySendResponse: - """ - Send money to a slash handle - - Args: - amount_cents: The amount of money to send in cents. - - slash_handle: The username of the SlashHandle to send money to. You can get this by asking - your recipient for their SlashHandle. - - legal_entity_id: The ID of the LegalEntity to send money from. You can get this by calling - `GET /legal-entity`. This field or `slashHandleId` is required unless you are - authenticating via API key. - - source_slash_handle_id: The ID of the SlashHandle to send money from. You can get this by calling - `GET /slash-handle`. This field or `legalEntityId` is required unless you are - authenticating via API key. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return cast( - PaySendResponse, - self._post( - "/pay", - body=maybe_transform( - { - "amount_cents": amount_cents, - "slash_handle": slash_handle, - "legal_entity_id": legal_entity_id, - "source_slash_handle_id": source_slash_handle_id, - }, - pay_send_params.PaySendParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast(Any, PaySendResponse), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class AsyncPayResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncPayResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncPayResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncPayResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#with_streaming_response - """ - return AsyncPayResourceWithStreamingResponse(self) - - async def retrieve( - self, - *, - # 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SlashHandle: - """Retrieve your pay by slash information.""" - return await self._get( - "/pay", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SlashHandle, - ) - - async def send( - self, - *, - amount_cents: float, - slash_handle: str, - legal_entity_id: str | Omit = omit, - source_slash_handle_id: str | Omit = omit, - # 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PaySendResponse: - """ - Send money to a slash handle - - Args: - amount_cents: The amount of money to send in cents. - - slash_handle: The username of the SlashHandle to send money to. You can get this by asking - your recipient for their SlashHandle. - - legal_entity_id: The ID of the LegalEntity to send money from. You can get this by calling - `GET /legal-entity`. This field or `slashHandleId` is required unless you are - authenticating via API key. - - source_slash_handle_id: The ID of the SlashHandle to send money from. You can get this by calling - `GET /slash-handle`. This field or `legalEntityId` is required unless you are - authenticating via API key. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return cast( - PaySendResponse, - await self._post( - "/pay", - body=await async_maybe_transform( - { - "amount_cents": amount_cents, - "slash_handle": slash_handle, - "legal_entity_id": legal_entity_id, - "source_slash_handle_id": source_slash_handle_id, - }, - pay_send_params.PaySendParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast(Any, PaySendResponse), # Union types cannot be passed in as arguments in the type system - ), - ) - - -class PayResourceWithRawResponse: - def __init__(self, pay: PayResource) -> None: - self._pay = pay - - self.retrieve = to_raw_response_wrapper( - pay.retrieve, - ) - self.send = to_raw_response_wrapper( - pay.send, - ) - - -class AsyncPayResourceWithRawResponse: - def __init__(self, pay: AsyncPayResource) -> None: - self._pay = pay - - self.retrieve = async_to_raw_response_wrapper( - pay.retrieve, - ) - self.send = async_to_raw_response_wrapper( - pay.send, - ) - - -class PayResourceWithStreamingResponse: - def __init__(self, pay: PayResource) -> None: - self._pay = pay - - self.retrieve = to_streamed_response_wrapper( - pay.retrieve, - ) - self.send = to_streamed_response_wrapper( - pay.send, - ) - - -class AsyncPayResourceWithStreamingResponse: - def __init__(self, pay: AsyncPayResource) -> None: - self._pay = pay - - self.retrieve = async_to_streamed_response_wrapper( - pay.retrieve, - ) - self.send = async_to_streamed_response_wrapper( - pay.send, - ) diff --git a/src/slash_sdk/resources/slash_handle.py b/src/slash_sdk/resources/slash_handle.py deleted file mode 100644 index b54c0fc..0000000 --- a/src/slash_sdk/resources/slash_handle.py +++ /dev/null @@ -1,173 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..types import slash_handle_list_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options -from ..types.slash_handle_list_response import SlashHandleListResponse - -__all__ = ["SlashHandleResource", "AsyncSlashHandleResource"] - - -class SlashHandleResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SlashHandleResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#accessing-raw-response-data-eg-headers - """ - return SlashHandleResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SlashHandleResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#with_streaming_response - """ - return SlashHandleResourceWithStreamingResponse(self) - - def list( - self, - *, - cursor: str | Omit = omit, - # 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SlashHandleListResponse: - """ - List all of your Slash Handles - - Args: - cursor: A cursor string to fetch the next page of results - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/slash-handle", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"cursor": cursor}, slash_handle_list_params.SlashHandleListParams), - ), - cast_to=SlashHandleListResponse, - ) - - -class AsyncSlashHandleResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSlashHandleResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#accessing-raw-response-data-eg-headers - """ - return AsyncSlashHandleResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSlashHandleResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/slashfi/slash-sdk-python#with_streaming_response - """ - return AsyncSlashHandleResourceWithStreamingResponse(self) - - async def list( - self, - *, - cursor: str | Omit = omit, - # 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. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SlashHandleListResponse: - """ - List all of your Slash Handles - - Args: - cursor: A cursor string to fetch the next page of results - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/slash-handle", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform({"cursor": cursor}, slash_handle_list_params.SlashHandleListParams), - ), - cast_to=SlashHandleListResponse, - ) - - -class SlashHandleResourceWithRawResponse: - def __init__(self, slash_handle: SlashHandleResource) -> None: - self._slash_handle = slash_handle - - self.list = to_raw_response_wrapper( - slash_handle.list, - ) - - -class AsyncSlashHandleResourceWithRawResponse: - def __init__(self, slash_handle: AsyncSlashHandleResource) -> None: - self._slash_handle = slash_handle - - self.list = async_to_raw_response_wrapper( - slash_handle.list, - ) - - -class SlashHandleResourceWithStreamingResponse: - def __init__(self, slash_handle: SlashHandleResource) -> None: - self._slash_handle = slash_handle - - self.list = to_streamed_response_wrapper( - slash_handle.list, - ) - - -class AsyncSlashHandleResourceWithStreamingResponse: - def __init__(self, slash_handle: AsyncSlashHandleResource) -> None: - self._slash_handle = slash_handle - - self.list = async_to_streamed_response_wrapper( - slash_handle.list, - ) diff --git a/src/slash_sdk/types/__init__.py b/src/slash_sdk/types/__init__.py index 0d60e31..f389de0 100644 --- a/src/slash_sdk/types/__init__.py +++ b/src/slash_sdk/types/__init__.py @@ -11,12 +11,9 @@ from .card_status import CardStatus as CardStatus from .money_param import MoneyParam as MoneyParam from .transaction import Transaction as Transaction -from .slash_handle import SlashHandle as SlashHandle from .commission_rule import CommissionRule as CommissionRule -from .pay_send_params import PaySendParams as PaySendParams from .virtual_account import VirtualAccount as VirtualAccount from .card_list_params import CardListParams as CardListParams -from .pay_send_response import PaySendResponse as PaySendResponse from .card_create_params import CardCreateParams as CardCreateParams from .card_list_response import CardListResponse as CardListResponse from .card_update_params import CardUpdateParams as CardUpdateParams @@ -41,14 +38,12 @@ from .card_group_update_params import CardGroupUpdateParams as CardGroupUpdateParams from .card_product_list_params import CardProductListParams as CardProductListParams from .commission_details_param import CommissionDetailsParam as CommissionDetailsParam -from .slash_handle_list_params import SlashHandleListParams as SlashHandleListParams from .oauth2_get_token_response import Oauth2GetTokenResponse as Oauth2GetTokenResponse from .transaction_list_response import TransactionListResponse as TransactionListResponse from .card_product_list_response import CardProductListResponse as CardProductListResponse from .developer_application_data import DeveloperApplicationData as DeveloperApplicationData from .developer_application_type import DeveloperApplicationType as DeveloperApplicationType from .legal_entity_list_response import LegalEntityListResponse as LegalEntityListResponse -from .slash_handle_list_response import SlashHandleListResponse as SlashHandleListResponse from .developer_application_model import DeveloperApplicationModel as DeveloperApplicationModel from .virtual_account_list_params import VirtualAccountListParams as VirtualAccountListParams from .crypto_create_offramp_params import CryptoCreateOfframpParams as CryptoCreateOfframpParams diff --git a/src/slash_sdk/types/pay_send_params.py b/src/slash_sdk/types/pay_send_params.py deleted file mode 100644 index 91d0630..0000000 --- a/src/slash_sdk/types/pay_send_params.py +++ /dev/null @@ -1,34 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["PaySendParams"] - - -class PaySendParams(TypedDict, total=False): - amount_cents: Required[Annotated[float, PropertyInfo(alias="amountCents")]] - """The amount of money to send in cents.""" - - slash_handle: Required[Annotated[str, PropertyInfo(alias="slashHandle")]] - """The username of the SlashHandle to send money to. - - You can get this by asking your recipient for their SlashHandle. - """ - - legal_entity_id: Annotated[str, PropertyInfo(alias="legalEntityId")] - """The ID of the LegalEntity to send money from. - - You can get this by calling `GET /legal-entity`. This field or `slashHandleId` - is required unless you are authenticating via API key. - """ - - source_slash_handle_id: Annotated[str, PropertyInfo(alias="sourceSlashHandleId")] - """The ID of the SlashHandle to send money from. - - You can get this by calling `GET /slash-handle`. This field or `legalEntityId` - is required unless you are authenticating via API key. - """ diff --git a/src/slash_sdk/types/pay_send_response.py b/src/slash_sdk/types/pay_send_response.py deleted file mode 100644 index 55981f8..0000000 --- a/src/slash_sdk/types/pay_send_response.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal, TypeAlias - -from .._models import BaseModel - -__all__ = ["PaySendResponse", "UnionMember0", "UnionMember1"] - - -class UnionMember0(BaseModel): - success: Literal[True] - - redirect: Optional[str] = None - - -class UnionMember1(BaseModel): - error: str - - success: Literal[False] - - -PaySendResponse: TypeAlias = Union[UnionMember0, UnionMember1] diff --git a/src/slash_sdk/types/slash_handle.py b/src/slash_sdk/types/slash_handle.py deleted file mode 100644 index 8434e05..0000000 --- a/src/slash_sdk/types/slash_handle.py +++ /dev/null @@ -1,23 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from pydantic import Field as FieldInfo - -from .._models import BaseModel - -__all__ = ["SlashHandle"] - - -class SlashHandle(BaseModel): - """Details about a single SlashHandle""" - - id: str - """The id of the SlashHandle""" - - account_id: str = FieldInfo(alias="accountId") - """The ID of the account that will send and receive funds for this entity""" - - name: str - """The display name of the entity""" - - slash_handle: str = FieldInfo(alias="slashHandle") - """The username that others can use to send money to this entity""" diff --git a/src/slash_sdk/types/slash_handle_list_params.py b/src/slash_sdk/types/slash_handle_list_params.py deleted file mode 100644 index 0e996e8..0000000 --- a/src/slash_sdk/types/slash_handle_list_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["SlashHandleListParams"] - - -class SlashHandleListParams(TypedDict, total=False): - cursor: str - """A cursor string to fetch the next page of results""" diff --git a/src/slash_sdk/types/slash_handle_list_response.py b/src/slash_sdk/types/slash_handle_list_response.py deleted file mode 100644 index dfd2e55..0000000 --- a/src/slash_sdk/types/slash_handle_list_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .._models import BaseModel -from .slash_handle import SlashHandle -from .pagination_response import PaginationResponse - -__all__ = ["SlashHandleListResponse"] - - -class SlashHandleListResponse(BaseModel): - items: List[SlashHandle] - - metadata: PaginationResponse - """Response sent when requesting a list of data""" diff --git a/tests/api_resources/test_pay.py b/tests/api_resources/test_pay.py deleted file mode 100644 index b2fe0b7..0000000 --- a/tests/api_resources/test_pay.py +++ /dev/null @@ -1,176 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from slash_sdk import SlashSDK, AsyncSlashSDK -from tests.utils import assert_matches_type -from slash_sdk.types import SlashHandle, PaySendResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestPay: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_retrieve(self, client: SlashSDK) -> None: - pay = client.pay.retrieve() - assert_matches_type(SlashHandle, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_retrieve(self, client: SlashSDK) -> None: - response = client.pay.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pay = response.parse() - assert_matches_type(SlashHandle, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_retrieve(self, client: SlashSDK) -> None: - with client.pay.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pay = response.parse() - assert_matches_type(SlashHandle, pay, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_send(self, client: SlashSDK) -> None: - pay = client.pay.send( - amount_cents=0, - slash_handle="slashHandle", - ) - assert_matches_type(PaySendResponse, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_send_with_all_params(self, client: SlashSDK) -> None: - pay = client.pay.send( - amount_cents=0, - slash_handle="slashHandle", - legal_entity_id="legalEntityId", - source_slash_handle_id="sourceSlashHandleId", - ) - assert_matches_type(PaySendResponse, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_send(self, client: SlashSDK) -> None: - response = client.pay.with_raw_response.send( - amount_cents=0, - slash_handle="slashHandle", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pay = response.parse() - assert_matches_type(PaySendResponse, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_send(self, client: SlashSDK) -> None: - with client.pay.with_streaming_response.send( - amount_cents=0, - slash_handle="slashHandle", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pay = response.parse() - assert_matches_type(PaySendResponse, pay, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncPay: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_retrieve(self, async_client: AsyncSlashSDK) -> None: - pay = await async_client.pay.retrieve() - assert_matches_type(SlashHandle, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncSlashSDK) -> None: - response = await async_client.pay.with_raw_response.retrieve() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pay = await response.parse() - assert_matches_type(SlashHandle, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncSlashSDK) -> None: - async with async_client.pay.with_streaming_response.retrieve() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pay = await response.parse() - assert_matches_type(SlashHandle, pay, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_send(self, async_client: AsyncSlashSDK) -> None: - pay = await async_client.pay.send( - amount_cents=0, - slash_handle="slashHandle", - ) - assert_matches_type(PaySendResponse, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_send_with_all_params(self, async_client: AsyncSlashSDK) -> None: - pay = await async_client.pay.send( - amount_cents=0, - slash_handle="slashHandle", - legal_entity_id="legalEntityId", - source_slash_handle_id="sourceSlashHandleId", - ) - assert_matches_type(PaySendResponse, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_send(self, async_client: AsyncSlashSDK) -> None: - response = await async_client.pay.with_raw_response.send( - amount_cents=0, - slash_handle="slashHandle", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pay = await response.parse() - assert_matches_type(PaySendResponse, pay, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_send(self, async_client: AsyncSlashSDK) -> None: - async with async_client.pay.with_streaming_response.send( - amount_cents=0, - slash_handle="slashHandle", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - pay = await response.parse() - assert_matches_type(PaySendResponse, pay, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_slash_handle.py b/tests/api_resources/test_slash_handle.py deleted file mode 100644 index a1dee57..0000000 --- a/tests/api_resources/test_slash_handle.py +++ /dev/null @@ -1,96 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from slash_sdk import SlashSDK, AsyncSlashSDK -from tests.utils import assert_matches_type -from slash_sdk.types import SlashHandleListResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSlashHandle: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list(self, client: SlashSDK) -> None: - slash_handle = client.slash_handle.list() - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_list_with_all_params(self, client: SlashSDK) -> None: - slash_handle = client.slash_handle.list( - cursor="cursor", - ) - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_list(self, client: SlashSDK) -> None: - response = client.slash_handle.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - slash_handle = response.parse() - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_list(self, client: SlashSDK) -> None: - with client.slash_handle.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - slash_handle = response.parse() - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncSlashHandle: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list(self, async_client: AsyncSlashSDK) -> None: - slash_handle = await async_client.slash_handle.list() - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncSlashSDK) -> None: - slash_handle = await async_client.slash_handle.list( - cursor="cursor", - ) - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_list(self, async_client: AsyncSlashSDK) -> None: - response = await async_client.slash_handle.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - slash_handle = await response.parse() - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_list(self, async_client: AsyncSlashSDK) -> None: - async with async_client.slash_handle.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - slash_handle = await response.parse() - assert_matches_type(SlashHandleListResponse, slash_handle, path=["response"]) - - assert cast(Any, response.is_closed) is True From 47ea2de42a4430641a44e10101e79693cfa94ba4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 05:30:36 +0000 Subject: [PATCH 08/34] feat(api): api update --- .stats.yml | 4 ++-- src/slash_sdk/resources/transaction.py | 16 ++++++++++++++++ .../types/transaction_aggregate_params.py | 6 ++++++ src/slash_sdk/types/transaction_list_params.py | 6 ++++++ tests/api_resources/test_transaction.py | 4 ++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dacec26..f4bb3dc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-5f96f1193e2d0809bc7cdf7b04368f1d3acca07405784cc46087a01daf4c362f.yml -openapi_spec_hash: 6929a4ff6ab1460410822068a7975f9d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-3994cb88af041581aeea72c0e16b234001cd1851be73d9d1abfea59b20b8d57c.yml +openapi_spec_hash: 635c6b8535be6d7f0636af551ff9f9b1 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 diff --git a/src/slash_sdk/resources/transaction.py b/src/slash_sdk/resources/transaction.py index d54ef42..df4095a 100644 --- a/src/slash_sdk/resources/transaction.py +++ b/src/slash_sdk/resources/transaction.py @@ -87,6 +87,7 @@ def list( cursor: str | Omit = omit, filter_account_id: str | Omit = omit, filter_card_id: str | Omit = omit, + filter_category: Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"] | Omit = omit, filter_detailed_status: Literal[ "pending", "canceled", "failed", "settled", "declined", "refund", "reversed", "returned", "dispute" ] @@ -119,6 +120,8 @@ def list( filter_card_id: Filter transactions by cardId + filter_category: Filter transactions by category type + filter_detailed_status: Filter transactions by detailed status filter_from_authorized_at: Pass in a unix timestamp in milliseconds to filter transactions by authorization @@ -166,6 +169,7 @@ def list( "cursor": cursor, "filter_account_id": filter_account_id, "filter_card_id": filter_card_id, + "filter_category": filter_category, "filter_detailed_status": filter_detailed_status, "filter_from_authorized_at": filter_from_authorized_at, "filter_from_date": filter_from_date, @@ -188,6 +192,7 @@ def aggregate( account_id: str | Omit = omit, filter_account_id: str | Omit = omit, filter_card_id: str | Omit = omit, + filter_category: Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"] | Omit = omit, filter_detailed_status: Literal[ "pending", "canceled", "failed", "settled", "declined", "refund", "reversed", "returned", "dispute" ] @@ -217,6 +222,8 @@ def aggregate( filter_card_id: Filter transactions by cardId + filter_category: Filter transactions by category type + filter_detailed_status: Filter transactions by detailed status filter_from_authorized_at: Pass in a unix timestamp in milliseconds to filter transactions by authorization @@ -261,6 +268,7 @@ def aggregate( "account_id": account_id, "filter_account_id": filter_account_id, "filter_card_id": filter_card_id, + "filter_category": filter_category, "filter_detailed_status": filter_detailed_status, "filter_from_authorized_at": filter_from_authorized_at, "filter_from_date": filter_from_date, @@ -405,6 +413,7 @@ async def list( cursor: str | Omit = omit, filter_account_id: str | Omit = omit, filter_card_id: str | Omit = omit, + filter_category: Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"] | Omit = omit, filter_detailed_status: Literal[ "pending", "canceled", "failed", "settled", "declined", "refund", "reversed", "returned", "dispute" ] @@ -437,6 +446,8 @@ async def list( filter_card_id: Filter transactions by cardId + filter_category: Filter transactions by category type + filter_detailed_status: Filter transactions by detailed status filter_from_authorized_at: Pass in a unix timestamp in milliseconds to filter transactions by authorization @@ -484,6 +495,7 @@ async def list( "cursor": cursor, "filter_account_id": filter_account_id, "filter_card_id": filter_card_id, + "filter_category": filter_category, "filter_detailed_status": filter_detailed_status, "filter_from_authorized_at": filter_from_authorized_at, "filter_from_date": filter_from_date, @@ -506,6 +518,7 @@ async def aggregate( account_id: str | Omit = omit, filter_account_id: str | Omit = omit, filter_card_id: str | Omit = omit, + filter_category: Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"] | Omit = omit, filter_detailed_status: Literal[ "pending", "canceled", "failed", "settled", "declined", "refund", "reversed", "returned", "dispute" ] @@ -535,6 +548,8 @@ async def aggregate( filter_card_id: Filter transactions by cardId + filter_category: Filter transactions by category type + filter_detailed_status: Filter transactions by detailed status filter_from_authorized_at: Pass in a unix timestamp in milliseconds to filter transactions by authorization @@ -579,6 +594,7 @@ async def aggregate( "account_id": account_id, "filter_account_id": filter_account_id, "filter_card_id": filter_card_id, + "filter_category": filter_category, "filter_detailed_status": filter_detailed_status, "filter_from_authorized_at": filter_from_authorized_at, "filter_from_date": filter_from_date, diff --git a/src/slash_sdk/types/transaction_aggregate_params.py b/src/slash_sdk/types/transaction_aggregate_params.py index 96c9751..86c3831 100644 --- a/src/slash_sdk/types/transaction_aggregate_params.py +++ b/src/slash_sdk/types/transaction_aggregate_params.py @@ -22,6 +22,12 @@ class TransactionAggregateParams(TypedDict, total=False): filter_card_id: Annotated[str, PropertyInfo(alias="filter:cardId")] """Filter transactions by cardId""" + filter_category: Annotated[ + Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"], + PropertyInfo(alias="filter:category"), + ] + """Filter transactions by category type""" + filter_detailed_status: Annotated[ Literal["pending", "canceled", "failed", "settled", "declined", "refund", "reversed", "returned", "dispute"], PropertyInfo(alias="filter:detailed_status"), diff --git a/src/slash_sdk/types/transaction_list_params.py b/src/slash_sdk/types/transaction_list_params.py index edea1d3..fed1d42 100644 --- a/src/slash_sdk/types/transaction_list_params.py +++ b/src/slash_sdk/types/transaction_list_params.py @@ -25,6 +25,12 @@ class TransactionListParams(TypedDict, total=False): filter_card_id: Annotated[str, PropertyInfo(alias="filter:cardId")] """Filter transactions by cardId""" + filter_category: Annotated[ + Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"], + PropertyInfo(alias="filter:category"), + ] + """Filter transactions by category type""" + filter_detailed_status: Annotated[ Literal["pending", "canceled", "failed", "settled", "declined", "refund", "reversed", "returned", "dispute"], PropertyInfo(alias="filter:detailed_status"), diff --git a/tests/api_resources/test_transaction.py b/tests/api_resources/test_transaction.py index 9e3be9b..0964e5f 100644 --- a/tests/api_resources/test_transaction.py +++ b/tests/api_resources/test_transaction.py @@ -79,6 +79,7 @@ def test_method_list_with_all_params(self, client: SlashSDK) -> None: cursor="cursor", filter_account_id="filter:accountId", filter_card_id="filter:cardId", + filter_category="card", filter_detailed_status="pending", filter_from_authorized_at="filter:from_authorized_at", filter_from_date="filter:from_date", @@ -126,6 +127,7 @@ def test_method_aggregate_with_all_params(self, client: SlashSDK) -> None: account_id="accountId", filter_account_id="filter:accountId", filter_card_id="filter:cardId", + filter_category="card", filter_detailed_status="pending", filter_from_authorized_at="filter:from_authorized_at", filter_from_date="filter:from_date", @@ -309,6 +311,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSlashSDK) -> cursor="cursor", filter_account_id="filter:accountId", filter_card_id="filter:cardId", + filter_category="card", filter_detailed_status="pending", filter_from_authorized_at="filter:from_authorized_at", filter_from_date="filter:from_date", @@ -356,6 +359,7 @@ async def test_method_aggregate_with_all_params(self, async_client: AsyncSlashSD account_id="accountId", filter_account_id="filter:accountId", filter_card_id="filter:cardId", + filter_category="card", filter_detailed_status="pending", filter_from_authorized_at="filter:from_authorized_at", filter_from_date="filter:from_date", From f1eff440f3ef4ed6a0495ccba3ecd7826d862c9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2026 22:12:42 +0000 Subject: [PATCH 09/34] feat(api): api update --- .stats.yml | 4 ++-- src/slash_sdk/resources/transaction.py | 10 ++++++++++ src/slash_sdk/types/transaction_list_params.py | 7 +++++++ tests/api_resources/test_transaction.py | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f4bb3dc..a42939b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-3994cb88af041581aeea72c0e16b234001cd1851be73d9d1abfea59b20b8d57c.yml -openapi_spec_hash: 635c6b8535be6d7f0636af551ff9f9b1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-f26e7721a21cee0988d9ee91a255093044bcc12d61ec33460a35223c677bcfd7.yml +openapi_spec_hash: d88ce202bf6a57798952c9ffca5c851e config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 diff --git a/src/slash_sdk/resources/transaction.py b/src/slash_sdk/resources/transaction.py index df4095a..2c702d6 100644 --- a/src/slash_sdk/resources/transaction.py +++ b/src/slash_sdk/resources/transaction.py @@ -86,6 +86,7 @@ def list( account_id: str | Omit = omit, cursor: str | Omit = omit, filter_account_id: str | Omit = omit, + filter_card_group_id: str | Omit = omit, filter_card_id: str | Omit = omit, filter_category: Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"] | Omit = omit, filter_detailed_status: Literal[ @@ -118,6 +119,9 @@ def list( filter_account_id: Pass in an account ID to filter transactions by account ID. This will return all transactions that match the account ID passed in. + filter_card_group_id: Filter transactions by card group ID. This will return all card transactions + that belong to cards in the specified card group. + filter_card_id: Filter transactions by cardId filter_category: Filter transactions by category type @@ -168,6 +172,7 @@ def list( "account_id": account_id, "cursor": cursor, "filter_account_id": filter_account_id, + "filter_card_group_id": filter_card_group_id, "filter_card_id": filter_card_id, "filter_category": filter_category, "filter_detailed_status": filter_detailed_status, @@ -412,6 +417,7 @@ async def list( account_id: str | Omit = omit, cursor: str | Omit = omit, filter_account_id: str | Omit = omit, + filter_card_group_id: str | Omit = omit, filter_card_id: str | Omit = omit, filter_category: Literal["card", "ach", "wire", "international_wire", "rtp", "fee", "internal"] | Omit = omit, filter_detailed_status: Literal[ @@ -444,6 +450,9 @@ async def list( filter_account_id: Pass in an account ID to filter transactions by account ID. This will return all transactions that match the account ID passed in. + filter_card_group_id: Filter transactions by card group ID. This will return all card transactions + that belong to cards in the specified card group. + filter_card_id: Filter transactions by cardId filter_category: Filter transactions by category type @@ -494,6 +503,7 @@ async def list( "account_id": account_id, "cursor": cursor, "filter_account_id": filter_account_id, + "filter_card_group_id": filter_card_group_id, "filter_card_id": filter_card_id, "filter_category": filter_category, "filter_detailed_status": filter_detailed_status, diff --git a/src/slash_sdk/types/transaction_list_params.py b/src/slash_sdk/types/transaction_list_params.py index fed1d42..91007bf 100644 --- a/src/slash_sdk/types/transaction_list_params.py +++ b/src/slash_sdk/types/transaction_list_params.py @@ -22,6 +22,13 @@ class TransactionListParams(TypedDict, total=False): This will return all transactions that match the account ID passed in. """ + filter_card_group_id: Annotated[str, PropertyInfo(alias="filter:cardGroupId")] + """Filter transactions by card group ID. + + This will return all card transactions that belong to cards in the specified + card group. + """ + filter_card_id: Annotated[str, PropertyInfo(alias="filter:cardId")] """Filter transactions by cardId""" diff --git a/tests/api_resources/test_transaction.py b/tests/api_resources/test_transaction.py index 0964e5f..1cd23f1 100644 --- a/tests/api_resources/test_transaction.py +++ b/tests/api_resources/test_transaction.py @@ -78,6 +78,7 @@ def test_method_list_with_all_params(self, client: SlashSDK) -> None: account_id="accountId", cursor="cursor", filter_account_id="filter:accountId", + filter_card_group_id="filter:cardGroupId", filter_card_id="filter:cardId", filter_category="card", filter_detailed_status="pending", @@ -310,6 +311,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncSlashSDK) -> account_id="accountId", cursor="cursor", filter_account_id="filter:accountId", + filter_card_group_id="filter:cardGroupId", filter_card_id="filter:cardId", filter_category="card", filter_detailed_status="pending", From 69a46d3e8f0346e3cefb71a5258267e91322abfe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 19:35:37 +0000 Subject: [PATCH 10/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a42939b..af998b9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-f26e7721a21cee0988d9ee91a255093044bcc12d61ec33460a35223c677bcfd7.yml -openapi_spec_hash: d88ce202bf6a57798952c9ffca5c851e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-c89f8785f84ed2d7f44fbb6d07932bf4b38f5c11b20af7c828b399095f2698b7.yml +openapi_spec_hash: 7c5bb49bd49ab839dd151b8e66a0721e config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 7a99863a0fc92c44b19e44c0e46ec0dee21e47f8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 22:30:38 +0000 Subject: [PATCH 11/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index af998b9..351399c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-c89f8785f84ed2d7f44fbb6d07932bf4b38f5c11b20af7c828b399095f2698b7.yml -openapi_spec_hash: 7c5bb49bd49ab839dd151b8e66a0721e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-1c0d144e1ac5b28e906cce432b2415585496c28a413fcfb52ea8af4ea940799e.yml +openapi_spec_hash: f63034ff785422e5f00ae6570e8d6e3b config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 5f3d61dd1364b8f8c34c2f55f87102823144a603 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 06:30:39 +0000 Subject: [PATCH 12/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 351399c..28538f3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-1c0d144e1ac5b28e906cce432b2415585496c28a413fcfb52ea8af4ea940799e.yml -openapi_spec_hash: f63034ff785422e5f00ae6570e8d6e3b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-c6a2c14f8d482899f828dd0a57c84c38c4d75ffbf0afac5d60e8cccc68f2eaf4.yml +openapi_spec_hash: ff217aef5b72e95b076d9a6837cbd83d config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 92b23751d66f4c8e7a73c97bc57e8d11a40ed174 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2026 10:30:41 +0000 Subject: [PATCH 13/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 28538f3..9e00393 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-c6a2c14f8d482899f828dd0a57c84c38c4d75ffbf0afac5d60e8cccc68f2eaf4.yml -openapi_spec_hash: ff217aef5b72e95b076d9a6837cbd83d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-967ca7ecd5a8719048480ac299c1fba7ba23b689a2757ae8a4286dbc73ce8c06.yml +openapi_spec_hash: bc23b9abe5a49d18e3f1679c4043f672 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From a81ebd50a8f9ad52ecc1041b3ead8ba159a6d9d4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 23:30:50 +0000 Subject: [PATCH 14/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9e00393..049ef94 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-967ca7ecd5a8719048480ac299c1fba7ba23b689a2757ae8a4286dbc73ce8c06.yml -openapi_spec_hash: bc23b9abe5a49d18e3f1679c4043f672 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-5b9b20dfddefb3747ad6547d22a8daeb6413e56a2169e0de2a0dfa70782d5a42.yml +openapi_spec_hash: 7476af4a0e29d8cf7f846e92ea474e28 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 916df298793981ab5a894c72b33913cf2739bb92 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 08:30:39 +0000 Subject: [PATCH 15/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 049ef94..320b786 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-5b9b20dfddefb3747ad6547d22a8daeb6413e56a2169e0de2a0dfa70782d5a42.yml -openapi_spec_hash: 7476af4a0e29d8cf7f846e92ea474e28 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-4226bdbb0058fe2ec8115341d2d348e1c9731aba82702f9df1736457c5752ef1.yml +openapi_spec_hash: 7e429d0c54e313a5c12c1d8be04b6e57 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 2d11f9b1903e6f454ebb23e1141ebaa03373cfb6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:42:35 +0000 Subject: [PATCH 16/34] fix(pydantic): do not pass `by_alias` unless set --- src/slash_sdk/_compat.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/slash_sdk/_compat.py b/src/slash_sdk/_compat.py index 786ff42..e6690a4 100644 --- a/src/slash_sdk/_compat.py +++ b/src/slash_sdk/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -142,6 +146,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -149,7 +156,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", From acdef8e72361b2a7b24485d67f68e357c48de380 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:47:56 +0000 Subject: [PATCH 17/34] fix(deps): bump minimum typing-extensions version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7be5265..f98814d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", + "typing-extensions>=4.14, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", From 504ef27f0aab30e84c40a2f08d89eda3085d7547 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:51:29 +0000 Subject: [PATCH 18/34] chore(internal): tweak CI branches --- .github/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bec92b0..3472c63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' From f3d8b79a99fbe26244ceed68eb5f68815faeb710 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 18:30:45 +0000 Subject: [PATCH 19/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 320b786..3276c05 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-4226bdbb0058fe2ec8115341d2d348e1c9731aba82702f9df1736457c5752ef1.yml -openapi_spec_hash: 7e429d0c54e313a5c12c1d8be04b6e57 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-50ca6d07e02dcf5af61efb3373e6a859f5330959e045267c0643f9e073761702.yml +openapi_spec_hash: 494c7ea0b7a1688a9c48e8871b19d077 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From ce53cefe50c4fd5fc0ed31406e4881cc7c464c65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 06:30:46 +0000 Subject: [PATCH 20/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3276c05..519ac6a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-50ca6d07e02dcf5af61efb3373e6a859f5330959e045267c0643f9e073761702.yml -openapi_spec_hash: 494c7ea0b7a1688a9c48e8871b19d077 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-41286c1f03c0277c31018b9b6c9c676c56961f75dcf1d363ddbcd2fe1948c9aa.yml +openapi_spec_hash: c80526f85efdeebf8b3341c79d43a11a config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 509a588cf24e5549ea16f55a4c178a1b9a221935 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 03:52:40 +0000 Subject: [PATCH 21/34] fix: sanitize endpoint path params --- src/slash_sdk/_utils/__init__.py | 1 + src/slash_sdk/_utils/_path.py | 127 ++++++++++++++++++ src/slash_sdk/resources/account.py | 10 +- src/slash_sdk/resources/card/card.py | 14 +- .../resources/card/spending_constraint.py | 10 +- .../resources/card_group/card_group.py | 14 +- .../card_group/spending_constraint.py | 10 +- src/slash_sdk/resources/developer_account.py | 10 +- .../resources/developer_application.py | 28 +++- .../resources/fdx/accounts/accounts.py | 18 +-- .../resources/fdx/accounts/statements.py | 14 +- src/slash_sdk/resources/merchant.py | 6 +- src/slash_sdk/resources/transaction.py | 14 +- src/slash_sdk/resources/virtual_account.py | 10 +- src/slash_sdk/resources/webhook.py | 6 +- tests/test_utils/test_path.py | 89 ++++++++++++ 16 files changed, 310 insertions(+), 71 deletions(-) create mode 100644 src/slash_sdk/_utils/_path.py create mode 100644 tests/test_utils/test_path.py diff --git a/src/slash_sdk/_utils/__init__.py b/src/slash_sdk/_utils/__init__.py index dc64e29..10cb66d 100644 --- a/src/slash_sdk/_utils/__init__.py +++ b/src/slash_sdk/_utils/__init__.py @@ -1,3 +1,4 @@ +from ._path import path_template as path_template from ._sync import asyncify as asyncify from ._proxy import LazyProxy as LazyProxy from ._utils import ( diff --git a/src/slash_sdk/_utils/_path.py b/src/slash_sdk/_utils/_path.py new file mode 100644 index 0000000..4d6e1e4 --- /dev/null +++ b/src/slash_sdk/_utils/_path.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from typing import ( + Any, + Mapping, + Callable, +) +from urllib.parse import quote + +# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). +_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") + +_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}") + + +def _quote_path_segment_part(value: str) -> str: + """Percent-encode `value` for use in a URI path segment. + + Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + """ + # quote() already treats unreserved characters (letters, digits, and -._~) + # as safe, so we only need to add sub-delims, ':', and '@'. + # Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted. + return quote(value, safe="!$&'()*+,;=:@") + + +def _quote_query_part(value: str) -> str: + """Percent-encode `value` for use in a URI query string. + + Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + """ + return quote(value, safe="!$'()*+,;:@/?") + + +def _quote_fragment_part(value: str) -> str: + """Percent-encode `value` for use in a URI fragment. + + Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.5 + """ + return quote(value, safe="!$&'()*+,;=:@/?") + + +def _interpolate( + template: str, + values: Mapping[str, Any], + quoter: Callable[[str], str], +) -> str: + """Replace {name} placeholders in `template`, quoting each value with `quoter`. + + Placeholder names are looked up in `values`. + + Raises: + KeyError: If a placeholder is not found in `values`. + """ + # re.split with a capturing group returns alternating + # [text, name, text, name, ..., text] elements. + parts = _PLACEHOLDER_RE.split(template) + + for i in range(1, len(parts), 2): + name = parts[i] + if name not in values: + raise KeyError(f"a value for placeholder {{{name}}} was not provided") + val = values[name] + if val is None: + parts[i] = "null" + elif isinstance(val, bool): + parts[i] = "true" if val else "false" + else: + parts[i] = quoter(str(values[name])) + + return "".join(parts) + + +def path_template(template: str, /, **kwargs: Any) -> str: + """Interpolate {name} placeholders in `template` from keyword arguments. + + Args: + template: The template string containing {name} placeholders. + **kwargs: Keyword arguments to interpolate into the template. + + Returns: + The template with placeholders interpolated and percent-encoded. + + Safe characters for percent-encoding are dependent on the URI component. + Placeholders in path and fragment portions are percent-encoded where the `segment` + and `fragment` sets from RFC 3986 respectively are considered safe. + Placeholders in the query portion are percent-encoded where the `query` set from + RFC 3986 §3.3 is considered safe except for = and & characters. + + Raises: + KeyError: If a placeholder is not found in `kwargs`. + ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments). + """ + # Split the template into path, query, and fragment portions. + fragment_template: str | None = None + query_template: str | None = None + + rest = template + if "#" in rest: + rest, fragment_template = rest.split("#", 1) + if "?" in rest: + rest, query_template = rest.split("?", 1) + path_template = rest + + # Interpolate each portion with the appropriate quoting rules. + path_result = _interpolate(path_template, kwargs, _quote_path_segment_part) + + # Reject dot-segments (. and ..) in the final assembled path. The check + # runs after interpolation so that adjacent placeholders or a mix of static + # text and placeholders that together form a dot-segment are caught. + # Also reject percent-encoded dot-segments to protect against incorrectly + # implemented normalization in servers/proxies. + for segment in path_result.split("/"): + if _DOT_SEGMENT_RE.match(segment): + raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed") + + result = path_result + if query_template is not None: + result += "?" + _interpolate(query_template, kwargs, _quote_query_part) + if fragment_template is not None: + result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part) + + return result diff --git a/src/slash_sdk/resources/account.py b/src/slash_sdk/resources/account.py index 3e28203..c61c47c 100644 --- a/src/slash_sdk/resources/account.py +++ b/src/slash_sdk/resources/account.py @@ -6,7 +6,7 @@ from ..types import account_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -69,7 +69,7 @@ def retrieve( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/account/{account_id}", + path_template("/account/{account_id}", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -146,7 +146,7 @@ def retrieve_balance( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/account/{account_id}/balance", + path_template("/account/{account_id}/balance", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -200,7 +200,7 @@ async def retrieve( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/account/{account_id}", + path_template("/account/{account_id}", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -277,7 +277,7 @@ async def retrieve_balance( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/account/{account_id}/balance", + path_template("/account/{account_id}/balance", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/slash_sdk/resources/card/card.py b/src/slash_sdk/resources/card/card.py index d0f689e..6af6684 100644 --- a/src/slash_sdk/resources/card/card.py +++ b/src/slash_sdk/resources/card/card.py @@ -9,7 +9,7 @@ from ...types import CardStatus, card_list_params, card_create_params, card_update_params, card_retrieve_params from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -165,7 +165,7 @@ def retrieve( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._get( - f"/card/{card_id}", + path_template("/card/{card_id}", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -221,7 +221,7 @@ def update( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._patch( - f"/card/{card_id}", + path_template("/card/{card_id}", card_id=card_id), body=maybe_transform( { "card_group_id": card_group_id, @@ -348,7 +348,7 @@ def get_utilization( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._get( - f"/card/{card_id}/utilization", + path_template("/card/{card_id}/utilization", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -485,7 +485,7 @@ async def retrieve( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._get( - f"/card/{card_id}", + path_template("/card/{card_id}", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,7 +541,7 @@ async def update( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._patch( - f"/card/{card_id}", + path_template("/card/{card_id}", card_id=card_id), body=await async_maybe_transform( { "card_group_id": card_group_id, @@ -668,7 +668,7 @@ async def get_utilization( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._get( - f"/card/{card_id}/utilization", + path_template("/card/{card_id}/utilization", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/slash_sdk/resources/card/spending_constraint.py b/src/slash_sdk/resources/card/spending_constraint.py index 9e43f11..30110ec 100644 --- a/src/slash_sdk/resources/card/spending_constraint.py +++ b/src/slash_sdk/resources/card/spending_constraint.py @@ -7,7 +7,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -75,7 +75,7 @@ def update_full( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._put( - f"/card/{card_id}/spending-constraint", + path_template("/card/{card_id}/spending-constraint", card_id=card_id), body=maybe_transform( { "country_rule": country_rule, @@ -126,7 +126,7 @@ def update_partial( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._patch( - f"/card/{card_id}/spending-constraint", + path_template("/card/{card_id}/spending-constraint", card_id=card_id), body=maybe_transform( { "country_rule": country_rule, @@ -196,7 +196,7 @@ async def update_full( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._put( - f"/card/{card_id}/spending-constraint", + path_template("/card/{card_id}/spending-constraint", card_id=card_id), body=await async_maybe_transform( { "country_rule": country_rule, @@ -247,7 +247,7 @@ async def update_partial( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._patch( - f"/card/{card_id}/spending-constraint", + path_template("/card/{card_id}/spending-constraint", card_id=card_id), body=await async_maybe_transform( { "country_rule": country_rule, diff --git a/src/slash_sdk/resources/card_group/card_group.py b/src/slash_sdk/resources/card_group/card_group.py index beabdb1..9702f8a 100644 --- a/src/slash_sdk/resources/card_group/card_group.py +++ b/src/slash_sdk/resources/card_group/card_group.py @@ -9,7 +9,7 @@ from ...types import card_group_list_params, card_group_create_params, card_group_update_params from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -131,7 +131,7 @@ def retrieve( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return self._get( - f"/card-group/{card_group_id}", + path_template("/card-group/{card_group_id}", card_group_id=card_group_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -169,7 +169,7 @@ def update( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return self._patch( - f"/card-group/{card_group_id}", + path_template("/card-group/{card_group_id}", card_group_id=card_group_id), body=maybe_transform( { "name": name, @@ -264,7 +264,7 @@ def get_utilization( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return self._get( - f"/card-group/{card_group_id}/utilization", + path_template("/card-group/{card_group_id}/utilization", card_group_id=card_group_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -368,7 +368,7 @@ async def retrieve( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return await self._get( - f"/card-group/{card_group_id}", + path_template("/card-group/{card_group_id}", card_group_id=card_group_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,7 +406,7 @@ async def update( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return await self._patch( - f"/card-group/{card_group_id}", + path_template("/card-group/{card_group_id}", card_group_id=card_group_id), body=await async_maybe_transform( { "name": name, @@ -501,7 +501,7 @@ async def get_utilization( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return await self._get( - f"/card-group/{card_group_id}/utilization", + path_template("/card-group/{card_group_id}/utilization", card_group_id=card_group_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/slash_sdk/resources/card_group/spending_constraint.py b/src/slash_sdk/resources/card_group/spending_constraint.py index 5041d30..035ff19 100644 --- a/src/slash_sdk/resources/card_group/spending_constraint.py +++ b/src/slash_sdk/resources/card_group/spending_constraint.py @@ -7,7 +7,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -75,7 +75,7 @@ def update_full( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return self._put( - f"/card-group/{card_group_id}/spending-constraint", + path_template("/card-group/{card_group_id}/spending-constraint", card_group_id=card_group_id), body=maybe_transform( { "country_rule": country_rule, @@ -126,7 +126,7 @@ def update_partial( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return self._patch( - f"/card-group/{card_group_id}/spending-constraint", + path_template("/card-group/{card_group_id}/spending-constraint", card_group_id=card_group_id), body=maybe_transform( { "country_rule": country_rule, @@ -196,7 +196,7 @@ async def update_full( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return await self._put( - f"/card-group/{card_group_id}/spending-constraint", + path_template("/card-group/{card_group_id}/spending-constraint", card_group_id=card_group_id), body=await async_maybe_transform( { "country_rule": country_rule, @@ -247,7 +247,7 @@ async def update_partial( if not card_group_id: raise ValueError(f"Expected a non-empty value for `card_group_id` but received {card_group_id!r}") return await self._patch( - f"/card-group/{card_group_id}/spending-constraint", + path_template("/card-group/{card_group_id}/spending-constraint", card_group_id=card_group_id), body=await async_maybe_transform( { "country_rule": country_rule, diff --git a/src/slash_sdk/resources/developer_account.py b/src/slash_sdk/resources/developer_account.py index b8f031f..a3a29c6 100644 --- a/src/slash_sdk/resources/developer_account.py +++ b/src/slash_sdk/resources/developer_account.py @@ -6,7 +6,7 @@ from ..types import DeveloperApplicationType, developer_account_create_application_params from .._types import Body, Query, Headers, NotGiven, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -74,7 +74,9 @@ def create_application( f"Expected a non-empty value for `developer_account_id` but received {developer_account_id!r}" ) return self._post( - f"/developer-account/{developer_account_id}/application", + path_template( + "/developer-account/{developer_account_id}/application", developer_account_id=developer_account_id + ), body=maybe_transform( { "data": data, @@ -141,7 +143,9 @@ async def create_application( f"Expected a non-empty value for `developer_account_id` but received {developer_account_id!r}" ) return await self._post( - f"/developer-account/{developer_account_id}/application", + path_template( + "/developer-account/{developer_account_id}/application", developer_account_id=developer_account_id + ), body=await async_maybe_transform( { "data": data, diff --git a/src/slash_sdk/resources/developer_application.py b/src/slash_sdk/resources/developer_application.py index e46610e..5b046f1 100644 --- a/src/slash_sdk/resources/developer_application.py +++ b/src/slash_sdk/resources/developer_application.py @@ -6,7 +6,7 @@ from ..types import developer_application_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -70,7 +70,9 @@ def retrieve( f"Expected a non-empty value for `developer_application_id` but received {developer_application_id!r}" ) return self._get( - f"/developer-application/{developer_application_id}", + path_template( + "/developer-application/{developer_application_id}", developer_application_id=developer_application_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -107,7 +109,9 @@ def update( f"Expected a non-empty value for `developer_application_id` but received {developer_application_id!r}" ) return self._patch( - f"/developer-application/{developer_application_id}", + path_template( + "/developer-application/{developer_application_id}", developer_application_id=developer_application_id + ), body=maybe_transform( { "data": data, @@ -149,7 +153,10 @@ def create_or_regenerate_secret( f"Expected a non-empty value for `developer_application_id` but received {developer_application_id!r}" ) return self._post( - f"/developer-application/{developer_application_id}/secret", + path_template( + "/developer-application/{developer_application_id}/secret", + developer_application_id=developer_application_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -205,7 +212,9 @@ async def retrieve( f"Expected a non-empty value for `developer_application_id` but received {developer_application_id!r}" ) return await self._get( - f"/developer-application/{developer_application_id}", + path_template( + "/developer-application/{developer_application_id}", developer_application_id=developer_application_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -242,7 +251,9 @@ async def update( f"Expected a non-empty value for `developer_application_id` but received {developer_application_id!r}" ) return await self._patch( - f"/developer-application/{developer_application_id}", + path_template( + "/developer-application/{developer_application_id}", developer_application_id=developer_application_id + ), body=await async_maybe_transform( { "data": data, @@ -284,7 +295,10 @@ async def create_or_regenerate_secret( f"Expected a non-empty value for `developer_application_id` but received {developer_application_id!r}" ) return await self._post( - f"/developer-application/{developer_application_id}/secret", + path_template( + "/developer-application/{developer_application_id}/secret", + developer_application_id=developer_application_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/slash_sdk/resources/fdx/accounts/accounts.py b/src/slash_sdk/resources/fdx/accounts/accounts.py index 232b565..ac4bd96 100644 --- a/src/slash_sdk/resources/fdx/accounts/accounts.py +++ b/src/slash_sdk/resources/fdx/accounts/accounts.py @@ -7,7 +7,7 @@ import httpx from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform +from ...._utils import path_template, maybe_transform, async_maybe_transform from ...._compat import cached_property from .statements import ( StatementsResource, @@ -91,7 +91,7 @@ def retrieve( return cast( AccountRetrieveResponse, self._get( - f"/fdx/accounts/{account_id}", + path_template("/fdx/accounts/{account_id}", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -185,7 +185,7 @@ def list_transactions( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/fdx/accounts/{account_id}/transactions", + path_template("/fdx/accounts/{account_id}/transactions", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +230,7 @@ def retrieve_contact( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/fdx/accounts/{account_id}/contact", + path_template("/fdx/accounts/{account_id}/contact", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -269,7 +269,7 @@ def retrieve_payment_networks( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/fdx/accounts/{account_id}/payment-networks", + path_template("/fdx/accounts/{account_id}/payment-networks", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -339,7 +339,7 @@ async def retrieve( return cast( AccountRetrieveResponse, await self._get( - f"/fdx/accounts/{account_id}", + path_template("/fdx/accounts/{account_id}", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -433,7 +433,7 @@ async def list_transactions( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/fdx/accounts/{account_id}/transactions", + path_template("/fdx/accounts/{account_id}/transactions", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -478,7 +478,7 @@ async def retrieve_contact( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/fdx/accounts/{account_id}/contact", + path_template("/fdx/accounts/{account_id}/contact", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -517,7 +517,7 @@ async def retrieve_payment_networks( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/fdx/accounts/{account_id}/payment-networks", + path_template("/fdx/accounts/{account_id}/payment-networks", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/slash_sdk/resources/fdx/accounts/statements.py b/src/slash_sdk/resources/fdx/accounts/statements.py index d18fbc7..5abbf9a 100644 --- a/src/slash_sdk/resources/fdx/accounts/statements.py +++ b/src/slash_sdk/resources/fdx/accounts/statements.py @@ -5,7 +5,7 @@ import httpx from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform +from ...._utils import path_template, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -87,7 +87,7 @@ def list( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/fdx/accounts/{account_id}/statements", + path_template("/fdx/accounts/{account_id}/statements", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -136,7 +136,9 @@ def retrieve_pdf( raise ValueError(f"Expected a non-empty value for `statement_id` but received {statement_id!r}") extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} return self._get( - f"/fdx/accounts/{account_id}/statements/{statement_id}", + path_template( + "/fdx/accounts/{account_id}/statements/{statement_id}", account_id=account_id, statement_id=statement_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -202,7 +204,7 @@ async def list( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/fdx/accounts/{account_id}/statements", + path_template("/fdx/accounts/{account_id}/statements", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -251,7 +253,9 @@ async def retrieve_pdf( raise ValueError(f"Expected a non-empty value for `statement_id` but received {statement_id!r}") extra_headers = {"Accept": "application/pdf", **(extra_headers or {})} return await self._get( - f"/fdx/accounts/{account_id}/statements/{statement_id}", + path_template( + "/fdx/accounts/{account_id}/statements/{statement_id}", account_id=account_id, statement_id=statement_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/slash_sdk/resources/merchant.py b/src/slash_sdk/resources/merchant.py index eed3bd4..a8ff825 100644 --- a/src/slash_sdk/resources/merchant.py +++ b/src/slash_sdk/resources/merchant.py @@ -6,7 +6,7 @@ from ..types import merchant_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -68,7 +68,7 @@ def retrieve( if not merchant_id: raise ValueError(f"Expected a non-empty value for `merchant_id` but received {merchant_id!r}") return self._get( - f"/merchant/{merchant_id}", + path_template("/merchant/{merchant_id}", merchant_id=merchant_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,7 +168,7 @@ async def retrieve( if not merchant_id: raise ValueError(f"Expected a non-empty value for `merchant_id` but received {merchant_id!r}") return await self._get( - f"/merchant/{merchant_id}", + path_template("/merchant/{merchant_id}", merchant_id=merchant_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/slash_sdk/resources/transaction.py b/src/slash_sdk/resources/transaction.py index 2c702d6..0ac025d 100644 --- a/src/slash_sdk/resources/transaction.py +++ b/src/slash_sdk/resources/transaction.py @@ -8,7 +8,7 @@ from ..types import transaction_list_params, transaction_aggregate_params, transaction_update_note_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -73,7 +73,7 @@ def retrieve( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return self._get( - f"/transaction/{transaction_id}", + path_template("/transaction/{transaction_id}", transaction_id=transaction_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -315,7 +315,7 @@ def retrieve_fee_details( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return self._get( - f"/transaction/{transaction_id}/fee-details", + path_template("/transaction/{transaction_id}/fee-details", transaction_id=transaction_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -349,7 +349,7 @@ def update_note( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return self._patch( - f"/transaction/{transaction_id}/note", + path_template("/transaction/{transaction_id}/note", transaction_id=transaction_id), body=maybe_transform({"note": note}, transaction_update_note_params.TransactionUpdateNoteParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -404,7 +404,7 @@ async def retrieve( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return await self._get( - f"/transaction/{transaction_id}", + path_template("/transaction/{transaction_id}", transaction_id=transaction_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -646,7 +646,7 @@ async def retrieve_fee_details( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return await self._get( - f"/transaction/{transaction_id}/fee-details", + path_template("/transaction/{transaction_id}/fee-details", transaction_id=transaction_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -680,7 +680,7 @@ async def update_note( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return await self._patch( - f"/transaction/{transaction_id}/note", + path_template("/transaction/{transaction_id}/note", transaction_id=transaction_id), body=await async_maybe_transform( {"note": note}, transaction_update_note_params.TransactionUpdateNoteParams ), diff --git a/src/slash_sdk/resources/virtual_account.py b/src/slash_sdk/resources/virtual_account.py index e34799f..b5f075f 100644 --- a/src/slash_sdk/resources/virtual_account.py +++ b/src/slash_sdk/resources/virtual_account.py @@ -12,7 +12,7 @@ virtual_account_update_params, ) from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import required_args, maybe_transform, async_maybe_transform +from .._utils import path_template, required_args, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -125,7 +125,7 @@ def retrieve( if not virtual_account_id: raise ValueError(f"Expected a non-empty value for `virtual_account_id` but received {virtual_account_id!r}") return self._get( - f"/virtual-account/{virtual_account_id}", + path_template("/virtual-account/{virtual_account_id}", virtual_account_id=virtual_account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -216,7 +216,7 @@ def update( if not virtual_account_id: raise ValueError(f"Expected a non-empty value for `virtual_account_id` but received {virtual_account_id!r}") return self._patch( - f"/virtual-account/{virtual_account_id}", + path_template("/virtual-account/{virtual_account_id}", virtual_account_id=virtual_account_id), body=maybe_transform( { "action": action, @@ -385,7 +385,7 @@ async def retrieve( if not virtual_account_id: raise ValueError(f"Expected a non-empty value for `virtual_account_id` but received {virtual_account_id!r}") return await self._get( - f"/virtual-account/{virtual_account_id}", + path_template("/virtual-account/{virtual_account_id}", virtual_account_id=virtual_account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -476,7 +476,7 @@ async def update( if not virtual_account_id: raise ValueError(f"Expected a non-empty value for `virtual_account_id` but received {virtual_account_id!r}") return await self._patch( - f"/virtual-account/{virtual_account_id}", + path_template("/virtual-account/{virtual_account_id}", virtual_account_id=virtual_account_id), body=await async_maybe_transform( { "action": action, diff --git a/src/slash_sdk/resources/webhook.py b/src/slash_sdk/resources/webhook.py index 09bee4f..8307ffd 100644 --- a/src/slash_sdk/resources/webhook.py +++ b/src/slash_sdk/resources/webhook.py @@ -8,7 +8,7 @@ from ..types import webhook_list_params, webhook_create_params, webhook_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -145,7 +145,7 @@ def update( if not webhook_id: raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}") return self._patch( - f"/webhook/{webhook_id}", + path_template("/webhook/{webhook_id}", webhook_id=webhook_id), body=maybe_transform( { "status": status, @@ -327,7 +327,7 @@ async def update( if not webhook_id: raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}") return await self._patch( - f"/webhook/{webhook_id}", + path_template("/webhook/{webhook_id}", webhook_id=webhook_id), body=await async_maybe_transform( { "status": status, diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 0000000..a614103 --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from slash_sdk._utils._path import path_template + + +@pytest.mark.parametrize( + "template, kwargs, expected", + [ + ("/v1/{id}", dict(id="abc"), "/v1/abc"), + ("/v1/{a}/{b}", dict(a="x", b="y"), "/v1/x/y"), + ("/v1/{a}{b}/path/{c}?val={d}#{e}", dict(a="x", b="y", c="z", d="u", e="v"), "/v1/xy/path/z?val=u#v"), + ("/{w}/{w}", dict(w="echo"), "/echo/echo"), + ("/v1/static", {}, "/v1/static"), + ("", {}, ""), + ("/v1/?q={n}&count=10", dict(n=42), "/v1/?q=42&count=10"), + ("/v1/{v}", dict(v=None), "/v1/null"), + ("/v1/{v}", dict(v=True), "/v1/true"), + ("/v1/{v}", dict(v=False), "/v1/false"), + ("/v1/{v}", dict(v=".hidden"), "/v1/.hidden"), # dot prefix ok + ("/v1/{v}", dict(v="file.txt"), "/v1/file.txt"), # dot in middle ok + ("/v1/{v}", dict(v="..."), "/v1/..."), # triple dot ok + ("/v1/{a}{b}", dict(a=".", b="txt"), "/v1/.txt"), # dot var combining with adjacent to be ok + ("/items?q={v}#{f}", dict(v=".", f=".."), "/items?q=.#.."), # dots in query/fragment are fine + ( + "/v1/{a}?query={b}", + dict(a="../../other/endpoint", b="a&bad=true"), + "/v1/..%2F..%2Fother%2Fendpoint?query=a%26bad%3Dtrue", + ), + ("/v1/{val}", dict(val="a/b/c"), "/v1/a%2Fb%2Fc"), + ("/v1/{val}", dict(val="a/b/c?query=value"), "/v1/a%2Fb%2Fc%3Fquery=value"), + ("/v1/{val}", dict(val="a/b/c?query=value&bad=true"), "/v1/a%2Fb%2Fc%3Fquery=value&bad=true"), + ("/v1/{val}", dict(val="%20"), "/v1/%2520"), # escapes escape sequences in input + # Query: slash and ? are safe, # is not + ("/items?q={v}", dict(v="a/b"), "/items?q=a/b"), + ("/items?q={v}", dict(v="a?b"), "/items?q=a?b"), + ("/items?q={v}", dict(v="a#b"), "/items?q=a%23b"), + ("/items?q={v}", dict(v="a b"), "/items?q=a%20b"), + # Fragment: slash and ? are safe + ("/docs#{v}", dict(v="a/b"), "/docs#a/b"), + ("/docs#{v}", dict(v="a?b"), "/docs#a?b"), + # Path: slash, ? and # are all encoded + ("/v1/{v}", dict(v="a/b"), "/v1/a%2Fb"), + ("/v1/{v}", dict(v="a?b"), "/v1/a%3Fb"), + ("/v1/{v}", dict(v="a#b"), "/v1/a%23b"), + # same var encoded differently by component + ( + "/v1/{v}?q={v}#{v}", + dict(v="a/b?c#d"), + "/v1/a%2Fb%3Fc%23d?q=a/b?c%23d#a/b?c%23d", + ), + ("/v1/{val}", dict(val="x?admin=true"), "/v1/x%3Fadmin=true"), # query injection + ("/v1/{val}", dict(val="x#admin"), "/v1/x%23admin"), # fragment injection + ], +) +def test_interpolation(template: str, kwargs: dict[str, Any], expected: str) -> None: + assert path_template(template, **kwargs) == expected + + +def test_missing_kwarg_raises_key_error() -> None: + with pytest.raises(KeyError, match="org_id"): + path_template("/v1/{org_id}") + + +@pytest.mark.parametrize( + "template, kwargs", + [ + ("{a}/path", dict(a=".")), + ("{a}/path", dict(a="..")), + ("/v1/{a}", dict(a=".")), + ("/v1/{a}", dict(a="..")), + ("/v1/{a}/path", dict(a=".")), + ("/v1/{a}/path", dict(a="..")), + ("/v1/{a}{b}", dict(a=".", b=".")), # adjacent vars → ".." + ("/v1/{a}.", dict(a=".")), # var + static → ".." + ("/v1/{a}{b}", dict(a="", b=".")), # empty + dot → "." + ("/v1/%2e/{x}", dict(x="ok")), # encoded dot in static text + ("/v1/%2e./{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/.%2E/{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/{v}?q=1", dict(v="..")), + ("/v1/{v}#frag", dict(v="..")), + ], +) +def test_dot_segment_rejected(template: str, kwargs: dict[str, Any]) -> None: + with pytest.raises(ValueError, match="dot-segment"): + path_template(template, **kwargs) From 0b46bfac0089df26487542f4f2e2ae671138fc41 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 22 Mar 2026 08:30:39 +0000 Subject: [PATCH 22/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 519ac6a..038d1e7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-41286c1f03c0277c31018b9b6c9c676c56961f75dcf1d363ddbcd2fe1948c9aa.yml -openapi_spec_hash: c80526f85efdeebf8b3341c79d43a11a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-9b23a10297ff164293b8fd58c3ac077e193921f5fa3ccf5b9f5f507bf6eb58c2.yml +openapi_spec_hash: 35a851516c9eb8f67fc62fe5a94399b4 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 6d2f4da4fc4f7d9f74bba9c97b2f38965e0c822b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 22 Mar 2026 22:30:51 +0000 Subject: [PATCH 23/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 038d1e7..e7d92ae 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-9b23a10297ff164293b8fd58c3ac077e193921f5fa3ccf5b9f5f507bf6eb58c2.yml -openapi_spec_hash: 35a851516c9eb8f67fc62fe5a94399b4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-8501c736f16a9c6a10d6ff75de5d1d95bb93f16f70b2106b2e4861a0fb27b795.yml +openapi_spec_hash: 110d17fd30d2b270c73b68b3c36a6dc1 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 0d40adadd47ddc74051495812222415aeb254f72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 05:11:34 +0000 Subject: [PATCH 24/34] chore(internal): update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 95ceb18..3824f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .prism.log +.stdy.log _dev __pycache__ From daa9f6008e80c6604f7ba05273f66e876b726913 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 07:30:40 +0000 Subject: [PATCH 25/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e7d92ae..9e36580 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-8501c736f16a9c6a10d6ff75de5d1d95bb93f16f70b2106b2e4861a0fb27b795.yml -openapi_spec_hash: 110d17fd30d2b270c73b68b3c36a6dc1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-d4fb9d6b3ee4b2853f7cea3c55aa01598068c76957fa23ea7563c06307df3f3c.yml +openapi_spec_hash: 769c5544491425918b554ca41c8edda9 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From a37ad0591c6a413ce5957904697c8db606af4c3d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 03:30:20 +0000 Subject: [PATCH 26/34] chore(ci): skip lint on metadata-only changes Note that we still want to run tests, as these depend on the metadata. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3472c63..c757454 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/slash-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 @@ -38,7 +38,7 @@ jobs: run: ./scripts/lint build: - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') timeout-minutes: 10 name: build permissions: From 112627e73ec266cf0680b494d80c9958b837f139 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 17:30:50 +0000 Subject: [PATCH 27/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9e36580..04caf8b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-d4fb9d6b3ee4b2853f7cea3c55aa01598068c76957fa23ea7563c06307df3f3c.yml -openapi_spec_hash: 769c5544491425918b554ca41c8edda9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-6e16355eb8cfa90fd08a34ce8ed5f1678bb24a2ba2a31efa97b4ee6196a3dda9.yml +openapi_spec_hash: 16a3c0705fd22e8dd243c9bffc0550aa config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From c4c24987c6914038c7f19231c94156ba7c1a8693 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 09:30:52 +0000 Subject: [PATCH 28/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 04caf8b..5d56788 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-6e16355eb8cfa90fd08a34ce8ed5f1678bb24a2ba2a31efa97b4ee6196a3dda9.yml -openapi_spec_hash: 16a3c0705fd22e8dd243c9bffc0550aa +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-006eee84bc2f1f1b51b9d872b0bf1c07c138346520566baab2e2ea75b14338d1.yml +openapi_spec_hash: 0473b8ed3c2914057a7a5d4d8759d54c config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 343548c801ca0ffa7f1d5b0ccb86652109ba1d57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 11:30:45 +0000 Subject: [PATCH 29/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5d56788..23fdbde 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-006eee84bc2f1f1b51b9d872b0bf1c07c138346520566baab2e2ea75b14338d1.yml -openapi_spec_hash: 0473b8ed3c2914057a7a5d4d8759d54c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-b991295a4d4e6233df74b21c7cca01c08d6e3244f26deacab8d14be51d462d9b.yml +openapi_spec_hash: 8a8112491006e98847f4fb88aa43e066 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 35fb0ecbf782d492722a4636689ef9bdd6fba190 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 18:30:45 +0000 Subject: [PATCH 30/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 23fdbde..c819de1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-b991295a4d4e6233df74b21c7cca01c08d6e3244f26deacab8d14be51d462d9b.yml -openapi_spec_hash: 8a8112491006e98847f4fb88aa43e066 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-10a66b6ff040796a3a1325ccea636d5b33d0f4707164fedb36e05bdbde41f750.yml +openapi_spec_hash: 58722b676a7d56352e1197509e875b7c config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 2a9632fd3fd8c3e7689f72bdf27db90b106adf20 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 06:46:43 +0000 Subject: [PATCH 31/34] feat(internal): implement indices array format for query and form serialization --- src/slash_sdk/_qs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slash_sdk/_qs.py b/src/slash_sdk/_qs.py index ada6fd3..de8c99b 100644 --- a/src/slash_sdk/_qs.py +++ b/src/slash_sdk/_qs.py @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" From c30b3860d1f6b105b872cafd8565df1c1b7e40e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 08:30:53 +0000 Subject: [PATCH 32/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c819de1..18b580b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-10a66b6ff040796a3a1325ccea636d5b33d0f4707164fedb36e05bdbde41f750.yml -openapi_spec_hash: 58722b676a7d56352e1197509e875b7c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-4c03d27b22d91af3db11c119740b8fa406bedd6184b774476291ca486d0e1c50.yml +openapi_spec_hash: 65c0322c8fe41ace709028bd6a51b9e9 config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From 08ac5fafe490569d0a388a32415ac016ef98faf3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 02:30:53 +0000 Subject: [PATCH 33/34] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 18b580b..8292f71 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 52 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-4c03d27b22d91af3db11c119740b8fa406bedd6184b774476291ca486d0e1c50.yml -openapi_spec_hash: 65c0322c8fe41ace709028bd6a51b9e9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/slash-financial--inc-dash%2Fslash-sdk-7f31a3be697a2cfed2f8a155edafa048098dcdcd00c9a562ac1e0067d2518be3.yml +openapi_spec_hash: 639ee7b20e3b634d76def08e5c65656e config_hash: 9a5c338a583a0bc1a2e798ec5b94d860 From c1d7c8a65aa966ea34910a4230015f049a2b75e2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 02:31:18 +0000 Subject: [PATCH 34/34] release: 0.1.0-alpha.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 27 +++++++++++++++++++++++++++ pyproject.toml | 2 +- src/slash_sdk/_version.py | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aaf968a..b56c3d0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.3" + ".": "0.1.0-alpha.4" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d8563dd..aace143 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,32 @@ # Changelog +## 0.1.0-alpha.4 (2026-04-02) + +Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/slashfi/slash-sdk-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4) + +### Features + +* **api:** api update ([f1eff44](https://github.com/slashfi/slash-sdk-python/commit/f1eff440f3ef4ed6a0495ccba3ecd7826d862c9c)) +* **api:** api update ([47ea2de](https://github.com/slashfi/slash-sdk-python/commit/47ea2de42a4430641a44e10101e79693cfa94ba4)) +* **api:** api update ([403ce72](https://github.com/slashfi/slash-sdk-python/commit/403ce72fe8450996c6eec0b12d18605d6fd1ba10)) +* **api:** api update ([68fa0ae](https://github.com/slashfi/slash-sdk-python/commit/68fa0aeac982ca051911fb116fc585f60ec8d3b5)) +* **internal:** implement indices array format for query and form serialization ([2a9632f](https://github.com/slashfi/slash-sdk-python/commit/2a9632fd3fd8c3e7689f72bdf27db90b106adf20)) + + +### Bug Fixes + +* **deps:** bump minimum typing-extensions version ([acdef8e](https://github.com/slashfi/slash-sdk-python/commit/acdef8e72361b2a7b24485d67f68e357c48de380)) +* **pydantic:** do not pass `by_alias` unless set ([2d11f9b](https://github.com/slashfi/slash-sdk-python/commit/2d11f9b1903e6f454ebb23e1141ebaa03373cfb6)) +* sanitize endpoint path params ([509a588](https://github.com/slashfi/slash-sdk-python/commit/509a588cf24e5549ea16f55a4c178a1b9a221935)) + + +### Chores + +* **ci:** skip lint on metadata-only changes ([a37ad05](https://github.com/slashfi/slash-sdk-python/commit/a37ad0591c6a413ce5957904697c8db606af4c3d)) +* **ci:** skip uploading artifacts on stainless-internal branches ([59a7a78](https://github.com/slashfi/slash-sdk-python/commit/59a7a78b6e534d5e3acb42824220a1e11c9c3a60)) +* **internal:** tweak CI branches ([504ef27](https://github.com/slashfi/slash-sdk-python/commit/504ef27f0aab30e84c40a2f08d89eda3085d7547)) +* **internal:** update gitignore ([0d40ada](https://github.com/slashfi/slash-sdk-python/commit/0d40adadd47ddc74051495812222415aeb254f72)) + ## 0.1.0-alpha.3 (2026-03-06) Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/slashfi/slash-sdk-python/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) diff --git a/pyproject.toml b/pyproject.toml index f98814d..93266de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "slash-sdk" -version = "0.1.0-alpha.3" +version = "0.1.0-alpha.4" description = "The official Python library for the slash-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/slash_sdk/_version.py b/src/slash_sdk/_version.py index bfe6468..4ffe448 100644 --- a/src/slash_sdk/_version.py +++ b/src/slash_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "slash_sdk" -__version__ = "0.1.0-alpha.3" # x-release-please-version +__version__ = "0.1.0-alpha.4" # x-release-please-version