From aa1fb409cf03eb89f125787927ff50374abf2a95 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 05:28:26 +0000 Subject: [PATCH 1/2] feat(api): api update (#1032) --- .stats.yml | 4 +- api.md | 14 + src/increase/_client.py | 9 + src/increase/resources/__init__.py | 14 + src/increase/resources/file_links.py | 424 ++++++++++++++++++ src/increase/types/__init__.py | 3 + src/increase/types/file.py | 4 +- src/increase/types/file_link.py | 50 +++ src/increase/types/file_link_create_params.py | 23 + src/increase/types/file_link_list_params.py | 61 +++ tests/api_resources/test_file_links.py | 272 +++++++++++ 11 files changed, 875 insertions(+), 3 deletions(-) create mode 100644 src/increase/resources/file_links.py create mode 100644 src/increase/types/file_link.py create mode 100644 src/increase/types/file_link_create_params.py create mode 100644 src/increase/types/file_link_list_params.py create mode 100644 tests/api_resources/test_file_links.py diff --git a/.stats.yml b/.stats.yml index 1cce0ab4a..6b3168540 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 198 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-1a9b03edcf2324393d39557ff1597830acce6897eb2e1aed988ee03e8a6630ee.yml +configured_endpoints: 201 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-7b89d3a40ae97579e589512ffb00e48f1cdd04e38d075dd8c5a16f80909ccfd5.yml diff --git a/api.md b/api.md index de6730c73..83c51db42 100644 --- a/api.md +++ b/api.md @@ -532,6 +532,20 @@ Methods: - client.files.retrieve(file_id) -> File - client.files.list(\*\*params) -> SyncPage[File] +# FileLinks + +Types: + +```python +from increase.types import FileLink +``` + +Methods: + +- client.file_links.create(\*\*params) -> FileLink +- client.file_links.retrieve(file_link_id) -> FileLink +- client.file_links.list(\*\*params) -> SyncPage[FileLink] + # Documents Types: diff --git a/src/increase/_client.py b/src/increase/_client.py index a04fa6531..d3f4e8d00 100644 --- a/src/increase/_client.py +++ b/src/increase/_client.py @@ -37,6 +37,7 @@ webhooks, documents, lockboxes, + file_links, oauth_tokens, transactions, ach_transfers, @@ -147,6 +148,7 @@ class Increase(SyncAPIClient): ) account_statements: account_statements.AccountStatementsResource files: files.FilesResource + file_links: file_links.FileLinksResource documents: documents.DocumentsResource exports: exports.ExportsResource events: events.EventsResource @@ -298,6 +300,7 @@ def __init__( ) self.account_statements = account_statements.AccountStatementsResource(self) self.files = files.FilesResource(self) + self.file_links = file_links.FileLinksResource(self) self.documents = documents.DocumentsResource(self) self.exports = exports.ExportsResource(self) self.events = events.EventsResource(self) @@ -514,6 +517,7 @@ class AsyncIncrease(AsyncAPIClient): ) account_statements: account_statements.AsyncAccountStatementsResource files: files.AsyncFilesResource + file_links: file_links.AsyncFileLinksResource documents: documents.AsyncDocumentsResource exports: exports.AsyncExportsResource events: events.AsyncEventsResource @@ -667,6 +671,7 @@ def __init__( ) self.account_statements = account_statements.AsyncAccountStatementsResource(self) self.files = files.AsyncFilesResource(self) + self.file_links = file_links.AsyncFileLinksResource(self) self.documents = documents.AsyncDocumentsResource(self) self.exports = exports.AsyncExportsResource(self) self.events = events.AsyncEventsResource(self) @@ -924,6 +929,7 @@ def __init__(self, client: Increase) -> None: ) self.account_statements = account_statements.AccountStatementsResourceWithRawResponse(client.account_statements) self.files = files.FilesResourceWithRawResponse(client.files) + self.file_links = file_links.FileLinksResourceWithRawResponse(client.file_links) self.documents = documents.DocumentsResourceWithRawResponse(client.documents) self.exports = exports.ExportsResourceWithRawResponse(client.exports) self.events = events.EventsResourceWithRawResponse(client.events) @@ -1043,6 +1049,7 @@ def __init__(self, client: AsyncIncrease) -> None: client.account_statements ) self.files = files.AsyncFilesResourceWithRawResponse(client.files) + self.file_links = file_links.AsyncFileLinksResourceWithRawResponse(client.file_links) self.documents = documents.AsyncDocumentsResourceWithRawResponse(client.documents) self.exports = exports.AsyncExportsResourceWithRawResponse(client.exports) self.events = events.AsyncEventsResourceWithRawResponse(client.events) @@ -1170,6 +1177,7 @@ def __init__(self, client: Increase) -> None: client.account_statements ) self.files = files.FilesResourceWithStreamingResponse(client.files) + self.file_links = file_links.FileLinksResourceWithStreamingResponse(client.file_links) self.documents = documents.DocumentsResourceWithStreamingResponse(client.documents) self.exports = exports.ExportsResourceWithStreamingResponse(client.exports) self.events = events.EventsResourceWithStreamingResponse(client.events) @@ -1299,6 +1307,7 @@ def __init__(self, client: AsyncIncrease) -> None: client.account_statements ) self.files = files.AsyncFilesResourceWithStreamingResponse(client.files) + self.file_links = file_links.AsyncFileLinksResourceWithStreamingResponse(client.file_links) self.documents = documents.AsyncDocumentsResourceWithStreamingResponse(client.documents) self.exports = exports.AsyncExportsResourceWithStreamingResponse(client.exports) self.events = events.AsyncEventsResourceWithStreamingResponse(client.events) diff --git a/src/increase/resources/__init__.py b/src/increase/resources/__init__.py index f6da14554..e5e05cbf1 100644 --- a/src/increase/resources/__init__.py +++ b/src/increase/resources/__init__.py @@ -81,6 +81,14 @@ LockboxesResourceWithStreamingResponse, AsyncLockboxesResourceWithStreamingResponse, ) +from .file_links import ( + FileLinksResource, + AsyncFileLinksResource, + FileLinksResourceWithRawResponse, + AsyncFileLinksResourceWithRawResponse, + FileLinksResourceWithStreamingResponse, + AsyncFileLinksResourceWithStreamingResponse, +) from .simulations import ( SimulationsResource, AsyncSimulationsResource, @@ -651,6 +659,12 @@ "AsyncFilesResourceWithRawResponse", "FilesResourceWithStreamingResponse", "AsyncFilesResourceWithStreamingResponse", + "FileLinksResource", + "AsyncFileLinksResource", + "FileLinksResourceWithRawResponse", + "AsyncFileLinksResourceWithRawResponse", + "FileLinksResourceWithStreamingResponse", + "AsyncFileLinksResourceWithStreamingResponse", "DocumentsResource", "AsyncDocumentsResource", "DocumentsResourceWithRawResponse", diff --git a/src/increase/resources/file_links.py b/src/increase/resources/file_links.py new file mode 100644 index 000000000..30d79e14e --- /dev/null +++ b/src/increase/resources/file_links.py @@ -0,0 +1,424 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime + +import httpx + +from ..types import file_link_list_params, file_link_create_params +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._utils import ( + maybe_transform, + async_maybe_transform, +) +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.file_link import FileLink + +__all__ = ["FileLinksResource", "AsyncFileLinksResource"] + + +class FileLinksResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FileLinksResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return FileLinksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FileLinksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return FileLinksResourceWithStreamingResponse(self) + + def create( + self, + *, + file_id: str, + expires_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> FileLink: + """ + Create a File Link + + Args: + file_id: The File to create a File Link for. + + expires_at: The time at which the File Link will expire. The default is 1 hour from the time + of the request. The maxiumum is 1 day from the time of the request. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/file_links", + body=maybe_transform( + { + "file_id": file_id, + "expires_at": expires_at, + }, + file_link_create_params.FileLinkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FileLink, + ) + + def retrieve( + self, + file_link_id: str, + *, + # 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, + ) -> FileLink: + """ + Retrieve a File Link + + Args: + file_link_id: The identifier of the File Link. + + 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 file_link_id: + raise ValueError(f"Expected a non-empty value for `file_link_id` but received {file_link_id!r}") + return self._get( + f"/file_links/{file_link_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileLink, + ) + + def list( + self, + *, + file_id: str, + created_at: file_link_list_params.CreatedAt | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + idempotency_key: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncPage[FileLink]: + """ + List File Links + + Args: + file_id: The identifier of the File to list File Links for. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/file_links", + page=SyncPage[FileLink], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "file_id": file_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + }, + file_link_list_params.FileLinkListParams, + ), + ), + model=FileLink, + ) + + +class AsyncFileLinksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFileLinksResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncFileLinksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFileLinksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncFileLinksResourceWithStreamingResponse(self) + + async def create( + self, + *, + file_id: str, + expires_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> FileLink: + """ + Create a File Link + + Args: + file_id: The File to create a File Link for. + + expires_at: The time at which the File Link will expire. The default is 1 hour from the time + of the request. The maxiumum is 1 day from the time of the request. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/file_links", + body=await async_maybe_transform( + { + "file_id": file_id, + "expires_at": expires_at, + }, + file_link_create_params.FileLinkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FileLink, + ) + + async def retrieve( + self, + file_link_id: str, + *, + # 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, + ) -> FileLink: + """ + Retrieve a File Link + + Args: + file_link_id: The identifier of the File Link. + + 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 file_link_id: + raise ValueError(f"Expected a non-empty value for `file_link_id` but received {file_link_id!r}") + return await self._get( + f"/file_links/{file_link_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FileLink, + ) + + def list( + self, + *, + file_id: str, + created_at: file_link_list_params.CreatedAt | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + idempotency_key: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[FileLink, AsyncPage[FileLink]]: + """ + List File Links + + Args: + file_id: The identifier of the File to list File Links for. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/file_links", + page=AsyncPage[FileLink], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "file_id": file_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + }, + file_link_list_params.FileLinkListParams, + ), + ), + model=FileLink, + ) + + +class FileLinksResourceWithRawResponse: + def __init__(self, file_links: FileLinksResource) -> None: + self._file_links = file_links + + self.create = to_raw_response_wrapper( + file_links.create, + ) + self.retrieve = to_raw_response_wrapper( + file_links.retrieve, + ) + self.list = to_raw_response_wrapper( + file_links.list, + ) + + +class AsyncFileLinksResourceWithRawResponse: + def __init__(self, file_links: AsyncFileLinksResource) -> None: + self._file_links = file_links + + self.create = async_to_raw_response_wrapper( + file_links.create, + ) + self.retrieve = async_to_raw_response_wrapper( + file_links.retrieve, + ) + self.list = async_to_raw_response_wrapper( + file_links.list, + ) + + +class FileLinksResourceWithStreamingResponse: + def __init__(self, file_links: FileLinksResource) -> None: + self._file_links = file_links + + self.create = to_streamed_response_wrapper( + file_links.create, + ) + self.retrieve = to_streamed_response_wrapper( + file_links.retrieve, + ) + self.list = to_streamed_response_wrapper( + file_links.list, + ) + + +class AsyncFileLinksResourceWithStreamingResponse: + def __init__(self, file_links: AsyncFileLinksResource) -> None: + self._file_links = file_links + + self.create = async_to_streamed_response_wrapper( + file_links.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + file_links.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + file_links.list, + ) diff --git a/src/increase/types/__init__.py b/src/increase/types/__init__.py index 71a969901..16bcc0f21 100644 --- a/src/increase/types/__init__.py +++ b/src/increase/types/__init__.py @@ -12,6 +12,7 @@ from .lockbox import Lockbox as Lockbox from .program import Program as Program from .document import Document as Document +from .file_link import FileLink as FileLink from .oauth_token import OAuthToken as OAuthToken from .transaction import Transaction as Transaction from .ach_transfer import ACHTransfer as ACHTransfer @@ -60,6 +61,7 @@ from .account_update_params import AccountUpdateParams as AccountUpdateParams from .bookkeeping_entry_set import BookkeepingEntrySet as BookkeepingEntrySet from .entity_confirm_params import EntityConfirmParams as EntityConfirmParams +from .file_link_list_params import FileLinkListParams as FileLinkListParams from .inbound_check_deposit import InboundCheckDeposit as InboundCheckDeposit from .inbound_wire_transfer import InboundWireTransfer as InboundWireTransfer from .lockbox_create_params import LockboxCreateParams as LockboxCreateParams @@ -67,6 +69,7 @@ from .physical_card_profile import PhysicalCardProfile as PhysicalCardProfile from .wire_drawdown_request import WireDrawdownRequest as WireDrawdownRequest from .account_balance_params import AccountBalanceParams as AccountBalanceParams +from .file_link_create_params import FileLinkCreateParams as FileLinkCreateParams from .transaction_list_params import TransactionListParams as TransactionListParams from .ach_transfer_list_params import ACHTransferListParams as ACHTransferListParams from .card_dispute_list_params import CardDisputeListParams as CardDisputeListParams diff --git a/src/increase/types/file.py b/src/increase/types/file.py index 7c2e004f9..e3cfe6f99 100644 --- a/src/increase/types/file.py +++ b/src/increase/types/file.py @@ -29,7 +29,9 @@ class File(BaseModel): download_url: Optional[str] = None """A URL from where the File can be downloaded at this point in time. - The location of this URL may change over time. + The location of this URL may change over time. This URL requires authentication + with your Increase API key. If you need a URL that does not require + authentication, create a File Link instead. """ filename: Optional[str] = None diff --git a/src/increase/types/file_link.py b/src/increase/types/file_link.py new file mode 100644 index 000000000..926b15119 --- /dev/null +++ b/src/increase/types/file_link.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["FileLink"] + + +class FileLink(BaseModel): + id: str + """The File Link identifier.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the File + Link was created. + """ + + expires_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the File + Link will expire. + """ + + file_id: str + """The identifier of the File the File Link points to.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + public_download_url: str + """A URL where the File can be downloaded. + + The URL will expire after the `expires_at` time. This URL is unauthenticated and + can be used to download the File without an Increase API key. + """ + + type: Literal["file_link"] + """A constant representing the object's type. + + For this resource it will always be `file_link`. + """ diff --git a/src/increase/types/file_link_create_params.py b/src/increase/types/file_link_create_params.py new file mode 100644 index 000000000..8707daaa8 --- /dev/null +++ b/src/increase/types/file_link_create_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FileLinkCreateParams"] + + +class FileLinkCreateParams(TypedDict, total=False): + file_id: Required[str] + """The File to create a File Link for.""" + + expires_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The time at which the File Link will expire. + + The default is 1 hour from the time of the request. The maxiumum is 1 day from + the time of the request. + """ diff --git a/src/increase/types/file_link_list_params.py b/src/increase/types/file_link_list_params.py new file mode 100644 index 000000000..432f19d06 --- /dev/null +++ b/src/increase/types/file_link_list_params.py @@ -0,0 +1,61 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FileLinkListParams", "CreatedAt"] + + +class FileLinkListParams(TypedDict, total=False): + file_id: Required[str] + """The identifier of the File to list File Links for.""" + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ diff --git a/tests/api_resources/test_file_links.py b/tests/api_resources/test_file_links.py new file mode 100644 index 000000000..29df07284 --- /dev/null +++ b/tests/api_resources/test_file_links.py @@ -0,0 +1,272 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import FileLink +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFileLinks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + file_link = client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + file_link = client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.file_links.with_raw_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.file_links.with_streaming_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + file_link = client.file_links.retrieve( + "file_link_id", + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.file_links.with_raw_response.retrieve( + "file_link_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.file_links.with_streaming_response.retrieve( + "file_link_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_link_id` but received ''"): + client.file_links.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + file_link = client.file_links.list( + file_id="file_id", + ) + assert_matches_type(SyncPage[FileLink], file_link, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + file_link = client.file_links.list( + file_id="file_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + ) + assert_matches_type(SyncPage[FileLink], file_link, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.file_links.with_raw_response.list( + file_id="file_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = response.parse() + assert_matches_type(SyncPage[FileLink], file_link, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.file_links.with_streaming_response.list( + file_id="file_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = response.parse() + assert_matches_type(SyncPage[FileLink], file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFileLinks: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.file_links.with_raw_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = await response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.file_links.with_streaming_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = await response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.retrieve( + "file_link_id", + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.file_links.with_raw_response.retrieve( + "file_link_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = await response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.file_links.with_streaming_response.retrieve( + "file_link_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = await response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_link_id` but received ''"): + await async_client.file_links.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.list( + file_id="file_id", + ) + assert_matches_type(AsyncPage[FileLink], file_link, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.list( + file_id="file_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + ) + assert_matches_type(AsyncPage[FileLink], file_link, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.file_links.with_raw_response.list( + file_id="file_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = await response.parse() + assert_matches_type(AsyncPage[FileLink], file_link, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.file_links.with_streaming_response.list( + file_id="file_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = await response.parse() + assert_matches_type(AsyncPage[FileLink], file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True From 481c50f59449a85e359991d44bd81c7e60cad9df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 05:28:52 +0000 Subject: [PATCH 2/2] release: 0.208.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/increase/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3ba9c38c6..3a7ed508c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.207.1" + ".": "0.208.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 861bb4e5a..d51368558 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.208.0 (2025-03-15) + +Full Changelog: [v0.207.1...v0.208.0](https://github.com/Increase/increase-python/compare/v0.207.1...v0.208.0) + +### Features + +* **api:** api update ([#1032](https://github.com/Increase/increase-python/issues/1032)) ([aa1fb40](https://github.com/Increase/increase-python/commit/aa1fb409cf03eb89f125787927ff50374abf2a95)) + ## 0.207.1 (2025-03-14) Full Changelog: [v0.207.0...v0.207.1](https://github.com/Increase/increase-python/compare/v0.207.0...v0.207.1) diff --git a/pyproject.toml b/pyproject.toml index bafdac262..d6e898cd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.207.1" +version = "0.208.0" description = "The official Python library for the increase API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/increase/_version.py b/src/increase/_version.py index a5a035a8e..abaad9a5f 100644 --- a/src/increase/_version.py +++ b/src/increase/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "increase" -__version__ = "0.207.1" # x-release-please-version +__version__ = "0.208.0" # x-release-please-version