From 9bd565e3cee12d961291d7b4641195045097f7c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 01:53:24 +0000 Subject: [PATCH 01/13] feat(api): update SDK from prod (d8f41b559592a1a8c68c0c40fdb773aa6e53795e) --- .stats.yml | 6 +++--- src/fragment/types/invoice.py | 2 +- src/fragment/types/invoice_search_params.py | 8 +++++++- tests/api_resources/test_invoices.py | 6 ++++-- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8601088..9ea9bc9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-0b499e34e128eee284c8b3d28d431f0521e747a9d573571b57b59c2dca2aac6e.yml -openapi_spec_hash: c50d64859d14067d66dc02c0da86184c -config_hash: 452389671401acf58c5429a09ae573db +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-e53627b335a398743561c2e4495be2c16f4ae8774e340d1dba572b0e53840d52.yml +openapi_spec_hash: b5f41f6d232ca3b8f275d99b035a332b +config_hash: f1988767ef4c888bd82f3521ba7114e1 diff --git a/src/fragment/types/invoice.py b/src/fragment/types/invoice.py index 57bbe8f..3830d7a 100644 --- a/src/fragment/types/invoice.py +++ b/src/fragment/types/invoice.py @@ -266,7 +266,7 @@ class Invoice(BaseModel): """ISO 8601 timestamp when the invoice was created""" status: Literal["active"] - """The status of the invoice""" + """Deprecated: The status of the invoice""" tags: List[Tag] """Metadata tags for this invoice""" diff --git a/src/fragment/types/invoice_search_params.py b/src/fragment/types/invoice_search_params.py index c10ea93..54b396e 100644 --- a/src/fragment/types/invoice_search_params.py +++ b/src/fragment/types/invoice_search_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Iterable -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["InvoiceSearchParams", "Filter", "FilterTags", "FilterTagsAll", "FilterTagsAny", "PageInfo"] @@ -62,6 +62,12 @@ class FilterTags(TypedDict, total=False): class Filter(TypedDict, total=False): """Filter criteria for the search""" + status: Literal["open"] + """Filter by invoice status. + + `open` returns invoices with non-zero clearing account balances. + """ + tags: FilterTags """Tag-based filter criteria. diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 29c5d56..532f69d 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -363,6 +363,7 @@ def test_method_search(self, client: Fragment) -> None: def test_method_search_with_all_params(self, client: Fragment) -> None: invoice = client.invoices.search( filter={ + "status": "open", "tags": { "all": [ { @@ -376,7 +377,7 @@ def test_method_search_with_all_params(self, client: Fragment) -> None: "value": "us-*", } ], - } + }, }, page_info={ "after": "after", @@ -758,6 +759,7 @@ async def test_method_search(self, async_client: AsyncFragment) -> None: async def test_method_search_with_all_params(self, async_client: AsyncFragment) -> None: invoice = await async_client.invoices.search( filter={ + "status": "open", "tags": { "all": [ { @@ -771,7 +773,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncFragment) "value": "us-*", } ], - } + }, }, page_info={ "after": "after", From 67481e45971c9e704986c425b42b4a9938b45746 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 18:04:15 +0000 Subject: [PATCH 02/13] feat(api): update SDK from prod (5cede0854eb141955854b7a9d3eb0e07a9588e3c) --- .stats.yml | 8 +- api.md | 2 + src/fragment/resources/transactions.py | 112 ++++++++++++ src/fragment/types/__init__.py | 2 + src/fragment/types/transaction.py | 4 +- .../transaction_create_allocations_params.py | 2 + .../transaction_list_history_response.py | 27 ++- ...transaction_search_allocations_response.py | 4 +- .../types/transaction_search_response.py | 27 ++- .../types/transaction_update_params.py | 129 +++++++++++++ .../types/transaction_update_response.py | 11 ++ tests/api_resources/test_transactions.py | 173 ++++++++++++++++++ 12 files changed, 483 insertions(+), 18 deletions(-) create mode 100644 src/fragment/types/transaction_update_params.py create mode 100644 src/fragment/types/transaction_update_response.py diff --git a/.stats.yml b/.stats.yml index 9ea9bc9..d469da0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-e53627b335a398743561c2e4495be2c16f4ae8774e340d1dba572b0e53840d52.yml -openapi_spec_hash: b5f41f6d232ca3b8f275d99b035a332b -config_hash: f1988767ef4c888bd82f3521ba7114e1 +configured_endpoints: 23 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-1ac1d5e34a8fbabcecc040255a4c5f3d9e6e986bb1b57ec76ed8cd146e5e2bf4.yml +openapi_spec_hash: ec746b4b585a33e6f5f722537e37c956 +config_hash: afc05056f5a776aa1501387e38c4820e diff --git a/api.md b/api.md index f444e32..4f300cb 100644 --- a/api.md +++ b/api.md @@ -81,6 +81,7 @@ from fragment.types import ( Transaction, TransactionCreateResponse, TransactionRetrieveResponse, + TransactionUpdateResponse, TransactionListResponse, TransactionCreateAllocationsResponse, TransactionListHistoryResponse, @@ -93,6 +94,7 @@ Methods: - client.transactions.create(\*\*params) -> TransactionCreateResponse - client.transactions.retrieve(transaction_ref) -> TransactionRetrieveResponse +- client.transactions.update(transaction_ref, \*\*params) -> TransactionUpdateResponse - client.transactions.list(\*\*params) -> TransactionListResponse - client.transactions.create_allocations(transaction_ref, \*\*params) -> TransactionCreateAllocationsResponse - client.transactions.list_history(transaction_ref) -> TransactionListHistoryResponse diff --git a/src/fragment/resources/transactions.py b/src/fragment/resources/transactions.py index 673bbe9..609c8ed 100644 --- a/src/fragment/resources/transactions.py +++ b/src/fragment/resources/transactions.py @@ -12,6 +12,7 @@ transaction_list_params, transaction_create_params, transaction_search_params, + transaction_update_params, transaction_create_allocations_params, transaction_search_allocations_params, ) @@ -29,6 +30,7 @@ from ..types.transaction_list_response import TransactionListResponse from ..types.transaction_create_response import TransactionCreateResponse from ..types.transaction_search_response import TransactionSearchResponse +from ..types.transaction_update_response import TransactionUpdateResponse from ..types.transaction_retrieve_response import TransactionRetrieveResponse from ..types.transaction_list_history_response import TransactionListHistoryResponse from ..types.transaction_create_allocations_response import TransactionCreateAllocationsResponse @@ -339,6 +341,55 @@ def retrieve( cast_to=TransactionRetrieveResponse, ) + def update( + self, + transaction_ref: str, + *, + current_transaction_version: int, + allocations: transaction_update_params.Allocations | Omit = omit, + tags: transaction_update_params.Tags | 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, + ) -> TransactionUpdateResponse: + """ + Updates a transaction (tags, allocations, or both) + + Args: + transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an + external ID. + + current_transaction_version: Current transaction version for optimistic concurrency control. + + 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 + """ + if not transaction_ref: + raise ValueError(f"Expected a non-empty value for `transaction_ref` but received {transaction_ref!r}") + return self._patch( + path_template("/transactions/{transaction_ref}", transaction_ref=transaction_ref), + body=maybe_transform( + { + "current_transaction_version": current_transaction_version, + "allocations": allocations, + "tags": tags, + }, + transaction_update_params.TransactionUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TransactionUpdateResponse, + ) + def list( self, *, @@ -846,6 +897,55 @@ async def retrieve( cast_to=TransactionRetrieveResponse, ) + async def update( + self, + transaction_ref: str, + *, + current_transaction_version: int, + allocations: transaction_update_params.Allocations | Omit = omit, + tags: transaction_update_params.Tags | 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, + ) -> TransactionUpdateResponse: + """ + Updates a transaction (tags, allocations, or both) + + Args: + transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an + external ID. + + current_transaction_version: Current transaction version for optimistic concurrency control. + + 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 + """ + if not transaction_ref: + raise ValueError(f"Expected a non-empty value for `transaction_ref` but received {transaction_ref!r}") + return await self._patch( + path_template("/transactions/{transaction_ref}", transaction_ref=transaction_ref), + body=await async_maybe_transform( + { + "current_transaction_version": current_transaction_version, + "allocations": allocations, + "tags": tags, + }, + transaction_update_params.TransactionUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TransactionUpdateResponse, + ) + async def list( self, *, @@ -1061,6 +1161,9 @@ def __init__(self, transactions: TransactionsResource) -> None: self.retrieve = to_raw_response_wrapper( transactions.retrieve, ) + self.update = to_raw_response_wrapper( + transactions.update, + ) self.list = to_raw_response_wrapper( transactions.list, ) @@ -1088,6 +1191,9 @@ def __init__(self, transactions: AsyncTransactionsResource) -> None: self.retrieve = async_to_raw_response_wrapper( transactions.retrieve, ) + self.update = async_to_raw_response_wrapper( + transactions.update, + ) self.list = async_to_raw_response_wrapper( transactions.list, ) @@ -1115,6 +1221,9 @@ def __init__(self, transactions: TransactionsResource) -> None: self.retrieve = to_streamed_response_wrapper( transactions.retrieve, ) + self.update = to_streamed_response_wrapper( + transactions.update, + ) self.list = to_streamed_response_wrapper( transactions.list, ) @@ -1142,6 +1251,9 @@ def __init__(self, transactions: AsyncTransactionsResource) -> None: self.retrieve = async_to_streamed_response_wrapper( transactions.retrieve, ) + self.update = async_to_streamed_response_wrapper( + transactions.update, + ) self.list = async_to_streamed_response_wrapper( transactions.list, ) diff --git a/src/fragment/types/__init__.py b/src/fragment/types/__init__.py index 5f5dbd0..71f51de 100644 --- a/src/fragment/types/__init__.py +++ b/src/fragment/types/__init__.py @@ -30,8 +30,10 @@ from .transaction_create_params import TransactionCreateParams as TransactionCreateParams from .transaction_list_response import TransactionListResponse as TransactionListResponse from .transaction_search_params import TransactionSearchParams as TransactionSearchParams +from .transaction_update_params import TransactionUpdateParams as TransactionUpdateParams from .transaction_create_response import TransactionCreateResponse as TransactionCreateResponse from .transaction_search_response import TransactionSearchResponse as TransactionSearchResponse +from .transaction_update_response import TransactionUpdateResponse as TransactionUpdateResponse from .invoice_list_history_response import InvoiceListHistoryResponse as InvoiceListHistoryResponse from .transaction_retrieve_response import TransactionRetrieveResponse as TransactionRetrieveResponse from .external_account_create_params import ExternalAccountCreateParams as ExternalAccountCreateParams diff --git a/src/fragment/types/transaction.py b/src/fragment/types/transaction.py index c6f9908..26bda81 100644 --- a/src/fragment/types/transaction.py +++ b/src/fragment/types/transaction.py @@ -33,10 +33,10 @@ class Allocation(BaseModel): """Transaction allocation against an invoice.""" amount: str - """Amount to allocate in smallest currency unit as stringified bigint.""" + """Allocated amount in smallest currency unit as stringified bigint.""" invoice_id: str - """The invoice to allocate against.""" + """The invoice this allocation is applied against.""" type: Literal["invoice_payin", "invoice_payout"] """The type of allocation.""" diff --git a/src/fragment/types/transaction_create_allocations_params.py b/src/fragment/types/transaction_create_allocations_params.py index 1885ef8..1e30832 100644 --- a/src/fragment/types/transaction_create_allocations_params.py +++ b/src/fragment/types/transaction_create_allocations_params.py @@ -40,6 +40,8 @@ class AllocationUpdateAddAllocationOperationUserExternalID(TypedDict, total=Fals class AllocationUpdateAddAllocationOperation(TypedDict, total=False): + """Transaction allocation against an invoice.""" + amount: Required[str] """Amount to allocate in smallest currency unit as stringified bigint.""" diff --git a/src/fragment/types/transaction_list_history_response.py b/src/fragment/types/transaction_list_history_response.py index fb1338d..ea76b3a 100644 --- a/src/fragment/types/transaction_list_history_response.py +++ b/src/fragment/types/transaction_list_history_response.py @@ -16,6 +16,7 @@ "DataDiffDeleteAllocationDiffEntry", "DataDiffDeleteAllocationDiffEntryItem", "DataDiffDeleteAllocationDiffEntryItemUser", + "DataDiffUpdateAllocationDiffEntry", ] @@ -33,10 +34,10 @@ class DataDiffAddAllocationDiffEntryItem(BaseModel): """Transaction allocation against an invoice.""" amount: str - """Amount to allocate in smallest currency unit as stringified bigint.""" + """Allocated amount in smallest currency unit as stringified bigint.""" invoice_id: str - """The invoice to allocate against.""" + """The invoice this allocation is applied against.""" type: Literal["invoice_payin", "invoice_payout"] """The type of allocation.""" @@ -67,10 +68,10 @@ class DataDiffDeleteAllocationDiffEntryItem(BaseModel): """Transaction allocation against an invoice.""" amount: str - """Amount to allocate in smallest currency unit as stringified bigint.""" + """Allocated amount in smallest currency unit as stringified bigint.""" invoice_id: str - """The invoice to allocate against.""" + """The invoice this allocation is applied against.""" type: Literal["invoice_payin", "invoice_payout"] """The type of allocation.""" @@ -87,7 +88,23 @@ class DataDiffDeleteAllocationDiffEntry(BaseModel): """An allocation was deleted""" -DataDiff: TypeAlias = Union[DataDiffAddAllocationDiffEntry, DataDiffDeleteAllocationDiffEntry] +class DataDiffUpdateAllocationDiffEntry(BaseModel): + id: str + """The ID of the updated allocation.""" + + new_amount: str + """New amount in smallest currency unit as stringified bigint.""" + + old_amount: str + """Previous amount in smallest currency unit as stringified bigint.""" + + op: Literal["update"] + """An allocation was updated""" + + +DataDiff: TypeAlias = Union[ + DataDiffAddAllocationDiffEntry, DataDiffDeleteAllocationDiffEntry, DataDiffUpdateAllocationDiffEntry +] class Data(Transaction): diff --git a/src/fragment/types/transaction_search_allocations_response.py b/src/fragment/types/transaction_search_allocations_response.py index 12f6f25..52bd79a 100644 --- a/src/fragment/types/transaction_search_allocations_response.py +++ b/src/fragment/types/transaction_search_allocations_response.py @@ -36,10 +36,10 @@ class Data(BaseModel): """Allocation ID.""" amount: str - """Amount to allocate in smallest currency unit as stringified bigint.""" + """Allocated amount in smallest currency unit as stringified bigint.""" invoice_id: str - """The invoice to allocate against.""" + """The invoice this allocation is applied against.""" posted: datetime """Posted timestamp of the parent transaction in ISO 8601 format.""" diff --git a/src/fragment/types/transaction_search_response.py b/src/fragment/types/transaction_search_response.py index 4f1daf9..61c9a33 100644 --- a/src/fragment/types/transaction_search_response.py +++ b/src/fragment/types/transaction_search_response.py @@ -16,6 +16,7 @@ "DataDiffDeleteAllocationDiffEntry", "DataDiffDeleteAllocationDiffEntryItem", "DataDiffDeleteAllocationDiffEntryItemUser", + "DataDiffUpdateAllocationDiffEntry", ] @@ -33,10 +34,10 @@ class DataDiffAddAllocationDiffEntryItem(BaseModel): """Transaction allocation against an invoice.""" amount: str - """Amount to allocate in smallest currency unit as stringified bigint.""" + """Allocated amount in smallest currency unit as stringified bigint.""" invoice_id: str - """The invoice to allocate against.""" + """The invoice this allocation is applied against.""" type: Literal["invoice_payin", "invoice_payout"] """The type of allocation.""" @@ -67,10 +68,10 @@ class DataDiffDeleteAllocationDiffEntryItem(BaseModel): """Transaction allocation against an invoice.""" amount: str - """Amount to allocate in smallest currency unit as stringified bigint.""" + """Allocated amount in smallest currency unit as stringified bigint.""" invoice_id: str - """The invoice to allocate against.""" + """The invoice this allocation is applied against.""" type: Literal["invoice_payin", "invoice_payout"] """The type of allocation.""" @@ -87,7 +88,23 @@ class DataDiffDeleteAllocationDiffEntry(BaseModel): """An allocation was deleted""" -DataDiff: TypeAlias = Union[DataDiffAddAllocationDiffEntry, DataDiffDeleteAllocationDiffEntry] +class DataDiffUpdateAllocationDiffEntry(BaseModel): + id: str + """The ID of the updated allocation.""" + + new_amount: str + """New amount in smallest currency unit as stringified bigint.""" + + old_amount: str + """Previous amount in smallest currency unit as stringified bigint.""" + + op: Literal["update"] + """An allocation was updated""" + + +DataDiff: TypeAlias = Union[ + DataDiffAddAllocationDiffEntry, DataDiffDeleteAllocationDiffEntry, DataDiffUpdateAllocationDiffEntry +] class Data(Transaction): diff --git a/src/fragment/types/transaction_update_params.py b/src/fragment/types/transaction_update_params.py new file mode 100644 index 0000000..9a19f2c --- /dev/null +++ b/src/fragment/types/transaction_update_params.py @@ -0,0 +1,129 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "TransactionUpdateParams", + "Allocations", + "AllocationsCreate", + "AllocationsCreateUser", + "AllocationsCreateUserID", + "AllocationsCreateUserExternalID", + "AllocationsUpdate", + "Tags", + "TagsCreate", + "TagsDelete", + "TagsUpdate", +] + + +class TransactionUpdateParams(TypedDict, total=False): + current_transaction_version: Required[int] + """Current transaction version for optimistic concurrency control.""" + + allocations: Allocations + + tags: Tags + + +class AllocationsCreateUserID(TypedDict, total=False): + id: Required[str] + """FRAGMENT generated ID of the user""" + + +class AllocationsCreateUserExternalID(TypedDict, total=False): + external_id: Required[str] + """External ID of the user""" + + +AllocationsCreateUser: TypeAlias = Union[AllocationsCreateUserID, AllocationsCreateUserExternalID] + + +class AllocationsCreate(TypedDict, total=False): + """Transaction allocation against an invoice.""" + + amount: Required[str] + """Amount to allocate in smallest currency unit as stringified bigint.""" + + invoice_id: Required[str] + """The invoice to allocate against.""" + + type: Required[Literal["invoice_payin", "invoice_payout"]] + """The type of allocation.""" + + user: Required[AllocationsCreateUser] + """Identifies a user by Fragment-generated id or external_id (request body).""" + + +class AllocationsUpdate(TypedDict, total=False): + id: Required[str] + """The ID of the allocation to update.""" + + amount: Required[str] + """New amount in smallest currency unit as stringified bigint.""" + + +class Allocations(TypedDict, total=False): + create: Iterable[AllocationsCreate] + """Allocations to add to the transaction""" + + update: Iterable[AllocationsUpdate] + """Existing allocations to update""" + + +class TagsCreate(TypedDict, total=False): + """A key-value tag pair for metadata""" + + key: Required[str] + """Tag key. + + Must be a valid safe string (no special characters like #, /, :). Max 50 + characters. + """ + + value: Required[str] + """Tag value. + + Must be a valid safe string (no special characters like #, /, :). Max 200 + characters. + """ + + +class TagsDelete(TypedDict, total=False): + key: Required[str] + """Tag key to delete""" + + +class TagsUpdate(TypedDict, total=False): + """A key-value tag pair for metadata""" + + key: Required[str] + """Tag key. + + Must be a valid safe string (no special characters like #, /, :). Max 50 + characters. + """ + + value: Required[str] + """Tag value. + + Must be a valid safe string (no special characters like #, /, :). Max 200 + characters. + """ + + +class Tags(TypedDict, total=False): + create: Iterable[TagsCreate] + """Tags to add""" + + delete: Iterable[TagsDelete] + """Tags to remove by key""" + + update: Iterable[TagsUpdate] + """Tags to update. + + The key identifies the existing tag; the value is the new value. + """ diff --git a/src/fragment/types/transaction_update_response.py b/src/fragment/types/transaction_update_response.py new file mode 100644 index 0000000..54a3d8a --- /dev/null +++ b/src/fragment/types/transaction_update_response.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .._models import BaseModel +from .transaction import Transaction + +__all__ = ["TransactionUpdateResponse"] + + +class TransactionUpdateResponse(BaseModel): + data: Transaction + """Transaction object.""" diff --git a/tests/api_resources/test_transactions.py b/tests/api_resources/test_transactions.py index 2bfb29f..4b125f6 100644 --- a/tests/api_resources/test_transactions.py +++ b/tests/api_resources/test_transactions.py @@ -13,6 +13,7 @@ TransactionListResponse, TransactionCreateResponse, TransactionSearchResponse, + TransactionUpdateResponse, TransactionRetrieveResponse, TransactionListHistoryResponse, TransactionCreateAllocationsResponse, @@ -167,6 +168,92 @@ def test_path_params_retrieve(self, client: Fragment) -> None: "", ) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update(self, client: Fragment) -> None: + transaction = client.transactions.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + ) + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_with_all_params(self, client: Fragment) -> None: + transaction = client.transactions.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + allocations={ + "create": [ + { + "amount": "1000", + "invoice_id": "inv_abc123", + "type": "invoice_payin", + "user": {"id": "user_abc123"}, + } + ], + "update": [ + { + "id": "alloc_abc123", + "amount": "2000", + } + ], + }, + tags={ + "create": [ + { + "key": "region", + "value": "us-east", + } + ], + "delete": [{"key": "key"}], + "update": [ + { + "key": "region", + "value": "eu-west-1", + } + ], + }, + ) + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update(self, client: Fragment) -> None: + response = client.transactions.with_raw_response.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + transaction = response.parse() + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update(self, client: Fragment) -> None: + with client.transactions.with_streaming_response.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + transaction = response.parse() + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update(self, client: Fragment) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `transaction_ref` but received ''"): + client.transactions.with_raw_response.update( + transaction_ref="", + current_transaction_version=0, + ) + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Fragment) -> None: @@ -543,6 +630,92 @@ async def test_path_params_retrieve(self, async_client: AsyncFragment) -> None: "", ) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update(self, async_client: AsyncFragment) -> None: + transaction = await async_client.transactions.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + ) + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncFragment) -> None: + transaction = await async_client.transactions.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + allocations={ + "create": [ + { + "amount": "1000", + "invoice_id": "inv_abc123", + "type": "invoice_payin", + "user": {"id": "user_abc123"}, + } + ], + "update": [ + { + "id": "alloc_abc123", + "amount": "2000", + } + ], + }, + tags={ + "create": [ + { + "key": "region", + "value": "us-east", + } + ], + "delete": [{"key": "key"}], + "update": [ + { + "key": "region", + "value": "eu-west-1", + } + ], + }, + ) + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update(self, async_client: AsyncFragment) -> None: + response = await async_client.transactions.with_raw_response.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + transaction = await response.parse() + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update(self, async_client: AsyncFragment) -> None: + async with async_client.transactions.with_streaming_response.update( + transaction_ref="txn_abc123", + current_transaction_version=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + transaction = await response.parse() + assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update(self, async_client: AsyncFragment) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `transaction_ref` but received ''"): + await async_client.transactions.with_raw_response.update( + transaction_ref="", + current_transaction_version=0, + ) + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncFragment) -> None: From ea85617c004e54e4a27abf4c8a5e585d17256d7c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 15:36:49 +0000 Subject: [PATCH 03/13] feat(api): update SDK from prod (523b1fdd6cc6b5732ccdad5095c21f69fe1f7489) --- .stats.yml | 4 ++-- src/fragment/types/invoice_retrieve_response.py | 8 ++++---- src/fragment/types/invoice_search_response.py | 6 +++--- src/fragment/types/transaction.py | 6 +++--- .../types/transaction_list_history_response.py | 12 ++++++------ .../types/transaction_search_allocations_response.py | 8 ++++---- src/fragment/types/transaction_search_response.py | 12 ++++++------ 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.stats.yml b/.stats.yml index d469da0..a4874a9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-1ac1d5e34a8fbabcecc040255a4c5f3d9e6e986bb1b57ec76ed8cd146e5e2bf4.yml -openapi_spec_hash: ec746b4b585a33e6f5f722537e37c956 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-d9af2f7a25f1b257ad41d419f9a436f0bc0b3a3fc1dd70db7ca50845f58dfb4e.yml +openapi_spec_hash: 142080b0b3d94edee6efa27b8c37ea51 config_hash: afc05056f5a776aa1501387e38c4820e diff --git a/src/fragment/types/invoice_retrieve_response.py b/src/fragment/types/invoice_retrieve_response.py index a0d6748..714a43d 100644 --- a/src/fragment/types/invoice_retrieve_response.py +++ b/src/fragment/types/invoice_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from datetime import datetime from typing_extensions import Literal @@ -94,12 +94,12 @@ class DataPaymentTransaction(BaseModel): class DataPaymentUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -302,7 +302,7 @@ class DataPayment(BaseModel): """The type of the payment.""" user: DataPaymentUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class DataUserBalanceNet(BaseModel): diff --git a/src/fragment/types/invoice_search_response.py b/src/fragment/types/invoice_search_response.py index 57102c0..29f5d76 100644 --- a/src/fragment/types/invoice_search_response.py +++ b/src/fragment/types/invoice_search_response.py @@ -96,12 +96,12 @@ class DataInvoicePaymentTransaction(BaseModel): class DataInvoicePaymentUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -304,7 +304,7 @@ class DataInvoicePayment(BaseModel): """The type of the payment.""" user: DataInvoicePaymentUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class DataInvoiceUserBalanceNet(BaseModel): diff --git a/src/fragment/types/transaction.py b/src/fragment/types/transaction.py index 26bda81..663f902 100644 --- a/src/fragment/types/transaction.py +++ b/src/fragment/types/transaction.py @@ -20,12 +20,12 @@ class Account(BaseModel): class AllocationUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -42,7 +42,7 @@ class Allocation(BaseModel): """The type of allocation.""" user: AllocationUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class Tag(BaseModel): diff --git a/src/fragment/types/transaction_list_history_response.py b/src/fragment/types/transaction_list_history_response.py index ea76b3a..f962d31 100644 --- a/src/fragment/types/transaction_list_history_response.py +++ b/src/fragment/types/transaction_list_history_response.py @@ -21,12 +21,12 @@ class DataDiffAddAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -43,7 +43,7 @@ class DataDiffAddAllocationDiffEntryItem(BaseModel): """The type of allocation.""" user: DataDiffAddAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class DataDiffAddAllocationDiffEntry(BaseModel): @@ -55,12 +55,12 @@ class DataDiffAddAllocationDiffEntry(BaseModel): class DataDiffDeleteAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -77,7 +77,7 @@ class DataDiffDeleteAllocationDiffEntryItem(BaseModel): """The type of allocation.""" user: DataDiffDeleteAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class DataDiffDeleteAllocationDiffEntry(BaseModel): diff --git a/src/fragment/types/transaction_search_allocations_response.py b/src/fragment/types/transaction_search_allocations_response.py index 52bd79a..9d76da0 100644 --- a/src/fragment/types/transaction_search_allocations_response.py +++ b/src/fragment/types/transaction_search_allocations_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from datetime import datetime from typing_extensions import Literal @@ -20,12 +20,12 @@ class DataTransaction(BaseModel): class DataUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -51,7 +51,7 @@ class Data(BaseModel): """The type of allocation.""" user: DataUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class TransactionSearchAllocationsResponse(BaseModel): diff --git a/src/fragment/types/transaction_search_response.py b/src/fragment/types/transaction_search_response.py index 61c9a33..c9a337d 100644 --- a/src/fragment/types/transaction_search_response.py +++ b/src/fragment/types/transaction_search_response.py @@ -21,12 +21,12 @@ class DataDiffAddAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -43,7 +43,7 @@ class DataDiffAddAllocationDiffEntryItem(BaseModel): """The type of allocation.""" user: DataDiffAddAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class DataDiffAddAllocationDiffEntry(BaseModel): @@ -55,12 +55,12 @@ class DataDiffAddAllocationDiffEntry(BaseModel): class DataDiffDeleteAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" id: str """FRAGMENT generated ID of the user""" - external_id: Optional[str] = None + external_id: str """External ID of the user""" @@ -77,7 +77,7 @@ class DataDiffDeleteAllocationDiffEntryItem(BaseModel): """The type of allocation.""" user: DataDiffDeleteAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and optional external_id.""" + """User reference in API responses: Fragment user id and external_id.""" class DataDiffDeleteAllocationDiffEntry(BaseModel): From fc27b304c5dae27cb485853ad80c55b3c1392df0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 16:44:55 +0000 Subject: [PATCH 04/13] feat(api): update SDK from prod (a5eb093078fe5947a299bccafd30a0c7f2e90790) --- .stats.yml | 4 +- .../types/invoice_list_history_response.py | 571 +----------------- .../transaction_list_history_response.py | 119 +--- .../types/transaction_search_response.py | 119 +--- 4 files changed, 11 insertions(+), 802 deletions(-) diff --git a/.stats.yml b/.stats.yml index a4874a9..c7f89b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-d9af2f7a25f1b257ad41d419f9a436f0bc0b3a3fc1dd70db7ca50845f58dfb4e.yml -openapi_spec_hash: 142080b0b3d94edee6efa27b8c37ea51 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-bd5f8e1bae80ccdcb630450411e3919da9a89a6045f7c56d44e80bf492bd6f03.yml +openapi_spec_hash: c373020f7be240137ee660bacb9703cb config_hash: afc05056f5a776aa1501387e38c4820e diff --git a/src/fragment/types/invoice_list_history_response.py b/src/fragment/types/invoice_list_history_response.py index ed3d106..d411162 100644 --- a/src/fragment/types/invoice_list_history_response.py +++ b/src/fragment/types/invoice_list_history_response.py @@ -1,579 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias +from typing import List from .invoice import Invoice from .._models import BaseModel -__all__ = [ - "InvoiceListHistoryResponse", - "Data", - "DataDiff", - "DataDiffAddDiffEntry", - "DataDiffAddDiffEntryItem", - "DataDiffAddDiffEntryItemPrice", - "DataDiffAddDiffEntryItemTag", - "DataDiffUpdateDiffEntry", - "DataDiffUpdateDiffEntryNewPrice", - "DataDiffUpdateDiffEntryOldPrice", - "DataDiffDeleteDiffEntry", - "DataDiffDeleteDiffEntryItem", - "DataDiffDeleteDiffEntryItemPrice", - "DataDiffDeleteDiffEntryItemTag", -] - - -class DataDiffAddDiffEntryItemPrice(BaseModel): - """Price breakdown containing amount, unit price, and quantity""" - - amount: str - """Total amount in smallest currency unit (represented as string for bigint)""" - - quantity: int - """Quantity of units for this line item""" - - unit_price: str - """Unit price in smallest currency unit (represented as string for bigint)""" - - -class DataDiffAddDiffEntryItemTag(BaseModel): - """A key-value tag pair""" - - key: str - """Tag key""" - - value: str - """Tag value""" - - -class DataDiffAddDiffEntryItem(BaseModel): - """Invoice line item object""" - - id: str - """Unique identifier for the line item""" - - amount: str - """Deprecated: use price.amount instead. - - Total amount in smallest currency unit (represented as string for bigint) - """ - - currency_code: Literal[ - "ADA", - "BTC", - "DAI", - "ETH", - "SOL", - "USDC", - "USDT", - "USDG", - "EURC", - "CADC", - "CADT", - "XLM", - "UNI", - "BCH", - "LTC", - "AAVE", - "LINK", - "MATIC", - "PTS", - "AED", - "AFN", - "ALL", - "AMD", - "ANG", - "AOA", - "ARS", - "AUD", - "AWG", - "AZN", - "BAM", - "BBD", - "BDT", - "BGN", - "BHD", - "BIF", - "BMD", - "BND", - "BOB", - "BRL", - "BSD", - "BTN", - "BWP", - "BYR", - "BZD", - "CAD", - "CDF", - "CHF", - "CLP", - "CNY", - "COP", - "CRC", - "CUC", - "CUP", - "CVE", - "CZK", - "DJF", - "DKK", - "DOP", - "DZD", - "EGP", - "ERN", - "ETB", - "EUR", - "FJD", - "FKP", - "GBP", - "GEL", - "GGP", - "GHS", - "GIP", - "GMD", - "GNF", - "GTQ", - "GYD", - "HKD", - "HNL", - "HRK", - "HTG", - "HUF", - "IDR", - "ILS", - "IMP", - "INR", - "IQD", - "IRR", - "ISK", - "JMD", - "JOD", - "JPY", - "KES", - "KGS", - "KHR", - "KMF", - "KPW", - "KRW", - "KWD", - "KYD", - "KZT", - "LAK", - "LBP", - "LKR", - "LRD", - "LSL", - "LYD", - "MAD", - "MDL", - "MGA", - "MKD", - "MMK", - "MNT", - "MOP", - "MUR", - "MVR", - "MWK", - "MXN", - "MYR", - "MZN", - "NAD", - "NGN", - "NIO", - "NOK", - "NPR", - "NZD", - "OMR", - "PAB", - "PEN", - "PGK", - "PHP", - "PKR", - "PLN", - "PYG", - "QAR", - "RON", - "RSD", - "RUB", - "RWF", - "SAR", - "SBD", - "SCR", - "SDG", - "SEK", - "SGD", - "SHP", - "SLL", - "SOS", - "SPL", - "SRD", - "SVC", - "SYP", - "STN", - "SZL", - "THB", - "TJS", - "TMT", - "TND", - "TOP", - "TRY", - "TTD", - "TVD", - "TWD", - "TZS", - "UAH", - "UGX", - "USD", - "UYU", - "UZS", - "VEF", - "VND", - "VUV", - "WST", - "XAF", - "XCD", - "XOF", - "XPF", - "YER", - "ZAR", - "ZMW", - "LOGICAL", - "CUSTOM", - ] - """Currency code (ISO 4217 or crypto)""" - - description: str - """Description of the line item""" - - price: DataDiffAddDiffEntryItemPrice - """Price breakdown containing amount, unit price, and quantity""" - - product_id: str - """ID of the product/catalog item""" - - tags: List[DataDiffAddDiffEntryItemTag] - """Metadata tags for this line item""" - - type: Literal["payin", "payout"] - """The type of the line item""" - - user_id: str - """External ID of the user associated with this line item""" - - -class DataDiffAddDiffEntry(BaseModel): - item: DataDiffAddDiffEntryItem - """Invoice line item object""" - - op: Literal["add"] - """A line item was added""" - - -class DataDiffUpdateDiffEntryNewPrice(BaseModel): - """Price breakdown containing amount, unit price, and quantity""" - - amount: str - """Total amount in smallest currency unit (represented as string for bigint)""" - - quantity: int - """Quantity of units for this line item""" - - unit_price: str - """Unit price in smallest currency unit (represented as string for bigint)""" - - -class DataDiffUpdateDiffEntryOldPrice(BaseModel): - """Price breakdown containing amount, unit price, and quantity""" - - amount: str - """Total amount in smallest currency unit (represented as string for bigint)""" - - quantity: int - """Quantity of units for this line item""" - - unit_price: str - """Unit price in smallest currency unit (represented as string for bigint)""" - - -class DataDiffUpdateDiffEntry(BaseModel): - id: str - """ID of the updated line item""" - - new_amount: str - """Deprecated: use new_price.amount instead. New amount after the update""" - - new_price: DataDiffUpdateDiffEntryNewPrice - """Price breakdown containing amount, unit price, and quantity""" - - old_amount: str - """Deprecated: use old_price.amount instead. Amount before the update""" - - old_price: DataDiffUpdateDiffEntryOldPrice - """Price breakdown containing amount, unit price, and quantity""" - - op: Literal["update"] - """A line item was updated""" - - -class DataDiffDeleteDiffEntryItemPrice(BaseModel): - """Price breakdown containing amount, unit price, and quantity""" - - amount: str - """Total amount in smallest currency unit (represented as string for bigint)""" - - quantity: int - """Quantity of units for this line item""" - - unit_price: str - """Unit price in smallest currency unit (represented as string for bigint)""" - - -class DataDiffDeleteDiffEntryItemTag(BaseModel): - """A key-value tag pair""" - - key: str - """Tag key""" - - value: str - """Tag value""" - - -class DataDiffDeleteDiffEntryItem(BaseModel): - """Invoice line item object""" - - id: str - """Unique identifier for the line item""" - - amount: str - """Deprecated: use price.amount instead. - - Total amount in smallest currency unit (represented as string for bigint) - """ - - currency_code: Literal[ - "ADA", - "BTC", - "DAI", - "ETH", - "SOL", - "USDC", - "USDT", - "USDG", - "EURC", - "CADC", - "CADT", - "XLM", - "UNI", - "BCH", - "LTC", - "AAVE", - "LINK", - "MATIC", - "PTS", - "AED", - "AFN", - "ALL", - "AMD", - "ANG", - "AOA", - "ARS", - "AUD", - "AWG", - "AZN", - "BAM", - "BBD", - "BDT", - "BGN", - "BHD", - "BIF", - "BMD", - "BND", - "BOB", - "BRL", - "BSD", - "BTN", - "BWP", - "BYR", - "BZD", - "CAD", - "CDF", - "CHF", - "CLP", - "CNY", - "COP", - "CRC", - "CUC", - "CUP", - "CVE", - "CZK", - "DJF", - "DKK", - "DOP", - "DZD", - "EGP", - "ERN", - "ETB", - "EUR", - "FJD", - "FKP", - "GBP", - "GEL", - "GGP", - "GHS", - "GIP", - "GMD", - "GNF", - "GTQ", - "GYD", - "HKD", - "HNL", - "HRK", - "HTG", - "HUF", - "IDR", - "ILS", - "IMP", - "INR", - "IQD", - "IRR", - "ISK", - "JMD", - "JOD", - "JPY", - "KES", - "KGS", - "KHR", - "KMF", - "KPW", - "KRW", - "KWD", - "KYD", - "KZT", - "LAK", - "LBP", - "LKR", - "LRD", - "LSL", - "LYD", - "MAD", - "MDL", - "MGA", - "MKD", - "MMK", - "MNT", - "MOP", - "MUR", - "MVR", - "MWK", - "MXN", - "MYR", - "MZN", - "NAD", - "NGN", - "NIO", - "NOK", - "NPR", - "NZD", - "OMR", - "PAB", - "PEN", - "PGK", - "PHP", - "PKR", - "PLN", - "PYG", - "QAR", - "RON", - "RSD", - "RUB", - "RWF", - "SAR", - "SBD", - "SCR", - "SDG", - "SEK", - "SGD", - "SHP", - "SLL", - "SOS", - "SPL", - "SRD", - "SVC", - "SYP", - "STN", - "SZL", - "THB", - "TJS", - "TMT", - "TND", - "TOP", - "TRY", - "TTD", - "TVD", - "TWD", - "TZS", - "UAH", - "UGX", - "USD", - "UYU", - "UZS", - "VEF", - "VND", - "VUV", - "WST", - "XAF", - "XCD", - "XOF", - "XPF", - "YER", - "ZAR", - "ZMW", - "LOGICAL", - "CUSTOM", - ] - """Currency code (ISO 4217 or crypto)""" - - description: str - """Description of the line item""" - - price: DataDiffDeleteDiffEntryItemPrice - """Price breakdown containing amount, unit price, and quantity""" - - product_id: str - """ID of the product/catalog item""" - - tags: List[DataDiffDeleteDiffEntryItemTag] - """Metadata tags for this line item""" - - type: Literal["payin", "payout"] - """The type of the line item""" - - user_id: str - """External ID of the user associated with this line item""" - - -class DataDiffDeleteDiffEntry(BaseModel): - item: DataDiffDeleteDiffEntryItem - """Invoice line item object""" - - op: Literal["delete"] - """A line item was deleted""" - - -DataDiff: TypeAlias = Union[DataDiffAddDiffEntry, DataDiffUpdateDiffEntry, DataDiffDeleteDiffEntry] - - -class Data(Invoice): - """A versioned snapshot of an invoice""" - - diff: Optional[List[DataDiff]] = None - """Cumulative diff of changes applied to the invoice""" - - version: Optional[float] = None # type: ignore - """Version number of this invoice snapshot""" +__all__ = ["InvoiceListHistoryResponse"] class InvoiceListHistoryResponse(BaseModel): """Version history of an invoice""" - data: List[Data] + data: List[Invoice] diff --git a/src/fragment/types/transaction_list_history_response.py b/src/fragment/types/transaction_list_history_response.py index f962d31..3ee4420 100644 --- a/src/fragment/types/transaction_list_history_response.py +++ b/src/fragment/types/transaction_list_history_response.py @@ -1,127 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias +from typing import List from .._models import BaseModel from .transaction import Transaction -__all__ = [ - "TransactionListHistoryResponse", - "Data", - "DataDiff", - "DataDiffAddAllocationDiffEntry", - "DataDiffAddAllocationDiffEntryItem", - "DataDiffAddAllocationDiffEntryItemUser", - "DataDiffDeleteAllocationDiffEntry", - "DataDiffDeleteAllocationDiffEntryItem", - "DataDiffDeleteAllocationDiffEntryItemUser", - "DataDiffUpdateAllocationDiffEntry", -] - - -class DataDiffAddAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" - - id: str - """FRAGMENT generated ID of the user""" - - external_id: str - """External ID of the user""" - - -class DataDiffAddAllocationDiffEntryItem(BaseModel): - """Transaction allocation against an invoice.""" - - amount: str - """Allocated amount in smallest currency unit as stringified bigint.""" - - invoice_id: str - """The invoice this allocation is applied against.""" - - type: Literal["invoice_payin", "invoice_payout"] - """The type of allocation.""" - - user: DataDiffAddAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and external_id.""" - - -class DataDiffAddAllocationDiffEntry(BaseModel): - item: DataDiffAddAllocationDiffEntryItem - """Transaction allocation against an invoice.""" - - op: Literal["add"] - """An allocation was added""" - - -class DataDiffDeleteAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" - - id: str - """FRAGMENT generated ID of the user""" - - external_id: str - """External ID of the user""" - - -class DataDiffDeleteAllocationDiffEntryItem(BaseModel): - """Transaction allocation against an invoice.""" - - amount: str - """Allocated amount in smallest currency unit as stringified bigint.""" - - invoice_id: str - """The invoice this allocation is applied against.""" - - type: Literal["invoice_payin", "invoice_payout"] - """The type of allocation.""" - - user: DataDiffDeleteAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and external_id.""" - - -class DataDiffDeleteAllocationDiffEntry(BaseModel): - item: DataDiffDeleteAllocationDiffEntryItem - """Transaction allocation against an invoice.""" - - op: Literal["delete"] - """An allocation was deleted""" - - -class DataDiffUpdateAllocationDiffEntry(BaseModel): - id: str - """The ID of the updated allocation.""" - - new_amount: str - """New amount in smallest currency unit as stringified bigint.""" - - old_amount: str - """Previous amount in smallest currency unit as stringified bigint.""" - - op: Literal["update"] - """An allocation was updated""" - - -DataDiff: TypeAlias = Union[ - DataDiffAddAllocationDiffEntry, DataDiffDeleteAllocationDiffEntry, DataDiffUpdateAllocationDiffEntry -] - - -class Data(Transaction): - """A versioned snapshot of a transaction""" - - diff: Optional[List[DataDiff]] = None - """Allocation changes applied in this version. - - Absent on version 1 (initial creation). Each entry describes an allocation that - was added or deleted. - """ - - version: Optional[int] = None # type: ignore - """Version number of this transaction snapshot.""" +__all__ = ["TransactionListHistoryResponse"] class TransactionListHistoryResponse(BaseModel): """Version history of a transaction""" - data: List[Data] + data: List[Transaction] diff --git a/src/fragment/types/transaction_search_response.py b/src/fragment/types/transaction_search_response.py index c9a337d..49f7099 100644 --- a/src/fragment/types/transaction_search_response.py +++ b/src/fragment/types/transaction_search_response.py @@ -1,127 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias +from typing import List from .._models import BaseModel from .transaction import Transaction -__all__ = [ - "TransactionSearchResponse", - "Data", - "DataDiff", - "DataDiffAddAllocationDiffEntry", - "DataDiffAddAllocationDiffEntryItem", - "DataDiffAddAllocationDiffEntryItemUser", - "DataDiffDeleteAllocationDiffEntry", - "DataDiffDeleteAllocationDiffEntryItem", - "DataDiffDeleteAllocationDiffEntryItemUser", - "DataDiffUpdateAllocationDiffEntry", -] - - -class DataDiffAddAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" - - id: str - """FRAGMENT generated ID of the user""" - - external_id: str - """External ID of the user""" - - -class DataDiffAddAllocationDiffEntryItem(BaseModel): - """Transaction allocation against an invoice.""" - - amount: str - """Allocated amount in smallest currency unit as stringified bigint.""" - - invoice_id: str - """The invoice this allocation is applied against.""" - - type: Literal["invoice_payin", "invoice_payout"] - """The type of allocation.""" - - user: DataDiffAddAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and external_id.""" - - -class DataDiffAddAllocationDiffEntry(BaseModel): - item: DataDiffAddAllocationDiffEntryItem - """Transaction allocation against an invoice.""" - - op: Literal["add"] - """An allocation was added""" - - -class DataDiffDeleteAllocationDiffEntryItemUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" - - id: str - """FRAGMENT generated ID of the user""" - - external_id: str - """External ID of the user""" - - -class DataDiffDeleteAllocationDiffEntryItem(BaseModel): - """Transaction allocation against an invoice.""" - - amount: str - """Allocated amount in smallest currency unit as stringified bigint.""" - - invoice_id: str - """The invoice this allocation is applied against.""" - - type: Literal["invoice_payin", "invoice_payout"] - """The type of allocation.""" - - user: DataDiffDeleteAllocationDiffEntryItemUser - """User reference in API responses: Fragment user id and external_id.""" - - -class DataDiffDeleteAllocationDiffEntry(BaseModel): - item: DataDiffDeleteAllocationDiffEntryItem - """Transaction allocation against an invoice.""" - - op: Literal["delete"] - """An allocation was deleted""" - - -class DataDiffUpdateAllocationDiffEntry(BaseModel): - id: str - """The ID of the updated allocation.""" - - new_amount: str - """New amount in smallest currency unit as stringified bigint.""" - - old_amount: str - """Previous amount in smallest currency unit as stringified bigint.""" - - op: Literal["update"] - """An allocation was updated""" - - -DataDiff: TypeAlias = Union[ - DataDiffAddAllocationDiffEntry, DataDiffDeleteAllocationDiffEntry, DataDiffUpdateAllocationDiffEntry -] - - -class Data(Transaction): - """A versioned snapshot of a transaction""" - - diff: Optional[List[DataDiff]] = None - """Allocation changes applied in this version. - - Absent on version 1 (initial creation). Each entry describes an allocation that - was added or deleted. - """ - - version: Optional[int] = None # type: ignore - """Version number of this transaction snapshot.""" +__all__ = ["TransactionSearchResponse"] class TransactionSearchResponse(BaseModel): """Search results for transactions.""" - data: List[Data] + data: List[Transaction] From 1d1b5d0b74975f2505475ca8167176680eff0655 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 20:20:33 +0000 Subject: [PATCH 05/13] feat(api): update SDK from prod (729db28098a20ebc22e879a2cd1c6ad860f9ce4c) --- .stats.yml | 8 +- api.md | 2 - src/fragment/resources/transactions.py | 112 ----------- src/fragment/types/__init__.py | 6 - src/fragment/types/invoice_update_params.py | 60 +++++- .../transaction_create_allocations_params.py | 69 ------- ...transaction_create_allocations_response.py | 11 -- .../types/transaction_update_params.py | 30 ++- tests/api_resources/test_invoices.py | 32 +++- tests/api_resources/test_transactions.py | 181 ++---------------- 10 files changed, 130 insertions(+), 381 deletions(-) delete mode 100644 src/fragment/types/transaction_create_allocations_params.py delete mode 100644 src/fragment/types/transaction_create_allocations_response.py diff --git a/.stats.yml b/.stats.yml index c7f89b5..d0b6146 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 23 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-bd5f8e1bae80ccdcb630450411e3919da9a89a6045f7c56d44e80bf492bd6f03.yml -openapi_spec_hash: c373020f7be240137ee660bacb9703cb -config_hash: afc05056f5a776aa1501387e38c4820e +configured_endpoints: 22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-60daf02b324d50717c8ca7667f5b10b59be952cd10e241d1b0c4bc1480f0622e.yml +openapi_spec_hash: 42c18143f558432ff26fbcc94b8844ca +config_hash: e9de8e5044d45256185649ca63b8490f diff --git a/api.md b/api.md index 4f300cb..a140d9b 100644 --- a/api.md +++ b/api.md @@ -83,7 +83,6 @@ from fragment.types import ( TransactionRetrieveResponse, TransactionUpdateResponse, TransactionListResponse, - TransactionCreateAllocationsResponse, TransactionListHistoryResponse, TransactionSearchResponse, TransactionSearchAllocationsResponse, @@ -96,7 +95,6 @@ Methods: - client.transactions.retrieve(transaction_ref) -> TransactionRetrieveResponse - client.transactions.update(transaction_ref, \*\*params) -> TransactionUpdateResponse - client.transactions.list(\*\*params) -> TransactionListResponse -- client.transactions.create_allocations(transaction_ref, \*\*params) -> TransactionCreateAllocationsResponse - client.transactions.list_history(transaction_ref) -> TransactionListHistoryResponse - client.transactions.search(\*\*params) -> TransactionSearchResponse - client.transactions.search_allocations(\*\*params) -> TransactionSearchAllocationsResponse diff --git a/src/fragment/resources/transactions.py b/src/fragment/resources/transactions.py index 609c8ed..ed733d6 100644 --- a/src/fragment/resources/transactions.py +++ b/src/fragment/resources/transactions.py @@ -13,7 +13,6 @@ transaction_create_params, transaction_search_params, transaction_update_params, - transaction_create_allocations_params, transaction_search_allocations_params, ) from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given @@ -33,7 +32,6 @@ from ..types.transaction_update_response import TransactionUpdateResponse from ..types.transaction_retrieve_response import TransactionRetrieveResponse from ..types.transaction_list_history_response import TransactionListHistoryResponse -from ..types.transaction_create_allocations_response import TransactionCreateAllocationsResponse from ..types.transaction_search_allocations_response import TransactionSearchAllocationsResponse __all__ = ["TransactionsResource", "AsyncTransactionsResource"] @@ -439,55 +437,6 @@ def list( cast_to=TransactionListResponse, ) - def create_allocations( - self, - transaction_ref: str, - *, - allocation_updates: Iterable[transaction_create_allocations_params.AllocationUpdate], - version: int, - # 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, - ) -> TransactionCreateAllocationsResponse: - """ - Updates allocations on an existing transaction - - Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. - - allocation_updates: Allocation operations to apply - - version: Current transaction version for optimistic concurrency control - - 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 - """ - if not transaction_ref: - raise ValueError(f"Expected a non-empty value for `transaction_ref` but received {transaction_ref!r}") - return self._post( - path_template("/transactions/{transaction_ref}/allocations", transaction_ref=transaction_ref), - body=maybe_transform( - { - "allocation_updates": allocation_updates, - "version": version, - }, - transaction_create_allocations_params.TransactionCreateAllocationsParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TransactionCreateAllocationsResponse, - ) - def list_history( self, transaction_ref: str, @@ -995,55 +944,6 @@ async def list( cast_to=TransactionListResponse, ) - async def create_allocations( - self, - transaction_ref: str, - *, - allocation_updates: Iterable[transaction_create_allocations_params.AllocationUpdate], - version: int, - # 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, - ) -> TransactionCreateAllocationsResponse: - """ - Updates allocations on an existing transaction - - Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. - - allocation_updates: Allocation operations to apply - - version: Current transaction version for optimistic concurrency control - - 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 - """ - if not transaction_ref: - raise ValueError(f"Expected a non-empty value for `transaction_ref` but received {transaction_ref!r}") - return await self._post( - path_template("/transactions/{transaction_ref}/allocations", transaction_ref=transaction_ref), - body=await async_maybe_transform( - { - "allocation_updates": allocation_updates, - "version": version, - }, - transaction_create_allocations_params.TransactionCreateAllocationsParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=TransactionCreateAllocationsResponse, - ) - async def list_history( self, transaction_ref: str, @@ -1167,9 +1067,6 @@ def __init__(self, transactions: TransactionsResource) -> None: self.list = to_raw_response_wrapper( transactions.list, ) - self.create_allocations = to_raw_response_wrapper( - transactions.create_allocations, - ) self.list_history = to_raw_response_wrapper( transactions.list_history, ) @@ -1197,9 +1094,6 @@ def __init__(self, transactions: AsyncTransactionsResource) -> None: self.list = async_to_raw_response_wrapper( transactions.list, ) - self.create_allocations = async_to_raw_response_wrapper( - transactions.create_allocations, - ) self.list_history = async_to_raw_response_wrapper( transactions.list_history, ) @@ -1227,9 +1121,6 @@ def __init__(self, transactions: TransactionsResource) -> None: self.list = to_streamed_response_wrapper( transactions.list, ) - self.create_allocations = to_streamed_response_wrapper( - transactions.create_allocations, - ) self.list_history = to_streamed_response_wrapper( transactions.list_history, ) @@ -1257,9 +1148,6 @@ def __init__(self, transactions: AsyncTransactionsResource) -> None: self.list = async_to_streamed_response_wrapper( transactions.list, ) - self.create_allocations = async_to_streamed_response_wrapper( - transactions.create_allocations, - ) self.list_history = async_to_streamed_response_wrapper( transactions.list_history, ) diff --git a/src/fragment/types/__init__.py b/src/fragment/types/__init__.py index 71f51de..290f576 100644 --- a/src/fragment/types/__init__.py +++ b/src/fragment/types/__init__.py @@ -40,15 +40,9 @@ from .external_account_list_response import ExternalAccountListResponse as ExternalAccountListResponse from .external_account_create_response import ExternalAccountCreateResponse as ExternalAccountCreateResponse from .transaction_list_history_response import TransactionListHistoryResponse as TransactionListHistoryResponse -from .transaction_create_allocations_params import ( - TransactionCreateAllocationsParams as TransactionCreateAllocationsParams, -) from .transaction_search_allocations_params import ( TransactionSearchAllocationsParams as TransactionSearchAllocationsParams, ) -from .transaction_create_allocations_response import ( - TransactionCreateAllocationsResponse as TransactionCreateAllocationsResponse, -) from .transaction_search_allocations_response import ( TransactionSearchAllocationsResponse as TransactionSearchAllocationsResponse, ) diff --git a/src/fragment/types/invoice_update_params.py b/src/fragment/types/invoice_update_params.py index ad3ca78..79c199d 100644 --- a/src/fragment/types/invoice_update_params.py +++ b/src/fragment/types/invoice_update_params.py @@ -20,10 +20,12 @@ "LineItemsUpdateTags", "LineItemsUpdateTagsCreate", "LineItemsUpdateTagsDelete", + "LineItemsUpdateTagsSet", "LineItemsUpdateTagsUpdate", "Tags", "TagsCreate", "TagsDelete", + "TagsSet", "TagsUpdate", ] @@ -335,6 +337,24 @@ class LineItemsUpdateTagsDelete(TypedDict, total=False): """Tag key to delete""" +class LineItemsUpdateTagsSet(TypedDict, total=False): + """A key-value tag pair for metadata""" + + key: Required[str] + """Tag key. + + Must be a valid safe string (no special characters like #, /, :). Max 50 + characters. + """ + + value: Required[str] + """Tag value. + + Must be a valid safe string (no special characters like #, /, :). Max 200 + characters. + """ + + class LineItemsUpdateTagsUpdate(TypedDict, total=False): """A key-value tag pair for metadata""" @@ -355,15 +375,22 @@ class LineItemsUpdateTagsUpdate(TypedDict, total=False): class LineItemsUpdateTags(TypedDict, total=False): create: Iterable[LineItemsUpdateTagsCreate] - """Tags to add""" + """Tags to add. Prefer `set` unless you specifically want create-only validation.""" delete: Iterable[LineItemsUpdateTagsDelete] """Tags to remove by key""" + set: Iterable[LineItemsUpdateTagsSet] + """ + Tags to create or overwrite without requiring the caller to distinguish between + create and update. + """ + update: Iterable[LineItemsUpdateTagsUpdate] """Tags to update. - The key identifies the existing tag; the value is the new value. + The key identifies the existing tag; the value is the new value. Prefer `set` + unless you specifically want update-only validation. """ @@ -414,6 +441,24 @@ class TagsDelete(TypedDict, total=False): """Tag key to delete""" +class TagsSet(TypedDict, total=False): + """A key-value tag pair for metadata""" + + key: Required[str] + """Tag key. + + Must be a valid safe string (no special characters like #, /, :). Max 50 + characters. + """ + + value: Required[str] + """Tag value. + + Must be a valid safe string (no special characters like #, /, :). Max 200 + characters. + """ + + class TagsUpdate(TypedDict, total=False): """A key-value tag pair for metadata""" @@ -434,13 +479,20 @@ class TagsUpdate(TypedDict, total=False): class Tags(TypedDict, total=False): create: Iterable[TagsCreate] - """Tags to add""" + """Tags to add. Prefer `set` unless you specifically want create-only validation.""" delete: Iterable[TagsDelete] """Tags to remove by key""" + set: Iterable[TagsSet] + """ + Tags to create or overwrite without requiring the caller to distinguish between + create and update. + """ + update: Iterable[TagsUpdate] """Tags to update. - The key identifies the existing tag; the value is the new value. + The key identifies the existing tag; the value is the new value. Prefer `set` + unless you specifically want update-only validation. """ diff --git a/src/fragment/types/transaction_create_allocations_params.py b/src/fragment/types/transaction_create_allocations_params.py deleted file mode 100644 index 1e30832..0000000 --- a/src/fragment/types/transaction_create_allocations_params.py +++ /dev/null @@ -1,69 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "TransactionCreateAllocationsParams", - "AllocationUpdate", - "AllocationUpdateAddAllocationOperation", - "AllocationUpdateAddAllocationOperationUser", - "AllocationUpdateAddAllocationOperationUserID", - "AllocationUpdateAddAllocationOperationUserExternalID", - "AllocationUpdateDeleteAllocationOperation", -] - - -class TransactionCreateAllocationsParams(TypedDict, total=False): - allocation_updates: Required[Iterable[AllocationUpdate]] - """Allocation operations to apply""" - - version: Required[int] - """Current transaction version for optimistic concurrency control""" - - -class AllocationUpdateAddAllocationOperationUserID(TypedDict, total=False): - id: Required[str] - """FRAGMENT generated ID of the user""" - - -class AllocationUpdateAddAllocationOperationUserExternalID(TypedDict, total=False): - external_id: Required[str] - """External ID of the user""" - - -AllocationUpdateAddAllocationOperationUser: TypeAlias = Union[ - AllocationUpdateAddAllocationOperationUserID, AllocationUpdateAddAllocationOperationUserExternalID -] - - -class AllocationUpdateAddAllocationOperation(TypedDict, total=False): - """Transaction allocation against an invoice.""" - - amount: Required[str] - """Amount to allocate in smallest currency unit as stringified bigint.""" - - invoice_id: Required[str] - """The invoice to allocate against.""" - - op: Required[Literal["add"]] - """Add a new allocation""" - - type: Required[Literal["invoice_payin", "invoice_payout"]] - """The type of allocation.""" - - user: Required[AllocationUpdateAddAllocationOperationUser] - """Identifies a user by Fragment-generated id or external_id (request body).""" - - -class AllocationUpdateDeleteAllocationOperation(TypedDict, total=False): - id: Required[str] - """The ID of the allocation to remove.""" - - op: Required[Literal["delete"]] - """Delete an allocation""" - - -AllocationUpdate: TypeAlias = Union[AllocationUpdateAddAllocationOperation, AllocationUpdateDeleteAllocationOperation] diff --git a/src/fragment/types/transaction_create_allocations_response.py b/src/fragment/types/transaction_create_allocations_response.py deleted file mode 100644 index b9887f3..0000000 --- a/src/fragment/types/transaction_create_allocations_response.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .._models import BaseModel -from .transaction import Transaction - -__all__ = ["TransactionCreateAllocationsResponse"] - - -class TransactionCreateAllocationsResponse(BaseModel): - data: Transaction - """Transaction object.""" diff --git a/src/fragment/types/transaction_update_params.py b/src/fragment/types/transaction_update_params.py index 9a19f2c..0cdb0d5 100644 --- a/src/fragment/types/transaction_update_params.py +++ b/src/fragment/types/transaction_update_params.py @@ -16,6 +16,7 @@ "Tags", "TagsCreate", "TagsDelete", + "TagsSet", "TagsUpdate", ] @@ -97,6 +98,24 @@ class TagsDelete(TypedDict, total=False): """Tag key to delete""" +class TagsSet(TypedDict, total=False): + """A key-value tag pair for metadata""" + + key: Required[str] + """Tag key. + + Must be a valid safe string (no special characters like #, /, :). Max 50 + characters. + """ + + value: Required[str] + """Tag value. + + Must be a valid safe string (no special characters like #, /, :). Max 200 + characters. + """ + + class TagsUpdate(TypedDict, total=False): """A key-value tag pair for metadata""" @@ -117,13 +136,20 @@ class TagsUpdate(TypedDict, total=False): class Tags(TypedDict, total=False): create: Iterable[TagsCreate] - """Tags to add""" + """Tags to add. Prefer `set` unless you specifically want create-only validation.""" delete: Iterable[TagsDelete] """Tags to remove by key""" + set: Iterable[TagsSet] + """ + Tags to create or overwrite without requiring the caller to distinguish between + create and update. + """ + update: Iterable[TagsUpdate] """Tags to update. - The key identifies the existing tag; the value is the new value. + The key identifies the existing tag; the value is the new value. Prefer `set` + unless you specifically want update-only validation. """ diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index 532f69d..b4cd2ff 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -214,12 +214,18 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: } ], "delete": [{"key": "key"}], - "update": [ + "set": [ { "key": "region", "value": "eu-west-1", } ], + "update": [ + { + "key": "region", + "value": "us-east", + } + ], }, } ], @@ -232,12 +238,18 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: } ], "delete": [{"key": "key"}], - "update": [ + "set": [ { "key": "region", "value": "eu-west-1", } ], + "update": [ + { + "key": "region", + "value": "us-east", + } + ], }, ) assert_matches_type(InvoiceUpdateResponse, invoice, path=["response"]) @@ -610,12 +622,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) } ], "delete": [{"key": "key"}], - "update": [ + "set": [ { "key": "region", "value": "eu-west-1", } ], + "update": [ + { + "key": "region", + "value": "us-east", + } + ], }, } ], @@ -628,12 +646,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) } ], "delete": [{"key": "key"}], - "update": [ + "set": [ { "key": "region", "value": "eu-west-1", } ], + "update": [ + { + "key": "region", + "value": "us-east", + } + ], }, ) assert_matches_type(InvoiceUpdateResponse, invoice, path=["response"]) diff --git a/tests/api_resources/test_transactions.py b/tests/api_resources/test_transactions.py index 4b125f6..7a77e1d 100644 --- a/tests/api_resources/test_transactions.py +++ b/tests/api_resources/test_transactions.py @@ -16,7 +16,6 @@ TransactionUpdateResponse, TransactionRetrieveResponse, TransactionListHistoryResponse, - TransactionCreateAllocationsResponse, TransactionSearchAllocationsResponse, ) from fragment._utils import parse_datetime @@ -207,12 +206,18 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: } ], "delete": [{"key": "key"}], - "update": [ + "set": [ { "key": "region", "value": "eu-west-1", } ], + "update": [ + { + "key": "region", + "value": "us-east", + } + ], }, ) assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) @@ -291,88 +296,6 @@ def test_streaming_response_list(self, client: Fragment) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_method_create_allocations(self, client: Fragment) -> None: - transaction = client.transactions.create_allocations( - transaction_ref="txn_abc123", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) - assert_matches_type(TransactionCreateAllocationsResponse, transaction, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_raw_response_create_allocations(self, client: Fragment) -> None: - response = client.transactions.with_raw_response.create_allocations( - transaction_ref="txn_abc123", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - transaction = response.parse() - assert_matches_type(TransactionCreateAllocationsResponse, transaction, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_streaming_response_create_allocations(self, client: Fragment) -> None: - with client.transactions.with_streaming_response.create_allocations( - transaction_ref="txn_abc123", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - transaction = response.parse() - assert_matches_type(TransactionCreateAllocationsResponse, transaction, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - def test_path_params_create_allocations(self, client: Fragment) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `transaction_ref` but received ''"): - client.transactions.with_raw_response.create_allocations( - transaction_ref="", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) - @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_history(self, client: Fragment) -> None: @@ -669,12 +592,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) } ], "delete": [{"key": "key"}], - "update": [ + "set": [ { "key": "region", "value": "eu-west-1", } ], + "update": [ + { + "key": "region", + "value": "us-east", + } + ], }, ) assert_matches_type(TransactionUpdateResponse, transaction, path=["response"]) @@ -753,88 +682,6 @@ async def test_streaming_response_list(self, async_client: AsyncFragment) -> Non assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_method_create_allocations(self, async_client: AsyncFragment) -> None: - transaction = await async_client.transactions.create_allocations( - transaction_ref="txn_abc123", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) - assert_matches_type(TransactionCreateAllocationsResponse, transaction, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_raw_response_create_allocations(self, async_client: AsyncFragment) -> None: - response = await async_client.transactions.with_raw_response.create_allocations( - transaction_ref="txn_abc123", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - transaction = await response.parse() - assert_matches_type(TransactionCreateAllocationsResponse, transaction, path=["response"]) - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_streaming_response_create_allocations(self, async_client: AsyncFragment) -> None: - async with async_client.transactions.with_streaming_response.create_allocations( - transaction_ref="txn_abc123", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - transaction = await response.parse() - assert_matches_type(TransactionCreateAllocationsResponse, transaction, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Mock server tests are disabled") - @parametrize - async def test_path_params_create_allocations(self, async_client: AsyncFragment) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `transaction_ref` but received ''"): - await async_client.transactions.with_raw_response.create_allocations( - transaction_ref="", - allocation_updates=[ - { - "amount": "1000", - "invoice_id": "inv_abc123", - "op": "add", - "type": "invoice_payin", - "user": {"id": "user_abc123"}, - } - ], - version=0, - ) - @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_history(self, async_client: AsyncFragment) -> None: From e2ce984d3cadaf39400d35ae5d35d464027dca54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 12:33:39 +0000 Subject: [PATCH 06/13] feat(api): update SDK from prod (511af1bcd4001be60c589fed1d05a5814e416679) --- .stats.yml | 4 ++-- src/fragment/resources/external_accounts.py | 16 ++++++++-------- src/fragment/types/external_account.py | 8 ++++---- .../types/external_account_create_params.py | 4 ++-- .../types/external_account_create_response.py | 2 +- .../types/external_account_list_response.py | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.stats.yml b/.stats.yml index d0b6146..4eeb19b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-60daf02b324d50717c8ca7667f5b10b59be952cd10e241d1b0c4bc1480f0622e.yml -openapi_spec_hash: 42c18143f558432ff26fbcc94b8844ca +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-2398fe7cbcc1f6d8c10d2e5557cd7543c2d82c32f1b6988fc9e86fdbddc3e2d8.yml +openapi_spec_hash: 4ae386787af2c8da5c2232f9e46c0764 config_hash: e9de8e5044d45256185649ca63b8490f diff --git a/src/fragment/resources/external_accounts.py b/src/fragment/resources/external_accounts.py index 724c0af..081bc9b 100644 --- a/src/fragment/resources/external_accounts.py +++ b/src/fragment/resources/external_accounts.py @@ -55,12 +55,12 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccountCreateResponse: """ - Creates a new external account + Creates a new external account. Args: - external_id: External ID for the account (user-provided, unique, mutable) + external_id: Unique user-provided external ID. - name: Human-readable name for the external account (mutable) + name: Human-readable name. extra_headers: Send extra headers @@ -95,7 +95,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccountListResponse: - """Lists all external accounts for the workspace""" + """Lists all external accounts.""" return self._get( "/external-accounts", options=make_request_options( @@ -138,12 +138,12 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccountCreateResponse: """ - Creates a new external account + Creates a new external account. Args: - external_id: External ID for the account (user-provided, unique, mutable) + external_id: Unique user-provided external ID. - name: Human-readable name for the external account (mutable) + name: Human-readable name. extra_headers: Send extra headers @@ -178,7 +178,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccountListResponse: - """Lists all external accounts for the workspace""" + """Lists all external accounts.""" return await self._get( "/external-accounts", options=make_request_options( diff --git a/src/fragment/types/external_account.py b/src/fragment/types/external_account.py index 2129b3d..26aa976 100644 --- a/src/fragment/types/external_account.py +++ b/src/fragment/types/external_account.py @@ -6,13 +6,13 @@ class ExternalAccount(BaseModel): - """External account object""" + """External account object.""" id: str - """Fragment-generated unique ID for the external account""" + """FRAGMENT generated unique ID.""" external_id: str - """User-provided external ID""" + """Unique user-provided external ID.""" name: str - """Human-readable name for the external account""" + """Human-readable name.""" diff --git a/src/fragment/types/external_account_create_params.py b/src/fragment/types/external_account_create_params.py index e4113a5..420420a 100644 --- a/src/fragment/types/external_account_create_params.py +++ b/src/fragment/types/external_account_create_params.py @@ -9,7 +9,7 @@ class ExternalAccountCreateParams(TypedDict, total=False): external_id: Required[str] - """External ID for the account (user-provided, unique, mutable)""" + """Unique user-provided external ID.""" name: Required[str] - """Human-readable name for the external account (mutable)""" + """Human-readable name.""" diff --git a/src/fragment/types/external_account_create_response.py b/src/fragment/types/external_account_create_response.py index ee0c3ec..9062890 100644 --- a/src/fragment/types/external_account_create_response.py +++ b/src/fragment/types/external_account_create_response.py @@ -8,4 +8,4 @@ class ExternalAccountCreateResponse(BaseModel): data: ExternalAccount - """External account object""" + """External account object.""" diff --git a/src/fragment/types/external_account_list_response.py b/src/fragment/types/external_account_list_response.py index fe69982..eb11ebd 100644 --- a/src/fragment/types/external_account_list_response.py +++ b/src/fragment/types/external_account_list_response.py @@ -9,6 +9,6 @@ class ExternalAccountListResponse(BaseModel): - """List of external accounts""" + """List of external accounts.""" data: List[ExternalAccount] From cd9337fbe43c0c5e6ed9ec1ef4c6db5bbf270403 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 16:35:49 +0000 Subject: [PATCH 07/13] feat(api): update SDK from prod (b3080493fb6bb118abdd03644b9ef6f59d417a3c) --- .stats.yml | 6 +- src/fragment/resources/external_accounts.py | 4 +- src/fragment/resources/invoices.py | 66 ++++---- src/fragment/resources/products.py | 46 +++--- src/fragment/resources/roles.py | 12 +- src/fragment/resources/transactions.py | 122 +++++++-------- src/fragment/resources/users.py | 16 +- src/fragment/types/external_account.py | 2 +- .../types/external_account_create_params.py | 2 +- src/fragment/types/invoice.py | 67 ++++---- src/fragment/types/invoice_create_params.py | 47 +++--- src/fragment/types/invoice_create_response.py | 2 +- .../types/invoice_list_history_response.py | 3 +- src/fragment/types/invoice_list_response.py | 3 +- .../types/invoice_retrieve_response.py | 143 ++++++++++++----- src/fragment/types/invoice_search_params.py | 6 +- src/fragment/types/invoice_search_response.py | 147 ++++++++++++------ src/fragment/types/invoice_update_params.py | 72 +++++---- src/fragment/types/invoice_update_response.py | 2 +- src/fragment/types/product.py | 26 ++-- src/fragment/types/product_create_params.py | 24 +-- src/fragment/types/product_create_response.py | 2 +- src/fragment/types/product_list_response.py | 3 +- .../types/product_retrieve_response.py | 2 +- src/fragment/types/role.py | 6 +- src/fragment/types/role_create_params.py | 2 +- src/fragment/types/role_create_response.py | 2 +- src/fragment/types/role_list_response.py | 1 + src/fragment/types/transaction.py | 54 ++++--- .../types/transaction_create_params.py | 45 +++--- .../transaction_list_history_response.py | 3 +- src/fragment/types/transaction_list_params.py | 12 +- .../types/transaction_list_response.py | 3 +- .../transaction_search_allocations_params.py | 4 +- ...transaction_search_allocations_response.py | 34 ++-- .../types/transaction_search_params.py | 13 +- .../types/transaction_search_response.py | 3 +- .../types/transaction_update_params.py | 32 ++-- src/fragment/types/user.py | 8 +- src/fragment/types/user_create_params.py | 4 +- src/fragment/types/user_create_response.py | 2 +- src/fragment/types/user_list_response.py | 2 +- tests/api_resources/test_transactions.py | 16 +- 43 files changed, 606 insertions(+), 465 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4eeb19b..50303e2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-2398fe7cbcc1f6d8c10d2e5557cd7543c2d82c32f1b6988fc9e86fdbddc3e2d8.yml -openapi_spec_hash: 4ae386787af2c8da5c2232f9e46c0764 -config_hash: e9de8e5044d45256185649ca63b8490f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-d1b5cc19383470227e1435e227958a95c540e527eaefb5fcc206d7f8b89bca69.yml +openapi_spec_hash: 1bf0e3c6be232b10ea36d85fb1aa22c5 +config_hash: 0bc054caf56d79dc6e95b7ad898419d1 diff --git a/src/fragment/resources/external_accounts.py b/src/fragment/resources/external_accounts.py index 081bc9b..9a63096 100644 --- a/src/fragment/resources/external_accounts.py +++ b/src/fragment/resources/external_accounts.py @@ -58,7 +58,7 @@ def create( Creates a new external account. Args: - external_id: Unique user-provided external ID. + external_id: User-provided unique external ID. name: Human-readable name. @@ -141,7 +141,7 @@ async def create( Creates a new external account. Args: - external_id: Unique user-provided external ID. + external_id: User-provided unique external ID. name: Human-readable name. diff --git a/src/fragment/resources/invoices.py b/src/fragment/resources/invoices.py index 48b0387..4ef65bf 100644 --- a/src/fragment/resources/invoices.py +++ b/src/fragment/resources/invoices.py @@ -63,17 +63,15 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceCreateResponse: - """Creates a new invoice + """ + Creates an invoice. Args: - invoice_id: Unique identifier for the invoice. - - Make this the canonical ID from your system - for the transaction. + invoice_id: Unique ID for the invoice. - line_items: List of line items to create with the invoice + line_items: Line items to create with the invoice. - tags: Optional metadata tags for this invoice + tags: Tags for the invoice. extra_headers: Send extra headers @@ -111,10 +109,10 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceRetrieveResponse: """ - Gets an invoice by ID with balance details + Fetches an invoice. Args: - id: Invoice ID + id: Unique identifier for the invoice. extra_headers: Send extra headers @@ -149,13 +147,12 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceUpdateResponse: """ - Updates an invoice + Updates an invoice. Args: - id: Invoice ID + id: Unique identifier for the invoice. - current_invoice_version: The current version of the invoice. Must match the stored version for the update - to succeed (optimistic concurrency). + current_invoice_version: Current version of the invoice. Must match the stored version. extra_headers: Send extra headers @@ -193,7 +190,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceListResponse: - """Lists all invoices for the workspace""" + """Lists all invoices.""" return self._get( "/invoices", options=make_request_options( @@ -214,10 +211,10 @@ def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceListHistoryResponse: """ - Gets the version history of an invoice + Gets the version history of an invoice. Args: - id: Invoice ID + id: Unique identifier for the invoice. extra_headers: Send extra headers @@ -250,10 +247,10 @@ def search( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceSearchResponse: """ - Searches invoices + Searches invoices. Args: - filter: Filter criteria for the search + filter: Filter criteria for the search. page_info: Pagination parameters @@ -316,17 +313,15 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceCreateResponse: - """Creates a new invoice + """ + Creates an invoice. Args: - invoice_id: Unique identifier for the invoice. - - Make this the canonical ID from your system - for the transaction. + invoice_id: Unique ID for the invoice. - line_items: List of line items to create with the invoice + line_items: Line items to create with the invoice. - tags: Optional metadata tags for this invoice + tags: Tags for the invoice. extra_headers: Send extra headers @@ -364,10 +359,10 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceRetrieveResponse: """ - Gets an invoice by ID with balance details + Fetches an invoice. Args: - id: Invoice ID + id: Unique identifier for the invoice. extra_headers: Send extra headers @@ -402,13 +397,12 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceUpdateResponse: """ - Updates an invoice + Updates an invoice. Args: - id: Invoice ID + id: Unique identifier for the invoice. - current_invoice_version: The current version of the invoice. Must match the stored version for the update - to succeed (optimistic concurrency). + current_invoice_version: Current version of the invoice. Must match the stored version. extra_headers: Send extra headers @@ -446,7 +440,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceListResponse: - """Lists all invoices for the workspace""" + """Lists all invoices.""" return await self._get( "/invoices", options=make_request_options( @@ -467,10 +461,10 @@ async def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceListHistoryResponse: """ - Gets the version history of an invoice + Gets the version history of an invoice. Args: - id: Invoice ID + id: Unique identifier for the invoice. extra_headers: Send extra headers @@ -503,10 +497,10 @@ async def search( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceSearchResponse: """ - Searches invoices + Searches invoices. Args: - filter: Filter criteria for the search + filter: Filter criteria for the search. page_info: Pagination parameters diff --git a/src/fragment/resources/products.py b/src/fragment/resources/products.py index 665b13f..99a61e6 100644 --- a/src/fragment/resources/products.py +++ b/src/fragment/resources/products.py @@ -62,18 +62,18 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductCreateResponse: """ - Creates a new product + Creates a new product. Args: - code: Product code (unique identifier) + code: Unique product code. - description: Description of the product + description: Product description. - paid_by_roles: Roles that can pay for this product. Reference roles by id or name. At least one - of paid_by_roles or paid_to_roles must be provided. + paid_by_roles: Roles that can pay for the product. Reference roles by `id` or `name`. At least + one of `paid_by_roles` or `paid_to_roles` must be provided. - paid_to_roles: Roles that receive payment for this product. Reference roles by id or name. At - least one of paid_by_roles or paid_to_roles must be provided. + paid_to_roles: Roles that can receive payment for the product. Reference roles by `id` or + `name`. At least one of `paid_by_roles` or `paid_to_roles` must be provided. extra_headers: Send extra headers @@ -111,11 +111,12 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductRetrieveResponse: - """ - Gets a product by code + """Gets a product by code. Args: - code: Product code + code: Product code. + + Must not include #, /, or :. extra_headers: Send extra headers @@ -145,7 +146,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductListResponse: - """Lists all products for the workspace""" + """Lists all products.""" return self._get( "/products", options=make_request_options( @@ -192,18 +193,18 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductCreateResponse: """ - Creates a new product + Creates a new product. Args: - code: Product code (unique identifier) + code: Unique product code. - description: Description of the product + description: Product description. - paid_by_roles: Roles that can pay for this product. Reference roles by id or name. At least one - of paid_by_roles or paid_to_roles must be provided. + paid_by_roles: Roles that can pay for the product. Reference roles by `id` or `name`. At least + one of `paid_by_roles` or `paid_to_roles` must be provided. - paid_to_roles: Roles that receive payment for this product. Reference roles by id or name. At - least one of paid_by_roles or paid_to_roles must be provided. + paid_to_roles: Roles that can receive payment for the product. Reference roles by `id` or + `name`. At least one of `paid_by_roles` or `paid_to_roles` must be provided. extra_headers: Send extra headers @@ -241,11 +242,12 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductRetrieveResponse: - """ - Gets a product by code + """Gets a product by code. Args: - code: Product code + code: Product code. + + Must not include #, /, or :. extra_headers: Send extra headers @@ -275,7 +277,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductListResponse: - """Lists all products for the workspace""" + """Lists all products.""" return await self._get( "/products", options=make_request_options( diff --git a/src/fragment/resources/roles.py b/src/fragment/resources/roles.py index 8fb673d..59acd8f 100644 --- a/src/fragment/resources/roles.py +++ b/src/fragment/resources/roles.py @@ -56,10 +56,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleCreateResponse: """ - Creates a new role + Creates a new role. Args: - role: Name of the role + role: Name of the role. extra_headers: Send extra headers @@ -88,7 +88,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleListResponse: - """Lists all roles for the workspace""" + """Lists all roles.""" return self._get( "/roles", options=make_request_options( @@ -132,10 +132,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleCreateResponse: """ - Creates a new role + Creates a new role. Args: - role: Name of the role + role: Name of the role. extra_headers: Send extra headers @@ -164,7 +164,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleListResponse: - """Lists all roles for the workspace""" + """Lists all roles.""" return await self._get( "/roles", options=make_request_options( diff --git a/src/fragment/resources/transactions.py b/src/fragment/resources/transactions.py index ed733d6..34e5069 100644 --- a/src/fragment/resources/transactions.py +++ b/src/fragment/resources/transactions.py @@ -256,24 +256,26 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionCreateResponse: - """ - Syncs a transaction, optionally with allocations + """Creates a transaction. Args: - account: Account reference. Provide id, external_id, or both. + account: External account for the transaction. + + Identify it by `id`, `external_id`, or + both. - allocations: Allocation entries for this transaction. Empty indicates unreconciled funds. + allocations: Allocations for the transaction. An empty array indicates unreconciled funds. - amount: Amount in smallest currency unit as stringified bigint (can be positive or - negative). + amount: Transaction amount, as a string in the smallest unit of the currency (for + example, cents for USD). Can be positive or negative. - currency: Currency code (ISO 4217 or crypto) + currency: Currency code (ISO 4217 or crypto). - external_id: External transaction ID used for idempotent sync. + external_id: Unique user-provided external ID for the transaction. - posted: Posted timestamp in ISO 8601 format. + posted: Timestamp when the transaction was posted. Uses ISO 8601 format. - tags: Optional metadata tags for this transaction + tags: Tags for the transaction. extra_headers: Send extra headers @@ -315,11 +317,10 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionRetrieveResponse: """ - Gets a transaction by ID or external ID + Fetches a transaction by ID or external ID. Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. + transaction_ref: Transaction `id` or `external_id`. extra_headers: Send extra headers @@ -354,13 +355,12 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionUpdateResponse: """ - Updates a transaction (tags, allocations, or both) + Updates a transaction. Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. + transaction_ref: Transaction `id` or `external_id`. - current_transaction_version: Current transaction version for optimistic concurrency control. + current_transaction_version: Current version of the transaction. Must match the stored version. extra_headers: Send extra headers @@ -400,16 +400,16 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionListResponse: - """Lists all transactions for the workspace + """ + Lists all transactions. Args: - account: Filter by account. - - Encoded account ID (ext_account_xxx) or external_id. If the - account does not exist, returns an empty list. + account: Filter by account `id` or `external_id`. If the account does not exist, returns + an empty list. - reconciliation_status: Filter by reconciliation state. reconciled = unallocated_amount === 0; - unreconciled = unallocated_amount !== 0. Omit for all transactions. + reconciliation_status: Filter by reconciliation status. `reconciled` returns transactions where + unallocated_amount is 0. `unreconciled` returns transactions where + unallocated_amount is not 0. Omit for all transactions. extra_headers: Send extra headers @@ -449,11 +449,10 @@ def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionListHistoryResponse: """ - Gets the version history of a transaction + Gets the version history of a transaction. Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. + transaction_ref: Transaction `id` or `external_id`. extra_headers: Send extra headers @@ -485,10 +484,10 @@ def search( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionSearchResponse: """ - Searches transactions by filter criteria + Searches transactions. Args: - filter: Filter criteria for searching transactions. + filter: Filter for searching transactions. extra_headers: Send extra headers @@ -519,10 +518,10 @@ def search_allocations( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionSearchAllocationsResponse: """ - Searches transaction allocations by filter criteria + Searches transaction allocations. Args: - filter: Filter criteria for searching transaction allocations. + filter: Filter for searching transaction allocations. extra_headers: Send extra headers @@ -763,24 +762,26 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionCreateResponse: - """ - Syncs a transaction, optionally with allocations + """Creates a transaction. Args: - account: Account reference. Provide id, external_id, or both. + account: External account for the transaction. + + Identify it by `id`, `external_id`, or + both. - allocations: Allocation entries for this transaction. Empty indicates unreconciled funds. + allocations: Allocations for the transaction. An empty array indicates unreconciled funds. - amount: Amount in smallest currency unit as stringified bigint (can be positive or - negative). + amount: Transaction amount, as a string in the smallest unit of the currency (for + example, cents for USD). Can be positive or negative. - currency: Currency code (ISO 4217 or crypto) + currency: Currency code (ISO 4217 or crypto). - external_id: External transaction ID used for idempotent sync. + external_id: Unique user-provided external ID for the transaction. - posted: Posted timestamp in ISO 8601 format. + posted: Timestamp when the transaction was posted. Uses ISO 8601 format. - tags: Optional metadata tags for this transaction + tags: Tags for the transaction. extra_headers: Send extra headers @@ -822,11 +823,10 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionRetrieveResponse: """ - Gets a transaction by ID or external ID + Fetches a transaction by ID or external ID. Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. + transaction_ref: Transaction `id` or `external_id`. extra_headers: Send extra headers @@ -861,13 +861,12 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionUpdateResponse: """ - Updates a transaction (tags, allocations, or both) + Updates a transaction. Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. + transaction_ref: Transaction `id` or `external_id`. - current_transaction_version: Current transaction version for optimistic concurrency control. + current_transaction_version: Current version of the transaction. Must match the stored version. extra_headers: Send extra headers @@ -907,16 +906,16 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionListResponse: - """Lists all transactions for the workspace + """ + Lists all transactions. Args: - account: Filter by account. - - Encoded account ID (ext_account_xxx) or external_id. If the - account does not exist, returns an empty list. + account: Filter by account `id` or `external_id`. If the account does not exist, returns + an empty list. - reconciliation_status: Filter by reconciliation state. reconciled = unallocated_amount === 0; - unreconciled = unallocated_amount !== 0. Omit for all transactions. + reconciliation_status: Filter by reconciliation status. `reconciled` returns transactions where + unallocated_amount is 0. `unreconciled` returns transactions where + unallocated_amount is not 0. Omit for all transactions. extra_headers: Send extra headers @@ -956,11 +955,10 @@ async def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionListHistoryResponse: """ - Gets the version history of a transaction + Gets the version history of a transaction. Args: - transaction_ref: Transaction reference. Accepts either an encoded Fragment ID (txn_xxx) or an - external ID. + transaction_ref: Transaction `id` or `external_id`. extra_headers: Send extra headers @@ -992,10 +990,10 @@ async def search( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionSearchResponse: """ - Searches transactions by filter criteria + Searches transactions. Args: - filter: Filter criteria for searching transactions. + filter: Filter for searching transactions. extra_headers: Send extra headers @@ -1026,10 +1024,10 @@ async def search_allocations( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionSearchAllocationsResponse: """ - Searches transaction allocations by filter criteria + Searches transaction allocations. Args: - filter: Filter criteria for searching transaction allocations. + filter: Filter for searching transaction allocations. extra_headers: Send extra headers diff --git a/src/fragment/resources/users.py b/src/fragment/resources/users.py index d37e0eb..3eee0b7 100644 --- a/src/fragment/resources/users.py +++ b/src/fragment/resources/users.py @@ -55,12 +55,12 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserCreateResponse: """ - Creates a new user + Creates a new user. Args: - external_id: External ID for the user + external_id: User-provided unique external ID. - role: Role of the user + role: Name of the role to assign. Must match an existing role. extra_headers: Send extra headers @@ -95,7 +95,7 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserListResponse: - """Lists all users for the workspace""" + """Lists all users.""" return self._get( "/users", options=make_request_options( @@ -138,12 +138,12 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserCreateResponse: """ - Creates a new user + Creates a new user. Args: - external_id: External ID for the user + external_id: User-provided unique external ID. - role: Role of the user + role: Name of the role to assign. Must match an existing role. extra_headers: Send extra headers @@ -178,7 +178,7 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserListResponse: - """Lists all users for the workspace""" + """Lists all users.""" return await self._get( "/users", options=make_request_options( diff --git a/src/fragment/types/external_account.py b/src/fragment/types/external_account.py index 26aa976..f1d72db 100644 --- a/src/fragment/types/external_account.py +++ b/src/fragment/types/external_account.py @@ -12,7 +12,7 @@ class ExternalAccount(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID.""" + """User-provided unique external ID.""" name: str """Human-readable name.""" diff --git a/src/fragment/types/external_account_create_params.py b/src/fragment/types/external_account_create_params.py index 420420a..a046d84 100644 --- a/src/fragment/types/external_account_create_params.py +++ b/src/fragment/types/external_account_create_params.py @@ -9,7 +9,7 @@ class ExternalAccountCreateParams(TypedDict, total=False): external_id: Required[str] - """Unique user-provided external ID.""" + """User-provided unique external ID.""" name: Required[str] """Human-readable name.""" diff --git a/src/fragment/types/invoice.py b/src/fragment/types/invoice.py index 3830d7a..35202a4 100644 --- a/src/fragment/types/invoice.py +++ b/src/fragment/types/invoice.py @@ -13,45 +13,51 @@ class Tag(BaseModel): """A key-value tag pair""" key: str - """Tag key""" + """Tag key.""" value: str - """Tag value""" + """Tag value.""" class LineItemPrice(BaseModel): - """Price breakdown containing amount, unit price, and quantity""" + """Price breakdown.""" amount: str - """Total amount in smallest currency unit (represented as string for bigint)""" + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ quantity: int - """Quantity of units for this line item""" + """Number of units.""" unit_price: str - """Unit price in smallest currency unit (represented as string for bigint)""" + """ + Unit price as a string in the smallest unit of the currency (for example, cents + for USD). + """ class LineItemTag(BaseModel): """A key-value tag pair""" key: str - """Tag key""" + """Tag key.""" value: str - """Tag value""" + """Tag value.""" class LineItem(BaseModel): - """Invoice line item object""" + """Invoice line item.""" id: str - """Unique identifier for the line item""" + """Unique invoice ID.""" amount: str - """Deprecated: use price.amount instead. - - Total amount in smallest currency unit (represented as string for bigint) + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). Deprecated, use price.amount instead. """ currency_code: Literal[ @@ -235,53 +241,50 @@ class LineItem(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" description: str - """Description of the line item""" + """Description of the line item.""" price: LineItemPrice - """Price breakdown containing amount, unit price, and quantity""" + """Price breakdown.""" product_id: str - """ID of the product/catalog item""" + """Unique identifier for the product.""" tags: List[LineItemTag] - """Metadata tags for this line item""" + """Tags for the line item.""" type: Literal["payin", "payout"] - """The type of the line item""" + """Type of the line item.""" user_id: str - """External ID of the user associated with this line item""" + """User-provided unique external ID.""" class Invoice(BaseModel): - """Invoice object""" + """Invoice object.""" id: str - """Unique identifier for the invoice""" + """Unique invoice ID.""" created: datetime - """ISO 8601 timestamp when the invoice was created""" + """Timestamp when the invoice was created. Uses ISO 8601 format.""" status: Literal["active"] - """Deprecated: The status of the invoice""" + """Status of the invoice. Deprecated.""" tags: List[Tag] - """Metadata tags for this invoice""" + """Tags for the invoice.""" version: float - """The current version of the invoice. - - Pass this value when updating to ensure thread safety. - """ + """Current version of the invoice.""" workspace_id: str - """Workspace ID this invoice belongs to""" + """Workspace the invoice belongs to.""" line_items: Optional[List[LineItem]] = None - """List of line items associated with this invoice""" + """Line items for the invoice.""" modified: Optional[datetime] = None - """ISO 8601 timestamp when the invoice was last modified""" + """Timestamp when the invoice was last modified. Uses ISO 8601 format.""" diff --git a/src/fragment/types/invoice_create_params.py b/src/fragment/types/invoice_create_params.py index 13fbb5a..11bd5c6 100644 --- a/src/fragment/types/invoice_create_params.py +++ b/src/fragment/types/invoice_create_params.py @@ -19,45 +19,45 @@ class InvoiceCreateParams(TypedDict, total=False): invoice_id: Required[str] - """Unique identifier for the invoice. - - Make this the canonical ID from your system for the transaction. - """ + """Unique ID for the invoice.""" line_items: Required[Iterable[LineItem]] - """List of line items to create with the invoice""" + """Line items to create with the invoice.""" tags: Iterable[Tag] - """Optional metadata tags for this invoice""" + """Tags for the invoice.""" class LineItemUserID(TypedDict, total=False): id: Required[str] - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" class LineItemUserExternalID(TypedDict, total=False): external_id: Required[str] - """External ID of the user""" + """User-provided unique external ID.""" LineItemUser: TypeAlias = Union[LineItemUserID, LineItemUserExternalID] class LineItemPrice(TypedDict, total=False): - """Price breakdown. Provide amount, or unit_price + quantity, or all three.""" + """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" amount: str - """Total amount in smallest currency unit. - - Required if unit_price and quantity are not provided. + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). Required if unit_price and quantity are not provided. """ quantity: int - """Number of units for this line item.""" + """Number of units for the line item.""" unit_price: str - """Price per unit in smallest currency unit.""" + """ + Price per unit as a string in the smallest unit of the currency (for example, + cents for USD). + """ class LineItemTag(TypedDict, total=False): @@ -82,19 +82,22 @@ class LineItem(TypedDict, total=False): """Data to create a line item.""" description: Required[str] - """Description of the line item""" + """Description of the line item.""" product_id: Required[str] - """ID of the product/catalog item""" + """Unique identifier for the product.""" type: Required[Literal["payin", "payout"]] - """The type of the line item""" + """Type of the line item.""" user: Required[LineItemUser] - """Identifies a user by Fragment-generated id or external_id (request body).""" + """Identifies a user by `id` or `external_id`.""" amount: str - """Deprecated: use price instead. Total amount in smallest currency unit.""" + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). Deprecated, use price instead. + """ currency_code: Literal[ "ADA", @@ -277,13 +280,13 @@ class LineItem(TypedDict, total=False): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" price: LineItemPrice - """Price breakdown. Provide amount, or unit_price + quantity, or all three.""" + """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" tags: Iterable[LineItemTag] - """Optional metadata tags for this line item""" + """Tags for the line item.""" class Tag(TypedDict, total=False): diff --git a/src/fragment/types/invoice_create_response.py b/src/fragment/types/invoice_create_response.py index eec755f..0199cce 100644 --- a/src/fragment/types/invoice_create_response.py +++ b/src/fragment/types/invoice_create_response.py @@ -8,4 +8,4 @@ class InvoiceCreateResponse(BaseModel): data: Invoice - """Invoice object""" + """Invoice object.""" diff --git a/src/fragment/types/invoice_list_history_response.py b/src/fragment/types/invoice_list_history_response.py index d411162..af74d5b 100644 --- a/src/fragment/types/invoice_list_history_response.py +++ b/src/fragment/types/invoice_list_history_response.py @@ -9,6 +9,5 @@ class InvoiceListHistoryResponse(BaseModel): - """Version history of an invoice""" - data: List[Invoice] + """Version history of the invoice.""" diff --git a/src/fragment/types/invoice_list_response.py b/src/fragment/types/invoice_list_response.py index 8f42ec0..b9a2949 100644 --- a/src/fragment/types/invoice_list_response.py +++ b/src/fragment/types/invoice_list_response.py @@ -9,6 +9,5 @@ class InvoiceListResponse(BaseModel): - """List of invoices""" - data: List[Invoice] + """List of invoices.""" diff --git a/src/fragment/types/invoice_retrieve_response.py b/src/fragment/types/invoice_retrieve_response.py index 714a43d..4939ae4 100644 --- a/src/fragment/types/invoice_retrieve_response.py +++ b/src/fragment/types/invoice_retrieve_response.py @@ -28,40 +28,67 @@ class DataBalanceNet(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataBalancePayins(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataBalancePayouts(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataBalance(BaseModel): currency: str - """Currency code""" + """Currency code (ISO 4217 or crypto).""" net: DataBalanceNet @@ -74,40 +101,43 @@ class DataPaymentTransactionTag(BaseModel): """A key-value tag pair""" key: str - """Tag key""" + """Tag key.""" value: str - """Tag value""" + """Tag value.""" class DataPaymentTransaction(BaseModel): - """Reference to a transaction by encoded ID and external ID.""" + """Transaction reference.""" id: str - """Encoded transaction ID.""" + """FRAGMENT generated unique ID.""" external_id: str - """External transaction ID.""" + """Unique user-provided external ID for the transaction.""" tags: List[DataPaymentTransactionTag] - """Metadata tags from the parent transaction.""" + """Tags from the parent transaction.""" class DataPaymentUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" id: str - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" external_id: str - """External ID of the user""" + """User-provided unique external ID.""" class DataPayment(BaseModel): - """A payment allocated to this invoice.""" + """A payment allocated to the invoice.""" amount: str - """Amount allocated in smallest currency unit as stringified bigint.""" + """ + Amount allocated as a string in the smallest unit of the currency (for example, + cents for USD). + """ currency: Literal[ "ADA", @@ -290,57 +320,84 @@ class DataPayment(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" posted: datetime - """Posted timestamp of the parent transaction in ISO 8601 format.""" + """Timestamp when the parent transaction was posted. Uses ISO 8601 format.""" transaction: DataPaymentTransaction - """Reference to a transaction by encoded ID and external ID.""" + """Transaction reference.""" type: Literal["payin", "payout"] - """The type of the payment.""" + """Type of the payment.""" user: DataPaymentUser - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" class DataUserBalanceNet(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataUserBalancePayins(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataUserBalancePayouts(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataUserBalance(BaseModel): currency: str - """Currency code""" + """Currency code (ISO 4217 or crypto).""" net: DataUserBalanceNet @@ -351,25 +408,25 @@ class DataUserBalance(BaseModel): class DataUser(BaseModel): id: str - """User/party ID""" + """User-provided unique external ID.""" balances: List[DataUserBalance] - """Per-currency balance breakdown for this user""" + """Per-currency balance breakdown for the user.""" class Data(Invoice): - """Invoice with balance details""" + """Invoice with balance details.""" balances: List[DataBalance] - """Invoice-level balances by currency: payins, payouts, and net (payins - payouts)""" + """Invoice-level balances by currency.""" payments: List[DataPayment] - """Transaction allocations (payments) associated with this invoice.""" + """Payments allocated to the invoice.""" users: List[DataUser] - """Users/parties involved in the invoice""" + """Users involved in the invoice.""" class InvoiceRetrieveResponse(BaseModel): data: Data - """Invoice with balance details""" + """Invoice with balance details.""" diff --git a/src/fragment/types/invoice_search_params.py b/src/fragment/types/invoice_search_params.py index 54b396e..224d0ce 100644 --- a/src/fragment/types/invoice_search_params.py +++ b/src/fragment/types/invoice_search_params.py @@ -10,7 +10,7 @@ class InvoiceSearchParams(TypedDict, total=False): filter: Required[Filter] - """Filter criteria for the search""" + """Filter criteria for the search.""" page_info: Required[PageInfo] """Pagination parameters""" @@ -60,7 +60,7 @@ class FilterTags(TypedDict, total=False): class Filter(TypedDict, total=False): - """Filter criteria for the search""" + """Filter criteria for the search.""" status: Literal["open"] """Filter by invoice status. @@ -80,7 +80,7 @@ class PageInfo(TypedDict, total=False): """Pagination parameters""" after: str - """Cursor for fetching the next page of results""" + """Cursor for fetching the next page of results.""" limit: int """Number of results to return. Defaults to 20.""" diff --git a/src/fragment/types/invoice_search_response.py b/src/fragment/types/invoice_search_response.py index 29f5d76..52c2ac1 100644 --- a/src/fragment/types/invoice_search_response.py +++ b/src/fragment/types/invoice_search_response.py @@ -30,40 +30,67 @@ class DataInvoiceBalanceNet(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataInvoiceBalancePayins(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataInvoiceBalancePayouts(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataInvoiceBalance(BaseModel): currency: str - """Currency code""" + """Currency code (ISO 4217 or crypto).""" net: DataInvoiceBalanceNet @@ -76,40 +103,43 @@ class DataInvoicePaymentTransactionTag(BaseModel): """A key-value tag pair""" key: str - """Tag key""" + """Tag key.""" value: str - """Tag value""" + """Tag value.""" class DataInvoicePaymentTransaction(BaseModel): - """Reference to a transaction by encoded ID and external ID.""" + """Transaction reference.""" id: str - """Encoded transaction ID.""" + """FRAGMENT generated unique ID.""" external_id: str - """External transaction ID.""" + """Unique user-provided external ID for the transaction.""" tags: List[DataInvoicePaymentTransactionTag] - """Metadata tags from the parent transaction.""" + """Tags from the parent transaction.""" class DataInvoicePaymentUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" id: str - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" external_id: str - """External ID of the user""" + """User-provided unique external ID.""" class DataInvoicePayment(BaseModel): - """A payment allocated to this invoice.""" + """A payment allocated to the invoice.""" amount: str - """Amount allocated in smallest currency unit as stringified bigint.""" + """ + Amount allocated as a string in the smallest unit of the currency (for example, + cents for USD). + """ currency: Literal[ "ADA", @@ -292,57 +322,84 @@ class DataInvoicePayment(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" posted: datetime - """Posted timestamp of the parent transaction in ISO 8601 format.""" + """Timestamp when the parent transaction was posted. Uses ISO 8601 format.""" transaction: DataInvoicePaymentTransaction - """Reference to a transaction by encoded ID and external ID.""" + """Transaction reference.""" type: Literal["payin", "payout"] - """The type of the payment.""" + """Type of the payment.""" user: DataInvoicePaymentUser - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" class DataInvoiceUserBalanceNet(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataInvoiceUserBalancePayins(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataInvoiceUserBalancePayouts(BaseModel): actual: str - """Actual amount (represented as string)""" + """ + Actual amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ expected: str - """Expected amount (represented as string)""" + """ + Expected amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ remaining: str - """Remaining amount (expected - actual, represented as string)""" + """ + Remaining amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class DataInvoiceUserBalance(BaseModel): currency: str - """Currency code""" + """Currency code (ISO 4217 or crypto).""" net: DataInvoiceUserBalanceNet @@ -353,41 +410,41 @@ class DataInvoiceUserBalance(BaseModel): class DataInvoiceUser(BaseModel): id: str - """User/party ID""" + """User-provided unique external ID.""" balances: List[DataInvoiceUserBalance] - """Per-currency balance breakdown for this user""" + """Per-currency balance breakdown for the user.""" class DataInvoice(Invoice): - """Invoice with balance details""" + """Invoice with balance details.""" balances: List[DataInvoiceBalance] - """Invoice-level balances by currency: payins, payouts, and net (payins - payouts)""" + """Invoice-level balances by currency.""" payments: List[DataInvoicePayment] - """Transaction allocations (payments) associated with this invoice.""" + """Payments allocated to the invoice.""" users: List[DataInvoiceUser] - """Users/parties involved in the invoice""" + """Users involved in the invoice.""" class DataPageInfo(BaseModel): """Pagination cursors.""" next_cursor: Optional[str] = None - """Cursor to fetch the next page of results""" + """Cursor to fetch the next page of results.""" class Data(BaseModel): invoices: List[DataInvoice] - """List of invoices matching the search criteria""" + """Invoices matching the search criteria.""" page_info: DataPageInfo """Pagination cursors.""" class InvoiceSearchResponse(BaseModel): - """Response body for searching invoices""" + """Search results for invoices.""" data: Data diff --git a/src/fragment/types/invoice_update_params.py b/src/fragment/types/invoice_update_params.py index 79c199d..8ea944b 100644 --- a/src/fragment/types/invoice_update_params.py +++ b/src/fragment/types/invoice_update_params.py @@ -32,11 +32,7 @@ class InvoiceUpdateParams(TypedDict, total=False): current_invoice_version: Required[float] - """The current version of the invoice. - - Must match the stored version for the update to succeed (optimistic - concurrency). - """ + """Current version of the invoice. Must match the stored version.""" line_items: LineItems @@ -45,31 +41,34 @@ class InvoiceUpdateParams(TypedDict, total=False): class LineItemsCreateUserID(TypedDict, total=False): id: Required[str] - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" class LineItemsCreateUserExternalID(TypedDict, total=False): external_id: Required[str] - """External ID of the user""" + """User-provided unique external ID.""" LineItemsCreateUser: TypeAlias = Union[LineItemsCreateUserID, LineItemsCreateUserExternalID] class LineItemsCreatePrice(TypedDict, total=False): - """Price breakdown. Provide amount, or unit_price + quantity, or all three.""" + """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" amount: str - """Total amount in smallest currency unit. - - Required if unit_price and quantity are not provided. + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). Required if unit_price and quantity are not provided. """ quantity: int - """Number of units for this line item.""" + """Number of units for the line item.""" unit_price: str - """Price per unit in smallest currency unit.""" + """ + Price per unit as a string in the smallest unit of the currency (for example, + cents for USD). + """ class LineItemsCreateTag(TypedDict, total=False): @@ -94,19 +93,22 @@ class LineItemsCreate(TypedDict, total=False): """Data to create a line item.""" description: Required[str] - """Description of the line item""" + """Description of the line item.""" product_id: Required[str] - """ID of the product/catalog item""" + """Unique identifier for the product.""" type: Required[Literal["payin", "payout"]] - """The type of the line item""" + """Type of the line item.""" user: Required[LineItemsCreateUser] - """Identifies a user by Fragment-generated id or external_id (request body).""" + """Identifies a user by `id` or `external_id`.""" amount: str - """Deprecated: use price instead. Total amount in smallest currency unit.""" + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). Deprecated, use price instead. + """ currency_code: Literal[ "ADA", @@ -289,29 +291,35 @@ class LineItemsCreate(TypedDict, total=False): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" price: LineItemsCreatePrice - """Price breakdown. Provide amount, or unit_price + quantity, or all three.""" + """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" tags: Iterable[LineItemsCreateTag] - """Optional metadata tags for this line item""" + """Tags for the line item.""" class LineItemsDelete(TypedDict, total=False): id: Required[str] - """ID of the line item to delete""" + """Unique identifier for the line item to delete.""" class LineItemsUpdatePrice(TypedDict, total=False): quantity: Required[int] - """Number of units for this line item.""" + """Number of units for the line item.""" unit_price: Required[str] - """Price per unit in smallest currency unit.""" + """ + Price per unit as a string in the smallest unit of the currency (for example, + cents for USD). + """ amount: str - """Total amount in smallest currency unit.""" + """ + Total amount as a string in the smallest unit of the currency (for example, + cents for USD). + """ class LineItemsUpdateTagsCreate(TypedDict, total=False): @@ -378,7 +386,7 @@ class LineItemsUpdateTags(TypedDict, total=False): """Tags to add. Prefer `set` unless you specifically want create-only validation.""" delete: Iterable[LineItemsUpdateTagsDelete] - """Tags to remove by key""" + """Tags to remove by key.""" set: Iterable[LineItemsUpdateTagsSet] """ @@ -395,10 +403,10 @@ class LineItemsUpdateTags(TypedDict, total=False): class LineItemsUpdate(TypedDict, total=False): - """Partial update for an existing line item. All fields except id are optional.""" + """Updates an existing line item.""" id: Required[str] - """ID of the line item to update""" + """Unique identifier for the line item to update.""" description: str @@ -409,13 +417,13 @@ class LineItemsUpdate(TypedDict, total=False): class LineItems(TypedDict, total=False): create: Iterable[LineItemsCreate] - """Line items to add to the invoice""" + """Line items to add to the invoice.""" delete: Iterable[LineItemsDelete] - """Line items to remove from the invoice""" + """Line items to remove from the invoice.""" update: Iterable[LineItemsUpdate] - """Existing line items to update""" + """Existing line items to update.""" class TagsCreate(TypedDict, total=False): @@ -482,7 +490,7 @@ class Tags(TypedDict, total=False): """Tags to add. Prefer `set` unless you specifically want create-only validation.""" delete: Iterable[TagsDelete] - """Tags to remove by key""" + """Tags to remove by key.""" set: Iterable[TagsSet] """ diff --git a/src/fragment/types/invoice_update_response.py b/src/fragment/types/invoice_update_response.py index 4f8409a..2ceb944 100644 --- a/src/fragment/types/invoice_update_response.py +++ b/src/fragment/types/invoice_update_response.py @@ -8,4 +8,4 @@ class InvoiceUpdateResponse(BaseModel): data: Invoice - """Invoice object""" + """Invoice object.""" diff --git a/src/fragment/types/product.py b/src/fragment/types/product.py index 23f9c30..66b73b8 100644 --- a/src/fragment/types/product.py +++ b/src/fragment/types/product.py @@ -12,45 +12,45 @@ class PaidByRole(BaseModel): """Role reference in product API responses.""" id: str - """The unique ID of the role""" + """FRAGMENT generated unique ID.""" name: str - """The name of the role""" + """Name of the role.""" class PaidToRole(BaseModel): """Role reference in product API responses.""" id: str - """The unique ID of the role""" + """FRAGMENT generated unique ID.""" name: str - """The name of the role""" + """Name of the role.""" class Product(BaseModel): - """Product object""" + """Product object.""" id: str - """Unique identifier for the product""" + """FRAGMENT generated unique ID.""" code: str - """User-defined product identifier.""" + """Product code.""" created: datetime - """ISO 8601 timestamp when the product was created""" + """Timestamp when the product was created. Uses ISO 8601 format.""" paid_by_roles: List[PaidByRole] - """User roles that can pay for this product""" + """Roles that can pay for the product.""" paid_to_roles: List[PaidToRole] - """User roles that receive payment for this product""" + """Roles that can receive payment for the product.""" update_version: float - """Version number for optimistic locking""" + """Current version of the product.""" workspace_id: str - """Workspace ID this product belongs to""" + """Workspace ID of the product.""" description: Optional[str] = None - """Description of the product""" + """Product description.""" diff --git a/src/fragment/types/product_create_params.py b/src/fragment/types/product_create_params.py index 99c8cba..07e7515 100644 --- a/src/fragment/types/product_create_params.py +++ b/src/fragment/types/product_create_params.py @@ -18,34 +18,34 @@ class ProductCreateParams(TypedDict, total=False): code: Required[str] - """Product code (unique identifier)""" + """Unique product code.""" description: str - """Description of the product""" + """Product description.""" paid_by_roles: Iterable[PaidByRole] - """Roles that can pay for this product. + """Roles that can pay for the product. - Reference roles by id or name. At least one of paid_by_roles or paid_to_roles - must be provided. + Reference roles by `id` or `name`. At least one of `paid_by_roles` or + `paid_to_roles` must be provided. """ paid_to_roles: Iterable[PaidToRole] - """Roles that receive payment for this product. + """Roles that can receive payment for the product. - Reference roles by id or name. At least one of paid_by_roles or paid_to_roles - must be provided. + Reference roles by `id` or `name`. At least one of `paid_by_roles` or + `paid_to_roles` must be provided. """ class PaidByRoleID(TypedDict, total=False): id: Required[str] - """The unique ID of the role""" + """FRAGMENT generated unique ID.""" class PaidByRoleName(TypedDict, total=False): name: Required[str] - """The name of the role""" + """Name of the role.""" PaidByRole: TypeAlias = Union[PaidByRoleID, PaidByRoleName] @@ -53,12 +53,12 @@ class PaidByRoleName(TypedDict, total=False): class PaidToRoleID(TypedDict, total=False): id: Required[str] - """The unique ID of the role""" + """FRAGMENT generated unique ID.""" class PaidToRoleName(TypedDict, total=False): name: Required[str] - """The name of the role""" + """Name of the role.""" PaidToRole: TypeAlias = Union[PaidToRoleID, PaidToRoleName] diff --git a/src/fragment/types/product_create_response.py b/src/fragment/types/product_create_response.py index f921f55..389e24b 100644 --- a/src/fragment/types/product_create_response.py +++ b/src/fragment/types/product_create_response.py @@ -8,4 +8,4 @@ class ProductCreateResponse(BaseModel): data: Product - """Product object""" + """Product object.""" diff --git a/src/fragment/types/product_list_response.py b/src/fragment/types/product_list_response.py index 8b2c8b1..7c4e7c6 100644 --- a/src/fragment/types/product_list_response.py +++ b/src/fragment/types/product_list_response.py @@ -9,6 +9,5 @@ class ProductListResponse(BaseModel): - """List of products""" - data: List[Product] + """List of products.""" diff --git a/src/fragment/types/product_retrieve_response.py b/src/fragment/types/product_retrieve_response.py index ab4a8dc..594d653 100644 --- a/src/fragment/types/product_retrieve_response.py +++ b/src/fragment/types/product_retrieve_response.py @@ -8,4 +8,4 @@ class ProductRetrieveResponse(BaseModel): data: Product - """Product object""" + """Product object.""" diff --git a/src/fragment/types/role.py b/src/fragment/types/role.py index d094b48..0716049 100644 --- a/src/fragment/types/role.py +++ b/src/fragment/types/role.py @@ -6,10 +6,10 @@ class Role(BaseModel): - """Role object""" + """Role object.""" id: str - """Unique role ID""" + """FRAGMENT generated unique ID.""" role: str - """Name of the role""" + """Name of the role.""" diff --git a/src/fragment/types/role_create_params.py b/src/fragment/types/role_create_params.py index 855e332..cde32ed 100644 --- a/src/fragment/types/role_create_params.py +++ b/src/fragment/types/role_create_params.py @@ -9,4 +9,4 @@ class RoleCreateParams(TypedDict, total=False): role: Required[str] - """Name of the role""" + """Name of the role.""" diff --git a/src/fragment/types/role_create_response.py b/src/fragment/types/role_create_response.py index 9f1dedd..c3baf28 100644 --- a/src/fragment/types/role_create_response.py +++ b/src/fragment/types/role_create_response.py @@ -8,4 +8,4 @@ class RoleCreateResponse(BaseModel): data: Role - """Role object""" + """Role object.""" diff --git a/src/fragment/types/role_list_response.py b/src/fragment/types/role_list_response.py index f945539..b660eb2 100644 --- a/src/fragment/types/role_list_response.py +++ b/src/fragment/types/role_list_response.py @@ -12,3 +12,4 @@ class RoleListResponse(BaseModel): """List of roles""" data: List[Role] + """List of roles.""" diff --git a/src/fragment/types/transaction.py b/src/fragment/types/transaction.py index 663f902..20ab8dc 100644 --- a/src/fragment/types/transaction.py +++ b/src/fragment/types/transaction.py @@ -10,70 +10,74 @@ class Account(BaseModel): - """External account reference on transaction responses.""" + """External account for the transaction.""" id: str - """User-facing encoded account ID.""" + """FRAGMENT generated unique ID.""" external_id: str - """External account reference ID.""" + """Unique user-provided external ID for the external account.""" class AllocationUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" id: str - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" external_id: str - """External ID of the user""" + """User-provided unique external ID.""" class Allocation(BaseModel): - """Transaction allocation against an invoice.""" + """An allocation linking a transaction to an invoice.""" amount: str - """Allocated amount in smallest currency unit as stringified bigint.""" + """ + Allocated amount, as a positive string in the smallest unit of the currency (for + example, cents for USD). + """ invoice_id: str - """The invoice this allocation is applied against.""" + """Invoice the allocation is applied against.""" type: Literal["invoice_payin", "invoice_payout"] - """The type of allocation.""" + """Type of allocation.""" user: AllocationUser - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" class Tag(BaseModel): """A key-value tag pair""" key: str - """Tag key""" + """Tag key.""" value: str - """Tag value""" + """Tag value.""" class Transaction(BaseModel): """Transaction object.""" id: str - """User-facing encoded transaction ID.""" + """FRAGMENT generated unique ID.""" account: Account - """External account reference on transaction responses.""" + """External account for the transaction.""" allocations: List[Allocation] + """Allocations applied to the transaction.""" amount: str """ - Amount in smallest currency unit as stringified bigint (can be positive or - negative). + Transaction amount, as a string in the smallest unit of the currency (for + example, cents for USD). Can be positive or negative. """ created: datetime - """Creation timestamp.""" + """Timestamp when the transaction was created. Uses ISO 8601 format.""" currency: Literal[ "ADA", @@ -256,22 +260,22 @@ class Transaction(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" external_id: str - """External idempotency key provided by the user.""" + """Unique user-provided external ID for the transaction.""" posted: datetime - """Posted timestamp in ISO 8601 format.""" + """Timestamp when the transaction was posted. Uses ISO 8601 format.""" tags: List[Tag] - """Metadata tags associated with this transaction.""" + """Tags for the transaction.""" unallocated_amount: str - """Read-only amount not yet allocated.""" + """Amount not yet allocated, as a string.""" version: int - """Current version of the transaction, used for optimistic concurrency control.""" + """Current version of the transaction.""" modified: Optional[datetime] = None - """Last modified timestamp.""" + """Timestamp when the transaction was last modified. Uses ISO 8601 format.""" diff --git a/src/fragment/types/transaction_create_params.py b/src/fragment/types/transaction_create_params.py index 8af2d0c..c710b2c 100644 --- a/src/fragment/types/transaction_create_params.py +++ b/src/fragment/types/transaction_create_params.py @@ -21,15 +21,18 @@ class TransactionCreateParams(TypedDict, total=False): account: Required[Account] - """Account reference. Provide id, external_id, or both.""" + """External account for the transaction. + + Identify it by `id`, `external_id`, or both. + """ allocations: Required[Iterable[Allocation]] - """Allocation entries for this transaction. Empty indicates unreconciled funds.""" + """Allocations for the transaction. An empty array indicates unreconciled funds.""" amount: Required[str] """ - Amount in smallest currency unit as stringified bigint (can be positive or - negative). + Transaction amount, as a string in the smallest unit of the currency (for + example, cents for USD). Can be positive or negative. """ currency: Required[ @@ -215,55 +218,61 @@ class TransactionCreateParams(TypedDict, total=False): "CUSTOM", ] ] - """Currency code (ISO 4217 or crypto)""" + """Currency code (ISO 4217 or crypto).""" external_id: Required[str] - """External transaction ID used for idempotent sync.""" + """Unique user-provided external ID for the transaction.""" posted: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Posted timestamp in ISO 8601 format.""" + """Timestamp when the transaction was posted. Uses ISO 8601 format.""" tags: Iterable[Tag] - """Optional metadata tags for this transaction""" + """Tags for the transaction.""" class Account(TypedDict, total=False): - """Account reference. Provide id, external_id, or both.""" + """External account for the transaction. + + Identify it by `id`, `external_id`, or both. + """ id: str - """User-facing encoded account ID.""" + """FRAGMENT generated unique ID.""" external_id: str - """External account reference ID.""" + """Unique user-provided external ID for the external account.""" class AllocationUserID(TypedDict, total=False): id: Required[str] - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" class AllocationUserExternalID(TypedDict, total=False): external_id: Required[str] - """External ID of the user""" + """User-provided unique external ID.""" AllocationUser: TypeAlias = Union[AllocationUserID, AllocationUserExternalID] class Allocation(TypedDict, total=False): - """Transaction allocation against an invoice.""" + """An allocation linking a transaction to an invoice.""" amount: Required[str] - """Amount to allocate in smallest currency unit as stringified bigint.""" + """ + Allocation amount, as a positive string in the smallest unit of the currency + (for example, cents for USD). + """ invoice_id: Required[str] - """The invoice to allocate against.""" + """Invoice to allocate against.""" type: Required[Literal["invoice_payin", "invoice_payout"]] - """The type of allocation.""" + """Type of allocation.""" user: Required[AllocationUser] - """Identifies a user by Fragment-generated id or external_id (request body).""" + """Identifies a user by `id` or `external_id`.""" class Tag(TypedDict, total=False): diff --git a/src/fragment/types/transaction_list_history_response.py b/src/fragment/types/transaction_list_history_response.py index 3ee4420..0f63fec 100644 --- a/src/fragment/types/transaction_list_history_response.py +++ b/src/fragment/types/transaction_list_history_response.py @@ -9,6 +9,5 @@ class TransactionListHistoryResponse(BaseModel): - """Version history of a transaction""" - data: List[Transaction] + """List of transaction versions over time, ordered by version, oldest first.""" diff --git a/src/fragment/types/transaction_list_params.py b/src/fragment/types/transaction_list_params.py index b5b8db4..e4b4620 100644 --- a/src/fragment/types/transaction_list_params.py +++ b/src/fragment/types/transaction_list_params.py @@ -9,15 +9,15 @@ class TransactionListParams(TypedDict, total=False): account: str - """Filter by account. + """Filter by account `id` or `external_id`. - Encoded account ID (ext_account_xxx) or external_id. If the account does not - exist, returns an empty list. + If the account does not exist, returns an empty list. """ reconciliation_status: Literal["reconciled", "unreconciled"] - """Filter by reconciliation state. + """Filter by reconciliation status. - reconciled = unallocated_amount === 0; unreconciled = unallocated_amount !== 0. - Omit for all transactions. + `reconciled` returns transactions where unallocated_amount is 0. `unreconciled` + returns transactions where unallocated_amount is not 0. Omit for all + transactions. """ diff --git a/src/fragment/types/transaction_list_response.py b/src/fragment/types/transaction_list_response.py index fc72d31..3e1be12 100644 --- a/src/fragment/types/transaction_list_response.py +++ b/src/fragment/types/transaction_list_response.py @@ -9,6 +9,5 @@ class TransactionListResponse(BaseModel): - """List of transactions""" - data: List[Transaction] + """List of transaction objects matching the filter criteria.""" diff --git a/src/fragment/types/transaction_search_allocations_params.py b/src/fragment/types/transaction_search_allocations_params.py index c1c8ee8..86e4be8 100644 --- a/src/fragment/types/transaction_search_allocations_params.py +++ b/src/fragment/types/transaction_search_allocations_params.py @@ -11,7 +11,7 @@ class TransactionSearchAllocationsParams(TypedDict, total=False): filter: Required[Filter] - """Filter criteria for searching transaction allocations.""" + """Filter for searching transaction allocations.""" class FilterInvoiceID(TypedDict, total=False): @@ -20,6 +20,6 @@ class FilterInvoiceID(TypedDict, total=False): class Filter(TypedDict, total=False): - """Filter criteria for searching transaction allocations.""" + """Filter for searching transaction allocations.""" invoice_id: Required[FilterInvoiceID] diff --git a/src/fragment/types/transaction_search_allocations_response.py b/src/fragment/types/transaction_search_allocations_response.py index 9d76da0..de11343 100644 --- a/src/fragment/types/transaction_search_allocations_response.py +++ b/src/fragment/types/transaction_search_allocations_response.py @@ -10,51 +10,53 @@ class DataTransaction(BaseModel): - """Reference to a transaction by encoded ID and external ID.""" + """Transaction reference.""" id: str - """Encoded transaction ID.""" + """FRAGMENT generated unique ID.""" external_id: str - """External transaction ID.""" + """Unique user-provided external ID for the transaction.""" class DataUser(BaseModel): - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" id: str - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" external_id: str - """External ID of the user""" + """User-provided unique external ID.""" class Data(BaseModel): - """A flattened allocation with a reference to its parent transaction.""" + """An allocation with a reference to its parent transaction.""" id: str - """Allocation ID.""" + """FRAGMENT generated unique ID.""" amount: str - """Allocated amount in smallest currency unit as stringified bigint.""" + """ + Allocated amount, as a positive string in the smallest unit of the currency (for + example, cents for USD). + """ invoice_id: str - """The invoice this allocation is applied against.""" + """Invoice the allocation is applied against.""" posted: datetime - """Posted timestamp of the parent transaction in ISO 8601 format.""" + """Timestamp when the parent transaction was posted. Uses ISO 8601 format.""" transaction: DataTransaction - """Reference to a transaction by encoded ID and external ID.""" + """Transaction reference.""" type: Literal["invoice_payin", "invoice_payout"] - """The type of allocation.""" + """Type of allocation.""" user: DataUser - """User reference in API responses: Fragment user id and external_id.""" + """User reference.""" class TransactionSearchAllocationsResponse(BaseModel): - """Search results for transaction allocations.""" - data: List[Data] + """List of allocation search results.""" diff --git a/src/fragment/types/transaction_search_params.py b/src/fragment/types/transaction_search_params.py index bb5005b..8040ffa 100644 --- a/src/fragment/types/transaction_search_params.py +++ b/src/fragment/types/transaction_search_params.py @@ -10,17 +10,20 @@ class TransactionSearchParams(TypedDict, total=False): filter: Required[Filter] - """Filter criteria for searching transactions.""" + """Filter for searching transactions.""" class FilterAccountAny(TypedDict, total=False): - """Account reference. Provide id, external_id, or both.""" + """External account for the transaction. + + Identify it by `id`, `external_id`, or both. + """ id: str - """User-facing encoded account ID.""" + """FRAGMENT generated unique ID.""" external_id: str - """External account reference ID.""" + """Unique user-provided external ID for the external account.""" class FilterAccount(TypedDict, total=False): @@ -29,6 +32,6 @@ class FilterAccount(TypedDict, total=False): class Filter(TypedDict, total=False): - """Filter criteria for searching transactions.""" + """Filter for searching transactions.""" account: Required[FilterAccount] diff --git a/src/fragment/types/transaction_search_response.py b/src/fragment/types/transaction_search_response.py index 49f7099..c3db566 100644 --- a/src/fragment/types/transaction_search_response.py +++ b/src/fragment/types/transaction_search_response.py @@ -9,6 +9,5 @@ class TransactionSearchResponse(BaseModel): - """Search results for transactions.""" - data: List[Transaction] + """List of transaction search results.""" diff --git a/src/fragment/types/transaction_update_params.py b/src/fragment/types/transaction_update_params.py index 0cdb0d5..b300565 100644 --- a/src/fragment/types/transaction_update_params.py +++ b/src/fragment/types/transaction_update_params.py @@ -23,7 +23,7 @@ class TransactionUpdateParams(TypedDict, total=False): current_transaction_version: Required[int] - """Current transaction version for optimistic concurrency control.""" + """Current version of the transaction. Must match the stored version.""" allocations: Allocations @@ -32,47 +32,53 @@ class TransactionUpdateParams(TypedDict, total=False): class AllocationsCreateUserID(TypedDict, total=False): id: Required[str] - """FRAGMENT generated ID of the user""" + """FRAGMENT generated unique ID.""" class AllocationsCreateUserExternalID(TypedDict, total=False): external_id: Required[str] - """External ID of the user""" + """User-provided unique external ID.""" AllocationsCreateUser: TypeAlias = Union[AllocationsCreateUserID, AllocationsCreateUserExternalID] class AllocationsCreate(TypedDict, total=False): - """Transaction allocation against an invoice.""" + """An allocation linking a transaction to an invoice.""" amount: Required[str] - """Amount to allocate in smallest currency unit as stringified bigint.""" + """ + Allocation amount, as a positive string in the smallest unit of the currency + (for example, cents for USD). + """ invoice_id: Required[str] - """The invoice to allocate against.""" + """Invoice to allocate against.""" type: Required[Literal["invoice_payin", "invoice_payout"]] - """The type of allocation.""" + """Type of allocation.""" user: Required[AllocationsCreateUser] - """Identifies a user by Fragment-generated id or external_id (request body).""" + """Identifies a user by `id` or `external_id`.""" class AllocationsUpdate(TypedDict, total=False): id: Required[str] - """The ID of the allocation to update.""" + """Allocation to update.""" amount: Required[str] - """New amount in smallest currency unit as stringified bigint.""" + """ + Updated allocation amount, as a positive string in the smallest unit of the + currency (for example, cents for USD). + """ class Allocations(TypedDict, total=False): create: Iterable[AllocationsCreate] - """Allocations to add to the transaction""" + """Creates a new allocation.""" update: Iterable[AllocationsUpdate] - """Existing allocations to update""" + """Updates an existing allocation.""" class TagsCreate(TypedDict, total=False): @@ -139,7 +145,7 @@ class Tags(TypedDict, total=False): """Tags to add. Prefer `set` unless you specifically want create-only validation.""" delete: Iterable[TagsDelete] - """Tags to remove by key""" + """Tags to remove by key.""" set: Iterable[TagsSet] """ diff --git a/src/fragment/types/user.py b/src/fragment/types/user.py index 7eea5f1..b1479b0 100644 --- a/src/fragment/types/user.py +++ b/src/fragment/types/user.py @@ -6,13 +6,13 @@ class User(BaseModel): - """User object""" + """User object.""" id: str - """Unique user ID""" + """FRAGMENT generated unique ID.""" external_id: str - """External ID for the user""" + """User-provided unique external ID.""" role: str - """Role of the user""" + """Name of the user's role.""" diff --git a/src/fragment/types/user_create_params.py b/src/fragment/types/user_create_params.py index 997cb6c..e38ca03 100644 --- a/src/fragment/types/user_create_params.py +++ b/src/fragment/types/user_create_params.py @@ -9,7 +9,7 @@ class UserCreateParams(TypedDict, total=False): external_id: Required[str] - """External ID for the user""" + """User-provided unique external ID.""" role: Required[str] - """Role of the user""" + """Name of the role to assign. Must match an existing role.""" diff --git a/src/fragment/types/user_create_response.py b/src/fragment/types/user_create_response.py index 8584137..8a27ae5 100644 --- a/src/fragment/types/user_create_response.py +++ b/src/fragment/types/user_create_response.py @@ -8,4 +8,4 @@ class UserCreateResponse(BaseModel): data: User - """User object""" + """User object.""" diff --git a/src/fragment/types/user_list_response.py b/src/fragment/types/user_list_response.py index 95d7d93..90f0021 100644 --- a/src/fragment/types/user_list_response.py +++ b/src/fragment/types/user_list_response.py @@ -9,6 +9,6 @@ class UserListResponse(BaseModel): - """List of users""" + """List of users.""" data: List[User] diff --git a/tests/api_resources/test_transactions.py b/tests/api_resources/test_transactions.py index 7a77e1d..6147986 100644 --- a/tests/api_resources/test_transactions.py +++ b/tests/api_resources/test_transactions.py @@ -42,7 +42,7 @@ def test_method_create(self, client: Fragment) -> None: amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), ) assert_matches_type(TransactionCreateResponse, transaction, path=["response"]) @@ -65,7 +65,7 @@ def test_method_create_with_all_params(self, client: Fragment) -> None: amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), tags=[ { "key": "region", @@ -91,7 +91,7 @@ def test_raw_response_create(self, client: Fragment) -> None: amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), ) assert response.is_closed is True @@ -115,7 +115,7 @@ def test_streaming_response_create(self, client: Fragment) -> None: amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -428,7 +428,7 @@ async def test_method_create(self, async_client: AsyncFragment) -> None: amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), ) assert_matches_type(TransactionCreateResponse, transaction, path=["response"]) @@ -451,7 +451,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncFragment) amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), tags=[ { "key": "region", @@ -477,7 +477,7 @@ async def test_raw_response_create(self, async_client: AsyncFragment) -> None: amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), ) assert response.is_closed is True @@ -501,7 +501,7 @@ async def test_streaming_response_create(self, async_client: AsyncFragment) -> N amount="-1000", currency="USD", external_id="bank_txn_123", - posted=parse_datetime("2026-02-12T00:00:00.000Z"), + posted=parse_datetime("2024-01-13T00:00:00Z"), ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 25512da8089db4f3be50174a77373390fa29c52c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 21:20:12 +0000 Subject: [PATCH 08/13] feat(api): update SDK from prod (8051461980fb65468797d0b82dfa42dee9014004) --- .stats.yml | 4 ++-- src/fragment/resources/external_accounts.py | 8 +++---- src/fragment/resources/invoices.py | 12 +++++----- src/fragment/resources/products.py | 8 +++---- src/fragment/resources/roles.py | 4 ++-- src/fragment/resources/transactions.py | 12 +++++----- src/fragment/resources/users.py | 8 +++---- src/fragment/types/external_account.py | 2 +- .../types/external_account_create_params.py | 2 +- src/fragment/types/invoice.py | 4 ++-- src/fragment/types/invoice_create_params.py | 6 ++--- .../types/invoice_retrieve_response.py | 9 +++++--- src/fragment/types/invoice_search_params.py | 4 ++-- src/fragment/types/invoice_search_response.py | 9 +++++--- src/fragment/types/invoice_update_params.py | 22 +++++++++---------- src/fragment/types/role_list_response.py | 2 +- src/fragment/types/transaction.py | 8 +++---- .../types/transaction_create_params.py | 8 +++---- ...transaction_search_allocations_response.py | 4 ++-- .../types/transaction_search_params.py | 2 +- .../types/transaction_update_params.py | 14 ++++++------ src/fragment/types/user.py | 2 +- src/fragment/types/user_create_params.py | 2 +- 23 files changed, 81 insertions(+), 75 deletions(-) diff --git a/.stats.yml b/.stats.yml index 50303e2..7c785cb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-d1b5cc19383470227e1435e227958a95c540e527eaefb5fcc206d7f8b89bca69.yml -openapi_spec_hash: 1bf0e3c6be232b10ea36d85fb1aa22c5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-e4fc605988664c55f173328194e6516e6cc87c1390eb2053c9932d5447f10c42.yml +openapi_spec_hash: a7b2486e11f00309dfbed884389a8a9a config_hash: 0bc054caf56d79dc6e95b7ad898419d1 diff --git a/src/fragment/resources/external_accounts.py b/src/fragment/resources/external_accounts.py index 9a63096..f154e63 100644 --- a/src/fragment/resources/external_accounts.py +++ b/src/fragment/resources/external_accounts.py @@ -55,10 +55,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccountCreateResponse: """ - Creates a new external account. + Creates an external account. Args: - external_id: User-provided unique external ID. + external_id: User-provided unique ID. name: Human-readable name. @@ -138,10 +138,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccountCreateResponse: """ - Creates a new external account. + Creates an external account. Args: - external_id: User-provided unique external ID. + external_id: User-provided unique ID. name: Human-readable name. diff --git a/src/fragment/resources/invoices.py b/src/fragment/resources/invoices.py index 4ef65bf..493f60e 100644 --- a/src/fragment/resources/invoices.py +++ b/src/fragment/resources/invoices.py @@ -109,7 +109,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceRetrieveResponse: """ - Fetches an invoice. + Retrieves an invoice. Args: id: Unique identifier for the invoice. @@ -211,7 +211,7 @@ def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceListHistoryResponse: """ - Gets the version history of an invoice. + Retrieves the version history of an invoice. Args: id: Unique identifier for the invoice. @@ -252,7 +252,7 @@ def search( Args: filter: Filter criteria for the search. - page_info: Pagination parameters + page_info: Pagination parameters. extra_headers: Send extra headers @@ -359,7 +359,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceRetrieveResponse: """ - Fetches an invoice. + Retrieves an invoice. Args: id: Unique identifier for the invoice. @@ -461,7 +461,7 @@ async def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InvoiceListHistoryResponse: """ - Gets the version history of an invoice. + Retrieves the version history of an invoice. Args: id: Unique identifier for the invoice. @@ -502,7 +502,7 @@ async def search( Args: filter: Filter criteria for the search. - page_info: Pagination parameters + page_info: Pagination parameters. extra_headers: Send extra headers diff --git a/src/fragment/resources/products.py b/src/fragment/resources/products.py index 99a61e6..00147d5 100644 --- a/src/fragment/resources/products.py +++ b/src/fragment/resources/products.py @@ -62,7 +62,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductCreateResponse: """ - Creates a new product. + Creates a product. Args: code: Unique product code. @@ -111,7 +111,7 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductRetrieveResponse: - """Gets a product by code. + """Retrieves a product by code. Args: code: Product code. @@ -193,7 +193,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductCreateResponse: """ - Creates a new product. + Creates a product. Args: code: Unique product code. @@ -242,7 +242,7 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProductRetrieveResponse: - """Gets a product by code. + """Retrieves a product by code. Args: code: Product code. diff --git a/src/fragment/resources/roles.py b/src/fragment/resources/roles.py index 59acd8f..ee4729e 100644 --- a/src/fragment/resources/roles.py +++ b/src/fragment/resources/roles.py @@ -56,7 +56,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleCreateResponse: """ - Creates a new role. + Creates a role. Args: role: Name of the role. @@ -132,7 +132,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleCreateResponse: """ - Creates a new role. + Creates a role. Args: role: Name of the role. diff --git a/src/fragment/resources/transactions.py b/src/fragment/resources/transactions.py index 34e5069..a54f403 100644 --- a/src/fragment/resources/transactions.py +++ b/src/fragment/resources/transactions.py @@ -271,7 +271,7 @@ def create( currency: Currency code (ISO 4217 or crypto). - external_id: Unique user-provided external ID for the transaction. + external_id: User-provided unique ID. posted: Timestamp when the transaction was posted. Uses ISO 8601 format. @@ -317,7 +317,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionRetrieveResponse: """ - Fetches a transaction by ID or external ID. + Retrieves a transaction by ID or external ID. Args: transaction_ref: Transaction `id` or `external_id`. @@ -449,7 +449,7 @@ def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionListHistoryResponse: """ - Gets the version history of a transaction. + Retrieves the version history of a transaction. Args: transaction_ref: Transaction `id` or `external_id`. @@ -777,7 +777,7 @@ async def create( currency: Currency code (ISO 4217 or crypto). - external_id: Unique user-provided external ID for the transaction. + external_id: User-provided unique ID. posted: Timestamp when the transaction was posted. Uses ISO 8601 format. @@ -823,7 +823,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionRetrieveResponse: """ - Fetches a transaction by ID or external ID. + Retrieves a transaction by ID or external ID. Args: transaction_ref: Transaction `id` or `external_id`. @@ -955,7 +955,7 @@ async def list_history( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TransactionListHistoryResponse: """ - Gets the version history of a transaction. + Retrieves the version history of a transaction. Args: transaction_ref: Transaction `id` or `external_id`. diff --git a/src/fragment/resources/users.py b/src/fragment/resources/users.py index 3eee0b7..72c97c4 100644 --- a/src/fragment/resources/users.py +++ b/src/fragment/resources/users.py @@ -55,10 +55,10 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserCreateResponse: """ - Creates a new user. + Creates a user. Args: - external_id: User-provided unique external ID. + external_id: User-provided unique ID. role: Name of the role to assign. Must match an existing role. @@ -138,10 +138,10 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserCreateResponse: """ - Creates a new user. + Creates a user. Args: - external_id: User-provided unique external ID. + external_id: User-provided unique ID. role: Name of the role to assign. Must match an existing role. diff --git a/src/fragment/types/external_account.py b/src/fragment/types/external_account.py index f1d72db..e4e75e4 100644 --- a/src/fragment/types/external_account.py +++ b/src/fragment/types/external_account.py @@ -12,7 +12,7 @@ class ExternalAccount(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """User-provided unique external ID.""" + """User-provided unique ID.""" name: str """Human-readable name.""" diff --git a/src/fragment/types/external_account_create_params.py b/src/fragment/types/external_account_create_params.py index a046d84..0d8d739 100644 --- a/src/fragment/types/external_account_create_params.py +++ b/src/fragment/types/external_account_create_params.py @@ -9,7 +9,7 @@ class ExternalAccountCreateParams(TypedDict, total=False): external_id: Required[str] - """User-provided unique external ID.""" + """User-provided unique ID.""" name: Required[str] """Human-readable name.""" diff --git a/src/fragment/types/invoice.py b/src/fragment/types/invoice.py index 35202a4..7f9008c 100644 --- a/src/fragment/types/invoice.py +++ b/src/fragment/types/invoice.py @@ -10,7 +10,7 @@ class Tag(BaseModel): - """A key-value tag pair""" + """A key-value tag pair.""" key: str """Tag key.""" @@ -39,7 +39,7 @@ class LineItemPrice(BaseModel): class LineItemTag(BaseModel): - """A key-value tag pair""" + """A key-value tag pair.""" key: str """Tag key.""" diff --git a/src/fragment/types/invoice_create_params.py b/src/fragment/types/invoice_create_params.py index 11bd5c6..38d5226 100644 --- a/src/fragment/types/invoice_create_params.py +++ b/src/fragment/types/invoice_create_params.py @@ -35,7 +35,7 @@ class LineItemUserID(TypedDict, total=False): class LineItemUserExternalID(TypedDict, total=False): external_id: Required[str] - """User-provided unique external ID.""" + """User-provided unique ID.""" LineItemUser: TypeAlias = Union[LineItemUserID, LineItemUserExternalID] @@ -61,7 +61,7 @@ class LineItemPrice(TypedDict, total=False): class LineItemTag(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -290,7 +290,7 @@ class LineItem(TypedDict, total=False): class Tag(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. diff --git a/src/fragment/types/invoice_retrieve_response.py b/src/fragment/types/invoice_retrieve_response.py index 4939ae4..761cf81 100644 --- a/src/fragment/types/invoice_retrieve_response.py +++ b/src/fragment/types/invoice_retrieve_response.py @@ -98,7 +98,7 @@ class DataBalance(BaseModel): class DataPaymentTransactionTag(BaseModel): - """A key-value tag pair""" + """A key-value tag pair.""" key: str """Tag key.""" @@ -114,7 +114,7 @@ class DataPaymentTransaction(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID for the transaction.""" + """User-provided unique ID.""" tags: List[DataPaymentTransactionTag] """Tags from the parent transaction.""" @@ -127,7 +127,7 @@ class DataPaymentUser(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """User-provided unique external ID.""" + """User-provided unique ID.""" class DataPayment(BaseModel): @@ -413,6 +413,9 @@ class DataUser(BaseModel): balances: List[DataUserBalance] """Per-currency balance breakdown for the user.""" + external_id: str + """User-provided unique ID.""" + class Data(Invoice): """Invoice with balance details.""" diff --git a/src/fragment/types/invoice_search_params.py b/src/fragment/types/invoice_search_params.py index 224d0ce..6983d2e 100644 --- a/src/fragment/types/invoice_search_params.py +++ b/src/fragment/types/invoice_search_params.py @@ -13,7 +13,7 @@ class InvoiceSearchParams(TypedDict, total=False): """Filter criteria for the search.""" page_info: Required[PageInfo] - """Pagination parameters""" + """Pagination parameters.""" class FilterTagsAll(TypedDict, total=False): @@ -77,7 +77,7 @@ class Filter(TypedDict, total=False): class PageInfo(TypedDict, total=False): - """Pagination parameters""" + """Pagination parameters.""" after: str """Cursor for fetching the next page of results.""" diff --git a/src/fragment/types/invoice_search_response.py b/src/fragment/types/invoice_search_response.py index 52c2ac1..5a0d0b1 100644 --- a/src/fragment/types/invoice_search_response.py +++ b/src/fragment/types/invoice_search_response.py @@ -100,7 +100,7 @@ class DataInvoiceBalance(BaseModel): class DataInvoicePaymentTransactionTag(BaseModel): - """A key-value tag pair""" + """A key-value tag pair.""" key: str """Tag key.""" @@ -116,7 +116,7 @@ class DataInvoicePaymentTransaction(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID for the transaction.""" + """User-provided unique ID.""" tags: List[DataInvoicePaymentTransactionTag] """Tags from the parent transaction.""" @@ -129,7 +129,7 @@ class DataInvoicePaymentUser(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """User-provided unique external ID.""" + """User-provided unique ID.""" class DataInvoicePayment(BaseModel): @@ -415,6 +415,9 @@ class DataInvoiceUser(BaseModel): balances: List[DataInvoiceUserBalance] """Per-currency balance breakdown for the user.""" + external_id: str + """User-provided unique ID.""" + class DataInvoice(Invoice): """Invoice with balance details.""" diff --git a/src/fragment/types/invoice_update_params.py b/src/fragment/types/invoice_update_params.py index 8ea944b..f3f7425 100644 --- a/src/fragment/types/invoice_update_params.py +++ b/src/fragment/types/invoice_update_params.py @@ -46,7 +46,7 @@ class LineItemsCreateUserID(TypedDict, total=False): class LineItemsCreateUserExternalID(TypedDict, total=False): external_id: Required[str] - """User-provided unique external ID.""" + """User-provided unique ID.""" LineItemsCreateUser: TypeAlias = Union[LineItemsCreateUserID, LineItemsCreateUserExternalID] @@ -72,7 +72,7 @@ class LineItemsCreatePrice(TypedDict, total=False): class LineItemsCreateTag(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -323,7 +323,7 @@ class LineItemsUpdatePrice(TypedDict, total=False): class LineItemsUpdateTagsCreate(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -342,11 +342,11 @@ class LineItemsUpdateTagsCreate(TypedDict, total=False): class LineItemsUpdateTagsDelete(TypedDict, total=False): key: Required[str] - """Tag key to delete""" + """Tag key to delete.""" class LineItemsUpdateTagsSet(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -364,7 +364,7 @@ class LineItemsUpdateTagsSet(TypedDict, total=False): class LineItemsUpdateTagsUpdate(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -403,7 +403,7 @@ class LineItemsUpdateTags(TypedDict, total=False): class LineItemsUpdate(TypedDict, total=False): - """Updates an existing line item.""" + """Data for updating a line item.""" id: Required[str] """Unique identifier for the line item to update.""" @@ -427,7 +427,7 @@ class LineItems(TypedDict, total=False): class TagsCreate(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -446,11 +446,11 @@ class TagsCreate(TypedDict, total=False): class TagsDelete(TypedDict, total=False): key: Required[str] - """Tag key to delete""" + """Tag key to delete.""" class TagsSet(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -468,7 +468,7 @@ class TagsSet(TypedDict, total=False): class TagsUpdate(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. diff --git a/src/fragment/types/role_list_response.py b/src/fragment/types/role_list_response.py index b660eb2..0d8c7f9 100644 --- a/src/fragment/types/role_list_response.py +++ b/src/fragment/types/role_list_response.py @@ -9,7 +9,7 @@ class RoleListResponse(BaseModel): - """List of roles""" + """List of roles.""" data: List[Role] """List of roles.""" diff --git a/src/fragment/types/transaction.py b/src/fragment/types/transaction.py index 20ab8dc..9a7e566 100644 --- a/src/fragment/types/transaction.py +++ b/src/fragment/types/transaction.py @@ -16,7 +16,7 @@ class Account(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID for the external account.""" + """User-provided unique ID.""" class AllocationUser(BaseModel): @@ -26,7 +26,7 @@ class AllocationUser(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """User-provided unique external ID.""" + """User-provided unique ID.""" class Allocation(BaseModel): @@ -49,7 +49,7 @@ class Allocation(BaseModel): class Tag(BaseModel): - """A key-value tag pair""" + """A key-value tag pair.""" key: str """Tag key.""" @@ -263,7 +263,7 @@ class Transaction(BaseModel): """Currency code (ISO 4217 or crypto).""" external_id: str - """Unique user-provided external ID for the transaction.""" + """User-provided unique ID.""" posted: datetime """Timestamp when the transaction was posted. Uses ISO 8601 format.""" diff --git a/src/fragment/types/transaction_create_params.py b/src/fragment/types/transaction_create_params.py index c710b2c..563a780 100644 --- a/src/fragment/types/transaction_create_params.py +++ b/src/fragment/types/transaction_create_params.py @@ -221,7 +221,7 @@ class TransactionCreateParams(TypedDict, total=False): """Currency code (ISO 4217 or crypto).""" external_id: Required[str] - """Unique user-provided external ID for the transaction.""" + """User-provided unique ID.""" posted: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] """Timestamp when the transaction was posted. Uses ISO 8601 format.""" @@ -240,7 +240,7 @@ class Account(TypedDict, total=False): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID for the external account.""" + """User-provided unique ID.""" class AllocationUserID(TypedDict, total=False): @@ -250,7 +250,7 @@ class AllocationUserID(TypedDict, total=False): class AllocationUserExternalID(TypedDict, total=False): external_id: Required[str] - """User-provided unique external ID.""" + """User-provided unique ID.""" AllocationUser: TypeAlias = Union[AllocationUserID, AllocationUserExternalID] @@ -276,7 +276,7 @@ class Allocation(TypedDict, total=False): class Tag(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. diff --git a/src/fragment/types/transaction_search_allocations_response.py b/src/fragment/types/transaction_search_allocations_response.py index de11343..32607c2 100644 --- a/src/fragment/types/transaction_search_allocations_response.py +++ b/src/fragment/types/transaction_search_allocations_response.py @@ -16,7 +16,7 @@ class DataTransaction(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID for the transaction.""" + """User-provided unique ID.""" class DataUser(BaseModel): @@ -26,7 +26,7 @@ class DataUser(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """User-provided unique external ID.""" + """User-provided unique ID.""" class Data(BaseModel): diff --git a/src/fragment/types/transaction_search_params.py b/src/fragment/types/transaction_search_params.py index 8040ffa..e022946 100644 --- a/src/fragment/types/transaction_search_params.py +++ b/src/fragment/types/transaction_search_params.py @@ -23,7 +23,7 @@ class FilterAccountAny(TypedDict, total=False): """FRAGMENT generated unique ID.""" external_id: str - """Unique user-provided external ID for the external account.""" + """User-provided unique ID.""" class FilterAccount(TypedDict, total=False): diff --git a/src/fragment/types/transaction_update_params.py b/src/fragment/types/transaction_update_params.py index b300565..7c83f59 100644 --- a/src/fragment/types/transaction_update_params.py +++ b/src/fragment/types/transaction_update_params.py @@ -37,7 +37,7 @@ class AllocationsCreateUserID(TypedDict, total=False): class AllocationsCreateUserExternalID(TypedDict, total=False): external_id: Required[str] - """User-provided unique external ID.""" + """User-provided unique ID.""" AllocationsCreateUser: TypeAlias = Union[AllocationsCreateUserID, AllocationsCreateUserExternalID] @@ -75,14 +75,14 @@ class AllocationsUpdate(TypedDict, total=False): class Allocations(TypedDict, total=False): create: Iterable[AllocationsCreate] - """Creates a new allocation.""" + """Allocations to create.""" update: Iterable[AllocationsUpdate] - """Updates an existing allocation.""" + """Allocations to update.""" class TagsCreate(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -101,11 +101,11 @@ class TagsCreate(TypedDict, total=False): class TagsDelete(TypedDict, total=False): key: Required[str] - """Tag key to delete""" + """Tag key to delete.""" class TagsSet(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. @@ -123,7 +123,7 @@ class TagsSet(TypedDict, total=False): class TagsUpdate(TypedDict, total=False): - """A key-value tag pair for metadata""" + """A key-value tag pair for metadata.""" key: Required[str] """Tag key. diff --git a/src/fragment/types/user.py b/src/fragment/types/user.py index b1479b0..ca34e05 100644 --- a/src/fragment/types/user.py +++ b/src/fragment/types/user.py @@ -12,7 +12,7 @@ class User(BaseModel): """FRAGMENT generated unique ID.""" external_id: str - """User-provided unique external ID.""" + """User-provided unique ID.""" role: str """Name of the user's role.""" diff --git a/src/fragment/types/user_create_params.py b/src/fragment/types/user_create_params.py index e38ca03..adf66eb 100644 --- a/src/fragment/types/user_create_params.py +++ b/src/fragment/types/user_create_params.py @@ -9,7 +9,7 @@ class UserCreateParams(TypedDict, total=False): external_id: Required[str] - """User-provided unique external ID.""" + """User-provided unique ID.""" role: Required[str] """Name of the role to assign. Must match an existing role.""" From dd8e3f1966650b7cb4043f377c4fcf9b30e188ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 16:08:39 +0000 Subject: [PATCH 09/13] fix(client): preserve hardcoded query params when merging with user params --- src/fragment/_base_client.py | 4 +++ tests/test_client.py | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/fragment/_base_client.py b/src/fragment/_base_client.py index 57ac0fb..a78c425 100644 --- a/src/fragment/_base_client.py +++ b/src/fragment/_base_client.py @@ -540,6 +540,10 @@ def _build_request( files = cast(HttpxRequestFiles, ForceMultipartDict()) prepared_url = self._prepare_url(options.url) + # preserve hard-coded query params from the url + if params and prepared_url.query: + params = {**dict(prepared_url.params.items()), **params} + prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0]) if "_" in prepared_url.host: # work around https://github.com/encode/httpx/discussions/2880 kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} diff --git a/tests/test_client.py b/tests/test_client.py index 10cfb2e..3bf1432 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -458,6 +458,30 @@ def test_default_query_option(self) -> None: client.close() + def test_hardcoded_query_params_in_url(self, client: Fragment) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: Fragment) -> None: request = client._build_request( FinalRequestOptions( @@ -1423,6 +1447,30 @@ async def test_default_query_option(self) -> None: await client.close() + async def test_hardcoded_query_params_in_url(self, async_client: AsyncFragment) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + def test_request_extra_json(self, client: Fragment) -> None: request = client._build_request( FinalRequestOptions( From dca29fcd235fe6c110efcdf9042fe012d06ce17e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 04:47:01 +0000 Subject: [PATCH 10/13] feat(api): update SDK from prod (b8f6f1940acd3d10fc17aaeb59cd75281f3c6436) --- .stats.yml | 4 ++-- src/fragment/_client.py | 12 ++++++++++++ src/fragment/resources/external_accounts.py | 4 ++++ src/fragment/resources/users.py | 4 ++++ src/fragment/types/invoice.py | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7c785cb..9ecf3c2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-e4fc605988664c55f173328194e6516e6cc87c1390eb2053c9932d5447f10c42.yml -openapi_spec_hash: a7b2486e11f00309dfbed884389a8a9a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-19313c1dfa734f2f19d644b8603387a37c7fa0c30afbf628e74760e81c88b51d.yml +openapi_spec_hash: 241697e6c3b32ba9a8fb8f72f78ae863 config_hash: 0bc054caf56d79dc6e95b7ad898419d1 diff --git a/src/fragment/_client.py b/src/fragment/_client.py index d91fcb0..a8932e4 100644 --- a/src/fragment/_client.py +++ b/src/fragment/_client.py @@ -113,6 +113,7 @@ def __init__( @cached_property def external_accounts(self) -> ExternalAccountsResource: + """External account management operations""" from .resources.external_accounts import ExternalAccountsResource return ExternalAccountsResource(self) @@ -147,6 +148,7 @@ def transactions(self) -> TransactionsResource: @cached_property def users(self) -> UsersResource: + """User management operations""" from .resources.users import UsersResource return UsersResource(self) @@ -342,6 +344,7 @@ def __init__( @cached_property def external_accounts(self) -> AsyncExternalAccountsResource: + """External account management operations""" from .resources.external_accounts import AsyncExternalAccountsResource return AsyncExternalAccountsResource(self) @@ -376,6 +379,7 @@ def transactions(self) -> AsyncTransactionsResource: @cached_property def users(self) -> AsyncUsersResource: + """User management operations""" from .resources.users import AsyncUsersResource return AsyncUsersResource(self) @@ -518,6 +522,7 @@ def __init__(self, client: Fragment) -> None: @cached_property def external_accounts(self) -> external_accounts.ExternalAccountsResourceWithRawResponse: + """External account management operations""" from .resources.external_accounts import ExternalAccountsResourceWithRawResponse return ExternalAccountsResourceWithRawResponse(self._client.external_accounts) @@ -552,6 +557,7 @@ def transactions(self) -> transactions.TransactionsResourceWithRawResponse: @cached_property def users(self) -> users.UsersResourceWithRawResponse: + """User management operations""" from .resources.users import UsersResourceWithRawResponse return UsersResourceWithRawResponse(self._client.users) @@ -565,6 +571,7 @@ def __init__(self, client: AsyncFragment) -> None: @cached_property def external_accounts(self) -> external_accounts.AsyncExternalAccountsResourceWithRawResponse: + """External account management operations""" from .resources.external_accounts import AsyncExternalAccountsResourceWithRawResponse return AsyncExternalAccountsResourceWithRawResponse(self._client.external_accounts) @@ -599,6 +606,7 @@ def transactions(self) -> transactions.AsyncTransactionsResourceWithRawResponse: @cached_property def users(self) -> users.AsyncUsersResourceWithRawResponse: + """User management operations""" from .resources.users import AsyncUsersResourceWithRawResponse return AsyncUsersResourceWithRawResponse(self._client.users) @@ -612,6 +620,7 @@ def __init__(self, client: Fragment) -> None: @cached_property def external_accounts(self) -> external_accounts.ExternalAccountsResourceWithStreamingResponse: + """External account management operations""" from .resources.external_accounts import ExternalAccountsResourceWithStreamingResponse return ExternalAccountsResourceWithStreamingResponse(self._client.external_accounts) @@ -646,6 +655,7 @@ def transactions(self) -> transactions.TransactionsResourceWithStreamingResponse @cached_property def users(self) -> users.UsersResourceWithStreamingResponse: + """User management operations""" from .resources.users import UsersResourceWithStreamingResponse return UsersResourceWithStreamingResponse(self._client.users) @@ -659,6 +669,7 @@ def __init__(self, client: AsyncFragment) -> None: @cached_property def external_accounts(self) -> external_accounts.AsyncExternalAccountsResourceWithStreamingResponse: + """External account management operations""" from .resources.external_accounts import AsyncExternalAccountsResourceWithStreamingResponse return AsyncExternalAccountsResourceWithStreamingResponse(self._client.external_accounts) @@ -693,6 +704,7 @@ def transactions(self) -> transactions.AsyncTransactionsResourceWithStreamingRes @cached_property def users(self) -> users.AsyncUsersResourceWithStreamingResponse: + """User management operations""" from .resources.users import AsyncUsersResourceWithStreamingResponse return AsyncUsersResourceWithStreamingResponse(self._client.users) diff --git a/src/fragment/resources/external_accounts.py b/src/fragment/resources/external_accounts.py index f154e63..8e85103 100644 --- a/src/fragment/resources/external_accounts.py +++ b/src/fragment/resources/external_accounts.py @@ -23,6 +23,8 @@ class ExternalAccountsResource(SyncAPIResource): + """External account management operations""" + @cached_property def with_raw_response(self) -> ExternalAccountsResourceWithRawResponse: """ @@ -106,6 +108,8 @@ def list( class AsyncExternalAccountsResource(AsyncAPIResource): + """External account management operations""" + @cached_property def with_raw_response(self) -> AsyncExternalAccountsResourceWithRawResponse: """ diff --git a/src/fragment/resources/users.py b/src/fragment/resources/users.py index 72c97c4..7994af1 100644 --- a/src/fragment/resources/users.py +++ b/src/fragment/resources/users.py @@ -23,6 +23,8 @@ class UsersResource(SyncAPIResource): + """User management operations""" + @cached_property def with_raw_response(self) -> UsersResourceWithRawResponse: """ @@ -106,6 +108,8 @@ def list( class AsyncUsersResource(AsyncAPIResource): + """User management operations""" + @cached_property def with_raw_response(self) -> AsyncUsersResourceWithRawResponse: """ diff --git a/src/fragment/types/invoice.py b/src/fragment/types/invoice.py index 7f9008c..ffb1022 100644 --- a/src/fragment/types/invoice.py +++ b/src/fragment/types/invoice.py @@ -52,7 +52,7 @@ class LineItem(BaseModel): """Invoice line item.""" id: str - """Unique invoice ID.""" + """FRAGMENT generated unique ID.""" amount: str """ From b244d5004f5f7fb0ba13745581e47e4bb84a67e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:53:40 +0000 Subject: [PATCH 11/13] fix: ensure file data are only sent as 1 parameter --- src/fragment/_utils/_utils.py | 5 +++-- tests/test_extract_files.py | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/fragment/_utils/_utils.py b/src/fragment/_utils/_utils.py index eec7f4a..63b8cd6 100644 --- a/src/fragment/_utils/_utils.py +++ b/src/fragment/_utils/_utils.py @@ -86,8 +86,9 @@ def _extract_items( index += 1 if is_dict(obj): try: - # We are at the last entry in the path so we must remove the field - if (len(path)) == index: + # Remove the field if there are no more dict keys in the path, + # only "" traversal markers or end. + if all(p == "" for p in path[index:]): item = obj.pop(key) else: item = obj[key] diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index 783e4c7..3a59a56 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -35,6 +35,15 @@ def test_multiple_files() -> None: assert query == {"documents": [{}, {}]} +def test_top_level_file_array() -> None: + query = {"files": [b"file one", b"file two"], "title": "hello"} + assert extract_files(query, paths=[["files", ""]]) == [ + ("files[]", b"file one"), + ("files[]", b"file two"), + ] + assert query == {"title": "hello"} + + @pytest.mark.parametrize( "query,paths,expected", [ From 4de3417d2e14d337dc6bbd9f809c4bc6f624015b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:04:22 +0000 Subject: [PATCH 12/13] feat(api): update SDK from prod (e1ebb9e4d62034855202a8ff99690880c072d953) --- .stats.yml | 6 +- src/fragment/resources/external_accounts.py | 4 +- src/fragment/resources/invoices.py | 12 +- src/fragment/resources/transactions.py | 42 ++++- src/fragment/types/external_account.py | 2 +- .../types/external_account_create_params.py | 2 +- src/fragment/types/invoice.py | 18 +-- src/fragment/types/invoice_create_params.py | 41 ++--- .../types/invoice_retrieve_response.py | 114 +++++++------- src/fragment/types/invoice_search_params.py | 6 +- src/fragment/types/invoice_search_response.py | 117 +++++++------- src/fragment/types/invoice_update_params.py | 148 +++++------------- src/fragment/types/transaction.py | 14 +- .../types/transaction_create_params.py | 22 +-- .../transaction_search_allocations_params.py | 5 +- ...transaction_search_allocations_response.py | 12 +- .../types/transaction_search_params.py | 84 +++++++++- .../types/transaction_search_response.py | 27 +++- .../types/transaction_update_params.py | 65 +++----- src/fragment/types/user_list_response.py | 1 + tests/api_resources/test_invoices.py | 94 ++++++----- tests/api_resources/test_transactions.py | 114 +++++++++++--- 22 files changed, 516 insertions(+), 434 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ecf3c2..7e70f72 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 22 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-19313c1dfa734f2f19d644b8603387a37c7fa0c30afbf628e74760e81c88b51d.yml -openapi_spec_hash: 241697e6c3b32ba9a8fb8f72f78ae863 -config_hash: 0bc054caf56d79dc6e95b7ad898419d1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fragment-foundries-inc-dash%2Ffragment-8472a9bd15eaa5b8aa9c12513d02b06ae385d06dd48e94a23f121678981de98a.yml +openapi_spec_hash: 4c42faa5ab6443bab546568adc330b7a +config_hash: 8e4b2d3ac55a0b2cdecfba99a1925e6f diff --git a/src/fragment/resources/external_accounts.py b/src/fragment/resources/external_accounts.py index 8e85103..0ff4275 100644 --- a/src/fragment/resources/external_accounts.py +++ b/src/fragment/resources/external_accounts.py @@ -62,7 +62,7 @@ def create( Args: external_id: User-provided unique ID. - name: Human-readable name. + name: Name of the account. extra_headers: Send extra headers @@ -147,7 +147,7 @@ async def create( Args: external_id: User-provided unique ID. - name: Human-readable name. + name: Name of the account. extra_headers: Send extra headers diff --git a/src/fragment/resources/invoices.py b/src/fragment/resources/invoices.py index 493f60e..4f6ea27 100644 --- a/src/fragment/resources/invoices.py +++ b/src/fragment/resources/invoices.py @@ -154,6 +154,10 @@ def update( current_invoice_version: Current version of the invoice. Must match the stored version. + line_items: Line item updates. + + tags: Tag updates. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -238,7 +242,7 @@ def search( self, *, filter: invoice_search_params.Filter, - page_info: invoice_search_params.PageInfo, + page_info: invoice_search_params.PageInfo | 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, @@ -404,6 +408,10 @@ async def update( current_invoice_version: Current version of the invoice. Must match the stored version. + line_items: Line item updates. + + tags: Tag updates. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -488,7 +496,7 @@ async def search( self, *, filter: invoice_search_params.Filter, - page_info: invoice_search_params.PageInfo, + page_info: invoice_search_params.PageInfo | 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, diff --git a/src/fragment/resources/transactions.py b/src/fragment/resources/transactions.py index a54f403..b8b30a4 100644 --- a/src/fragment/resources/transactions.py +++ b/src/fragment/resources/transactions.py @@ -266,10 +266,10 @@ def create( allocations: Allocations for the transaction. An empty array indicates unreconciled funds. - amount: Transaction amount, as a string in the smallest unit of the currency (for - example, cents for USD). Can be positive or negative. + amount: Transaction amount, as a string in the smallest currency unit, such as cents for + USD. Can be positive or negative. - currency: Currency code (ISO 4217 or crypto). + currency: ISO 4217 or crypto currency code. external_id: User-provided unique ID. @@ -362,6 +362,10 @@ def update( current_transaction_version: Current version of the transaction. Must match the stored version. + allocations: Allocation updates. + + tags: Tag updates. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -476,6 +480,7 @@ def search( self, *, filter: transaction_search_params.Filter, + page_info: transaction_search_params.PageInfo | 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, @@ -489,6 +494,8 @@ def search( Args: filter: Filter for searching transactions. + page_info: Pagination parameters. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -499,7 +506,13 @@ def search( """ return self._post( "/transactions/search", - body=maybe_transform({"filter": filter}, transaction_search_params.TransactionSearchParams), + body=maybe_transform( + { + "filter": filter, + "page_info": page_info, + }, + transaction_search_params.TransactionSearchParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -772,10 +785,10 @@ async def create( allocations: Allocations for the transaction. An empty array indicates unreconciled funds. - amount: Transaction amount, as a string in the smallest unit of the currency (for - example, cents for USD). Can be positive or negative. + amount: Transaction amount, as a string in the smallest currency unit, such as cents for + USD. Can be positive or negative. - currency: Currency code (ISO 4217 or crypto). + currency: ISO 4217 or crypto currency code. external_id: User-provided unique ID. @@ -868,6 +881,10 @@ async def update( current_transaction_version: Current version of the transaction. Must match the stored version. + allocations: Allocation updates. + + tags: Tag updates. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -982,6 +999,7 @@ async def search( self, *, filter: transaction_search_params.Filter, + page_info: transaction_search_params.PageInfo | 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, @@ -995,6 +1013,8 @@ async def search( Args: filter: Filter for searching transactions. + page_info: Pagination parameters. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1005,7 +1025,13 @@ async def search( """ return await self._post( "/transactions/search", - body=await async_maybe_transform({"filter": filter}, transaction_search_params.TransactionSearchParams), + body=await async_maybe_transform( + { + "filter": filter, + "page_info": page_info, + }, + transaction_search_params.TransactionSearchParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/fragment/types/external_account.py b/src/fragment/types/external_account.py index e4e75e4..02f2920 100644 --- a/src/fragment/types/external_account.py +++ b/src/fragment/types/external_account.py @@ -15,4 +15,4 @@ class ExternalAccount(BaseModel): """User-provided unique ID.""" name: str - """Human-readable name.""" + """Name of the account.""" diff --git a/src/fragment/types/external_account_create_params.py b/src/fragment/types/external_account_create_params.py index 0d8d739..ee8aaa3 100644 --- a/src/fragment/types/external_account_create_params.py +++ b/src/fragment/types/external_account_create_params.py @@ -12,4 +12,4 @@ class ExternalAccountCreateParams(TypedDict, total=False): """User-provided unique ID.""" name: Required[str] - """Human-readable name.""" + """Name of the account.""" diff --git a/src/fragment/types/invoice.py b/src/fragment/types/invoice.py index ffb1022..0d994a9 100644 --- a/src/fragment/types/invoice.py +++ b/src/fragment/types/invoice.py @@ -23,19 +23,13 @@ class LineItemPrice(BaseModel): """Price breakdown.""" amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Total amount as a string in the smallest currency unit, such as cents for USD.""" quantity: int """Number of units.""" unit_price: str - """ - Unit price as a string in the smallest unit of the currency (for example, cents - for USD). - """ + """Unit price as a string in the smallest currency unit, such as cents for USD.""" class LineItemTag(BaseModel): @@ -55,9 +49,9 @@ class LineItem(BaseModel): """FRAGMENT generated unique ID.""" amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). Deprecated, use price.amount instead. + """Total amount as a string in the smallest currency unit, such as cents for USD. + + Deprecated, use price.amount instead. """ currency_code: Literal[ @@ -241,7 +235,7 @@ class LineItem(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" description: str """Description of the line item.""" diff --git a/src/fragment/types/invoice_create_params.py b/src/fragment/types/invoice_create_params.py index 38d5226..33a09b3 100644 --- a/src/fragment/types/invoice_create_params.py +++ b/src/fragment/types/invoice_create_params.py @@ -45,9 +45,9 @@ class LineItemPrice(TypedDict, total=False): """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). Required if unit_price and quantity are not provided. + """Total amount as a string in the smallest currency unit, such as cents for USD. + + Required if unit_price and quantity are not provided. """ quantity: int @@ -55,8 +55,7 @@ class LineItemPrice(TypedDict, total=False): unit_price: str """ - Price per unit as a string in the smallest unit of the currency (for example, - cents for USD). + Price per unit as a string in the smallest currency unit, such as cents for USD. """ @@ -64,18 +63,10 @@ class LineItemTag(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class LineItem(TypedDict, total=False): @@ -94,9 +85,9 @@ class LineItem(TypedDict, total=False): """Identifies a user by `id` or `external_id`.""" amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). Deprecated, use price instead. + """Total amount as a string in the smallest currency unit, such as cents for USD. + + Deprecated, use price instead. """ currency_code: Literal[ @@ -280,7 +271,7 @@ class LineItem(TypedDict, total=False): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" price: LineItemPrice """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" @@ -293,15 +284,7 @@ class Tag(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" diff --git a/src/fragment/types/invoice_retrieve_response.py b/src/fragment/types/invoice_retrieve_response.py index 761cf81..77389ce 100644 --- a/src/fragment/types/invoice_retrieve_response.py +++ b/src/fragment/types/invoice_retrieve_response.py @@ -27,74 +27,74 @@ class DataBalanceNet(BaseModel): + """Net balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataBalancePayins(BaseModel): + """Payins balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataBalancePayouts(BaseModel): + """Payouts balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataBalance(BaseModel): currency: str - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" net: DataBalanceNet + """Net balance breakdown.""" payins: DataBalancePayins + """Payins balance breakdown.""" payouts: DataBalancePayouts + """Payouts balance breakdown.""" class DataPaymentTransactionTag(BaseModel): @@ -108,7 +108,7 @@ class DataPaymentTransactionTag(BaseModel): class DataPaymentTransaction(BaseModel): - """Transaction reference.""" + """Transaction the payment is applied to.""" id: str """FRAGMENT generated unique ID.""" @@ -121,7 +121,7 @@ class DataPaymentTransaction(BaseModel): class DataPaymentUser(BaseModel): - """User reference.""" + """User associated with the payment.""" id: str """FRAGMENT generated unique ID.""" @@ -135,8 +135,8 @@ class DataPayment(BaseModel): amount: str """ - Amount allocated as a string in the smallest unit of the currency (for example, - cents for USD). + Amount allocated as a string in the smallest currency unit, such as cents for + USD. """ currency: Literal[ @@ -320,90 +320,90 @@ class DataPayment(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" posted: datetime """Timestamp when the parent transaction was posted. Uses ISO 8601 format.""" transaction: DataPaymentTransaction - """Transaction reference.""" + """Transaction the payment is applied to.""" type: Literal["payin", "payout"] """Type of the payment.""" user: DataPaymentUser - """User reference.""" + """User associated with the payment.""" class DataUserBalanceNet(BaseModel): + """Net balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataUserBalancePayins(BaseModel): + """Payins balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataUserBalancePayouts(BaseModel): + """Payouts balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataUserBalance(BaseModel): currency: str - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" net: DataUserBalanceNet + """Net balance breakdown.""" payins: DataUserBalancePayins + """Payins balance breakdown.""" payouts: DataUserBalancePayouts + """Payouts balance breakdown.""" class DataUser(BaseModel): diff --git a/src/fragment/types/invoice_search_params.py b/src/fragment/types/invoice_search_params.py index 6983d2e..f63f61e 100644 --- a/src/fragment/types/invoice_search_params.py +++ b/src/fragment/types/invoice_search_params.py @@ -12,7 +12,7 @@ class InvoiceSearchParams(TypedDict, total=False): filter: Required[Filter] """Filter criteria for the search.""" - page_info: Required[PageInfo] + page_info: PageInfo """Pagination parameters.""" @@ -53,10 +53,10 @@ class FilterTags(TypedDict, total=False): """ all: Iterable[FilterTagsAll] - """Returns invoices matching every specified tag (AND).""" + """Returns invoices matching every specified tag, using AND logic.""" any: Iterable[FilterTagsAny] - """Returns invoices matching at least one of the specified tags (OR).""" + """Returns invoices matching at least one of the specified tags, using OR logic.""" class Filter(TypedDict, total=False): diff --git a/src/fragment/types/invoice_search_response.py b/src/fragment/types/invoice_search_response.py index 5a0d0b1..fa1ed31 100644 --- a/src/fragment/types/invoice_search_response.py +++ b/src/fragment/types/invoice_search_response.py @@ -29,74 +29,74 @@ class DataInvoiceBalanceNet(BaseModel): + """Net balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataInvoiceBalancePayins(BaseModel): + """Payins balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataInvoiceBalancePayouts(BaseModel): + """Payouts balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataInvoiceBalance(BaseModel): currency: str - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" net: DataInvoiceBalanceNet + """Net balance breakdown.""" payins: DataInvoiceBalancePayins + """Payins balance breakdown.""" payouts: DataInvoiceBalancePayouts + """Payouts balance breakdown.""" class DataInvoicePaymentTransactionTag(BaseModel): @@ -110,7 +110,7 @@ class DataInvoicePaymentTransactionTag(BaseModel): class DataInvoicePaymentTransaction(BaseModel): - """Transaction reference.""" + """Transaction the payment is applied to.""" id: str """FRAGMENT generated unique ID.""" @@ -123,7 +123,7 @@ class DataInvoicePaymentTransaction(BaseModel): class DataInvoicePaymentUser(BaseModel): - """User reference.""" + """User associated with the payment.""" id: str """FRAGMENT generated unique ID.""" @@ -137,8 +137,8 @@ class DataInvoicePayment(BaseModel): amount: str """ - Amount allocated as a string in the smallest unit of the currency (for example, - cents for USD). + Amount allocated as a string in the smallest currency unit, such as cents for + USD. """ currency: Literal[ @@ -322,90 +322,90 @@ class DataInvoicePayment(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" posted: datetime """Timestamp when the parent transaction was posted. Uses ISO 8601 format.""" transaction: DataInvoicePaymentTransaction - """Transaction reference.""" + """Transaction the payment is applied to.""" type: Literal["payin", "payout"] """Type of the payment.""" user: DataInvoicePaymentUser - """User reference.""" + """User associated with the payment.""" class DataInvoiceUserBalanceNet(BaseModel): + """Net balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataInvoiceUserBalancePayins(BaseModel): + """Payins balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataInvoiceUserBalancePayouts(BaseModel): + """Payouts balance breakdown.""" + actual: str - """ - Actual amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Actual amount as a string in the smallest currency unit, such as cents for USD.""" expected: str """ - Expected amount as a string in the smallest unit of the currency (for example, - cents for USD). + Expected amount as a string in the smallest currency unit, such as cents for + USD. """ remaining: str """ - Remaining amount as a string in the smallest unit of the currency (for example, - cents for USD). + Remaining amount as a string in the smallest currency unit, such as cents for + USD. """ class DataInvoiceUserBalance(BaseModel): currency: str - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" net: DataInvoiceUserBalanceNet + """Net balance breakdown.""" payins: DataInvoiceUserBalancePayins + """Payins balance breakdown.""" payouts: DataInvoiceUserBalancePayouts + """Payouts balance breakdown.""" class DataInvoiceUser(BaseModel): @@ -440,6 +440,8 @@ class DataPageInfo(BaseModel): class Data(BaseModel): + """Search results for invoices.""" + invoices: List[DataInvoice] """Invoices matching the search criteria.""" @@ -451,3 +453,4 @@ class InvoiceSearchResponse(BaseModel): """Search results for invoices.""" data: Data + """Search results for invoices.""" diff --git a/src/fragment/types/invoice_update_params.py b/src/fragment/types/invoice_update_params.py index f3f7425..c29afab 100644 --- a/src/fragment/types/invoice_update_params.py +++ b/src/fragment/types/invoice_update_params.py @@ -35,8 +35,10 @@ class InvoiceUpdateParams(TypedDict, total=False): """Current version of the invoice. Must match the stored version.""" line_items: LineItems + """Line item updates.""" tags: Tags + """Tag updates.""" class LineItemsCreateUserID(TypedDict, total=False): @@ -56,9 +58,9 @@ class LineItemsCreatePrice(TypedDict, total=False): """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). Required if unit_price and quantity are not provided. + """Total amount as a string in the smallest currency unit, such as cents for USD. + + Required if unit_price and quantity are not provided. """ quantity: int @@ -66,8 +68,7 @@ class LineItemsCreatePrice(TypedDict, total=False): unit_price: str """ - Price per unit as a string in the smallest unit of the currency (for example, - cents for USD). + Price per unit as a string in the smallest currency unit, such as cents for USD. """ @@ -75,18 +76,10 @@ class LineItemsCreateTag(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class LineItemsCreate(TypedDict, total=False): @@ -105,9 +98,9 @@ class LineItemsCreate(TypedDict, total=False): """Identifies a user by `id` or `external_id`.""" amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). Deprecated, use price instead. + """Total amount as a string in the smallest currency unit, such as cents for USD. + + Deprecated, use price instead. """ currency_code: Literal[ @@ -291,7 +284,7 @@ class LineItemsCreate(TypedDict, total=False): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" price: LineItemsCreatePrice """Price breakdown. Provide amount, or unit_price and quantity, or all three.""" @@ -311,33 +304,21 @@ class LineItemsUpdatePrice(TypedDict, total=False): unit_price: Required[str] """ - Price per unit as a string in the smallest unit of the currency (for example, - cents for USD). + Price per unit as a string in the smallest currency unit, such as cents for USD. """ amount: str - """ - Total amount as a string in the smallest unit of the currency (for example, - cents for USD). - """ + """Total amount as a string in the smallest currency unit, such as cents for USD.""" class LineItemsUpdateTagsCreate(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class LineItemsUpdateTagsDelete(TypedDict, total=False): @@ -349,57 +330,36 @@ class LineItemsUpdateTagsSet(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class LineItemsUpdateTagsUpdate(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class LineItemsUpdateTags(TypedDict, total=False): + """Tag updates.""" + create: Iterable[LineItemsUpdateTagsCreate] - """Tags to add. Prefer `set` unless you specifically want create-only validation.""" + """Tags to create. The tag key must not already exist.""" delete: Iterable[LineItemsUpdateTagsDelete] - """Tags to remove by key.""" + """Tags to remove.""" set: Iterable[LineItemsUpdateTagsSet] - """ - Tags to create or overwrite without requiring the caller to distinguish between - create and update. - """ + """Tags to set. Creates a new tag or updates an existing tag.""" update: Iterable[LineItemsUpdateTagsUpdate] - """Tags to update. - - The key identifies the existing tag; the value is the new value. Prefer `set` - unless you specifically want update-only validation. - """ + """Tags to update. The tag key must already exist.""" class LineItemsUpdate(TypedDict, total=False): @@ -413,9 +373,12 @@ class LineItemsUpdate(TypedDict, total=False): price: LineItemsUpdatePrice tags: LineItemsUpdateTags + """Tag updates.""" class LineItems(TypedDict, total=False): + """Line item updates.""" + create: Iterable[LineItemsCreate] """Line items to add to the invoice.""" @@ -430,18 +393,10 @@ class TagsCreate(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class TagsDelete(TypedDict, total=False): @@ -453,54 +408,33 @@ class TagsSet(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class TagsUpdate(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class Tags(TypedDict, total=False): + """Tag updates.""" + create: Iterable[TagsCreate] - """Tags to add. Prefer `set` unless you specifically want create-only validation.""" + """Tags to create. The tag key must not already exist.""" delete: Iterable[TagsDelete] - """Tags to remove by key.""" + """Tags to remove.""" set: Iterable[TagsSet] - """ - Tags to create or overwrite without requiring the caller to distinguish between - create and update. - """ + """Tags to set. Creates a new tag or updates an existing tag.""" update: Iterable[TagsUpdate] - """Tags to update. - - The key identifies the existing tag; the value is the new value. Prefer `set` - unless you specifically want update-only validation. - """ + """Tags to update. The tag key must already exist.""" diff --git a/src/fragment/types/transaction.py b/src/fragment/types/transaction.py index 9a7e566..b1ce279 100644 --- a/src/fragment/types/transaction.py +++ b/src/fragment/types/transaction.py @@ -20,7 +20,7 @@ class Account(BaseModel): class AllocationUser(BaseModel): - """User reference.""" + """User associated with the allocation.""" id: str """FRAGMENT generated unique ID.""" @@ -34,8 +34,8 @@ class Allocation(BaseModel): amount: str """ - Allocated amount, as a positive string in the smallest unit of the currency (for - example, cents for USD). + Allocated amount, as a positive string in the smallest currency unit, such as + cents for USD. """ invoice_id: str @@ -45,7 +45,7 @@ class Allocation(BaseModel): """Type of allocation.""" user: AllocationUser - """User reference.""" + """User associated with the allocation.""" class Tag(BaseModel): @@ -72,8 +72,8 @@ class Transaction(BaseModel): amount: str """ - Transaction amount, as a string in the smallest unit of the currency (for - example, cents for USD). Can be positive or negative. + Transaction amount, as a string in the smallest currency unit, such as cents for + USD. Can be positive or negative. """ created: datetime @@ -260,7 +260,7 @@ class Transaction(BaseModel): "LOGICAL", "CUSTOM", ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" external_id: str """User-provided unique ID.""" diff --git a/src/fragment/types/transaction_create_params.py b/src/fragment/types/transaction_create_params.py index 563a780..847df59 100644 --- a/src/fragment/types/transaction_create_params.py +++ b/src/fragment/types/transaction_create_params.py @@ -31,8 +31,8 @@ class TransactionCreateParams(TypedDict, total=False): amount: Required[str] """ - Transaction amount, as a string in the smallest unit of the currency (for - example, cents for USD). Can be positive or negative. + Transaction amount, as a string in the smallest currency unit, such as cents for + USD. Can be positive or negative. """ currency: Required[ @@ -218,7 +218,7 @@ class TransactionCreateParams(TypedDict, total=False): "CUSTOM", ] ] - """Currency code (ISO 4217 or crypto).""" + """ISO 4217 or crypto currency code.""" external_id: Required[str] """User-provided unique ID.""" @@ -261,8 +261,8 @@ class Allocation(TypedDict, total=False): amount: Required[str] """ - Allocation amount, as a positive string in the smallest unit of the currency - (for example, cents for USD). + Allocation amount, as a positive string in the smallest currency unit, such as + cents for USD. """ invoice_id: Required[str] @@ -279,15 +279,7 @@ class Tag(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" diff --git a/src/fragment/types/transaction_search_allocations_params.py b/src/fragment/types/transaction_search_allocations_params.py index 86e4be8..ab556ca 100644 --- a/src/fragment/types/transaction_search_allocations_params.py +++ b/src/fragment/types/transaction_search_allocations_params.py @@ -15,11 +15,14 @@ class TransactionSearchAllocationsParams(TypedDict, total=False): class FilterInvoiceID(TypedDict, total=False): + """Invoice ID filter.""" + any: Required[SequenceNotStr[str]] - """Match allocations where invoice_id is any of these values (OR).""" + """Match allocations where invoice_id is any of these values, using OR logic.""" class Filter(TypedDict, total=False): """Filter for searching transaction allocations.""" invoice_id: Required[FilterInvoiceID] + """Invoice ID filter.""" diff --git a/src/fragment/types/transaction_search_allocations_response.py b/src/fragment/types/transaction_search_allocations_response.py index 32607c2..81c7994 100644 --- a/src/fragment/types/transaction_search_allocations_response.py +++ b/src/fragment/types/transaction_search_allocations_response.py @@ -10,7 +10,7 @@ class DataTransaction(BaseModel): - """Transaction reference.""" + """Transaction the allocation is applied to.""" id: str """FRAGMENT generated unique ID.""" @@ -20,7 +20,7 @@ class DataTransaction(BaseModel): class DataUser(BaseModel): - """User reference.""" + """User associated with the allocation.""" id: str """FRAGMENT generated unique ID.""" @@ -37,8 +37,8 @@ class Data(BaseModel): amount: str """ - Allocated amount, as a positive string in the smallest unit of the currency (for - example, cents for USD). + Allocated amount, as a positive string in the smallest currency unit, such as + cents for USD. """ invoice_id: str @@ -48,13 +48,13 @@ class Data(BaseModel): """Timestamp when the parent transaction was posted. Uses ISO 8601 format.""" transaction: DataTransaction - """Transaction reference.""" + """Transaction the allocation is applied to.""" type: Literal["invoice_payin", "invoice_payout"] """Type of allocation.""" user: DataUser - """User reference.""" + """User associated with the allocation.""" class TransactionSearchAllocationsResponse(BaseModel): diff --git a/src/fragment/types/transaction_search_params.py b/src/fragment/types/transaction_search_params.py index e022946..94db272 100644 --- a/src/fragment/types/transaction_search_params.py +++ b/src/fragment/types/transaction_search_params.py @@ -5,13 +5,25 @@ from typing import Iterable from typing_extensions import Required, TypedDict -__all__ = ["TransactionSearchParams", "Filter", "FilterAccount", "FilterAccountAny"] +__all__ = [ + "TransactionSearchParams", + "Filter", + "FilterAccount", + "FilterAccountAny", + "FilterTags", + "FilterTagsAll", + "FilterTagsAny", + "PageInfo", +] class TransactionSearchParams(TypedDict, total=False): filter: Required[Filter] """Filter for searching transactions.""" + page_info: PageInfo + """Pagination parameters.""" + class FilterAccountAny(TypedDict, total=False): """External account for the transaction. @@ -27,11 +39,77 @@ class FilterAccountAny(TypedDict, total=False): class FilterAccount(TypedDict, total=False): + """Account filter.""" + any: Required[Iterable[FilterAccountAny]] - """Match transactions belonging to any of these accounts (OR).""" + """Match transactions belonging to any of these accounts, using OR logic.""" + + +class FilterTagsAll(TypedDict, total=False): + """A tag filter.""" + + key: Required[str] + """Tag key to filter on. Must be an exact match; wildcards are not supported.""" + + value: Required[str] + """Tag value pattern to filter on. + + Supports wildcards: `*` matches any characters, `?` matches a single character. + Use `\\**` or `\\??` to match literal asterisks or question marks. Use `*` to match + any value for the given key. + """ + + +class FilterTagsAny(TypedDict, total=False): + """A tag filter.""" + + key: Required[str] + """Tag key to filter on. Must be an exact match; wildcards are not supported.""" + + value: Required[str] + """Tag value pattern to filter on. + + Supports wildcards: `*` matches any characters, `?` matches a single character. + Use `\\**` or `\\??` to match literal asterisks or question marks. Use `*` to match + any value for the given key. + """ + + +class FilterTags(TypedDict, total=False): + """Tag-based filter criteria. + + When both `any` and `all` are provided, results must match every entry in `all` AND at least one entry in `any`. + """ + + all: Iterable[FilterTagsAll] + """Returns transactions matching every specified tag, using AND logic.""" + + any: Iterable[FilterTagsAny] + """ + Returns transactions matching at least one of the specified tags, using OR + logic. + """ class Filter(TypedDict, total=False): """Filter for searching transactions.""" - account: Required[FilterAccount] + account: FilterAccount + """Account filter.""" + + tags: FilterTags + """Tag-based filter criteria. + + When both `any` and `all` are provided, results must match every entry in `all` + AND at least one entry in `any`. + """ + + +class PageInfo(TypedDict, total=False): + """Pagination parameters.""" + + after: str + """Cursor for fetching the next page of results.""" + + limit: int + """Number of results to return. Defaults to 20.""" diff --git a/src/fragment/types/transaction_search_response.py b/src/fragment/types/transaction_search_response.py index c3db566..70246fb 100644 --- a/src/fragment/types/transaction_search_response.py +++ b/src/fragment/types/transaction_search_response.py @@ -1,13 +1,34 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from .._models import BaseModel from .transaction import Transaction -__all__ = ["TransactionSearchResponse"] +__all__ = ["TransactionSearchResponse", "DataV2", "DataV2PageInfo"] + + +class DataV2PageInfo(BaseModel): + """Pagination cursors.""" + + next_cursor: Optional[str] = None + """Cursor to fetch the next page of results.""" + + +class DataV2(BaseModel): + page_info: DataV2PageInfo + """Pagination cursors.""" + + transactions: List[Transaction] + """Transactions matching the search criteria.""" class TransactionSearchResponse(BaseModel): data: List[Transaction] - """List of transaction search results.""" + """Deprecated. + + Use `data_v2.transactions` instead. Returns the full unpaginated list of + matching transactions. + """ + + data_v2: DataV2 diff --git a/src/fragment/types/transaction_update_params.py b/src/fragment/types/transaction_update_params.py index 7c83f59..2f2898a 100644 --- a/src/fragment/types/transaction_update_params.py +++ b/src/fragment/types/transaction_update_params.py @@ -26,8 +26,10 @@ class TransactionUpdateParams(TypedDict, total=False): """Current version of the transaction. Must match the stored version.""" allocations: Allocations + """Allocation updates.""" tags: Tags + """Tag updates.""" class AllocationsCreateUserID(TypedDict, total=False): @@ -48,8 +50,8 @@ class AllocationsCreate(TypedDict, total=False): amount: Required[str] """ - Allocation amount, as a positive string in the smallest unit of the currency - (for example, cents for USD). + Allocation amount, as a positive string in the smallest currency unit, such as + cents for USD. """ invoice_id: Required[str] @@ -68,12 +70,14 @@ class AllocationsUpdate(TypedDict, total=False): amount: Required[str] """ - Updated allocation amount, as a positive string in the smallest unit of the - currency (for example, cents for USD). + Updated allocation amount, as a positive string in the smallest currency unit, + such as cents for USD. """ class Allocations(TypedDict, total=False): + """Allocation updates.""" + create: Iterable[AllocationsCreate] """Allocations to create.""" @@ -85,18 +89,10 @@ class TagsCreate(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class TagsDelete(TypedDict, total=False): @@ -108,54 +104,33 @@ class TagsSet(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class TagsUpdate(TypedDict, total=False): """A key-value tag pair for metadata.""" key: Required[str] - """Tag key. - - Must be a valid safe string (no special characters like #, /, :). Max 50 - characters. - """ + """Tag key. Must not contain #, /, or :. Max 50 characters.""" value: Required[str] - """Tag value. - - Must be a valid safe string (no special characters like #, /, :). Max 200 - characters. - """ + """Tag value. Must not contain #, /, or :. Max 200 characters.""" class Tags(TypedDict, total=False): + """Tag updates.""" + create: Iterable[TagsCreate] - """Tags to add. Prefer `set` unless you specifically want create-only validation.""" + """Tags to create. The tag key must not already exist.""" delete: Iterable[TagsDelete] - """Tags to remove by key.""" + """Tags to remove.""" set: Iterable[TagsSet] - """ - Tags to create or overwrite without requiring the caller to distinguish between - create and update. - """ + """Tags to set. Creates a new tag or updates an existing tag.""" update: Iterable[TagsUpdate] - """Tags to update. - - The key identifies the existing tag; the value is the new value. Prefer `set` - unless you specifically want update-only validation. - """ + """Tags to update. The tag key must already exist.""" diff --git a/src/fragment/types/user_list_response.py b/src/fragment/types/user_list_response.py index 90f0021..f4a0a11 100644 --- a/src/fragment/types/user_list_response.py +++ b/src/fragment/types/user_list_response.py @@ -12,3 +12,4 @@ class UserListResponse(BaseModel): """List of users.""" data: List[User] + """List of users.""" diff --git a/tests/api_resources/test_invoices.py b/tests/api_resources/test_invoices.py index b4cd2ff..232f3da 100644 --- a/tests/api_resources/test_invoices.py +++ b/tests/api_resources/test_invoices.py @@ -60,16 +60,16 @@ def test_method_create_with_all_params(self, client: Fragment) -> None: }, "tags": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], } ], tags=[ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], ) @@ -190,8 +190,8 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: }, "tags": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], } @@ -209,21 +209,21 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: "tags": { "create": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], "delete": [{"key": "key"}], "set": [ { - "key": "region", - "value": "eu-west-1", + "key": "department", + "value": "engineering", } ], "update": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], }, @@ -233,21 +233,21 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: tags={ "create": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], "delete": [{"key": "key"}], "set": [ { - "key": "region", - "value": "eu-west-1", + "key": "department", + "value": "engineering", } ], "update": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], }, @@ -366,7 +366,6 @@ def test_path_params_list_history(self, client: Fragment) -> None: def test_method_search(self, client: Fragment) -> None: invoice = client.invoices.search( filter={}, - page_info={}, ) assert_matches_type(InvoiceSearchResponse, invoice, path=["response"]) @@ -379,14 +378,14 @@ def test_method_search_with_all_params(self, client: Fragment) -> None: "tags": { "all": [ { - "key": "env", - "value": "prod", + "key": "department", + "value": "engineering", } ], "any": [ { - "key": "region", - "value": "us-*", + "key": "department", + "value": "eng*", } ], }, @@ -403,7 +402,6 @@ def test_method_search_with_all_params(self, client: Fragment) -> None: def test_raw_response_search(self, client: Fragment) -> None: response = client.invoices.with_raw_response.search( filter={}, - page_info={}, ) assert response.is_closed is True @@ -416,7 +414,6 @@ def test_raw_response_search(self, client: Fragment) -> None: def test_streaming_response_search(self, client: Fragment) -> None: with client.invoices.with_streaming_response.search( filter={}, - page_info={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -468,16 +465,16 @@ async def test_method_create_with_all_params(self, async_client: AsyncFragment) }, "tags": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], } ], tags=[ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], ) @@ -598,8 +595,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) }, "tags": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], } @@ -617,21 +614,21 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) "tags": { "create": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], "delete": [{"key": "key"}], "set": [ { - "key": "region", - "value": "eu-west-1", + "key": "department", + "value": "engineering", } ], "update": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], }, @@ -641,21 +638,21 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) tags={ "create": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], "delete": [{"key": "key"}], "set": [ { - "key": "region", - "value": "eu-west-1", + "key": "department", + "value": "engineering", } ], "update": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], }, @@ -774,7 +771,6 @@ async def test_path_params_list_history(self, async_client: AsyncFragment) -> No async def test_method_search(self, async_client: AsyncFragment) -> None: invoice = await async_client.invoices.search( filter={}, - page_info={}, ) assert_matches_type(InvoiceSearchResponse, invoice, path=["response"]) @@ -787,14 +783,14 @@ async def test_method_search_with_all_params(self, async_client: AsyncFragment) "tags": { "all": [ { - "key": "env", - "value": "prod", + "key": "department", + "value": "engineering", } ], "any": [ { - "key": "region", - "value": "us-*", + "key": "department", + "value": "eng*", } ], }, @@ -811,7 +807,6 @@ async def test_method_search_with_all_params(self, async_client: AsyncFragment) async def test_raw_response_search(self, async_client: AsyncFragment) -> None: response = await async_client.invoices.with_raw_response.search( filter={}, - page_info={}, ) assert response.is_closed is True @@ -824,7 +819,6 @@ async def test_raw_response_search(self, async_client: AsyncFragment) -> None: async def test_streaming_response_search(self, async_client: AsyncFragment) -> None: async with async_client.invoices.with_streaming_response.search( filter={}, - page_info={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_transactions.py b/tests/api_resources/test_transactions.py index 6147986..c7fa19b 100644 --- a/tests/api_resources/test_transactions.py +++ b/tests/api_resources/test_transactions.py @@ -68,8 +68,8 @@ def test_method_create_with_all_params(self, client: Fragment) -> None: posted=parse_datetime("2024-01-13T00:00:00Z"), tags=[ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], ) @@ -201,21 +201,21 @@ def test_method_update_with_all_params(self, client: Fragment) -> None: tags={ "create": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], "delete": [{"key": "key"}], "set": [ { - "key": "region", - "value": "eu-west-1", + "key": "department", + "value": "engineering", } ], "update": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], }, @@ -342,7 +342,42 @@ def test_path_params_list_history(self, client: Fragment) -> None: @parametrize def test_method_search(self, client: Fragment) -> None: transaction = client.transactions.search( - filter={"account": {"any": [{}]}}, + filter={}, + ) + assert_matches_type(TransactionSearchResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_search_with_all_params(self, client: Fragment) -> None: + transaction = client.transactions.search( + filter={ + "account": { + "any": [ + { + "id": "ext_account_YWJjMTIz", + "external_id": "acct_external_123", + } + ] + }, + "tags": { + "all": [ + { + "key": "department", + "value": "engineering", + } + ], + "any": [ + { + "key": "department", + "value": "eng*", + } + ], + }, + }, + page_info={ + "after": "after", + "limit": 20, + }, ) assert_matches_type(TransactionSearchResponse, transaction, path=["response"]) @@ -350,7 +385,7 @@ def test_method_search(self, client: Fragment) -> None: @parametrize def test_raw_response_search(self, client: Fragment) -> None: response = client.transactions.with_raw_response.search( - filter={"account": {"any": [{}]}}, + filter={}, ) assert response.is_closed is True @@ -362,7 +397,7 @@ def test_raw_response_search(self, client: Fragment) -> None: @parametrize def test_streaming_response_search(self, client: Fragment) -> None: with client.transactions.with_streaming_response.search( - filter={"account": {"any": [{}]}}, + filter={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -454,8 +489,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncFragment) posted=parse_datetime("2024-01-13T00:00:00Z"), tags=[ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], ) @@ -587,21 +622,21 @@ async def test_method_update_with_all_params(self, async_client: AsyncFragment) tags={ "create": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], "delete": [{"key": "key"}], "set": [ { - "key": "region", - "value": "eu-west-1", + "key": "department", + "value": "engineering", } ], "update": [ { - "key": "region", - "value": "us-east", + "key": "department", + "value": "engineering", } ], }, @@ -728,7 +763,42 @@ async def test_path_params_list_history(self, async_client: AsyncFragment) -> No @parametrize async def test_method_search(self, async_client: AsyncFragment) -> None: transaction = await async_client.transactions.search( - filter={"account": {"any": [{}]}}, + filter={}, + ) + assert_matches_type(TransactionSearchResponse, transaction, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_search_with_all_params(self, async_client: AsyncFragment) -> None: + transaction = await async_client.transactions.search( + filter={ + "account": { + "any": [ + { + "id": "ext_account_YWJjMTIz", + "external_id": "acct_external_123", + } + ] + }, + "tags": { + "all": [ + { + "key": "department", + "value": "engineering", + } + ], + "any": [ + { + "key": "department", + "value": "eng*", + } + ], + }, + }, + page_info={ + "after": "after", + "limit": 20, + }, ) assert_matches_type(TransactionSearchResponse, transaction, path=["response"]) @@ -736,7 +806,7 @@ async def test_method_search(self, async_client: AsyncFragment) -> None: @parametrize async def test_raw_response_search(self, async_client: AsyncFragment) -> None: response = await async_client.transactions.with_raw_response.search( - filter={"account": {"any": [{}]}}, + filter={}, ) assert response.is_closed is True @@ -748,7 +818,7 @@ async def test_raw_response_search(self, async_client: AsyncFragment) -> None: @parametrize async def test_streaming_response_search(self, async_client: AsyncFragment) -> None: async with async_client.transactions.with_streaming_response.search( - filter={"account": {"any": [{}]}}, + filter={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 4b3c6a82e054dfc2d73683a025a499f8dad0e1ea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:04:40 +0000 Subject: [PATCH 13/13] release: 0.10.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ pyproject.toml | 2 +- src/fragment/_version.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6d78745..091cfb1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.0" + ".": "0.10.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ef5cf99..383e52e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 0.10.0 (2026-04-13) + +Full Changelog: [v0.9.0...v0.10.0](https://github.com/fragment-dev/fragment-py/compare/v0.9.0...v0.10.0) + +### Features + +* **api:** update SDK from prod (511af1bcd4001be60c589fed1d05a5814e416679) ([e2ce984](https://github.com/fragment-dev/fragment-py/commit/e2ce984d3cadaf39400d35ae5d35d464027dca54)) +* **api:** update SDK from prod (523b1fdd6cc6b5732ccdad5095c21f69fe1f7489) ([ea85617](https://github.com/fragment-dev/fragment-py/commit/ea85617c004e54e4a27abf4c8a5e585d17256d7c)) +* **api:** update SDK from prod (5cede0854eb141955854b7a9d3eb0e07a9588e3c) ([67481e4](https://github.com/fragment-dev/fragment-py/commit/67481e45971c9e704986c425b42b4a9938b45746)) +* **api:** update SDK from prod (729db28098a20ebc22e879a2cd1c6ad860f9ce4c) ([1d1b5d0](https://github.com/fragment-dev/fragment-py/commit/1d1b5d0b74975f2505475ca8167176680eff0655)) +* **api:** update SDK from prod (8051461980fb65468797d0b82dfa42dee9014004) ([25512da](https://github.com/fragment-dev/fragment-py/commit/25512da8089db4f3be50174a77373390fa29c52c)) +* **api:** update SDK from prod (a5eb093078fe5947a299bccafd30a0c7f2e90790) ([fc27b30](https://github.com/fragment-dev/fragment-py/commit/fc27b304c5dae27cb485853ad80c55b3c1392df0)) +* **api:** update SDK from prod (b3080493fb6bb118abdd03644b9ef6f59d417a3c) ([cd9337f](https://github.com/fragment-dev/fragment-py/commit/cd9337fbe43c0c5e6ed9ec1ef4c6db5bbf270403)) +* **api:** update SDK from prod (b8f6f1940acd3d10fc17aaeb59cd75281f3c6436) ([dca29fc](https://github.com/fragment-dev/fragment-py/commit/dca29fcd235fe6c110efcdf9042fe012d06ce17e)) +* **api:** update SDK from prod (d8f41b559592a1a8c68c0c40fdb773aa6e53795e) ([9bd565e](https://github.com/fragment-dev/fragment-py/commit/9bd565e3cee12d961291d7b4641195045097f7c9)) +* **api:** update SDK from prod (e1ebb9e4d62034855202a8ff99690880c072d953) ([4de3417](https://github.com/fragment-dev/fragment-py/commit/4de3417d2e14d337dc6bbd9f809c4bc6f624015b)) + + +### Bug Fixes + +* **client:** preserve hardcoded query params when merging with user params ([dd8e3f1](https://github.com/fragment-dev/fragment-py/commit/dd8e3f1966650b7cb4043f377c4fcf9b30e188ba)) +* ensure file data are only sent as 1 parameter ([b244d50](https://github.com/fragment-dev/fragment-py/commit/b244d5004f5f7fb0ba13745581e47e4bb84a67e4)) + ## 0.9.0 (2026-03-27) Full Changelog: [v0.8.0...v0.9.0](https://github.com/fragment-dev/fragment-py/compare/v0.8.0...v0.9.0) diff --git a/pyproject.toml b/pyproject.toml index 06b2946..67a8a18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fragment-py" -version = "0.9.0" +version = "0.10.0" description = "The official Python library for the fragment API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/fragment/_version.py b/src/fragment/_version.py index f6d2ffa..bba4162 100644 --- a/src/fragment/_version.py +++ b/src/fragment/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "fragment" -__version__ = "0.9.0" # x-release-please-version +__version__ = "0.10.0" # x-release-please-version