From b19f25850980fbcacbea7820ad9680335ccad20b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 01:15:58 +0000 Subject: [PATCH] feat(api): api update (#94) --- .stats.yml | 4 +- api.md | 14 + src/conductor/resources/qbd/__init__.py | 14 + .../resources/qbd/credit_card_credits.py | 700 ++++++++++ src/conductor/resources/qbd/invoices.py | 6 +- src/conductor/resources/qbd/qbd.py | 32 + src/conductor/types/qbd/__init__.py | 3 + src/conductor/types/qbd/credit_card_credit.py | 1194 +++++++++++++++++ .../qbd/credit_card_credit_create_params.py | 208 +++ .../qbd/credit_card_credit_list_params.py | 141 ++ .../types/qbd/invoice_create_params.py | 3 +- src/conductor/types/qbd/qbd_invoice.py | 3 +- .../qbd/test_credit_card_credits.py | 880 ++++++++++++ 13 files changed, 3192 insertions(+), 10 deletions(-) create mode 100644 src/conductor/resources/qbd/credit_card_credits.py create mode 100644 src/conductor/types/qbd/credit_card_credit.py create mode 100644 src/conductor/types/qbd/credit_card_credit_create_params.py create mode 100644 src/conductor/types/qbd/credit_card_credit_list_params.py create mode 100644 tests/api_resources/qbd/test_credit_card_credits.py diff --git a/.stats.yml b/.stats.yml index a19a344e..b428b633 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 50 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-d4fb92aaf77acf523483ecc97b1443118b5be5f095d1d91a8cc6028197048283.yml +configured_endpoints: 53 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-cf989f0c24e47b06658f8eb4f0c7c3f7c7d20a17d5f85ac5679f76e8c3ecad9c.yml diff --git a/api.md b/api.md index d7cf8b3a..28659145 100644 --- a/api.md +++ b/api.md @@ -241,3 +241,17 @@ Methods: - client.qbd.vendors.create(\*\*params) -> QbdVendor - client.qbd.vendors.retrieve(id) -> QbdVendor - client.qbd.vendors.list(\*\*params) -> SyncCursorPage[QbdVendor] + +## CreditCardCredits + +Types: + +```python +from conductor.types.qbd import CreditCardCredit +``` + +Methods: + +- client.qbd.credit_card_credits.create(\*\*params) -> CreditCardCredit +- client.qbd.credit_card_credits.retrieve(id) -> CreditCardCredit +- client.qbd.credit_card_credits.list(\*\*params) -> SyncCursorPage[CreditCardCredit] diff --git a/src/conductor/resources/qbd/__init__.py b/src/conductor/resources/qbd/__init__.py index 4dffac89..8ac4a2fb 100644 --- a/src/conductor/resources/qbd/__init__.py +++ b/src/conductor/resources/qbd/__init__.py @@ -112,6 +112,14 @@ CreditCardChargesResourceWithStreamingResponse, AsyncCreditCardChargesResourceWithStreamingResponse, ) +from .credit_card_credits import ( + CreditCardCreditsResource, + AsyncCreditCardCreditsResource, + CreditCardCreditsResourceWithRawResponse, + AsyncCreditCardCreditsResourceWithRawResponse, + CreditCardCreditsResourceWithStreamingResponse, + AsyncCreditCardCreditsResourceWithStreamingResponse, +) from .non_inventory_items import ( NonInventoryItemsResource, AsyncNonInventoryItemsResource, @@ -206,6 +214,12 @@ "AsyncVendorsResourceWithRawResponse", "VendorsResourceWithStreamingResponse", "AsyncVendorsResourceWithStreamingResponse", + "CreditCardCreditsResource", + "AsyncCreditCardCreditsResource", + "CreditCardCreditsResourceWithRawResponse", + "AsyncCreditCardCreditsResourceWithRawResponse", + "CreditCardCreditsResourceWithStreamingResponse", + "AsyncCreditCardCreditsResourceWithStreamingResponse", "QbdResource", "AsyncQbdResource", "QbdResourceWithRawResponse", diff --git a/src/conductor/resources/qbd/credit_card_credits.py b/src/conductor/resources/qbd/credit_card_credits.py new file mode 100644 index 00000000..3bb706f7 --- /dev/null +++ b/src/conductor/resources/qbd/credit_card_credits.py @@ -0,0 +1,700 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date + +import httpx + +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 ...types.qbd import credit_card_credit_list_params, credit_card_credit_create_params +from ...pagination import SyncCursorPage, AsyncCursorPage +from ..._base_client import AsyncPaginator, make_request_options +from ...types.qbd.credit_card_credit import CreditCardCredit + +__all__ = ["CreditCardCreditsResource", "AsyncCreditCardCreditsResource"] + + +class CreditCardCreditsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CreditCardCreditsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/conductor-is/conductor-python#accessing-raw-response-data-eg-headers + """ + return CreditCardCreditsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CreditCardCreditsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/conductor-is/conductor-python#with_streaming_response + """ + return CreditCardCreditsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + transaction_date: Union[str, date], + conductor_end_user_id: str, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[credit_card_credit_create_params.ExpenseLine] | NotGiven = NOT_GIVEN, + external_id: str | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[credit_card_credit_create_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[credit_card_credit_create_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + payee_id: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_id: str | 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, + ) -> CreditCardCredit: + """ + Creates a credit card credit for the specified account. + + Args: + account_id: The bank account or credit card account to which the credit is applied. + + transaction_date: The date of this credit card credit, in ISO 8601 format (YYYY-MM-DD). + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + exchange_rate: The market exchange rate between this credit card credit's currency and the home + currency in QuickBooks at the time of this transaction. Represented as a decimal + value (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + + expense_lines: The credit card credit's expense lines, each representing one line in this + expense. + + external_id: A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + + item_group_lines: The credit card credit's item-group lines, each representing a predefined group + of items purchased together. + + item_lines: The credit card credit's item lines, each representing the purchase of a + specific item or service. + + memo: A memo or note for this credit card credit, as entered by the user. + + payee_id: The vendor or company from whom this credit card credit was received for + purchased merchandise or services. + + ref_number: The case-sensitive user-defined reference number for this credit card credit, + which can be used to identify the transaction in QuickBooks. This value is not + required to be unique and can be arbitrarily changed by the QuickBooks user. + + sales_tax_code_id: The sales-tax code associated with this credit card credit, determining whether + it is taxable or non-taxable. It's used to assign a default tax status to all + transactions for this credit card credit. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + + 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 + """ + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._post( + "/quickbooks-desktop/credit-card-credits", + body=maybe_transform( + { + "account_id": account_id, + "transaction_date": transaction_date, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "external_id": external_id, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "payee_id": payee_id, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + }, + credit_card_credit_create_params.CreditCardCreditCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreditCardCredit, + ) + + def retrieve( + self, + id: str, + *, + conductor_end_user_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, + ) -> CreditCardCredit: + """ + Retrieves a credit card credit by ID. + + Args: + id: The QuickBooks-assigned unique identifier of the credit card credit to retrieve. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._get( + f"/quickbooks-desktop/credit-card-credits/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreditCardCredit, + ) + + def list( + self, + *, + conductor_end_user_id: str, + account_ids: str | NotGiven = NOT_GIVEN, + currency_ids: str | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + ids: str | NotGiven = NOT_GIVEN, + include_line_items: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + payee_ids: str | NotGiven = NOT_GIVEN, + ref_number_contains: str | NotGiven = NOT_GIVEN, + ref_number_ends_with: str | NotGiven = NOT_GIVEN, + ref_number_from: str | NotGiven = NOT_GIVEN, + ref_numbers: str | NotGiven = NOT_GIVEN, + ref_number_starts_with: str | NotGiven = NOT_GIVEN, + ref_number_to: str | NotGiven = NOT_GIVEN, + transaction_date_from: Union[str, date] | NotGiven = NOT_GIVEN, + transaction_date_to: Union[str, date] | NotGiven = NOT_GIVEN, + updated_after: str | NotGiven = NOT_GIVEN, + updated_before: str | 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, + ) -> SyncCursorPage[CreditCardCredit]: + """ + Returns a list of credit card credits. + + Args: + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + account_ids: Filter for credit card credits from this account or accounts. Specify a single + account ID or multiple using a comma-separated list (e.g., `accountIds=1,2,3`). + + currency_ids: Filter for credit card credits in this currency or currencies. Specify a single + currency ID or multiple using a comma-separated list (e.g., + `currencyIds=1,2,3`). + + cursor: The pagination token to fetch the next set of results when paginating with the + `limit` parameter. Retrieve this value from the `nextCursor` field in the + previous response. If omitted, the API returns the first page of results. + + ids: Filter for specific credit card credits by their QuickBooks-assigned unique + identifier(s). Specify a single ID or multiple using a comma-separated list + (e.g., `ids=1,2,3`). NOTE: If you include this parameter, all other query + parameters will be ignored. + + include_line_items: Whether to include line items in the response. + + limit: The maximum number of objects to return, ranging from 1 to 500. Defaults to 500. + Use this parameter in conjunction with the `cursor` parameter to paginate + through results. The response will include a `nextCursor` field, which can be + used as the `cursor` parameter value in subsequent requests to fetch the next + set of results. + + payee_ids: Filter for credit card credits from this payee or payees. Specify a single payee + ID or multiple using a comma-separated list (e.g., `payeeIds=1,2,3`). These are + the vendors or companies from whom the credits were received. + + ref_number_contains: Filter for transactions whose `refNumber` contains this substring. If you use + this parameter, you cannot use `refNumberStartsWith` or `refNumberEndsWith`. + + ref_number_ends_with: Filter for transactions whose `refNumber` ends with this substring. If you use + this parameter, you cannot use `refNumberContains` or `refNumberStartsWith`. + + ref_number_from: Filter for transactions whose `refNumber` is greater than or equal to this + value. If omitted, the range will begin with the first number of the list. Uses + a numerical comparison for values that contain only digits; otherwise, uses a + lexicographical comparison. + + ref_numbers: Filter for specific credit card credits by their ref-number(s), case-sensitive. + Specify a single ref-number or multiple using a comma-separated list (e.g., + `refNumbers=1,2,3`). In QuickBooks, ref-numbers are not required to be unique + and can be arbitrarily changed by the QuickBooks user. NOTE: If you include this + parameter, all other query parameters will be ignored. + + ref_number_starts_with: Filter for transactions whose `refNumber` starts with this substring. If you use + this parameter, you cannot use `refNumberContains` or `refNumberEndsWith`. + + ref_number_to: Filter for transactions whose `refNumber` is less than or equal to this value. + If omitted, the range will end with the last number of the list. Uses a + numerical comparison for values that contain only digits; otherwise, uses a + lexicographical comparison. + + transaction_date_from: Filter for transactions created on or after this date, in ISO 8601 format + (YYYY-MM-DD). + + transaction_date_to: Filter for transactions created on or before this date, in ISO 8601 format + (YYYY-MM-DD). + + updated_after: Filter for objects updated on or after this date and time, in ISO 8601 format + (YYYY-MM-DDTHH:mm:ss). If you only provide a date (YYYY-MM-DD), the time is + assumed to be 00:00:00 of that day. + + updated_before: Filter for objects updated on or before this date and time, in ISO 8601 format + (YYYY-MM-DDTHH:mm:ss). If you only provide a date (YYYY-MM-DD), the time is + assumed to be 23:59:59 of that day. + + 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 + """ + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._get_api_list( + "/quickbooks-desktop/credit-card-credits", + page=SyncCursorPage[CreditCardCredit], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_ids": account_ids, + "currency_ids": currency_ids, + "cursor": cursor, + "ids": ids, + "include_line_items": include_line_items, + "limit": limit, + "payee_ids": payee_ids, + "ref_number_contains": ref_number_contains, + "ref_number_ends_with": ref_number_ends_with, + "ref_number_from": ref_number_from, + "ref_numbers": ref_numbers, + "ref_number_starts_with": ref_number_starts_with, + "ref_number_to": ref_number_to, + "transaction_date_from": transaction_date_from, + "transaction_date_to": transaction_date_to, + "updated_after": updated_after, + "updated_before": updated_before, + }, + credit_card_credit_list_params.CreditCardCreditListParams, + ), + ), + model=CreditCardCredit, + ) + + +class AsyncCreditCardCreditsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCreditCardCreditsResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return the + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/conductor-is/conductor-python#accessing-raw-response-data-eg-headers + """ + return AsyncCreditCardCreditsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCreditCardCreditsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/conductor-is/conductor-python#with_streaming_response + """ + return AsyncCreditCardCreditsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + transaction_date: Union[str, date], + conductor_end_user_id: str, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[credit_card_credit_create_params.ExpenseLine] | NotGiven = NOT_GIVEN, + external_id: str | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[credit_card_credit_create_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[credit_card_credit_create_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + payee_id: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_id: str | 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, + ) -> CreditCardCredit: + """ + Creates a credit card credit for the specified account. + + Args: + account_id: The bank account or credit card account to which the credit is applied. + + transaction_date: The date of this credit card credit, in ISO 8601 format (YYYY-MM-DD). + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + exchange_rate: The market exchange rate between this credit card credit's currency and the home + currency in QuickBooks at the time of this transaction. Represented as a decimal + value (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + + expense_lines: The credit card credit's expense lines, each representing one line in this + expense. + + external_id: A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + + item_group_lines: The credit card credit's item-group lines, each representing a predefined group + of items purchased together. + + item_lines: The credit card credit's item lines, each representing the purchase of a + specific item or service. + + memo: A memo or note for this credit card credit, as entered by the user. + + payee_id: The vendor or company from whom this credit card credit was received for + purchased merchandise or services. + + ref_number: The case-sensitive user-defined reference number for this credit card credit, + which can be used to identify the transaction in QuickBooks. This value is not + required to be unique and can be arbitrarily changed by the QuickBooks user. + + sales_tax_code_id: The sales-tax code associated with this credit card credit, determining whether + it is taxable or non-taxable. It's used to assign a default tax status to all + transactions for this credit card credit. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + + 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 + """ + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return await self._post( + "/quickbooks-desktop/credit-card-credits", + body=await async_maybe_transform( + { + "account_id": account_id, + "transaction_date": transaction_date, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "external_id": external_id, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "payee_id": payee_id, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + }, + credit_card_credit_create_params.CreditCardCreditCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreditCardCredit, + ) + + async def retrieve( + self, + id: str, + *, + conductor_end_user_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, + ) -> CreditCardCredit: + """ + Retrieves a credit card credit by ID. + + Args: + id: The QuickBooks-assigned unique identifier of the credit card credit to retrieve. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + 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 id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return await self._get( + f"/quickbooks-desktop/credit-card-credits/{id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CreditCardCredit, + ) + + def list( + self, + *, + conductor_end_user_id: str, + account_ids: str | NotGiven = NOT_GIVEN, + currency_ids: str | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + ids: str | NotGiven = NOT_GIVEN, + include_line_items: bool | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + payee_ids: str | NotGiven = NOT_GIVEN, + ref_number_contains: str | NotGiven = NOT_GIVEN, + ref_number_ends_with: str | NotGiven = NOT_GIVEN, + ref_number_from: str | NotGiven = NOT_GIVEN, + ref_numbers: str | NotGiven = NOT_GIVEN, + ref_number_starts_with: str | NotGiven = NOT_GIVEN, + ref_number_to: str | NotGiven = NOT_GIVEN, + transaction_date_from: Union[str, date] | NotGiven = NOT_GIVEN, + transaction_date_to: Union[str, date] | NotGiven = NOT_GIVEN, + updated_after: str | NotGiven = NOT_GIVEN, + updated_before: str | 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[CreditCardCredit, AsyncCursorPage[CreditCardCredit]]: + """ + Returns a list of credit card credits. + + Args: + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + account_ids: Filter for credit card credits from this account or accounts. Specify a single + account ID or multiple using a comma-separated list (e.g., `accountIds=1,2,3`). + + currency_ids: Filter for credit card credits in this currency or currencies. Specify a single + currency ID or multiple using a comma-separated list (e.g., + `currencyIds=1,2,3`). + + cursor: The pagination token to fetch the next set of results when paginating with the + `limit` parameter. Retrieve this value from the `nextCursor` field in the + previous response. If omitted, the API returns the first page of results. + + ids: Filter for specific credit card credits by their QuickBooks-assigned unique + identifier(s). Specify a single ID or multiple using a comma-separated list + (e.g., `ids=1,2,3`). NOTE: If you include this parameter, all other query + parameters will be ignored. + + include_line_items: Whether to include line items in the response. + + limit: The maximum number of objects to return, ranging from 1 to 500. Defaults to 500. + Use this parameter in conjunction with the `cursor` parameter to paginate + through results. The response will include a `nextCursor` field, which can be + used as the `cursor` parameter value in subsequent requests to fetch the next + set of results. + + payee_ids: Filter for credit card credits from this payee or payees. Specify a single payee + ID or multiple using a comma-separated list (e.g., `payeeIds=1,2,3`). These are + the vendors or companies from whom the credits were received. + + ref_number_contains: Filter for transactions whose `refNumber` contains this substring. If you use + this parameter, you cannot use `refNumberStartsWith` or `refNumberEndsWith`. + + ref_number_ends_with: Filter for transactions whose `refNumber` ends with this substring. If you use + this parameter, you cannot use `refNumberContains` or `refNumberStartsWith`. + + ref_number_from: Filter for transactions whose `refNumber` is greater than or equal to this + value. If omitted, the range will begin with the first number of the list. Uses + a numerical comparison for values that contain only digits; otherwise, uses a + lexicographical comparison. + + ref_numbers: Filter for specific credit card credits by their ref-number(s), case-sensitive. + Specify a single ref-number or multiple using a comma-separated list (e.g., + `refNumbers=1,2,3`). In QuickBooks, ref-numbers are not required to be unique + and can be arbitrarily changed by the QuickBooks user. NOTE: If you include this + parameter, all other query parameters will be ignored. + + ref_number_starts_with: Filter for transactions whose `refNumber` starts with this substring. If you use + this parameter, you cannot use `refNumberContains` or `refNumberEndsWith`. + + ref_number_to: Filter for transactions whose `refNumber` is less than or equal to this value. + If omitted, the range will end with the last number of the list. Uses a + numerical comparison for values that contain only digits; otherwise, uses a + lexicographical comparison. + + transaction_date_from: Filter for transactions created on or after this date, in ISO 8601 format + (YYYY-MM-DD). + + transaction_date_to: Filter for transactions created on or before this date, in ISO 8601 format + (YYYY-MM-DD). + + updated_after: Filter for objects updated on or after this date and time, in ISO 8601 format + (YYYY-MM-DDTHH:mm:ss). If you only provide a date (YYYY-MM-DD), the time is + assumed to be 00:00:00 of that day. + + updated_before: Filter for objects updated on or before this date and time, in ISO 8601 format + (YYYY-MM-DDTHH:mm:ss). If you only provide a date (YYYY-MM-DD), the time is + assumed to be 23:59:59 of that day. + + 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 + """ + extra_headers = {"Conductor-End-User-Id": conductor_end_user_id, **(extra_headers or {})} + return self._get_api_list( + "/quickbooks-desktop/credit-card-credits", + page=AsyncCursorPage[CreditCardCredit], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_ids": account_ids, + "currency_ids": currency_ids, + "cursor": cursor, + "ids": ids, + "include_line_items": include_line_items, + "limit": limit, + "payee_ids": payee_ids, + "ref_number_contains": ref_number_contains, + "ref_number_ends_with": ref_number_ends_with, + "ref_number_from": ref_number_from, + "ref_numbers": ref_numbers, + "ref_number_starts_with": ref_number_starts_with, + "ref_number_to": ref_number_to, + "transaction_date_from": transaction_date_from, + "transaction_date_to": transaction_date_to, + "updated_after": updated_after, + "updated_before": updated_before, + }, + credit_card_credit_list_params.CreditCardCreditListParams, + ), + ), + model=CreditCardCredit, + ) + + +class CreditCardCreditsResourceWithRawResponse: + def __init__(self, credit_card_credits: CreditCardCreditsResource) -> None: + self._credit_card_credits = credit_card_credits + + self.create = to_raw_response_wrapper( + credit_card_credits.create, + ) + self.retrieve = to_raw_response_wrapper( + credit_card_credits.retrieve, + ) + self.list = to_raw_response_wrapper( + credit_card_credits.list, + ) + + +class AsyncCreditCardCreditsResourceWithRawResponse: + def __init__(self, credit_card_credits: AsyncCreditCardCreditsResource) -> None: + self._credit_card_credits = credit_card_credits + + self.create = async_to_raw_response_wrapper( + credit_card_credits.create, + ) + self.retrieve = async_to_raw_response_wrapper( + credit_card_credits.retrieve, + ) + self.list = async_to_raw_response_wrapper( + credit_card_credits.list, + ) + + +class CreditCardCreditsResourceWithStreamingResponse: + def __init__(self, credit_card_credits: CreditCardCreditsResource) -> None: + self._credit_card_credits = credit_card_credits + + self.create = to_streamed_response_wrapper( + credit_card_credits.create, + ) + self.retrieve = to_streamed_response_wrapper( + credit_card_credits.retrieve, + ) + self.list = to_streamed_response_wrapper( + credit_card_credits.list, + ) + + +class AsyncCreditCardCreditsResourceWithStreamingResponse: + def __init__(self, credit_card_credits: AsyncCreditCardCreditsResource) -> None: + self._credit_card_credits = credit_card_credits + + self.create = async_to_streamed_response_wrapper( + credit_card_credits.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + credit_card_credits.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + credit_card_credits.list, + ) diff --git a/src/conductor/resources/qbd/invoices.py b/src/conductor/resources/qbd/invoices.py index bd4da630..0a68b15f 100644 --- a/src/conductor/resources/qbd/invoices.py +++ b/src/conductor/resources/qbd/invoices.py @@ -130,8 +130,7 @@ def create( will return an error. invoice_line_groups: The invoice's line item groups. Each group represents a predefined set of - related items, enabling organized presentation of multiple items within the - invoice. + related items. invoice_lines: The invoice's invoice lines, each representing a single product or service sold. @@ -567,8 +566,7 @@ async def create( will return an error. invoice_line_groups: The invoice's line item groups. Each group represents a predefined set of - related items, enabling organized presentation of multiple items within the - invoice. + related items. invoice_lines: The invoice's invoice lines, each representing a single product or service sold. diff --git a/src/conductor/resources/qbd/qbd.py b/src/conductor/resources/qbd/qbd.py index c78cceab..aca8b76f 100644 --- a/src/conductor/resources/qbd/qbd.py +++ b/src/conductor/resources/qbd/qbd.py @@ -108,6 +108,14 @@ CreditCardChargesResourceWithStreamingResponse, AsyncCreditCardChargesResourceWithStreamingResponse, ) +from .credit_card_credits import ( + CreditCardCreditsResource, + AsyncCreditCardCreditsResource, + CreditCardCreditsResourceWithRawResponse, + AsyncCreditCardCreditsResourceWithRawResponse, + CreditCardCreditsResourceWithStreamingResponse, + AsyncCreditCardCreditsResourceWithStreamingResponse, +) from .non_inventory_items import ( NonInventoryItemsResource, AsyncNonInventoryItemsResource, @@ -177,6 +185,10 @@ def standard_terms(self) -> StandardTermsResource: def vendors(self) -> VendorsResource: return VendorsResource(self._client) + @cached_property + def credit_card_credits(self) -> CreditCardCreditsResource: + return CreditCardCreditsResource(self._client) + @cached_property def with_raw_response(self) -> QbdResourceWithRawResponse: """ @@ -254,6 +266,10 @@ def standard_terms(self) -> AsyncStandardTermsResource: def vendors(self) -> AsyncVendorsResource: return AsyncVendorsResource(self._client) + @cached_property + def credit_card_credits(self) -> AsyncCreditCardCreditsResource: + return AsyncCreditCardCreditsResource(self._client) + @cached_property def with_raw_response(self) -> AsyncQbdResourceWithRawResponse: """ @@ -334,6 +350,10 @@ def standard_terms(self) -> StandardTermsResourceWithRawResponse: def vendors(self) -> VendorsResourceWithRawResponse: return VendorsResourceWithRawResponse(self._qbd.vendors) + @cached_property + def credit_card_credits(self) -> CreditCardCreditsResourceWithRawResponse: + return CreditCardCreditsResourceWithRawResponse(self._qbd.credit_card_credits) + class AsyncQbdResourceWithRawResponse: def __init__(self, qbd: AsyncQbdResource) -> None: @@ -395,6 +415,10 @@ def standard_terms(self) -> AsyncStandardTermsResourceWithRawResponse: def vendors(self) -> AsyncVendorsResourceWithRawResponse: return AsyncVendorsResourceWithRawResponse(self._qbd.vendors) + @cached_property + def credit_card_credits(self) -> AsyncCreditCardCreditsResourceWithRawResponse: + return AsyncCreditCardCreditsResourceWithRawResponse(self._qbd.credit_card_credits) + class QbdResourceWithStreamingResponse: def __init__(self, qbd: QbdResource) -> None: @@ -456,6 +480,10 @@ def standard_terms(self) -> StandardTermsResourceWithStreamingResponse: def vendors(self) -> VendorsResourceWithStreamingResponse: return VendorsResourceWithStreamingResponse(self._qbd.vendors) + @cached_property + def credit_card_credits(self) -> CreditCardCreditsResourceWithStreamingResponse: + return CreditCardCreditsResourceWithStreamingResponse(self._qbd.credit_card_credits) + class AsyncQbdResourceWithStreamingResponse: def __init__(self, qbd: AsyncQbdResource) -> None: @@ -516,3 +544,7 @@ def standard_terms(self) -> AsyncStandardTermsResourceWithStreamingResponse: @cached_property def vendors(self) -> AsyncVendorsResourceWithStreamingResponse: return AsyncVendorsResourceWithStreamingResponse(self._qbd.vendors) + + @cached_property + def credit_card_credits(self) -> AsyncCreditCardCreditsResourceWithStreamingResponse: + return AsyncCreditCardCreditsResourceWithStreamingResponse(self._qbd.credit_card_credits) diff --git a/src/conductor/types/qbd/__init__.py b/src/conductor/types/qbd/__init__.py index 512cf0ba..5e15e2ec 100644 --- a/src/conductor/types/qbd/__init__.py +++ b/src/conductor/types/qbd/__init__.py @@ -16,6 +16,7 @@ from .class_list_params import ClassListParams as ClassListParams from .qbd_standard_term import QbdStandardTerm as QbdStandardTerm from .bill_create_params import BillCreateParams as BillCreateParams +from .credit_card_credit import CreditCardCredit as CreditCardCredit from .non_inventory_item import NonInventoryItem as NonInventoryItem from .qbd_sales_tax_item import QbdSalesTaxItem as QbdSalesTaxItem from .vendor_list_params import VendorListParams as VendorListParams @@ -44,8 +45,10 @@ from .sales_tax_code_list_response import SalesTaxCodeListResponse as SalesTaxCodeListResponse from .sales_tax_item_create_params import SalesTaxItemCreateParams as SalesTaxItemCreateParams from .credit_card_charge_list_params import CreditCardChargeListParams as CreditCardChargeListParams +from .credit_card_credit_list_params import CreditCardCreditListParams as CreditCardCreditListParams from .date_driven_term_create_params import DateDrivenTermCreateParams as DateDrivenTermCreateParams from .date_driven_term_list_response import DateDrivenTermListResponse as DateDrivenTermListResponse from .non_inventory_item_list_params import NonInventoryItemListParams as NonInventoryItemListParams from .credit_card_charge_create_params import CreditCardChargeCreateParams as CreditCardChargeCreateParams +from .credit_card_credit_create_params import CreditCardCreditCreateParams as CreditCardCreditCreateParams from .non_inventory_item_create_params import NonInventoryItemCreateParams as NonInventoryItemCreateParams diff --git a/src/conductor/types/qbd/credit_card_credit.py b/src/conductor/types/qbd/credit_card_credit.py new file mode 100644 index 00000000..d270b03b --- /dev/null +++ b/src/conductor/types/qbd/credit_card_credit.py @@ -0,0 +1,1194 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import date +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from ..._models import BaseModel + +__all__ = [ + "CreditCardCredit", + "Account", + "Currency", + "CustomField", + "ExpenseLine", + "ExpenseLineAccount", + "ExpenseLineClass", + "ExpenseLineCustomField", + "ExpenseLinePayee", + "ExpenseLineSalesRepresentative", + "ExpenseLineSalesTaxCode", + "ItemGroupLine", + "ItemGroupLineCustomField", + "ItemGroupLineItemGroup", + "ItemGroupLineItemLine", + "ItemGroupLineItemLineClass", + "ItemGroupLineItemLineCustomer", + "ItemGroupLineItemLineCustomField", + "ItemGroupLineItemLineInventorySite", + "ItemGroupLineItemLineInventorySiteLocation", + "ItemGroupLineItemLineItem", + "ItemGroupLineItemLineOverrideUnitOfMeasureSet", + "ItemGroupLineItemLineSalesRepresentative", + "ItemGroupLineItemLineSalesTaxCode", + "ItemGroupLineOverrideUnitOfMeasureSet", + "ItemLine", + "ItemLineClass", + "ItemLineCustomer", + "ItemLineCustomField", + "ItemLineInventorySite", + "ItemLineInventorySiteLocation", + "ItemLineItem", + "ItemLineOverrideUnitOfMeasureSet", + "ItemLineSalesRepresentative", + "ItemLineSalesTaxCode", + "Payee", + "SalesTaxCode", +] + + +class Account(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique among all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class Currency(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique among all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class CustomField(BaseModel): + name: str + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Optional[str] = FieldInfo(alias="ownerId", default=None) + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + type: Literal[ + "amount_type", + "date_time_type", + "integer_type", + "percent_type", + "price_type", + "quantity_type", + "string_1024_type", + "string_255_type", + ] + """The data type of the custom field.""" + + value: str + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ExpenseLineAccount(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ExpenseLineClass(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ExpenseLineCustomField(BaseModel): + name: str + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Optional[str] = FieldInfo(alias="ownerId", default=None) + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + type: Literal[ + "amount_type", + "date_time_type", + "integer_type", + "percent_type", + "price_type", + "quantity_type", + "string_1024_type", + "string_255_type", + ] + """The data type of the custom field.""" + + value: str + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ExpenseLinePayee(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ExpenseLineSalesRepresentative(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ExpenseLineSalesTaxCode(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ExpenseLine(BaseModel): + id: str + """The unique identifier assigned by QuickBooks for this expense line. + + This ID is unique across all transaction line types. + """ + + account: Optional[ExpenseLineAccount] = None + """The expense account being debited (increased). + + The corresponding account being credited is usually a liability account (e.g., + Accounts Payable) or an asset account (e.g., Cash), depending on the transaction + type. + """ + + amount: Optional[str] = None + """The monetary amount for this expense line, represented as a decimal string.""" + + billing_status: Optional[Literal["billable", "has_been_billed", "not_billable"]] = FieldInfo( + alias="billingStatus", default=None + ) + """The billing status of this expense line.""" + + class_: Optional[ExpenseLineClass] = FieldInfo(alias="class", default=None) + """The expense line's class. + + Classes can be used to categorize objects into meaningful segments, such as + department, location, or type of work. In QuickBooks, class tracking is off by + default. If a class is specified for the entire parent transaction, it is + automatically applied to all expense lines unless overridden here, at the + transaction line level. + """ + + custom_fields: List[ExpenseLineCustomField] = FieldInfo(alias="customFields") + """ + The custom fields added by the user to this expense line object as a data + extension. These fields are not part of the standard QuickBooks object. + """ + + memo: Optional[str] = None + """A memo or note for this expense line, as entered by the user.""" + + object_type: Literal["qbd_expense_line"] = FieldInfo(alias="objectType") + """The type of object. This value is always `"qbd_expense_line"`.""" + + payee: Optional[ExpenseLinePayee] = None + """ + If `account` refers to an Accounts Payable (A/P) account, `payee` refers to the + expense's vendor (not the customer). If `account` refers to any other type of + account, `payee` refers to the expense's customer (not the vendor). + """ + + sales_representative: Optional[ExpenseLineSalesRepresentative] = FieldInfo( + alias="salesRepresentative", default=None + ) + """The expense line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code: Optional[ExpenseLineSalesTaxCode] = FieldInfo(alias="salesTaxCode", default=None) + """ + The sales-tax code associated with this expense line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this expense line. Default codes include "Non" (non-taxable) + and "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + +class ItemGroupLineCustomField(BaseModel): + name: str + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Optional[str] = FieldInfo(alias="ownerId", default=None) + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + type: Literal[ + "amount_type", + "date_time_type", + "integer_type", + "percent_type", + "price_type", + "quantity_type", + "string_1024_type", + "string_255_type", + ] + """The data type of the custom field.""" + + value: str + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ItemGroupLineItemGroup(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineClass(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineCustomer(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineCustomField(BaseModel): + name: str + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Optional[str] = FieldInfo(alias="ownerId", default=None) + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + type: Literal[ + "amount_type", + "date_time_type", + "integer_type", + "percent_type", + "price_type", + "quantity_type", + "string_1024_type", + "string_255_type", + ] + """The data type of the custom field.""" + + value: str + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ItemGroupLineItemLineInventorySite(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineInventorySiteLocation(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineItem(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineOverrideUnitOfMeasureSet(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineSalesRepresentative(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLineSalesTaxCode(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLineItemLine(BaseModel): + id: str + """The unique identifier assigned by QuickBooks for this item line. + + This ID is unique across all transaction line types. + """ + + amount: Optional[str] = None + """The monetary amount for this item line, represented as a decimal string.""" + + billing_status: Optional[Literal["billable", "has_been_billed", "not_billable"]] = FieldInfo( + alias="billingStatus", default=None + ) + """The billing status of this item line.""" + + class_: Optional[ItemGroupLineItemLineClass] = FieldInfo(alias="class", default=None) + """The item line's class. + + Classes can be used to categorize objects into meaningful segments, such as + department, location, or type of work. In QuickBooks, class tracking is off by + default. If a class is specified for the entire parent transaction, it is + automatically applied to all item lines unless overridden here, at the + transaction line level. + """ + + cost: Optional[str] = None + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified, QuickBooks will use them to + calculate `cost`. Likewise, if both `quantity` and `cost` are specified, + QuickBooks will use them to calculate the `amount`. + """ + + customer: Optional[ItemGroupLineItemLineCustomer] = None + """The customer or customer-job associated with this item line.""" + + custom_fields: List[ItemGroupLineItemLineCustomField] = FieldInfo(alias="customFields") + """The custom fields added by the user to this item line object as a data + extension. + + These fields are not part of the standard QuickBooks object. + """ + + description: Optional[str] = None + """A description of this item line.""" + + expiration_date: Optional[date] = FieldInfo(alias="expirationDate", default=None) + """ + The expiration date for the serial number or lot number of the item in this item + line, in ISO 8601 format (YYYY-MM-DD). This is particularly relevant for + perishable or time-sensitive inventory items. Note that this field is only + supported on QuickBooks Desktop 2023 or later. + """ + + inventory_site: Optional[ItemGroupLineItemLineInventorySite] = FieldInfo(alias="inventorySite", default=None) + """The site location where inventory for the item in this item line is stored.""" + + inventory_site_location: Optional[ItemGroupLineItemLineInventorySiteLocation] = FieldInfo( + alias="inventorySiteLocation", default=None + ) + """ + The specific location within the inventory site where the item in this item line + is stored, such as a bin or shelf. + """ + + item: Optional[ItemGroupLineItemLineItem] = None + """The item associated with this item line. + + This can refer to any good or service that the business buys or sells, including + item types such as a service item, inventory item, or special calculation item + like a discount item or sales-tax item. + """ + + lot_number: Optional[str] = FieldInfo(alias="lotNumber", default=None) + """The lot number of the item in this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + object_type: Literal["qbd_item_line"] = FieldInfo(alias="objectType") + """The type of object. This value is always `"qbd_item_line"`.""" + + override_unit_of_measure_set: Optional[ItemGroupLineItemLineOverrideUnitOfMeasureSet] = FieldInfo( + alias="overrideUnitOfMeasureSet", default=None + ) + """Specifies an alternative unit of measure set for this specific item line. + + This does not change the item's default unit of measure set (which is set on the + item itself rather than a transaction line), but allows selecting from a + different set of units for this particular line. For example, an item typically + measured in volume units could be sold using weight units in a specific + transaction. The actual unit selection (e.g., "pound" or "kilogram") is made + separately via the `unitOfMeasure` field. + """ + + quantity: Optional[float] = None + """The quantity of the item in this item line. + + If both `quantity` and `amount` are specified but not `rate`, QuickBooks will + calculate `rate`. If `quantity` and `rate` are specified but not `amount`, + QuickBooks will calculate `amount`. + """ + + sales_representative: Optional[ItemGroupLineItemLineSalesRepresentative] = FieldInfo( + alias="salesRepresentative", default=None + ) + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code: Optional[ItemGroupLineItemLineSalesTaxCode] = FieldInfo(alias="salesTaxCode", default=None) + """ + The sales-tax code associated with this item line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this item line. Default codes include "Non" (non-taxable) and + "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + serial_number: Optional[str] = FieldInfo(alias="serialNumber", default=None) + """The serial number of the item in this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Optional[str] = FieldInfo(alias="unitOfMeasure", default=None) + """The unit of measure used for the `quantity` in this item line. + + Must be a valid unit within the item's available units of measure. + """ + + +class ItemGroupLineOverrideUnitOfMeasureSet(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemGroupLine(BaseModel): + id: str + """The unique identifier assigned by QuickBooks for this item group line. + + This ID is unique across all transaction line types. + """ + + custom_fields: List[ItemGroupLineCustomField] = FieldInfo(alias="customFields") + """ + The custom fields added by the user to this item group line object as a data + extension. These fields are not part of the standard QuickBooks object. + """ + + description: Optional[str] = None + """A description of this item group line.""" + + item_group: ItemGroupLineItemGroup = FieldInfo(alias="itemGroup") + """The item group associated with this item group line. + + Item groups represent items that are grouped together for fast entry. + """ + + item_lines: List[ItemGroupLineItemLine] = FieldInfo(alias="itemLines") + """ + The item group line's item lines, each representing the purchase of a specific + item or service. + """ + + object_type: Literal["qbd_item_group_line"] = FieldInfo(alias="objectType") + """The type of object. This value is always `"qbd_item_group_line"`.""" + + override_unit_of_measure_set: Optional[ItemGroupLineOverrideUnitOfMeasureSet] = FieldInfo( + alias="overrideUnitOfMeasureSet", default=None + ) + """Specifies an alternative unit of measure set for this specific item group line. + + This does not change the item's default unit of measure set (which is set on the + item itself rather than a transaction line), but allows selecting from a + different set of units for this particular line. For example, an item typically + measured in volume units could be sold using weight units in a specific + transaction. The actual unit selection (e.g., "pound" or "kilogram") is made + separately via the `unitOfMeasure` field. + """ + + quantity: Optional[float] = None + """The quantity of the item in this item group line. + + If both `quantity` and `amount` are specified but not `rate`, QuickBooks will + calculate `rate`. If `quantity` and `rate` are specified but not `amount`, + QuickBooks will calculate `amount`. + """ + + total_amount: str = FieldInfo(alias="totalAmount") + """ + The total monetary amount for this item group line, represented as a decimal + string. + """ + + unit_of_measure: Optional[str] = FieldInfo(alias="unitOfMeasure", default=None) + """The unit of measure used for the `quantity` in this item group line. + + Must be a valid unit within the item's available units of measure. + """ + + +class ItemLineClass(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineCustomer(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineCustomField(BaseModel): + name: str + """The name of the custom field, unique for the specified `ownerId`. + + For public custom fields, this name is visible as a label in the QuickBooks UI. + """ + + owner_id: Optional[str] = FieldInfo(alias="ownerId", default=None) + """ + The identifier of the owner of the custom field, which QuickBooks internally + calls a "data extension". For public custom fields visible in the UI, such as + those added by the QuickBooks user, this is always "0". For private custom + fields that are only visible to the application that created them, this is a + valid GUID identifying the owning application. Internally, Conductor always + fetches all public custom fields (those with an `ownerId` of "0") for all + objects. + """ + + type: Literal[ + "amount_type", + "date_time_type", + "integer_type", + "percent_type", + "price_type", + "quantity_type", + "string_1024_type", + "string_255_type", + ] + """The data type of the custom field.""" + + value: str + """The value of the custom field. + + The maximum length depends on the field's data type. + """ + + +class ItemLineInventorySite(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineInventorySiteLocation(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineItem(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineOverrideUnitOfMeasureSet(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineSalesRepresentative(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLineSalesTaxCode(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique across all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class ItemLine(BaseModel): + id: str + """The unique identifier assigned by QuickBooks for this item line. + + This ID is unique across all transaction line types. + """ + + amount: Optional[str] = None + """The monetary amount for this item line, represented as a decimal string.""" + + billing_status: Optional[Literal["billable", "has_been_billed", "not_billable"]] = FieldInfo( + alias="billingStatus", default=None + ) + """The billing status of this item line.""" + + class_: Optional[ItemLineClass] = FieldInfo(alias="class", default=None) + """The item line's class. + + Classes can be used to categorize objects into meaningful segments, such as + department, location, or type of work. In QuickBooks, class tracking is off by + default. If a class is specified for the entire parent transaction, it is + automatically applied to all item lines unless overridden here, at the + transaction line level. + """ + + cost: Optional[str] = None + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified, QuickBooks will use them to + calculate `cost`. Likewise, if both `quantity` and `cost` are specified, + QuickBooks will use them to calculate the `amount`. + """ + + customer: Optional[ItemLineCustomer] = None + """The customer or customer-job associated with this item line.""" + + custom_fields: List[ItemLineCustomField] = FieldInfo(alias="customFields") + """The custom fields added by the user to this item line object as a data + extension. + + These fields are not part of the standard QuickBooks object. + """ + + description: Optional[str] = None + """A description of this item line.""" + + expiration_date: Optional[date] = FieldInfo(alias="expirationDate", default=None) + """ + The expiration date for the serial number or lot number of the item in this item + line, in ISO 8601 format (YYYY-MM-DD). This is particularly relevant for + perishable or time-sensitive inventory items. Note that this field is only + supported on QuickBooks Desktop 2023 or later. + """ + + inventory_site: Optional[ItemLineInventorySite] = FieldInfo(alias="inventorySite", default=None) + """The site location where inventory for the item in this item line is stored.""" + + inventory_site_location: Optional[ItemLineInventorySiteLocation] = FieldInfo( + alias="inventorySiteLocation", default=None + ) + """ + The specific location within the inventory site where the item in this item line + is stored, such as a bin or shelf. + """ + + item: Optional[ItemLineItem] = None + """The item associated with this item line. + + This can refer to any good or service that the business buys or sells, including + item types such as a service item, inventory item, or special calculation item + like a discount item or sales-tax item. + """ + + lot_number: Optional[str] = FieldInfo(alias="lotNumber", default=None) + """The lot number of the item in this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + object_type: Literal["qbd_item_line"] = FieldInfo(alias="objectType") + """The type of object. This value is always `"qbd_item_line"`.""" + + override_unit_of_measure_set: Optional[ItemLineOverrideUnitOfMeasureSet] = FieldInfo( + alias="overrideUnitOfMeasureSet", default=None + ) + """Specifies an alternative unit of measure set for this specific item line. + + This does not change the item's default unit of measure set (which is set on the + item itself rather than a transaction line), but allows selecting from a + different set of units for this particular line. For example, an item typically + measured in volume units could be sold using weight units in a specific + transaction. The actual unit selection (e.g., "pound" or "kilogram") is made + separately via the `unitOfMeasure` field. + """ + + quantity: Optional[float] = None + """The quantity of the item in this item line. + + If both `quantity` and `amount` are specified but not `rate`, QuickBooks will + calculate `rate`. If `quantity` and `rate` are specified but not `amount`, + QuickBooks will calculate `amount`. + """ + + sales_representative: Optional[ItemLineSalesRepresentative] = FieldInfo(alias="salesRepresentative", default=None) + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code: Optional[ItemLineSalesTaxCode] = FieldInfo(alias="salesTaxCode", default=None) + """ + The sales-tax code associated with this item line, determining whether it is + taxable or non-taxable. It's used to assign a default tax status to all + transactions for this item line. Default codes include "Non" (non-taxable) and + "Tax" (taxable), but custom codes can also be created in QuickBooks. If + QuickBooks is not set up to charge sales tax (via the "Do You Charge Sales Tax?" + preference), it will assign the default non-taxable code to all sales. + """ + + serial_number: Optional[str] = FieldInfo(alias="serialNumber", default=None) + """The serial number of the item in this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Optional[str] = FieldInfo(alias="unitOfMeasure", default=None) + """The unit of measure used for the `quantity` in this item line. + + Must be a valid unit within the item's available units of measure. + """ + + +class Payee(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique among all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class SalesTaxCode(BaseModel): + id: Optional[str] = None + """The unique identifier assigned by QuickBooks for this object. + + This ID is unique among all objects of the same type, but not across different + QuickBooks object types. + """ + + full_name: Optional[str] = FieldInfo(alias="fullName", default=None) + """ + The fully-qualified unique name for this object, formed by combining the names + of its parent objects with its own `name`, separated by colons. Not + case-sensitive. + """ + + +class CreditCardCredit(BaseModel): + id: str + """The unique identifier assigned by QuickBooks for this credit card credit. + + This ID is unique among all transaction types. + """ + + account: Account + """The bank account or credit card account to which the credit is applied.""" + + amount: str + """ + The total monetary amount for this credit card credit, represented as a decimal + string. This equals the sum of the amounts in the credit card credit's expense + lines, item lines, and item group lines. + """ + + amount_in_home_currency: Optional[str] = FieldInfo(alias="amountInHomeCurrency", default=None) + """ + The total amount for this credit card credit converted to the home currency of + the QuickBooks company file. Represented as a decimal string. + """ + + created_at: str = FieldInfo(alias="createdAt") + """ + The date and time when this credit card credit was created, in ISO 8601 format + (YYYY-MM-DDThh:mm:ss±hh:mm). The time zone is the same as the user's time zone + in QuickBooks. + """ + + currency: Optional[Currency] = None + """The credit card credit's currency. + + For built-in currencies, the name and code are standard international values. + For user-defined currencies, all values are editable. + """ + + custom_fields: List[CustomField] = FieldInfo(alias="customFields") + """ + The custom fields added by the user to this credit card credit object as a data + extension. These fields are not part of the standard QuickBooks object. + """ + + exchange_rate: Optional[float] = FieldInfo(alias="exchangeRate", default=None) + """ + The market exchange rate between this credit card credit's currency and the home + currency in QuickBooks at the time of this transaction. Represented as a decimal + value (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + """ + + expense_lines: List[ExpenseLine] = FieldInfo(alias="expenseLines") + """ + The credit card credit's expense lines, each representing one line in this + expense. + """ + + external_id: Optional[str] = FieldInfo(alias="externalId", default=None) + """ + A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + """ + + item_group_lines: List[ItemGroupLine] = FieldInfo(alias="itemGroupLines") + """ + The credit card credit's item-group lines, each representing a predefined group + of items purchased together. + """ + + item_lines: List[ItemLine] = FieldInfo(alias="itemLines") + """ + The credit card credit's item lines, each representing the purchase of a + specific item or service. + """ + + memo: Optional[str] = None + """A memo or note for this credit card credit, as entered by the user.""" + + object_type: Literal["qbd_credit_card_credit"] = FieldInfo(alias="objectType") + """The type of object. This value is always `"qbd_credit_card_credit"`.""" + + payee: Optional[Payee] = None + """ + The vendor or company from whom this credit card credit was received for + purchased merchandise or services. + """ + + ref_number: Optional[str] = FieldInfo(alias="refNumber", default=None) + """ + The case-sensitive user-defined reference number for this credit card credit, + which can be used to identify the transaction in QuickBooks. This value is not + required to be unique and can be arbitrarily changed by the QuickBooks user. + """ + + sales_tax_code: Optional[SalesTaxCode] = FieldInfo(alias="salesTaxCode", default=None) + """ + The sales-tax code associated with this credit card credit, determining whether + it is taxable or non-taxable. It's used to assign a default tax status to all + transactions for this credit card credit. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + """ + + transaction_date: date = FieldInfo(alias="transactionDate") + """The date of this credit card credit, in ISO 8601 format (YYYY-MM-DD).""" + + updated_at: str = FieldInfo(alias="updatedAt") + """ + The date and time when this credit card credit was last updated, in ISO 8601 + format (YYYY-MM-DDThh:mm:ss±hh:mm). The time zone is the same as the user's time + zone in QuickBooks. + """ + + version: str + """ + The current version identifier for this credit card credit, which changes each + time the object is modified. When updating this object, you must provide the + most recent `version` to ensure you're working with the latest data; otherwise, + the update will fail. This value is opaque and should not be interpreted. + """ diff --git a/src/conductor/types/qbd/credit_card_credit_create_params.py b/src/conductor/types/qbd/credit_card_credit_create_params.py new file mode 100644 index 00000000..3e6d1aa2 --- /dev/null +++ b/src/conductor/types/qbd/credit_card_credit_create_params.py @@ -0,0 +1,208 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = [ + "CreditCardCreditCreateParams", + "ExpenseLine", + "ExpenseLineCustomField", + "ItemGroupLine", + "ItemGroupLineCustomField", + "ItemLine", + "ItemLineCustomField", + "ItemLineLinkToTransactionLineItem", +] + + +class CreditCardCreditCreateParams(TypedDict, total=False): + account_id: Required[Annotated[str, PropertyInfo(alias="accountId")]] + """The bank account or credit card account to which the credit is applied.""" + + transaction_date: Required[Annotated[Union[str, date], PropertyInfo(alias="transactionDate", format="iso8601")]] + """The date of this credit card credit, in ISO 8601 format (YYYY-MM-DD).""" + + conductor_end_user_id: Required[Annotated[str, PropertyInfo(alias="Conductor-End-User-Id")]] + """ + The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + """ + + exchange_rate: Annotated[float, PropertyInfo(alias="exchangeRate")] + """ + The market exchange rate between this credit card credit's currency and the home + currency in QuickBooks at the time of this transaction. Represented as a decimal + value (e.g., 1.2345 for 1 EUR = 1.2345 USD if USD is the home currency). + """ + + expense_lines: Annotated[Iterable[ExpenseLine], PropertyInfo(alias="expenseLines")] + """ + The credit card credit's expense lines, each representing one line in this + expense. + """ + + external_id: Annotated[str, PropertyInfo(alias="externalId")] + """ + A globally unique identifier (GUID) you can provide for tracking this object in + your external system. Must be formatted as a valid GUID; otherwise, QuickBooks + will return an error. + """ + + item_group_lines: Annotated[Iterable[ItemGroupLine], PropertyInfo(alias="itemGroupLines")] + """ + The credit card credit's item-group lines, each representing a predefined group + of items purchased together. + """ + + item_lines: Annotated[Iterable[ItemLine], PropertyInfo(alias="itemLines")] + """ + The credit card credit's item lines, each representing the purchase of a + specific item or service. + """ + + memo: str + """A memo or note for this credit card credit, as entered by the user.""" + + payee_id: Annotated[str, PropertyInfo(alias="payeeId")] + """ + The vendor or company from whom this credit card credit was received for + purchased merchandise or services. + """ + + ref_number: Annotated[str, PropertyInfo(alias="refNumber")] + """ + The case-sensitive user-defined reference number for this credit card credit, + which can be used to identify the transaction in QuickBooks. This value is not + required to be unique and can be arbitrarily changed by the QuickBooks user. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + The sales-tax code associated with this credit card credit, determining whether + it is taxable or non-taxable. It's used to assign a default tax status to all + transactions for this credit card credit. Default codes include "Non" + (non-taxable) and "Tax" (taxable), but custom codes can also be created in + QuickBooks. If QuickBooks is not set up to charge sales tax (via the "Do You + Charge Sales Tax?" preference), it will assign the default non-taxable code to + all sales. + """ + + +class ExpenseLineCustomField(TypedDict, total=False): + name: Required[str] + + owner_id: Required[Annotated[str, PropertyInfo(alias="ownerId")]] + + value: Required[str] + + +class ExpenseLine(TypedDict, total=False): + account_id: Annotated[str, PropertyInfo(alias="accountId")] + + amount: str + + billable_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billableStatus") + ] + """The billing status of this line item.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + + custom_fields: Annotated[Iterable[ExpenseLineCustomField], PropertyInfo(alias="customFields")] + + memo: str + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + + +class ItemGroupLineCustomField(TypedDict, total=False): + name: Required[str] + + owner_id: Required[Annotated[str, PropertyInfo(alias="ownerId")]] + + value: Required[str] + + +class ItemGroupLine(TypedDict, total=False): + item_group_id: Required[Annotated[str, PropertyInfo(alias="itemGroupId")]] + + custom_fields: Annotated[Iterable[ItemGroupLineCustomField], PropertyInfo(alias="customFields")] + + inventory_site_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + + quantity: float + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + + +class ItemLineCustomField(TypedDict, total=False): + name: Required[str] + + owner_id: Required[Annotated[str, PropertyInfo(alias="ownerId")]] + + value: Required[str] + + +class ItemLineLinkToTransactionLineItem(TypedDict, total=False): + transaction_id: Required[Annotated[str, PropertyInfo(alias="transactionId")]] + + transaction_line_id: Required[Annotated[str, PropertyInfo(alias="transactionLineId")]] + + +class ItemLine(TypedDict, total=False): + amount: str + + billable_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billableStatus") + ] + """The billing status of this line item.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + + cost: str + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + + custom_fields: Annotated[Iterable[ItemLineCustomField], PropertyInfo(alias="customFields")] + + description: str + + expiration_date: Annotated[str, PropertyInfo(alias="expirationDate")] + + inventory_site_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """The ID of the inventory site where the item is stored.""" + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """The ID of the inventory site location where the item is stored.""" + + item_id: Annotated[str, PropertyInfo(alias="itemId")] + + link_to_transaction_line_item: Annotated[ + ItemLineLinkToTransactionLineItem, PropertyInfo(alias="linkToTransactionLineItem") + ] + + lot_number: Annotated[str, PropertyInfo(alias="lotNumber")] + + override_item_account_id: Annotated[str, PropertyInfo(alias="overrideItemAccountId")] + + quantity: float + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + + serial_number: Annotated[str, PropertyInfo(alias="serialNumber")] + """The serial number of the item.""" + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] diff --git a/src/conductor/types/qbd/credit_card_credit_list_params.py b/src/conductor/types/qbd/credit_card_credit_list_params.py new file mode 100644 index 00000000..bdbd5ca2 --- /dev/null +++ b/src/conductor/types/qbd/credit_card_credit_list_params.py @@ -0,0 +1,141 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["CreditCardCreditListParams"] + + +class CreditCardCreditListParams(TypedDict, total=False): + conductor_end_user_id: Required[Annotated[str, PropertyInfo(alias="Conductor-End-User-Id")]] + """ + The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + """ + + account_ids: Annotated[str, PropertyInfo(alias="accountIds")] + """Filter for credit card credits from this account or accounts. + + Specify a single account ID or multiple using a comma-separated list (e.g., + `accountIds=1,2,3`). + """ + + currency_ids: Annotated[str, PropertyInfo(alias="currencyIds")] + """Filter for credit card credits in this currency or currencies. + + Specify a single currency ID or multiple using a comma-separated list (e.g., + `currencyIds=1,2,3`). + """ + + cursor: str + """ + The pagination token to fetch the next set of results when paginating with the + `limit` parameter. Retrieve this value from the `nextCursor` field in the + previous response. If omitted, the API returns the first page of results. + """ + + ids: str + """ + Filter for specific credit card credits by their QuickBooks-assigned unique + identifier(s). Specify a single ID or multiple using a comma-separated list + (e.g., `ids=1,2,3`). NOTE: If you include this parameter, all other query + parameters will be ignored. + """ + + include_line_items: Annotated[bool, PropertyInfo(alias="includeLineItems")] + """Whether to include line items in the response.""" + + limit: int + """The maximum number of objects to return, ranging from 1 to 500. + + Defaults to 500. Use this parameter in conjunction with the `cursor` parameter + to paginate through results. The response will include a `nextCursor` field, + which can be used as the `cursor` parameter value in subsequent requests to + fetch the next set of results. + """ + + payee_ids: Annotated[str, PropertyInfo(alias="payeeIds")] + """Filter for credit card credits from this payee or payees. + + Specify a single payee ID or multiple using a comma-separated list (e.g., + `payeeIds=1,2,3`). These are the vendors or companies from whom the credits were + received. + """ + + ref_number_contains: Annotated[str, PropertyInfo(alias="refNumberContains")] + """Filter for transactions whose `refNumber` contains this substring. + + If you use this parameter, you cannot use `refNumberStartsWith` or + `refNumberEndsWith`. + """ + + ref_number_ends_with: Annotated[str, PropertyInfo(alias="refNumberEndsWith")] + """Filter for transactions whose `refNumber` ends with this substring. + + If you use this parameter, you cannot use `refNumberContains` or + `refNumberStartsWith`. + """ + + ref_number_from: Annotated[str, PropertyInfo(alias="refNumberFrom")] + """Filter for transactions whose `refNumber` is greater than or equal to this + value. + + If omitted, the range will begin with the first number of the list. Uses a + numerical comparison for values that contain only digits; otherwise, uses a + lexicographical comparison. + """ + + ref_numbers: Annotated[str, PropertyInfo(alias="refNumbers")] + """Filter for specific credit card credits by their ref-number(s), case-sensitive. + + Specify a single ref-number or multiple using a comma-separated list (e.g., + `refNumbers=1,2,3`). In QuickBooks, ref-numbers are not required to be unique + and can be arbitrarily changed by the QuickBooks user. NOTE: If you include this + parameter, all other query parameters will be ignored. + """ + + ref_number_starts_with: Annotated[str, PropertyInfo(alias="refNumberStartsWith")] + """Filter for transactions whose `refNumber` starts with this substring. + + If you use this parameter, you cannot use `refNumberContains` or + `refNumberEndsWith`. + """ + + ref_number_to: Annotated[str, PropertyInfo(alias="refNumberTo")] + """Filter for transactions whose `refNumber` is less than or equal to this value. + + If omitted, the range will end with the last number of the list. Uses a + numerical comparison for values that contain only digits; otherwise, uses a + lexicographical comparison. + """ + + transaction_date_from: Annotated[Union[str, date], PropertyInfo(alias="transactionDateFrom", format="iso8601")] + """ + Filter for transactions created on or after this date, in ISO 8601 format + (YYYY-MM-DD). + """ + + transaction_date_to: Annotated[Union[str, date], PropertyInfo(alias="transactionDateTo", format="iso8601")] + """ + Filter for transactions created on or before this date, in ISO 8601 format + (YYYY-MM-DD). + """ + + updated_after: Annotated[str, PropertyInfo(alias="updatedAfter")] + """ + Filter for objects updated on or after this date and time, in ISO 8601 format + (YYYY-MM-DDTHH:mm:ss). If you only provide a date (YYYY-MM-DD), the time is + assumed to be 00:00:00 of that day. + """ + + updated_before: Annotated[str, PropertyInfo(alias="updatedBefore")] + """ + Filter for objects updated on or before this date and time, in ISO 8601 format + (YYYY-MM-DDTHH:mm:ss). If you only provide a date (YYYY-MM-DD), the time is + assumed to be 23:59:59 of that day. + """ diff --git a/src/conductor/types/qbd/invoice_create_params.py b/src/conductor/types/qbd/invoice_create_params.py index b677bb9d..97e50276 100644 --- a/src/conductor/types/qbd/invoice_create_params.py +++ b/src/conductor/types/qbd/invoice_create_params.py @@ -84,8 +84,7 @@ class InvoiceCreateParams(TypedDict, total=False): invoice_line_groups: Annotated[Iterable[InvoiceLineGroup], PropertyInfo(alias="invoiceLineGroups")] """The invoice's line item groups. - Each group represents a predefined set of related items, enabling organized - presentation of multiple items within the invoice. + Each group represents a predefined set of related items. """ invoice_lines: Annotated[Iterable[InvoiceLine], PropertyInfo(alias="invoiceLines")] diff --git a/src/conductor/types/qbd/qbd_invoice.py b/src/conductor/types/qbd/qbd_invoice.py index 9b94c69d..9852b73a 100644 --- a/src/conductor/types/qbd/qbd_invoice.py +++ b/src/conductor/types/qbd/qbd_invoice.py @@ -1188,8 +1188,7 @@ class QbdInvoice(BaseModel): invoice_line_groups: List[InvoiceLineGroup] = FieldInfo(alias="invoiceLineGroups") """The invoice's line item groups. - Each group represents a predefined set of related items, enabling organized - presentation of multiple items within the invoice. + Each group represents a predefined set of related items. """ invoice_lines: List[InvoiceLine] = FieldInfo(alias="invoiceLines") diff --git a/tests/api_resources/qbd/test_credit_card_credits.py b/tests/api_resources/qbd/test_credit_card_credits.py new file mode 100644 index 00000000..e52c3e39 --- /dev/null +++ b/tests/api_resources/qbd/test_credit_card_credits.py @@ -0,0 +1,880 @@ +# 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 conductor import Conductor, AsyncConductor +from tests.utils import assert_matches_type +from conductor._utils import parse_date +from conductor.types.qbd import CreditCardCredit +from conductor.pagination import SyncCursorPage, AsyncCursorPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCreditCardCredits: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Conductor) -> None: + credit_card_credit = client.qbd.credit_card_credits.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Conductor) -> None: + credit_card_credit = client.qbd.credit_card_credits.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + exchange_rate=1.2345, + expense_lines=[ + { + "account_id": "accountId", + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "memo": "memo", + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + }, + { + "account_id": "accountId", + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "memo": "memo", + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + }, + { + "account_id": "accountId", + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "memo": "memo", + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + }, + ], + external_id="12345678-abcd-1234-abcd-1234567890ab", + item_group_lines=[ + { + "item_group_id": "itemGroupId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "quantity": 0, + "unit_of_measure": "unitOfMeasure", + }, + { + "item_group_id": "itemGroupId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "quantity": 0, + "unit_of_measure": "unitOfMeasure", + }, + { + "item_group_id": "itemGroupId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "quantity": 0, + "unit_of_measure": "unitOfMeasure", + }, + ], + item_lines=[ + { + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "cost": "cost", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "description": "description", + "expiration_date": "expirationDate", + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "item_id": "itemId", + "link_to_transaction_line_item": { + "transaction_id": "transactionId", + "transaction_line_id": "transactionLineId", + }, + "lot_number": "lotNumber", + "override_item_account_id": "overrideItemAccountId", + "quantity": 0, + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + "serial_number": "serialNumber", + "unit_of_measure": "unitOfMeasure", + }, + { + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "cost": "cost", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "description": "description", + "expiration_date": "expirationDate", + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "item_id": "itemId", + "link_to_transaction_line_item": { + "transaction_id": "transactionId", + "transaction_line_id": "transactionLineId", + }, + "lot_number": "lotNumber", + "override_item_account_id": "overrideItemAccountId", + "quantity": 0, + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + "serial_number": "serialNumber", + "unit_of_measure": "unitOfMeasure", + }, + { + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "cost": "cost", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "description": "description", + "expiration_date": "expirationDate", + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "item_id": "itemId", + "link_to_transaction_line_item": { + "transaction_id": "transactionId", + "transaction_line_id": "transactionLineId", + }, + "lot_number": "lotNumber", + "override_item_account_id": "overrideItemAccountId", + "quantity": 0, + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + "serial_number": "serialNumber", + "unit_of_measure": "unitOfMeasure", + }, + ], + memo="Refund for returned office supplies", + payee_id="80000001-1234567890", + ref_number="CREDIT-1234", + sales_tax_code_id="80000004-1234567890", + ) + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Conductor) -> None: + response = client.qbd.credit_card_credits.with_raw_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credit_card_credit = response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Conductor) -> None: + with client.qbd.credit_card_credits.with_streaming_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credit_card_credit = response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Conductor) -> None: + credit_card_credit = client.qbd.credit_card_credits.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Conductor) -> None: + response = client.qbd.credit_card_credits.with_raw_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credit_card_credit = response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Conductor) -> None: + with client.qbd.credit_card_credits.with_streaming_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credit_card_credit = response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Conductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.qbd.credit_card_credits.with_raw_response.retrieve( + id="", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + @parametrize + def test_method_list(self, client: Conductor) -> None: + credit_card_credit = client.qbd.credit_card_credits.list( + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(SyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Conductor) -> None: + credit_card_credit = client.qbd.credit_card_credits.list( + conductor_end_user_id="end_usr_1234567abcdefg", + account_ids="80000001-1234567890", + currency_ids="80000001-1234567890", + cursor="12345678-abcd-abcd-example-1234567890ab", + ids="123ABC-1234567890", + include_line_items=True, + limit=1, + payee_ids="80000001-1234567890", + ref_number_contains="CHARGE", + ref_number_ends_with="1234", + ref_number_from="CHARGE-0001", + ref_numbers="CREDIT CARD CREDIT-1234", + ref_number_starts_with="SALE", + ref_number_to="CHARGE-9999", + transaction_date_from=parse_date("2019-12-27"), + transaction_date_to=parse_date("2019-12-27"), + updated_after="updatedAfter", + updated_before="updatedBefore", + ) + assert_matches_type(SyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Conductor) -> None: + response = client.qbd.credit_card_credits.with_raw_response.list( + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credit_card_credit = response.parse() + assert_matches_type(SyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Conductor) -> None: + with client.qbd.credit_card_credits.with_streaming_response.list( + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credit_card_credit = response.parse() + assert_matches_type(SyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCreditCardCredits: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_create(self, async_client: AsyncConductor) -> None: + credit_card_credit = await async_client.qbd.credit_card_credits.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncConductor) -> None: + credit_card_credit = await async_client.qbd.credit_card_credits.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + exchange_rate=1.2345, + expense_lines=[ + { + "account_id": "accountId", + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "memo": "memo", + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + }, + { + "account_id": "accountId", + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "memo": "memo", + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + }, + { + "account_id": "accountId", + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "memo": "memo", + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + }, + ], + external_id="12345678-abcd-1234-abcd-1234567890ab", + item_group_lines=[ + { + "item_group_id": "itemGroupId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "quantity": 0, + "unit_of_measure": "unitOfMeasure", + }, + { + "item_group_id": "itemGroupId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "quantity": 0, + "unit_of_measure": "unitOfMeasure", + }, + { + "item_group_id": "itemGroupId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "quantity": 0, + "unit_of_measure": "unitOfMeasure", + }, + ], + item_lines=[ + { + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "cost": "cost", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "description": "description", + "expiration_date": "expirationDate", + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "item_id": "itemId", + "link_to_transaction_line_item": { + "transaction_id": "transactionId", + "transaction_line_id": "transactionLineId", + }, + "lot_number": "lotNumber", + "override_item_account_id": "overrideItemAccountId", + "quantity": 0, + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + "serial_number": "serialNumber", + "unit_of_measure": "unitOfMeasure", + }, + { + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "cost": "cost", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "description": "description", + "expiration_date": "expirationDate", + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "item_id": "itemId", + "link_to_transaction_line_item": { + "transaction_id": "transactionId", + "transaction_line_id": "transactionLineId", + }, + "lot_number": "lotNumber", + "override_item_account_id": "overrideItemAccountId", + "quantity": 0, + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + "serial_number": "serialNumber", + "unit_of_measure": "unitOfMeasure", + }, + { + "amount": "amount", + "billable_status": "billable", + "class_id": "classId", + "cost": "cost", + "customer_id": "customerId", + "custom_fields": [ + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + { + "name": "name", + "owner_id": "ownerId", + "value": "value", + }, + ], + "description": "description", + "expiration_date": "expirationDate", + "inventory_site_id": "inventorySiteId", + "inventory_site_location_id": "inventorySiteLocationId", + "item_id": "itemId", + "link_to_transaction_line_item": { + "transaction_id": "transactionId", + "transaction_line_id": "transactionLineId", + }, + "lot_number": "lotNumber", + "override_item_account_id": "overrideItemAccountId", + "quantity": 0, + "sales_representative_id": "salesRepresentativeId", + "sales_tax_code_id": "salesTaxCodeId", + "serial_number": "serialNumber", + "unit_of_measure": "unitOfMeasure", + }, + ], + memo="Refund for returned office supplies", + payee_id="80000001-1234567890", + ref_number="CREDIT-1234", + sales_tax_code_id="80000004-1234567890", + ) + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.credit_card_credits.with_raw_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credit_card_credit = await response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.credit_card_credits.with_streaming_response.create( + account_id="80000001-1234567890", + transaction_date=parse_date("2019-12-27"), + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credit_card_credit = await response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncConductor) -> None: + credit_card_credit = await async_client.qbd.credit_card_credits.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.credit_card_credits.with_raw_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credit_card_credit = await response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.credit_card_credits.with_streaming_response.retrieve( + id="123ABC-1234567890", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credit_card_credit = await response.parse() + assert_matches_type(CreditCardCredit, credit_card_credit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncConductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.qbd.credit_card_credits.with_raw_response.retrieve( + id="", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncConductor) -> None: + credit_card_credit = await async_client.qbd.credit_card_credits.list( + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(AsyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncConductor) -> None: + credit_card_credit = await async_client.qbd.credit_card_credits.list( + conductor_end_user_id="end_usr_1234567abcdefg", + account_ids="80000001-1234567890", + currency_ids="80000001-1234567890", + cursor="12345678-abcd-abcd-example-1234567890ab", + ids="123ABC-1234567890", + include_line_items=True, + limit=1, + payee_ids="80000001-1234567890", + ref_number_contains="CHARGE", + ref_number_ends_with="1234", + ref_number_from="CHARGE-0001", + ref_numbers="CREDIT CARD CREDIT-1234", + ref_number_starts_with="SALE", + ref_number_to="CHARGE-9999", + transaction_date_from=parse_date("2019-12-27"), + transaction_date_to=parse_date("2019-12-27"), + updated_after="updatedAfter", + updated_before="updatedBefore", + ) + assert_matches_type(AsyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.credit_card_credits.with_raw_response.list( + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + credit_card_credit = await response.parse() + assert_matches_type(AsyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.credit_card_credits.with_streaming_response.list( + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + credit_card_credit = await response.parse() + assert_matches_type(AsyncCursorPage[CreditCardCredit], credit_card_credit, path=["response"]) + + assert cast(Any, response.is_closed) is True