From d04dbb439f93f569323b0182ffdce8de6b92a1de Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 18:36:23 +0000 Subject: [PATCH] feat(api): api update (#151) --- .stats.yml | 4 +- api.md | 1 + src/conductor/resources/qbd/bills.py | 310 ++++++- src/conductor/types/qbd/__init__.py | 1 + src/conductor/types/qbd/bill_update_params.py | 534 ++++++++++++ src/conductor/types/qbd/qbd_invoice.py | 6 +- tests/api_resources/qbd/test_bills.py | 800 ++++++++++++++++++ 7 files changed, 1651 insertions(+), 5 deletions(-) create mode 100644 src/conductor/types/qbd/bill_update_params.py diff --git a/.stats.yml b/.stats.yml index 41eaa04..45e2c02 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 61 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-6b209f22588da138a86a94aaa8d1635d8ec612d2d41654fd7f5b43458b73a3d5.yml +configured_endpoints: 62 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-80031e54b796471e08687ece9231d8990afba9886708c24b32f86e9940e4b614.yml diff --git a/api.md b/api.md index 1b75c92..9125610 100644 --- a/api.md +++ b/api.md @@ -75,6 +75,7 @@ Methods: - client.qbd.bills.create(\*\*params) -> QbdBill - client.qbd.bills.retrieve(id) -> QbdBill +- client.qbd.bills.update(id, \*\*params) -> QbdBill - client.qbd.bills.list(\*\*params) -> SyncCursorPage[QbdBill] ## Classes diff --git a/src/conductor/resources/qbd/bills.py b/src/conductor/resources/qbd/bills.py index dbc8d19..2e5a6a0 100644 --- a/src/conductor/resources/qbd/bills.py +++ b/src/conductor/resources/qbd/bills.py @@ -21,7 +21,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.qbd import bill_list_params, bill_create_params +from ...types.qbd import bill_list_params, bill_create_params, bill_update_params from ...pagination import SyncCursorPage, AsyncCursorPage from ..._base_client import AsyncPaginator, make_request_options from ...types.qbd.qbd_bill import QbdBill @@ -224,6 +224,154 @@ def retrieve( cast_to=QbdBill, ) + def update( + self, + id: str, + *, + transaction_date: Union[str, date], + version: str, + conductor_end_user_id: str, + accounts_payable_account_id: str | NotGiven = NOT_GIVEN, + clear_expense_lines: bool | NotGiven = NOT_GIVEN, + clear_item_lines: bool | NotGiven = NOT_GIVEN, + due_date: Union[str, date] | NotGiven = NOT_GIVEN, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[bill_update_params.ExpenseLine] | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[bill_update_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[bill_update_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_id: str | NotGiven = NOT_GIVEN, + terms_id: str | NotGiven = NOT_GIVEN, + vendor_address: bill_update_params.VendorAddress | NotGiven = NOT_GIVEN, + vendor_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, + ) -> QbdBill: + """ + Updates a bill. + + Args: + id: The QuickBooks-assigned unique identifier of the bill to update. + + transaction_date: The date of this bill, in ISO 8601 format (YYYY-MM-DD). + + version: The current version identifier of the bill you are updating, which you can get + by fetching the object first. Provide the most recent `version` to ensure you're + working with the latest data; otherwise, the update will fail. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + accounts_payable_account_id: The Accounts Payable account to which this bill is assigned, used to track the + amount owed. If not specified, the default Accounts Payable account in + QuickBooks is used. + + clear_expense_lines: Indicates whether to clear all the expense lines of this bill. To modify + individual lines, use the field `expenseLines`. + + clear_item_lines: Indicates whether to clear all the item lines of this bill. To modify individual + lines, use the field `itemLines`. + + due_date: The date by which this bill must be paid, in ISO 8601 format (YYYY-MM-DD). + + exchange_rate: The market exchange rate between this bill'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 bill's expense lines, each representing one line in this expense. To add a + new expense line to this bill, include it in this array with its `id` set to + `-1`. When updating this field, you must include all EXISTING expense lines in + this array, even if you are only adding or modifying some; otherwise, QuickBooks + removes the unspecified lines. Hence, to remove an existing expense line, omit + it from this array entirely and only include the lines you wish to keep. If you + are not modifying, adding, or removing any expense lines for this bill, you can + omit this field entirely. + + item_group_lines: The bill's item group lines, each representing a predefined set of items bundled + together because they are commonly purchased together or grouped for faster + entry. To add a new item group line to this bill, include it in this array with + its `id` set to `-1`. When updating this field, you must include all EXISTING + item group lines in this array, even if you are only adding or modifying some; + otherwise, QuickBooks removes the unspecified lines. Hence, to remove an + existing item group line, omit it from this array entirely and only include the + lines you wish to keep. If you are not modifying, adding, or removing any item + group lines for this bill, you can omit this field entirely. + + item_lines: The bill's item lines, each representing the purchase of a specific item or + service. To add a new item line to this bill, include it in this array with its + `id` set to `-1`. When updating this field, you must include all EXISTING item + lines in this array, even if you are only adding or modifying some; otherwise, + QuickBooks removes the unspecified lines. Hence, to remove an existing item + line, omit it from this array entirely and only include the lines you wish to + keep. If you are not modifying, adding, or removing any item lines for this + bill, you can omit this field entirely. + + memo: A memo or note for this bill, as entered by the user. Appears in the Accounts + Payable register and relevant reports. + + ref_number: The case-sensitive user-defined reference number for this bill, 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 bill, determining whether it is taxable + or non-taxable. It's used to assign a default tax status to all transactions for + this bill. 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. + + terms_id: The bill's payment terms, defining when payment is due and any applicable + discounts. + + vendor_address: The address of the vendor who sent this bill. + + vendor_id: The vendor who sent this bill for goods or services purchased. + + 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._post( + f"/quickbooks-desktop/bills/{id}", + body=maybe_transform( + { + "transaction_date": transaction_date, + "version": version, + "accounts_payable_account_id": accounts_payable_account_id, + "clear_expense_lines": clear_expense_lines, + "clear_item_lines": clear_item_lines, + "due_date": due_date, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + "terms_id": terms_id, + "vendor_address": vendor_address, + "vendor_id": vendor_id, + }, + bill_update_params.BillUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdBill, + ) + def list( self, *, @@ -571,6 +719,154 @@ async def retrieve( cast_to=QbdBill, ) + async def update( + self, + id: str, + *, + transaction_date: Union[str, date], + version: str, + conductor_end_user_id: str, + accounts_payable_account_id: str | NotGiven = NOT_GIVEN, + clear_expense_lines: bool | NotGiven = NOT_GIVEN, + clear_item_lines: bool | NotGiven = NOT_GIVEN, + due_date: Union[str, date] | NotGiven = NOT_GIVEN, + exchange_rate: float | NotGiven = NOT_GIVEN, + expense_lines: Iterable[bill_update_params.ExpenseLine] | NotGiven = NOT_GIVEN, + item_group_lines: Iterable[bill_update_params.ItemGroupLine] | NotGiven = NOT_GIVEN, + item_lines: Iterable[bill_update_params.ItemLine] | NotGiven = NOT_GIVEN, + memo: str | NotGiven = NOT_GIVEN, + ref_number: str | NotGiven = NOT_GIVEN, + sales_tax_code_id: str | NotGiven = NOT_GIVEN, + terms_id: str | NotGiven = NOT_GIVEN, + vendor_address: bill_update_params.VendorAddress | NotGiven = NOT_GIVEN, + vendor_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, + ) -> QbdBill: + """ + Updates a bill. + + Args: + id: The QuickBooks-assigned unique identifier of the bill to update. + + transaction_date: The date of this bill, in ISO 8601 format (YYYY-MM-DD). + + version: The current version identifier of the bill you are updating, which you can get + by fetching the object first. Provide the most recent `version` to ensure you're + working with the latest data; otherwise, the update will fail. + + conductor_end_user_id: The ID of the EndUser to receive this request (e.g., + `"Conductor-End-User-Id: {{END_USER_ID}}"`). + + accounts_payable_account_id: The Accounts Payable account to which this bill is assigned, used to track the + amount owed. If not specified, the default Accounts Payable account in + QuickBooks is used. + + clear_expense_lines: Indicates whether to clear all the expense lines of this bill. To modify + individual lines, use the field `expenseLines`. + + clear_item_lines: Indicates whether to clear all the item lines of this bill. To modify individual + lines, use the field `itemLines`. + + due_date: The date by which this bill must be paid, in ISO 8601 format (YYYY-MM-DD). + + exchange_rate: The market exchange rate between this bill'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 bill's expense lines, each representing one line in this expense. To add a + new expense line to this bill, include it in this array with its `id` set to + `-1`. When updating this field, you must include all EXISTING expense lines in + this array, even if you are only adding or modifying some; otherwise, QuickBooks + removes the unspecified lines. Hence, to remove an existing expense line, omit + it from this array entirely and only include the lines you wish to keep. If you + are not modifying, adding, or removing any expense lines for this bill, you can + omit this field entirely. + + item_group_lines: The bill's item group lines, each representing a predefined set of items bundled + together because they are commonly purchased together or grouped for faster + entry. To add a new item group line to this bill, include it in this array with + its `id` set to `-1`. When updating this field, you must include all EXISTING + item group lines in this array, even if you are only adding or modifying some; + otherwise, QuickBooks removes the unspecified lines. Hence, to remove an + existing item group line, omit it from this array entirely and only include the + lines you wish to keep. If you are not modifying, adding, or removing any item + group lines for this bill, you can omit this field entirely. + + item_lines: The bill's item lines, each representing the purchase of a specific item or + service. To add a new item line to this bill, include it in this array with its + `id` set to `-1`. When updating this field, you must include all EXISTING item + lines in this array, even if you are only adding or modifying some; otherwise, + QuickBooks removes the unspecified lines. Hence, to remove an existing item + line, omit it from this array entirely and only include the lines you wish to + keep. If you are not modifying, adding, or removing any item lines for this + bill, you can omit this field entirely. + + memo: A memo or note for this bill, as entered by the user. Appears in the Accounts + Payable register and relevant reports. + + ref_number: The case-sensitive user-defined reference number for this bill, 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 bill, determining whether it is taxable + or non-taxable. It's used to assign a default tax status to all transactions for + this bill. 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. + + terms_id: The bill's payment terms, defining when payment is due and any applicable + discounts. + + vendor_address: The address of the vendor who sent this bill. + + vendor_id: The vendor who sent this bill for goods or services purchased. + + 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._post( + f"/quickbooks-desktop/bills/{id}", + body=await async_maybe_transform( + { + "transaction_date": transaction_date, + "version": version, + "accounts_payable_account_id": accounts_payable_account_id, + "clear_expense_lines": clear_expense_lines, + "clear_item_lines": clear_item_lines, + "due_date": due_date, + "exchange_rate": exchange_rate, + "expense_lines": expense_lines, + "item_group_lines": item_group_lines, + "item_lines": item_lines, + "memo": memo, + "ref_number": ref_number, + "sales_tax_code_id": sales_tax_code_id, + "terms_id": terms_id, + "vendor_address": vendor_address, + "vendor_id": vendor_id, + }, + bill_update_params.BillUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=QbdBill, + ) + def list( self, *, @@ -733,6 +1029,9 @@ def __init__(self, bills: BillsResource) -> None: self.retrieve = to_raw_response_wrapper( bills.retrieve, ) + self.update = to_raw_response_wrapper( + bills.update, + ) self.list = to_raw_response_wrapper( bills.list, ) @@ -748,6 +1047,9 @@ def __init__(self, bills: AsyncBillsResource) -> None: self.retrieve = async_to_raw_response_wrapper( bills.retrieve, ) + self.update = async_to_raw_response_wrapper( + bills.update, + ) self.list = async_to_raw_response_wrapper( bills.list, ) @@ -763,6 +1065,9 @@ def __init__(self, bills: BillsResource) -> None: self.retrieve = to_streamed_response_wrapper( bills.retrieve, ) + self.update = to_streamed_response_wrapper( + bills.update, + ) self.list = to_streamed_response_wrapper( bills.list, ) @@ -778,6 +1083,9 @@ def __init__(self, bills: AsyncBillsResource) -> None: self.retrieve = async_to_streamed_response_wrapper( bills.retrieve, ) + self.update = async_to_streamed_response_wrapper( + bills.update, + ) self.list = async_to_streamed_response_wrapper( bills.list, ) diff --git a/src/conductor/types/qbd/__init__.py b/src/conductor/types/qbd/__init__.py index 8e7248c..0ff4d40 100644 --- a/src/conductor/types/qbd/__init__.py +++ b/src/conductor/types/qbd/__init__.py @@ -17,6 +17,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 .bill_update_params import BillUpdateParams as BillUpdateParams 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 diff --git a/src/conductor/types/qbd/bill_update_params.py b/src/conductor/types/qbd/bill_update_params.py new file mode 100644 index 0000000..d555579 --- /dev/null +++ b/src/conductor/types/qbd/bill_update_params.py @@ -0,0 +1,534 @@ +# 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__ = ["BillUpdateParams", "ExpenseLine", "ItemGroupLine", "ItemGroupLineItemLine", "ItemLine", "VendorAddress"] + + +class BillUpdateParams(TypedDict, total=False): + transaction_date: Required[Annotated[Union[str, date], PropertyInfo(alias="transactionDate", format="iso8601")]] + """The date of this bill, in ISO 8601 format (YYYY-MM-DD).""" + + version: Required[str] + """ + The current version identifier of the bill you are updating, which you can get + by fetching the object first. Provide the most recent `version` to ensure you're + working with the latest data; otherwise, the update will fail. + """ + + 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}}"`). + """ + + accounts_payable_account_id: Annotated[str, PropertyInfo(alias="accountsPayableAccountId")] + """ + The Accounts Payable account to which this bill is assigned, used to track the + amount owed. If not specified, the default Accounts Payable account in + QuickBooks is used. + """ + + clear_expense_lines: Annotated[bool, PropertyInfo(alias="clearExpenseLines")] + """Indicates whether to clear all the expense lines of this bill. + + To modify individual lines, use the field `expenseLines`. + """ + + clear_item_lines: Annotated[bool, PropertyInfo(alias="clearItemLines")] + """Indicates whether to clear all the item lines of this bill. + + To modify individual lines, use the field `itemLines`. + """ + + due_date: Annotated[Union[str, date], PropertyInfo(alias="dueDate", format="iso8601")] + """The date by which this bill must be paid, in ISO 8601 format (YYYY-MM-DD).""" + + exchange_rate: Annotated[float, PropertyInfo(alias="exchangeRate")] + """ + The market exchange rate between this bill'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 bill's expense lines, each representing one line in this expense. + + To add a new expense line to this bill, include it in this array with its `id` + set to `-1`. When updating this field, you must include all EXISTING expense + lines in this array, even if you are only adding or modifying some; otherwise, + QuickBooks removes the unspecified lines. Hence, to remove an existing expense + line, omit it from this array entirely and only include the lines you wish to + keep. If you are not modifying, adding, or removing any expense lines for this + bill, you can omit this field entirely. + """ + + item_group_lines: Annotated[Iterable[ItemGroupLine], PropertyInfo(alias="itemGroupLines")] + """ + The bill's item group lines, each representing a predefined set of items bundled + together because they are commonly purchased together or grouped for faster + entry. To add a new item group line to this bill, include it in this array with + its `id` set to `-1`. When updating this field, you must include all EXISTING + item group lines in this array, even if you are only adding or modifying some; + otherwise, QuickBooks removes the unspecified lines. Hence, to remove an + existing item group line, omit it from this array entirely and only include the + lines you wish to keep. If you are not modifying, adding, or removing any item + group lines for this bill, you can omit this field entirely. + """ + + item_lines: Annotated[Iterable[ItemLine], PropertyInfo(alias="itemLines")] + """ + The bill's item lines, each representing the purchase of a specific item or + service. To add a new item line to this bill, include it in this array with its + `id` set to `-1`. When updating this field, you must include all EXISTING item + lines in this array, even if you are only adding or modifying some; otherwise, + QuickBooks removes the unspecified lines. Hence, to remove an existing item + line, omit it from this array entirely and only include the lines you wish to + keep. If you are not modifying, adding, or removing any item lines for this + bill, you can omit this field entirely. + """ + + memo: str + """A memo or note for this bill, as entered by the user. + + Appears in the Accounts Payable register and relevant reports. + """ + + ref_number: Annotated[str, PropertyInfo(alias="refNumber")] + """ + The case-sensitive user-defined reference number for this bill, 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 bill, determining whether it is taxable + or non-taxable. It's used to assign a default tax status to all transactions for + this bill. 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. + """ + + terms_id: Annotated[str, PropertyInfo(alias="termsId")] + """ + The bill's payment terms, defining when payment is due and any applicable + discounts. + """ + + vendor_address: Annotated[VendorAddress, PropertyInfo(alias="vendorAddress")] + """The address of the vendor who sent this bill.""" + + vendor_id: Annotated[str, PropertyInfo(alias="vendorId")] + """The vendor who sent this bill for goods or services purchased.""" + + +class ExpenseLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier from an existing expense line (you + must include all expense lines you wish to keep, whether updating or not), or + `-1` if you are adding a new expense line to the parent transaction. + """ + + account_id: Annotated[str, PropertyInfo(alias="accountId")] + """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: str + """The monetary amount of this expense line, represented as a decimal string.""" + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this expense line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """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. + """ + + memo: str + """A memo or note for this expense line, as entered by the user.""" + + payee_id: Annotated[str, PropertyInfo(alias="payeeId")] + """ + 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_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The expense line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + 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 ItemGroupLineItemLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier from an existing item line (you must + include all item lines you wish to keep, whether updating or not), or `-1` if + you are adding a new item line to the parent transaction. + """ + + amount: str + """The monetary amount of this item line, represented as a decimal string. + + If both `quantity` and `cost` are specified but not `amount`, QuickBooks will + use them to calculate `amount`. If `amount`, `cost`, and `quantity` are all + unspecified, then QuickBooks will calculate `amount` based on a `quantity` of + `1` and the suggested `cost`. + """ + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this item line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """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: str + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified but not `cost`, QuickBooks will + use them to calculate `cost`. + """ + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + """The customer or customer-job associated with this item line.""" + + description: str + """A description of this item line.""" + + expiration_date: Annotated[Union[str, date], PropertyInfo(alias="expirationDate", format="iso8601")] + """ + The expiration date for the serial number or lot number of the item associated + with 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_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """ + The site location where inventory for the item associated with this item line is + stored. + """ + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """ + The specific location (e.g., bin or shelf) within the inventory site where the + item associated with this item line is stored. + """ + + item_id: Annotated[str, PropertyInfo(alias="itemId")] + """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: Annotated[str, PropertyInfo(alias="lotNumber")] + """The lot number of the item associated with this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + override_item_account_id: Annotated[str, PropertyInfo(alias="overrideItemAccountId")] + """ + The account to use for this item line, overriding the default account associated + with the item. + """ + + override_unit_of_measure_set_id: Annotated[str, PropertyInfo(alias="overrideUnitOfMeasureSetId")] + """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: float + """The quantity of the item associated with this item line.""" + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + 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: Annotated[str, PropertyInfo(alias="serialNumber")] + """The serial number of the item associated with this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """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 ItemGroupLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier from an existing item group line (you + must include all item group lines you wish to keep, whether updating or not), or + `-1` if you are adding a new item group line to the parent transaction. + """ + + item_group_id: Annotated[str, PropertyInfo(alias="itemGroupId")] + """ + The item group line's item group, representing a predefined set of items bundled + because they are commonly purchased together or grouped for faster entry. + """ + + item_lines: Annotated[Iterable[ItemGroupLineItemLine], PropertyInfo(alias="itemLines")] + """ + The item group line's item lines, each representing the purchase of a specific + item or service. To add a new item line to this item group line, include it in + this array with its `id` set to `-1`. When updating this field, you must include + all EXISTING item lines in this array, even if you are only adding or modifying + some; otherwise, QuickBooks removes the unspecified lines. Hence, to remove an + existing item line, omit it from this array entirely and only include the lines + you wish to keep. If you are not modifying, adding, or removing any item lines + for this item group line, you can omit this field entirely. + """ + + override_unit_of_measure_set_id: Annotated[str, PropertyInfo(alias="overrideUnitOfMeasureSetId")] + """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: float + """The quantity of the item group associated with this item group line.""" + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """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 ItemLine(TypedDict, total=False): + id: Required[str] + """ + The QuickBooks-assigned unique identifier from an existing item line (you must + include all item lines you wish to keep, whether updating or not), or `-1` if + you are adding a new item line to the parent transaction. + """ + + amount: str + """The monetary amount of this item line, represented as a decimal string. + + If both `quantity` and `cost` are specified but not `amount`, QuickBooks will + use them to calculate `amount`. If `amount`, `cost`, and `quantity` are all + unspecified, then QuickBooks will calculate `amount` based on a `quantity` of + `1` and the suggested `cost`. + """ + + billing_status: Annotated[ + Literal["billable", "has_been_billed", "not_billable"], PropertyInfo(alias="billingStatus") + ] + """The billing status of this item line.""" + + class_id: Annotated[str, PropertyInfo(alias="classId")] + """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: str + """The cost of this item line, represented as a decimal string. + + If both `quantity` and `amount` are specified but not `cost`, QuickBooks will + use them to calculate `cost`. + """ + + customer_id: Annotated[str, PropertyInfo(alias="customerId")] + """The customer or customer-job associated with this item line.""" + + description: str + """A description of this item line.""" + + expiration_date: Annotated[Union[str, date], PropertyInfo(alias="expirationDate", format="iso8601")] + """ + The expiration date for the serial number or lot number of the item associated + with 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_id: Annotated[str, PropertyInfo(alias="inventorySiteId")] + """ + The site location where inventory for the item associated with this item line is + stored. + """ + + inventory_site_location_id: Annotated[str, PropertyInfo(alias="inventorySiteLocationId")] + """ + The specific location (e.g., bin or shelf) within the inventory site where the + item associated with this item line is stored. + """ + + item_id: Annotated[str, PropertyInfo(alias="itemId")] + """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: Annotated[str, PropertyInfo(alias="lotNumber")] + """The lot number of the item associated with this item line. + + Used for tracking groups of inventory items that are purchased or manufactured + together. + """ + + override_item_account_id: Annotated[str, PropertyInfo(alias="overrideItemAccountId")] + """ + The account to use for this item line, overriding the default account associated + with the item. + """ + + override_unit_of_measure_set_id: Annotated[str, PropertyInfo(alias="overrideUnitOfMeasureSetId")] + """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: float + """The quantity of the item associated with this item line.""" + + sales_representative_id: Annotated[str, PropertyInfo(alias="salesRepresentativeId")] + """The item line's sales representative. + + Sales representatives can be employees, vendors, or other names in QuickBooks. + """ + + sales_tax_code_id: Annotated[str, PropertyInfo(alias="salesTaxCodeId")] + """ + 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: Annotated[str, PropertyInfo(alias="serialNumber")] + """The serial number of the item associated with this item line. + + This is used for tracking individual units of serialized inventory items. + """ + + unit_of_measure: Annotated[str, PropertyInfo(alias="unitOfMeasure")] + """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 VendorAddress(TypedDict, total=False): + city: str + """The city, district, suburb, town, or village name of the address.""" + + country: str + """The country name of the address.""" + + line1: str + """The first line of the address (e.g., street, PO Box, or company name).""" + + line2: str + """ + The second line of the address, if needed (e.g., apartment, suite, unit, or + building). + """ + + line3: str + """The third line of the address, if needed.""" + + line4: str + """The fourth line of the address, if needed.""" + + line5: str + """The fifth line of the address, if needed.""" + + note: str + """ + A note written at the bottom of the address in the form in which it appears, + such as the invoice form. + """ + + postal_code: Annotated[str, PropertyInfo(alias="postalCode")] + """The postal code or ZIP code of the address.""" + + state: str + """The state, county, province, or region name of the address.""" diff --git a/src/conductor/types/qbd/qbd_invoice.py b/src/conductor/types/qbd/qbd_invoice.py index cd163b8..e33cda4 100644 --- a/src/conductor/types/qbd/qbd_invoice.py +++ b/src/conductor/types/qbd/qbd_invoice.py @@ -588,7 +588,7 @@ class InvoiceLineGroup(BaseModel): invoice_lines: List[InvoiceLineGroupInvoiceLine] = FieldInfo(alias="invoiceLines") """ - The invoice line group's line items, each representing a single product or + The invoice line group's invoice lines, each representing a single product or service sold. """ @@ -1207,7 +1207,9 @@ class QbdInvoice(BaseModel): """ invoice_lines: List[InvoiceLine] = FieldInfo(alias="invoiceLines") - """The invoice's line items, each representing a single product or service sold.""" + """ + The invoice's invoice lines, each representing a single product or service sold. + """ is_finance_charge: Optional[bool] = FieldInfo(alias="isFinanceCharge", default=None) """Whether this invoice includes a finance charge.""" diff --git a/tests/api_resources/qbd/test_bills.py b/tests/api_resources/qbd/test_bills.py index 91ef506..aedb2c6 100644 --- a/tests/api_resources/qbd/test_bills.py +++ b/tests/api_resources/qbd/test_bills.py @@ -407,6 +407,406 @@ def test_path_params_retrieve(self, client: Conductor) -> None: conductor_end_user_id="end_usr_1234567abcdefg", ) + @parametrize + def test_method_update(self, client: Conductor) -> None: + bill = client.qbd.bills.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdBill, bill, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Conductor) -> None: + bill = client.qbd.bills.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + accounts_payable_account_id="80000002-1234567890", + clear_expense_lines=False, + clear_item_lines=False, + due_date=parse_date("2019-12-27"), + exchange_rate=1.2345, + expense_lines=[ + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + ], + item_group_lines=[ + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + ], + item_lines=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + memo="Office supplies for September", + ref_number="BILL-1234", + sales_tax_code_id="80000004-1234567890", + terms_id="80000013-1234567890", + vendor_address={ + "city": "San Francisco", + "country": "United States", + "line1": "548 Market St.", + "line2": "Suite 100", + "line3": "line3", + "line4": "line4", + "line5": "line5", + "note": "Conductor HQ", + "postal_code": "94110", + "state": "CA", + }, + vendor_id="80000001-1234567890", + ) + assert_matches_type(QbdBill, bill, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Conductor) -> None: + response = client.qbd.bills.with_raw_response.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bill = response.parse() + assert_matches_type(QbdBill, bill, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Conductor) -> None: + with client.qbd.bills.with_streaming_response.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bill = response.parse() + assert_matches_type(QbdBill, bill, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Conductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.qbd.bills.with_raw_response.update( + id="", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + @parametrize def test_method_list(self, client: Conductor) -> None: bill = client.qbd.bills.list( @@ -856,6 +1256,406 @@ async def test_path_params_retrieve(self, async_client: AsyncConductor) -> None: conductor_end_user_id="end_usr_1234567abcdefg", ) + @parametrize + async def test_method_update(self, async_client: AsyncConductor) -> None: + bill = await async_client.qbd.bills.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + assert_matches_type(QbdBill, bill, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncConductor) -> None: + bill = await async_client.qbd.bills.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + accounts_payable_account_id="80000002-1234567890", + clear_expense_lines=False, + clear_item_lines=False, + due_date=parse_date("2019-12-27"), + exchange_rate=1.2345, + expense_lines=[ + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + { + "id": "123ABC-1234567890", + "account_id": "80000001-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "memo": "New office chair", + "payee_id": "80000001-1234567890", + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + }, + ], + item_group_lines=[ + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "item_group_id": "80000011-1234567890", + "item_lines": [ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "unit_of_measure": "Each", + }, + ], + item_lines=[ + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + { + "id": "123ABC-1234567890", + "amount": "1000.00", + "billing_status": "billable", + "class_id": "80000001-1234567890", + "cost": "1000.00", + "customer_id": "80000001-1234567890", + "description": "High-quality widget with custom engraving", + "expiration_date": parse_date("2019-12-27"), + "inventory_site_id": "80000001-1234567890", + "inventory_site_location_id": "80000002-1234567890", + "item_id": "80000010-1234567890", + "lot_number": "LOT2023-001", + "override_item_account_id": "80000001-1234567890", + "override_unit_of_measure_set_id": "80000003-1234567890", + "quantity": 5, + "sales_representative_id": "80000030-1234567890", + "sales_tax_code_id": "80000004-1234567890", + "serial_number": "SN1234567890", + "unit_of_measure": "Each", + }, + ], + memo="Office supplies for September", + ref_number="BILL-1234", + sales_tax_code_id="80000004-1234567890", + terms_id="80000013-1234567890", + vendor_address={ + "city": "San Francisco", + "country": "United States", + "line1": "548 Market St.", + "line2": "Suite 100", + "line3": "line3", + "line4": "line4", + "line5": "line5", + "note": "Conductor HQ", + "postal_code": "94110", + "state": "CA", + }, + vendor_id="80000001-1234567890", + ) + assert_matches_type(QbdBill, bill, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncConductor) -> None: + response = await async_client.qbd.bills.with_raw_response.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + bill = await response.parse() + assert_matches_type(QbdBill, bill, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncConductor) -> None: + async with async_client.qbd.bills.with_streaming_response.update( + id="123ABC-1234567890", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + bill = await response.parse() + assert_matches_type(QbdBill, bill, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncConductor) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.qbd.bills.with_raw_response.update( + id="", + transaction_date=parse_date("2019-12-27"), + version="1721172183", + conductor_end_user_id="end_usr_1234567abcdefg", + ) + @parametrize async def test_method_list(self, async_client: AsyncConductor) -> None: bill = await async_client.qbd.bills.list(