diff --git a/src/increase/resources/exports.py b/src/increase/resources/exports.py index b985d5472..05aef5db0 100644 --- a/src/increase/resources/exports.py +++ b/src/increase/resources/exports.py @@ -18,7 +18,8 @@ class Exports(SyncAPIResource): def create( self, *, - category: Literal["transaction_csv", "balance_csv"], + category: Literal["account_statement_ofx", "transaction_csv", "balance_csv"], + account_statement_ofx: export_create_params.AccountStatementOfx | NotGiven = NOT_GIVEN, balance_csv: export_create_params.BalanceCsv | NotGiven = NOT_GIVEN, transaction_csv: export_create_params.TransactionCsv | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -35,10 +36,15 @@ def create( Args: category: The type of Export to create. + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. + account_statement_ofx: Options for the created export. Required if `category` is equal to + `account_statement_ofx`. + balance_csv: Options for the created export. Required if `category` is equal to `balance_csv`. @@ -60,6 +66,7 @@ def create( body=maybe_transform( { "category": category, + "account_statement_ofx": account_statement_ofx, "balance_csv": balance_csv, "transaction_csv": transaction_csv, }, @@ -161,7 +168,8 @@ class AsyncExports(AsyncAPIResource): async def create( self, *, - category: Literal["transaction_csv", "balance_csv"], + category: Literal["account_statement_ofx", "transaction_csv", "balance_csv"], + account_statement_ofx: export_create_params.AccountStatementOfx | NotGiven = NOT_GIVEN, balance_csv: export_create_params.BalanceCsv | NotGiven = NOT_GIVEN, transaction_csv: export_create_params.TransactionCsv | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -178,10 +186,15 @@ async def create( Args: category: The type of Export to create. + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. + account_statement_ofx: Options for the created export. Required if `category` is equal to + `account_statement_ofx`. + balance_csv: Options for the created export. Required if `category` is equal to `balance_csv`. @@ -203,6 +216,7 @@ async def create( body=maybe_transform( { "category": category, + "account_statement_ofx": account_statement_ofx, "balance_csv": balance_csv, "transaction_csv": transaction_csv, }, diff --git a/src/increase/types/export.py b/src/increase/types/export.py index d7d25986d..d3b6c232b 100644 --- a/src/increase/types/export.py +++ b/src/increase/types/export.py @@ -13,12 +13,14 @@ class Export(BaseModel): id: str """The Export identifier.""" - category: Literal["transaction_csv", "balance_csv"] + category: Literal["account_statement_ofx", "transaction_csv", "balance_csv"] """The category of the Export. We may add additional possible values for this enum over time; your application should be able to handle that gracefully. + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. diff --git a/src/increase/types/export_create_params.py b/src/increase/types/export_create_params.py index f08ce3170..bac35e8e7 100644 --- a/src/increase/types/export_create_params.py +++ b/src/increase/types/export_create_params.py @@ -8,18 +8,34 @@ from .._utils import PropertyInfo -__all__ = ["ExportCreateParams", "BalanceCsv", "BalanceCsvCreatedAt", "TransactionCsv", "TransactionCsvCreatedAt"] +__all__ = [ + "ExportCreateParams", + "AccountStatementOfx", + "AccountStatementOfxCreatedAt", + "BalanceCsv", + "BalanceCsvCreatedAt", + "TransactionCsv", + "TransactionCsvCreatedAt", +] class ExportCreateParams(TypedDict, total=False): - category: Required[Literal["transaction_csv", "balance_csv"]] + category: Required[Literal["account_statement_ofx", "transaction_csv", "balance_csv"]] """The type of Export to create. + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. """ + account_statement_ofx: AccountStatementOfx + """Options for the created export. + + Required if `category` is equal to `account_statement_ofx`. + """ + balance_csv: BalanceCsv """Options for the created export. @@ -33,6 +49,40 @@ class ExportCreateParams(TypedDict, total=False): """ +class AccountStatementOfxCreatedAt(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. + """ + + +class AccountStatementOfx(TypedDict, total=False): + account_id: Required[str] + """The Account to create a statement for.""" + + created_at: AccountStatementOfxCreatedAt + """Filter results by time range on the `created_at` attribute.""" + + class BalanceCsvCreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ diff --git a/tests/api_resources/test_exports.py b/tests/api_resources/test_exports.py index 9d15151e7..08cc4aed1 100644 --- a/tests/api_resources/test_exports.py +++ b/tests/api_resources/test_exports.py @@ -24,14 +24,23 @@ class TestExports: @parametrize def test_method_create(self, client: Increase) -> None: export = client.exports.create( - category="transaction_csv", + category="account_statement_ofx", ) assert_matches_type(Export, export, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Increase) -> None: export = client.exports.create( - category="transaction_csv", + category="account_statement_ofx", + account_statement_ofx={ + "account_id": "string", + "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"), + }, + }, balance_csv={ "account_id": "string", "created_at": { @@ -82,14 +91,23 @@ class TestAsyncExports: @parametrize async def test_method_create(self, client: AsyncIncrease) -> None: export = await client.exports.create( - category="transaction_csv", + category="account_statement_ofx", ) assert_matches_type(Export, export, path=["response"]) @parametrize async def test_method_create_with_all_params(self, client: AsyncIncrease) -> None: export = await client.exports.create( - category="transaction_csv", + category="account_statement_ofx", + account_statement_ofx={ + "account_id": "string", + "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"), + }, + }, balance_csv={ "account_id": "string", "created_at": {