From 028221bd3fafe30ac1748211f25ad041143d43b7 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 9 Oct 2024 23:37:29 +0000
Subject: [PATCH] feat(api): api update (#57)
---
.stats.yml | 4 +-
api.md | 1 +
.../resources/qbd/date_driven_terms.py | 12 +-
src/conductor/resources/qbd/standard_terms.py | 142 +++++++++++++++++-
src/conductor/types/qbd/__init__.py | 1 +
src/conductor/types/qbd/date_driven_term.py | 6 +-
.../qbd/date_driven_term_create_params.py | 6 +-
src/conductor/types/qbd/qbd_standard_term.py | 6 +-
.../types/qbd/standard_term_create_params.py | 44 ++++++
.../api_resources/qbd/test_standard_terms.py | 97 +++++++++++-
10 files changed, 300 insertions(+), 19 deletions(-)
create mode 100644 src/conductor/types/qbd/standard_term_create_params.py
diff --git a/.stats.yml b/.stats.yml
index 7f91dc02..e76087cf 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 48
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-718574f99ce1ca403cfbfed1749f5ef4c78733d417d71ce29dcceb152e3b5cec.yml
+configured_endpoints: 49
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/conductor%2Fconductor-b72cbb29975fb7eb76998a0147cb708ab08c0084eec602f0d3e2751e2eecadb5.yml
diff --git a/api.md b/api.md
index e4bb9a58..be0f52e5 100644
--- a/api.md
+++ b/api.md
@@ -223,6 +223,7 @@ from conductor.types.qbd import QbdStandardTerm, StandardTermListResponse
Methods:
+- client.qbd.standard_terms.create(\*\*params) -> QbdStandardTerm
- client.qbd.standard_terms.retrieve(id) -> QbdStandardTerm
- client.qbd.standard_terms.list(\*\*params) -> StandardTermListResponse
diff --git a/src/conductor/resources/qbd/date_driven_terms.py b/src/conductor/resources/qbd/date_driven_terms.py
index ccbcc234..66172abd 100644
--- a/src/conductor/resources/qbd/date_driven_terms.py
+++ b/src/conductor/resources/qbd/date_driven_terms.py
@@ -77,10 +77,10 @@ def create(
`"Conductor-End-User-Id: {{END_USER_ID}}"`).
discount_day_of_month: The day of the month within which payment must be received to qualify for the
- discount defined by `discountPercentage`.
+ discount specified by `discountPercentage`.
- discount_percentage: The discount percentage applied to the payment if received by the
- `discountDayOfMonth`. The value is between 0 and 100.
+ discount_percentage: The discount percentage applied to the payment if received on or before the
+ specified `discountDayOfMonth`. The value is between 0 and 100.
grace_period_days: The number of days before `dueDayOfMonth` when an invoice or bill issued within
this threshold is considered due the following month. For example, with
@@ -321,10 +321,10 @@ async def create(
`"Conductor-End-User-Id: {{END_USER_ID}}"`).
discount_day_of_month: The day of the month within which payment must be received to qualify for the
- discount defined by `discountPercentage`.
+ discount specified by `discountPercentage`.
- discount_percentage: The discount percentage applied to the payment if received by the
- `discountDayOfMonth`. The value is between 0 and 100.
+ discount_percentage: The discount percentage applied to the payment if received on or before the
+ specified `discountDayOfMonth`. The value is between 0 and 100.
grace_period_days: The number of days before `dueDayOfMonth` when an invoice or bill issued within
this threshold is considered due the following month. For example, with
diff --git a/src/conductor/resources/qbd/standard_terms.py b/src/conductor/resources/qbd/standard_terms.py
index e4502f37..3436a8a6 100644
--- a/src/conductor/resources/qbd/standard_terms.py
+++ b/src/conductor/resources/qbd/standard_terms.py
@@ -19,7 +19,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from ...types.qbd import standard_term_list_params
+from ...types.qbd import standard_term_list_params, standard_term_create_params
from ..._base_client import make_request_options
from ...types.qbd.qbd_standard_term import QbdStandardTerm
from ...types.qbd.standard_term_list_response import StandardTermListResponse
@@ -47,6 +47,70 @@ def with_streaming_response(self) -> StandardTermsResourceWithStreamingResponse:
"""
return StandardTermsResourceWithStreamingResponse(self)
+ def create(
+ self,
+ *,
+ name: str,
+ conductor_end_user_id: str,
+ discount_days: float | NotGiven = NOT_GIVEN,
+ discount_percentage: str | NotGiven = NOT_GIVEN,
+ due_days: float | NotGiven = NOT_GIVEN,
+ is_active: bool | 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,
+ ) -> QbdStandardTerm:
+ """
+ Creates a standard term.
+
+ Args:
+ name: The case-insensitive unique name of this standard term, unique across all
+ standard terms.
+
+ conductor_end_user_id: The ID of the EndUser to receive this request (e.g.,
+ `"Conductor-End-User-Id: {{END_USER_ID}}"`).
+
+ discount_days: The number of days within which payment must be received to qualify for the
+ discount specified by `discountPercentage`.
+
+ discount_percentage: The discount percentage applied to the payment if received within the number of
+ days specified by `discountDays`. The value is between 0 and 100.
+
+ due_days: The number of days until payment is due.
+
+ is_active: Indicates whether this standard term is active. Inactive objects are typically
+ hidden from views and reports in QuickBooks.
+
+ 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/standard-terms",
+ body=maybe_transform(
+ {
+ "name": name,
+ "discount_days": discount_days,
+ "discount_percentage": discount_percentage,
+ "due_days": due_days,
+ "is_active": is_active,
+ },
+ standard_term_create_params.StandardTermCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=QbdStandardTerm,
+ )
+
def retrieve(
self,
id: str,
@@ -219,6 +283,70 @@ def with_streaming_response(self) -> AsyncStandardTermsResourceWithStreamingResp
"""
return AsyncStandardTermsResourceWithStreamingResponse(self)
+ async def create(
+ self,
+ *,
+ name: str,
+ conductor_end_user_id: str,
+ discount_days: float | NotGiven = NOT_GIVEN,
+ discount_percentage: str | NotGiven = NOT_GIVEN,
+ due_days: float | NotGiven = NOT_GIVEN,
+ is_active: bool | 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,
+ ) -> QbdStandardTerm:
+ """
+ Creates a standard term.
+
+ Args:
+ name: The case-insensitive unique name of this standard term, unique across all
+ standard terms.
+
+ conductor_end_user_id: The ID of the EndUser to receive this request (e.g.,
+ `"Conductor-End-User-Id: {{END_USER_ID}}"`).
+
+ discount_days: The number of days within which payment must be received to qualify for the
+ discount specified by `discountPercentage`.
+
+ discount_percentage: The discount percentage applied to the payment if received within the number of
+ days specified by `discountDays`. The value is between 0 and 100.
+
+ due_days: The number of days until payment is due.
+
+ is_active: Indicates whether this standard term is active. Inactive objects are typically
+ hidden from views and reports in QuickBooks.
+
+ 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/standard-terms",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "discount_days": discount_days,
+ "discount_percentage": discount_percentage,
+ "due_days": due_days,
+ "is_active": is_active,
+ },
+ standard_term_create_params.StandardTermCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=QbdStandardTerm,
+ )
+
async def retrieve(
self,
id: str,
@@ -375,6 +503,9 @@ class StandardTermsResourceWithRawResponse:
def __init__(self, standard_terms: StandardTermsResource) -> None:
self._standard_terms = standard_terms
+ self.create = to_raw_response_wrapper(
+ standard_terms.create,
+ )
self.retrieve = to_raw_response_wrapper(
standard_terms.retrieve,
)
@@ -387,6 +518,9 @@ class AsyncStandardTermsResourceWithRawResponse:
def __init__(self, standard_terms: AsyncStandardTermsResource) -> None:
self._standard_terms = standard_terms
+ self.create = async_to_raw_response_wrapper(
+ standard_terms.create,
+ )
self.retrieve = async_to_raw_response_wrapper(
standard_terms.retrieve,
)
@@ -399,6 +533,9 @@ class StandardTermsResourceWithStreamingResponse:
def __init__(self, standard_terms: StandardTermsResource) -> None:
self._standard_terms = standard_terms
+ self.create = to_streamed_response_wrapper(
+ standard_terms.create,
+ )
self.retrieve = to_streamed_response_wrapper(
standard_terms.retrieve,
)
@@ -411,6 +548,9 @@ class AsyncStandardTermsResourceWithStreamingResponse:
def __init__(self, standard_terms: AsyncStandardTermsResource) -> None:
self._standard_terms = standard_terms
+ self.create = async_to_streamed_response_wrapper(
+ standard_terms.create,
+ )
self.retrieve = async_to_streamed_response_wrapper(
standard_terms.retrieve,
)
diff --git a/src/conductor/types/qbd/__init__.py b/src/conductor/types/qbd/__init__.py
index c14747af..b1efec37 100644
--- a/src/conductor/types/qbd/__init__.py
+++ b/src/conductor/types/qbd/__init__.py
@@ -36,6 +36,7 @@
from .sales_tax_code_list_params import SalesTaxCodeListParams as SalesTaxCodeListParams
from .sales_tax_item_list_params import SalesTaxItemListParams as SalesTaxItemListParams
from .service_item_create_params import ServiceItemCreateParams as ServiceItemCreateParams
+from .standard_term_create_params import StandardTermCreateParams as StandardTermCreateParams
from .standard_term_list_response import StandardTermListResponse as StandardTermListResponse
from .date_driven_term_list_params import DateDrivenTermListParams as DateDrivenTermListParams
from .inventory_item_create_params import InventoryItemCreateParams as InventoryItemCreateParams
diff --git a/src/conductor/types/qbd/date_driven_term.py b/src/conductor/types/qbd/date_driven_term.py
index 67bba6e2..2cd323e6 100644
--- a/src/conductor/types/qbd/date_driven_term.py
+++ b/src/conductor/types/qbd/date_driven_term.py
@@ -28,13 +28,13 @@ class DateDrivenTerm(BaseModel):
discount_day_of_month: Optional[float] = FieldInfo(alias="discountDayOfMonth", default=None)
"""
The day of the month within which payment must be received to qualify for the
- discount defined by `discountPercentage`.
+ discount specified by `discountPercentage`.
"""
discount_percentage: Optional[str] = FieldInfo(alias="discountPercentage", default=None)
"""
- The discount percentage applied to the payment if received by the
- `discountDayOfMonth`. The value is between 0 and 100.
+ The discount percentage applied to the payment if received on or before the
+ specified `discountDayOfMonth`. The value is between 0 and 100.
"""
due_day_of_month: float = FieldInfo(alias="dueDayOfMonth")
diff --git a/src/conductor/types/qbd/date_driven_term_create_params.py b/src/conductor/types/qbd/date_driven_term_create_params.py
index 0319dabb..fb65d39b 100644
--- a/src/conductor/types/qbd/date_driven_term_create_params.py
+++ b/src/conductor/types/qbd/date_driven_term_create_params.py
@@ -28,13 +28,13 @@ class DateDrivenTermCreateParams(TypedDict, total=False):
discount_day_of_month: Annotated[float, PropertyInfo(alias="discountDayOfMonth")]
"""
The day of the month within which payment must be received to qualify for the
- discount defined by `discountPercentage`.
+ discount specified by `discountPercentage`.
"""
discount_percentage: Annotated[str, PropertyInfo(alias="discountPercentage")]
"""
- The discount percentage applied to the payment if received by the
- `discountDayOfMonth`. The value is between 0 and 100.
+ The discount percentage applied to the payment if received on or before the
+ specified `discountDayOfMonth`. The value is between 0 and 100.
"""
grace_period_days: Annotated[float, PropertyInfo(alias="gracePeriodDays")]
diff --git a/src/conductor/types/qbd/qbd_standard_term.py b/src/conductor/types/qbd/qbd_standard_term.py
index 784c7a47..c8783dad 100644
--- a/src/conductor/types/qbd/qbd_standard_term.py
+++ b/src/conductor/types/qbd/qbd_standard_term.py
@@ -28,13 +28,13 @@ class QbdStandardTerm(BaseModel):
discount_days: Optional[float] = FieldInfo(alias="discountDays", default=None)
"""
The number of days within which payment must be received to qualify for the
- discount defined by `discountPercentage`.
+ discount specified by `discountPercentage`.
"""
discount_percentage: Optional[str] = FieldInfo(alias="discountPercentage", default=None)
"""
- The discount percentage applied to the payment if received within `discountDays`
- number of days. The value is between 0 and 100.
+ The discount percentage applied to the payment if received within the number of
+ days specified by `discountDays`. The value is between 0 and 100.
"""
due_days: Optional[float] = FieldInfo(alias="dueDays", default=None)
diff --git a/src/conductor/types/qbd/standard_term_create_params.py b/src/conductor/types/qbd/standard_term_create_params.py
new file mode 100644
index 00000000..9499afff
--- /dev/null
+++ b/src/conductor/types/qbd/standard_term_create_params.py
@@ -0,0 +1,44 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, Annotated, TypedDict
+
+from ..._utils import PropertyInfo
+
+__all__ = ["StandardTermCreateParams"]
+
+
+class StandardTermCreateParams(TypedDict, total=False):
+ name: Required[str]
+ """
+ The case-insensitive unique name of this standard term, unique across all
+ standard terms.
+ """
+
+ 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}}"`).
+ """
+
+ discount_days: Annotated[float, PropertyInfo(alias="discountDays")]
+ """
+ The number of days within which payment must be received to qualify for the
+ discount specified by `discountPercentage`.
+ """
+
+ discount_percentage: Annotated[str, PropertyInfo(alias="discountPercentage")]
+ """
+ The discount percentage applied to the payment if received within the number of
+ days specified by `discountDays`. The value is between 0 and 100.
+ """
+
+ due_days: Annotated[float, PropertyInfo(alias="dueDays")]
+ """The number of days until payment is due."""
+
+ is_active: Annotated[bool, PropertyInfo(alias="isActive")]
+ """Indicates whether this standard term is active.
+
+ Inactive objects are typically hidden from views and reports in QuickBooks.
+ """
diff --git a/tests/api_resources/qbd/test_standard_terms.py b/tests/api_resources/qbd/test_standard_terms.py
index 8c2b1b80..acd62ae7 100644
--- a/tests/api_resources/qbd/test_standard_terms.py
+++ b/tests/api_resources/qbd/test_standard_terms.py
@@ -9,7 +9,10 @@
from conductor import Conductor, AsyncConductor
from tests.utils import assert_matches_type
-from conductor.types.qbd import QbdStandardTerm, StandardTermListResponse
+from conductor.types.qbd import (
+ QbdStandardTerm,
+ StandardTermListResponse,
+)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -17,6 +20,52 @@
class TestStandardTerms:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ def test_method_create(self, client: Conductor) -> None:
+ standard_term = client.qbd.standard_terms.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ )
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Conductor) -> None:
+ standard_term = client.qbd.standard_terms.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ discount_days=10,
+ discount_percentage="10",
+ due_days=30,
+ is_active=True,
+ )
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Conductor) -> None:
+ response = client.qbd.standard_terms.with_raw_response.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ standard_term = response.parse()
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Conductor) -> None:
+ with client.qbd.standard_terms.with_streaming_response.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ standard_term = response.parse()
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
def test_method_retrieve(self, client: Conductor) -> None:
standard_term = client.qbd.standard_terms.retrieve(
@@ -112,6 +161,52 @@ def test_streaming_response_list(self, client: Conductor) -> None:
class TestAsyncStandardTerms:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ async def test_method_create(self, async_client: AsyncConductor) -> None:
+ standard_term = await async_client.qbd.standard_terms.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ )
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncConductor) -> None:
+ standard_term = await async_client.qbd.standard_terms.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ discount_days=10,
+ discount_percentage="10",
+ due_days=30,
+ is_active=True,
+ )
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncConductor) -> None:
+ response = await async_client.qbd.standard_terms.with_raw_response.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ standard_term = await response.parse()
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncConductor) -> None:
+ async with async_client.qbd.standard_terms.with_streaming_response.create(
+ name="Net 30",
+ conductor_end_user_id="end_usr_1234567abcdefg",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ standard_term = await response.parse()
+ assert_matches_type(QbdStandardTerm, standard_term, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
@parametrize
async def test_method_retrieve(self, async_client: AsyncConductor) -> None:
standard_term = await async_client.qbd.standard_terms.retrieve(