Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.469.10
speakeasyVersion: 1.477.0
sources:
accounting-source:
sourceNamespace: accounting-source
Expand All @@ -16,11 +16,11 @@ sources:
- main
bank-feeds-source:
sourceNamespace: bank-feeds-source
sourceRevisionDigest: sha256:05a608be985dc9deb12eeb3a747ef0ae4cd1690b42852f97e61c7a43881748a7
sourceBlobDigest: sha256:cffec1fdf5b4aa33774403da44fc8cfb24f5f59d507b1e83d73b1b28f8efa50e
sourceRevisionDigest: sha256:406fc65cd0789662c52a4543f8ebde1591a55b4dccd1ce5ca1f79b753fe3b6b8
sourceBlobDigest: sha256:32ef2170d2a23ba969ba364ad8138e99de4de8e5ec43e66a9a2020b489f2ca18
tags:
- latest
- speakeasy-sdk-regen-1737391437
- speakeasy-sdk-regen-1738082181
- 3.0.0
banking-source:
sourceNamespace: banking-source
Expand Down Expand Up @@ -111,10 +111,10 @@ targets:
bank-feeds-library:
source: bank-feeds-source
sourceNamespace: bank-feeds-source
sourceRevisionDigest: sha256:05a608be985dc9deb12eeb3a747ef0ae4cd1690b42852f97e61c7a43881748a7
sourceBlobDigest: sha256:cffec1fdf5b4aa33774403da44fc8cfb24f5f59d507b1e83d73b1b28f8efa50e
sourceRevisionDigest: sha256:406fc65cd0789662c52a4543f8ebde1591a55b4dccd1ce5ca1f79b753fe3b6b8
sourceBlobDigest: sha256:32ef2170d2a23ba969ba364ad8138e99de4de8e5ec43e66a9a2020b489f2ca18
codeSamplesNamespace: bank-feeds-source-python-code-samples
codeSamplesRevisionDigest: sha256:769f019b1d6e0ca253780d1cec262d51ccd8297fa6a53d9bb1e28fd6b2ae11c1
codeSamplesRevisionDigest: sha256:a33dae9c9ff3c3d3205b35071ec9959903db9ca435c218fa7f3bad95fd4abce3
banking-library:
source: banking-source
sourceNamespace: banking-source
Expand Down
46 changes: 22 additions & 24 deletions bank-feeds/.speakeasy/gen.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bank-feeds/.speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
oAuth2PasswordEnabled: false
telemetryEnabled: true
python:
version: 10.2.0
version: 11.0.0
additionalDependencies:
dev: {}
main: {}
Expand Down
36 changes: 36 additions & 0 deletions bank-feeds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ A bank feed is a connection between a source bank account in your application an
* [Server Selection](#server-selection)
* [Custom HTTP Client](#custom-http-client)
* [Authentication](#authentication)
* [Resource Management](#resource-management)
* [Debugging](#debugging)
* [Support](#support)

Expand All @@ -52,6 +53,11 @@ A bank feed is a connection between a source bank account in your application an
<!-- Start SDK Installation [installation] -->
## SDK Installation

> [!NOTE]
> **Python version upgrade policy**
>
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.

The SDK can be installed with either *pip* or *poetry* package managers.

### PIP
Expand Down Expand Up @@ -541,6 +547,36 @@ with CodatBankFeeds(
```
<!-- End Authentication [security] -->

<!-- Start Resource Management [resource-management] -->
## Resource Management

The `CodatBankFeeds` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.

[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers

```python
from codat_bankfeeds import CodatBankFeeds
from codat_bankfeeds.models import shared
def main():
with CodatBankFeeds(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_bank_feeds:
# Rest of application here...


# Or when using async:
async def amain():
async with CodatBankFeeds(
security=shared.Security(
auth_header="Basic BASE_64_ENCODED(API_KEY)",
),
) as codat_bank_feeds:
# Rest of application here...
```
<!-- End Resource Management [resource-management] -->

<!-- Start Debugging [debug] -->
## Debugging

Expand Down
12 changes: 11 additions & 1 deletion bank-feeds/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -868,4 +868,14 @@ Based on:
### Generated
- [python v10.2.0] bank-feeds
### Releases
- [PyPI v10.2.0] https://pypi.org/project/codat-bankfeeds/10.2.0 - bank-feeds
- [PyPI v10.2.0] https://pypi.org/project/codat-bankfeeds/10.2.0 - bank-feeds

## 2025-01-28 16:36:02
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.477.0 (2.497.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [python v11.0.0] bank-feeds
### Releases
- [PyPI v11.0.0] https://pypi.org/project/codat-bankfeeds/11.0.0 - bank-feeds
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

## Supported Types

### `List[shared.SourceAccountV2]`
### `List[shared.SourceAccountV2Prototype]`

```python
value: List[shared.SourceAccountV2] = /* values here */
value: List[shared.SourceAccountV2Prototype] = /* values here */
```

### `List[shared.SourceAccount]`
### `List[shared.SourceAccountPrototype]`

```python
value: List[shared.SourceAccount] = /* values here */
value: List[shared.SourceAccountPrototype] = /* values here */
```

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

## Supported Types

### `operations.CreateBatchSourceAccountResponseBody`
### `List[operations.ResponseBody]`

```python
value: operations.CreateBatchSourceAccountResponseBody = /* values here */
value: List[operations.ResponseBody] = /* values here */
```

### `operations.CreateBatchSourceAccountSourceAccountsResponseBody`
### `List[operations.CreateBatchSourceAccountResponseBody]`

```python
value: operations.CreateBatchSourceAccountSourceAccountsResponseBody = /* values here */
value: List[operations.CreateBatchSourceAccountResponseBody] = /* values here */
```

Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# CreateBatchSourceAccountResponseBody

Success


## Supported Types

### `List[operations.One]`
### `shared.SourceAccountV2BatchCreateResponse`

```python
value: shared.SourceAccountV2BatchCreateResponse = /* values here */
```

### `shared.SourceAccountBatchCreateResponse`

```python
value: shared.SourceAccountBatchCreateResponse = /* values here */
```

### `shared.SourceAccountBatchErrorResponse`

```python
value: List[operations.One] = /* values here */
value: shared.SourceAccountBatchErrorResponse = /* values here */
```

17 changes: 17 additions & 0 deletions bank-feeds/docs/models/operations/responsebody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ResponseBody


## Supported Types

### `shared.SourceAccountV2BatchCreateResponse`

```python
value: shared.SourceAccountV2BatchCreateResponse = /* values here */
```

### `shared.SourceAccountBatchCreateResponse`

```python
value: shared.SourceAccountBatchCreateResponse = /* values here */
```

2 changes: 1 addition & 1 deletion bank-feeds/docs/models/shared/sourceaccountprototype.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions bank-feeds/docs/models/shared/sourceaccountv2prototype.md

Large diffs are not rendered by default.

41 changes: 17 additions & 24 deletions bank-feeds/docs/sdks/sourceaccounts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The _Create Source Account_ endpoint allows you to create a representation of a
```python
from codat_bankfeeds import CodatBankFeeds
from codat_bankfeeds.models import shared
from decimal import Decimal

with CodatBankFeeds(
security=shared.Security(
Expand All @@ -38,10 +39,15 @@ with CodatBankFeeds(
"company_id": "8a210b68-6988-11ed-a1eb-0242ac120002",
"connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171",
"request_body": {
"account_name": "<value>",
"account_number": "<value>",
"account_type": shared.AccountType.CREDIT_CARD,
"balance": Decimal("4174.58"),
"currency": "GBP",
"id": "<id>",
"account_info": {
"account_open_date": "2022-10-23",
},
"currency": "USD",
"modified_date": "2022-10-23T00:00:00Z",
},
})
Expand Down Expand Up @@ -84,7 +90,6 @@ The _Batch create source accounts_ endpoint allows you to create multiple repres
```python
from codat_bankfeeds import CodatBankFeeds
from codat_bankfeeds.models import shared
from decimal import Decimal

with CodatBankFeeds(
security=shared.Security(
Expand All @@ -97,26 +102,14 @@ with CodatBankFeeds(
"connection_id": "2e9d2c44-f675-40ba-8049-353bfcb5e171",
"request_body": [
{
"id": "acc-002",
"account_name": "account-081",
"account_number": "12345670",
"account_type": "Credit",
"balance": Decimal("99.99"),
"currency": "GBP",
"modified_date": "2023-01-09T14:14:14.1057478Z",
"sort_code": "123456",
"status": shared.Status.PENDING,
"id": "<id>",
"currency": "EUR",
"modified_date": "2022-10-23T00:00:00Z",
},
{
"id": "acc-003",
"account_name": "account-095",
"account_number": "12345671",
"account_type": "Credit",
"balance": Decimal("0"),
"id": "<id>",
"currency": "USD",
"modified_date": "2023-01-09T14:14:14.1057478Z",
"sort_code": "123456",
"status": shared.Status.PENDING,
"modified_date": "2022-10-23T00:00:00Z",
},
],
})
Expand All @@ -141,11 +134,11 @@ with CodatBankFeeds(

### Errors

| Error Type | Status Code | Content Type |
| --------------------------------- | --------------------------------- | --------------------------------- |
| errors.ErrorMessage | 400, 401, 402, 403, 404, 409, 429 | application/json |
| errors.ErrorMessage | 500, 503 | application/json |
| errors.SDKError | 4XX, 5XX | \*/\* |
| Error Type | Status Code | Content Type |
| ---------------------------- | ---------------------------- | ---------------------------- |
| errors.ErrorMessage | 400, 401, 402, 403, 404, 429 | application/json |
| errors.ErrorMessage | 500, 503 | application/json |
| errors.SDKError | 4XX, 5XX | \*/\* |

## delete

Expand Down
2 changes: 1 addition & 1 deletion bank-feeds/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions bank-feeds/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[project]
name = "codat-bankfeeds"
version = "10.2.0"
version = "11.0.0"
description = "Set up bank feeds from accounts in your application to supported accounting software."
authors = [{ name = "Speakeasy" },]
readme = "README-PYPI.md"
requires-python = ">=3.9"
dependencies = [
"eval-type-backport (>=0.2.0,<0.3.0)",
"httpx (>=0.28.1,<0.29.0)",
"jsonpath-python (>=1.0.6,<2.0.0)",
"pydantic (>=2.10.3,<2.11.0)",
"python-dateutil (>=2.8.2,<3.0.0)",
"typing-inspect (>=0.9.0,<0.10.0)",
"eval-type-backport >=0.2.0",
"httpx >=0.28.1",
"jsonpath-python >=1.0.6",
"pydantic >=2.10.3",
"python-dateutil >=2.8.2",
"typing-inspect >=0.9.0",
]

[tool.poetry]
Expand Down
6 changes: 3 additions & 3 deletions bank-feeds/src/codat_bankfeeds/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import importlib.metadata

__title__: str = "codat-bankfeeds"
__version__: str = "10.2.0"
__version__: str = "11.0.0"
__openapi_doc_version__: str = "3.0.0"
__gen_version__: str = "2.493.31"
__user_agent__: str = "speakeasy-sdk/python 10.2.0 2.493.31 3.0.0 codat-bankfeeds"
__gen_version__: str = "2.497.0"
__user_agent__: str = "speakeasy-sdk/python 11.0.0 2.497.0 3.0.0 codat-bankfeeds"

try:
if __package__ is not None:
Expand Down
50 changes: 50 additions & 0 deletions bank-feeds/src/codat_bankfeeds/httpclient.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

# pyright: reportReturnType = false
import asyncio
from concurrent.futures import ThreadPoolExecutor
from typing_extensions import Protocol, runtime_checkable
import httpx
from typing import Any, Optional, Union
Expand Down Expand Up @@ -82,3 +84,51 @@ def build_request(

async def aclose(self) -> None:
pass


class ClientOwner(Protocol):
client: Union[HttpClient, None]
async_client: Union[AsyncHttpClient, None]


def close_clients(
owner: ClientOwner,
sync_client: Union[HttpClient, None],
async_client: Union[AsyncHttpClient, None],
) -> None:
"""
A finalizer function that is meant to be used with weakref.finalize to close
httpx clients used by an SDK so that underlying resources can be garbage
collected.
"""

# Unset the client/async_client properties so there are no more references
# to them from the owning SDK instance and they can be reaped.
owner.client = None
owner.async_client = None

if sync_client is not None:
try:
sync_client.close()
except Exception:
pass

if async_client is not None:
is_async = False
try:
asyncio.get_running_loop()
is_async = True
except RuntimeError:
pass

try:
# If this function is called in an async loop then start another
# loop in a separate thread to close the async http client.
if is_async:
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(asyncio.run, async_client.aclose())
future.result()
else:
asyncio.run(async_client.aclose())
except Exception:
pass
Loading