|
| 1 | +# File generated from our OpenAPI spec by Stainless. |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +from typing_extensions import Literal |
| 6 | + |
| 7 | +from ..types import ( |
| 8 | + BookkeepingAccount, |
| 9 | + bookkeeping_account_list_params, |
| 10 | + bookkeeping_account_create_params, |
| 11 | +) |
| 12 | +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven |
| 13 | +from .._utils import maybe_transform |
| 14 | +from .._resource import SyncAPIResource, AsyncAPIResource |
| 15 | +from ..pagination import SyncPage, AsyncPage |
| 16 | +from .._base_client import AsyncPaginator, make_request_options |
| 17 | + |
| 18 | +__all__ = ["BookkeepingAccounts", "AsyncBookkeepingAccounts"] |
| 19 | + |
| 20 | + |
| 21 | +class BookkeepingAccounts(SyncAPIResource): |
| 22 | + def create( |
| 23 | + self, |
| 24 | + *, |
| 25 | + name: str, |
| 26 | + account_id: str | NotGiven = NOT_GIVEN, |
| 27 | + compliance_category: Literal["commingled_cash", "customer_balance"] | NotGiven = NOT_GIVEN, |
| 28 | + entity_id: str | NotGiven = NOT_GIVEN, |
| 29 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 30 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 31 | + extra_headers: Headers | None = None, |
| 32 | + extra_query: Query | None = None, |
| 33 | + extra_body: Body | None = None, |
| 34 | + timeout: float | None | NotGiven = NOT_GIVEN, |
| 35 | + idempotency_key: str | None = None, |
| 36 | + ) -> BookkeepingAccount: |
| 37 | + """ |
| 38 | + Create a Bookkeeping Account |
| 39 | +
|
| 40 | + Args: |
| 41 | + name: The name you choose for the account. |
| 42 | +
|
| 43 | + account_id: The entity, if `compliance_category` is `commingled_cash`. |
| 44 | +
|
| 45 | + compliance_category: The account compliance category. |
| 46 | +
|
| 47 | + entity_id: The entity, if `compliance_category` is `customer_balance`. |
| 48 | +
|
| 49 | + extra_headers: Send extra headers |
| 50 | +
|
| 51 | + extra_query: Add additional query parameters to the request |
| 52 | +
|
| 53 | + extra_body: Add additional JSON properties to the request |
| 54 | +
|
| 55 | + timeout: Override the client-level default timeout for this request, in seconds |
| 56 | +
|
| 57 | + idempotency_key: Specify a custom idempotency key for this request |
| 58 | + """ |
| 59 | + return self._post( |
| 60 | + "/bookkeeping_accounts", |
| 61 | + body=maybe_transform( |
| 62 | + { |
| 63 | + "compliance_category": compliance_category, |
| 64 | + "entity_id": entity_id, |
| 65 | + "account_id": account_id, |
| 66 | + "name": name, |
| 67 | + }, |
| 68 | + bookkeeping_account_create_params.BookkeepingAccountCreateParams, |
| 69 | + ), |
| 70 | + options=make_request_options( |
| 71 | + extra_headers=extra_headers, |
| 72 | + extra_query=extra_query, |
| 73 | + extra_body=extra_body, |
| 74 | + timeout=timeout, |
| 75 | + idempotency_key=idempotency_key, |
| 76 | + ), |
| 77 | + cast_to=BookkeepingAccount, |
| 78 | + ) |
| 79 | + |
| 80 | + def list( |
| 81 | + self, |
| 82 | + *, |
| 83 | + cursor: str | NotGiven = NOT_GIVEN, |
| 84 | + limit: int | NotGiven = NOT_GIVEN, |
| 85 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 86 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 87 | + extra_headers: Headers | None = None, |
| 88 | + extra_query: Query | None = None, |
| 89 | + extra_body: Body | None = None, |
| 90 | + timeout: float | None | NotGiven = NOT_GIVEN, |
| 91 | + ) -> SyncPage[BookkeepingAccount]: |
| 92 | + """ |
| 93 | + List Bookkeeping Accounts |
| 94 | +
|
| 95 | + Args: |
| 96 | + cursor: Return the page of entries after this one. |
| 97 | +
|
| 98 | + limit: Limit the size of the list that is returned. The default (and maximum) is 100 |
| 99 | + objects. |
| 100 | +
|
| 101 | + extra_headers: Send extra headers |
| 102 | +
|
| 103 | + extra_query: Add additional query parameters to the request |
| 104 | +
|
| 105 | + extra_body: Add additional JSON properties to the request |
| 106 | +
|
| 107 | + timeout: Override the client-level default timeout for this request, in seconds |
| 108 | + """ |
| 109 | + return self._get_api_list( |
| 110 | + "/bookkeeping_accounts", |
| 111 | + page=SyncPage[BookkeepingAccount], |
| 112 | + options=make_request_options( |
| 113 | + extra_headers=extra_headers, |
| 114 | + extra_query=extra_query, |
| 115 | + extra_body=extra_body, |
| 116 | + timeout=timeout, |
| 117 | + query=maybe_transform( |
| 118 | + { |
| 119 | + "cursor": cursor, |
| 120 | + "limit": limit, |
| 121 | + }, |
| 122 | + bookkeeping_account_list_params.BookkeepingAccountListParams, |
| 123 | + ), |
| 124 | + ), |
| 125 | + model=BookkeepingAccount, |
| 126 | + ) |
| 127 | + |
| 128 | + |
| 129 | +class AsyncBookkeepingAccounts(AsyncAPIResource): |
| 130 | + async def create( |
| 131 | + self, |
| 132 | + *, |
| 133 | + name: str, |
| 134 | + account_id: str | NotGiven = NOT_GIVEN, |
| 135 | + compliance_category: Literal["commingled_cash", "customer_balance"] | NotGiven = NOT_GIVEN, |
| 136 | + entity_id: str | NotGiven = NOT_GIVEN, |
| 137 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 138 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 139 | + extra_headers: Headers | None = None, |
| 140 | + extra_query: Query | None = None, |
| 141 | + extra_body: Body | None = None, |
| 142 | + timeout: float | None | NotGiven = NOT_GIVEN, |
| 143 | + idempotency_key: str | None = None, |
| 144 | + ) -> BookkeepingAccount: |
| 145 | + """ |
| 146 | + Create a Bookkeeping Account |
| 147 | +
|
| 148 | + Args: |
| 149 | + name: The name you choose for the account. |
| 150 | +
|
| 151 | + account_id: The entity, if `compliance_category` is `commingled_cash`. |
| 152 | +
|
| 153 | + compliance_category: The account compliance category. |
| 154 | +
|
| 155 | + entity_id: The entity, if `compliance_category` is `customer_balance`. |
| 156 | +
|
| 157 | + extra_headers: Send extra headers |
| 158 | +
|
| 159 | + extra_query: Add additional query parameters to the request |
| 160 | +
|
| 161 | + extra_body: Add additional JSON properties to the request |
| 162 | +
|
| 163 | + timeout: Override the client-level default timeout for this request, in seconds |
| 164 | +
|
| 165 | + idempotency_key: Specify a custom idempotency key for this request |
| 166 | + """ |
| 167 | + return await self._post( |
| 168 | + "/bookkeeping_accounts", |
| 169 | + body=maybe_transform( |
| 170 | + { |
| 171 | + "compliance_category": compliance_category, |
| 172 | + "entity_id": entity_id, |
| 173 | + "account_id": account_id, |
| 174 | + "name": name, |
| 175 | + }, |
| 176 | + bookkeeping_account_create_params.BookkeepingAccountCreateParams, |
| 177 | + ), |
| 178 | + options=make_request_options( |
| 179 | + extra_headers=extra_headers, |
| 180 | + extra_query=extra_query, |
| 181 | + extra_body=extra_body, |
| 182 | + timeout=timeout, |
| 183 | + idempotency_key=idempotency_key, |
| 184 | + ), |
| 185 | + cast_to=BookkeepingAccount, |
| 186 | + ) |
| 187 | + |
| 188 | + def list( |
| 189 | + self, |
| 190 | + *, |
| 191 | + cursor: str | NotGiven = NOT_GIVEN, |
| 192 | + limit: int | NotGiven = NOT_GIVEN, |
| 193 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 194 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 195 | + extra_headers: Headers | None = None, |
| 196 | + extra_query: Query | None = None, |
| 197 | + extra_body: Body | None = None, |
| 198 | + timeout: float | None | NotGiven = NOT_GIVEN, |
| 199 | + ) -> AsyncPaginator[BookkeepingAccount, AsyncPage[BookkeepingAccount]]: |
| 200 | + """ |
| 201 | + List Bookkeeping Accounts |
| 202 | +
|
| 203 | + Args: |
| 204 | + cursor: Return the page of entries after this one. |
| 205 | +
|
| 206 | + limit: Limit the size of the list that is returned. The default (and maximum) is 100 |
| 207 | + objects. |
| 208 | +
|
| 209 | + extra_headers: Send extra headers |
| 210 | +
|
| 211 | + extra_query: Add additional query parameters to the request |
| 212 | +
|
| 213 | + extra_body: Add additional JSON properties to the request |
| 214 | +
|
| 215 | + timeout: Override the client-level default timeout for this request, in seconds |
| 216 | + """ |
| 217 | + return self._get_api_list( |
| 218 | + "/bookkeeping_accounts", |
| 219 | + page=AsyncPage[BookkeepingAccount], |
| 220 | + options=make_request_options( |
| 221 | + extra_headers=extra_headers, |
| 222 | + extra_query=extra_query, |
| 223 | + extra_body=extra_body, |
| 224 | + timeout=timeout, |
| 225 | + query=maybe_transform( |
| 226 | + { |
| 227 | + "cursor": cursor, |
| 228 | + "limit": limit, |
| 229 | + }, |
| 230 | + bookkeeping_account_list_params.BookkeepingAccountListParams, |
| 231 | + ), |
| 232 | + ), |
| 233 | + model=BookkeepingAccount, |
| 234 | + ) |
0 commit comments