diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a2b1280b..b8af36c3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.28.1" + ".": "1.29.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f8bf2231..0369d429 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.29.0 (2023-11-06) + +Full Changelog: [v1.28.1...v1.29.0](https://github.com/orbcorp/orb-python/compare/v1.28.1...v1.29.0) + +### Features + +* **api:** remove unsupported params ([#33](https://github.com/orbcorp/orb-python/issues/33)) ([abd325f](https://github.com/orbcorp/orb-python/commit/abd325f78c1d58c30207bf69ba36b32229626fac)) + ## 1.28.1 (2023-11-06) Full Changelog: [v1.28.0...v1.28.1](https://github.com/orbcorp/orb-python/compare/v1.28.0...v1.28.1) diff --git a/pyproject.toml b/pyproject.toml index 3041c783..ecc89ebc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "orb-billing" -version = "1.28.1" +version = "1.29.0" description = "Client library for the orb API" readme = "README.md" license = "Apache-2.0" diff --git a/src/orb/_version.py b/src/orb/_version.py index 122a06f2..01754b4e 100644 --- a/src/orb/_version.py +++ b/src/orb/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. __title__ = "orb" -__version__ = "1.28.1" # x-release-please-version +__version__ = "1.29.0" # x-release-please-version diff --git a/src/orb/resources/customers/credits/ledger.py b/src/orb/resources/customers/credits/ledger.py index 02826212..c4332df3 100644 --- a/src/orb/resources/customers/credits/ledger.py +++ b/src/orb/resources/customers/credits/ledger.py @@ -107,7 +107,7 @@ def list( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (ex. trial credits with a $0 cost + the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. @@ -1985,7 +1985,7 @@ def list_by_external_id( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (ex. trial credits with a $0 cost + the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. @@ -2151,7 +2151,7 @@ def list( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (ex. trial credits with a $0 cost + the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. @@ -4029,7 +4029,7 @@ def list_by_external_id( deductions take place from a non-expiring credit block. If there are multiple blocks with the same expiration date, Orb will deduct from - the block with the _lower cost basis_ first (ex. trial credits with a $0 cost + the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid credits with a $5.00 cost basis). It's also possible for a single usage event's deduction to _span_ credit blocks. diff --git a/src/orb/resources/events/events.py b/src/orb/resources/events/events.py index 5ca49ca3..261798f4 100644 --- a/src/orb/resources/events/events.py +++ b/src/orb/resources/events/events.py @@ -75,7 +75,7 @@ def update( event in cases where you need to: - update an event with new metadata as you iterate on your pricing model - - update an event based on the result of an external API call (ex. call to a + - update an event based on the result of an external API call (e.g. call to a payment gateway succeeded or failed) This amendment API is always audit-safe. The process will still retain the @@ -174,7 +174,7 @@ def deprecate( event in cases where you need to: - no longer bill for an event that was improperly reported - - no longer bill for an event based on the result of an external API call (ex. + - no longer bill for an event based on the result of an external API call (e.g. call to a payment gateway failed and the user should not be billed) If you want to only change specific properties of an event, but keep the event @@ -478,14 +478,7 @@ def ingest( def search( self, *, - cursor: Optional[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - timestamp_gt: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - timestamp_gte: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - timestamp_lt: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - timestamp_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - event_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, - invoice_id: Optional[str] | NotGiven = NOT_GIVEN, + event_ids: List[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, @@ -507,10 +500,6 @@ def search( - `event_ids`: This is an explicit array of IDs to filter by. Note that an event's ID is the `idempotency_key` that was originally used for ingestion. - - `invoice_id`: This is an issued Orb invoice ID (see also - [List Invoices](list-invoices)). Orb will fetch all events that were used to - calculate the invoice. In the common case, this will be a list of events whose - `timestamp` property falls within the billing period specified by the invoice. By default, Orb does not return _deprecated_ events in this endpoint. @@ -518,20 +507,10 @@ def search( empty array for `data` instead. Args: - cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned - from the initial request. - - limit: The number of items to fetch. Defaults to 20. - event_ids: This is an explicit array of IDs to filter by. Note that an event's ID is the idempotency_key that was originally used for ingestion. Values in this array will be treated case sensitively. - invoice_id: This is an issued Orb invoice ID (see also List Invoices). Orb will fetch all - events that were used to calculate the invoice. In the common case, this will be - a list of events whose timestamp property falls within the billing period - specified by the invoice. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -544,30 +523,13 @@ def search( """ return self._post( "/events/search", - body=maybe_transform( - { - "event_ids": event_ids, - "invoice_id": invoice_id, - }, - event_search_params.EventSearchParams, - ), + body=maybe_transform({"event_ids": event_ids}, event_search_params.EventSearchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, idempotency_key=idempotency_key, - query=maybe_transform( - { - "cursor": cursor, - "limit": limit, - "timestamp_gt": timestamp_gt, - "timestamp_gte": timestamp_gte, - "timestamp_lt": timestamp_lt, - "timestamp_lte": timestamp_lte, - }, - event_search_params.EventSearchParams, - ), ), cast_to=EventSearchResponse, ) @@ -616,7 +578,7 @@ async def update( event in cases where you need to: - update an event with new metadata as you iterate on your pricing model - - update an event based on the result of an external API call (ex. call to a + - update an event based on the result of an external API call (e.g. call to a payment gateway succeeded or failed) This amendment API is always audit-safe. The process will still retain the @@ -715,7 +677,7 @@ async def deprecate( event in cases where you need to: - no longer bill for an event that was improperly reported - - no longer bill for an event based on the result of an external API call (ex. + - no longer bill for an event based on the result of an external API call (e.g. call to a payment gateway failed and the user should not be billed) If you want to only change specific properties of an event, but keep the event @@ -1019,14 +981,7 @@ async def ingest( async def search( self, *, - cursor: Optional[str] | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - timestamp_gt: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - timestamp_gte: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - timestamp_lt: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - timestamp_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN, - event_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, - invoice_id: Optional[str] | NotGiven = NOT_GIVEN, + event_ids: List[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, @@ -1048,10 +1003,6 @@ async def search( - `event_ids`: This is an explicit array of IDs to filter by. Note that an event's ID is the `idempotency_key` that was originally used for ingestion. - - `invoice_id`: This is an issued Orb invoice ID (see also - [List Invoices](list-invoices)). Orb will fetch all events that were used to - calculate the invoice. In the common case, this will be a list of events whose - `timestamp` property falls within the billing period specified by the invoice. By default, Orb does not return _deprecated_ events in this endpoint. @@ -1059,20 +1010,10 @@ async def search( empty array for `data` instead. Args: - cursor: Cursor for pagination. This can be populated by the `next_cursor` value returned - from the initial request. - - limit: The number of items to fetch. Defaults to 20. - event_ids: This is an explicit array of IDs to filter by. Note that an event's ID is the idempotency_key that was originally used for ingestion. Values in this array will be treated case sensitively. - invoice_id: This is an issued Orb invoice ID (see also List Invoices). Orb will fetch all - events that were used to calculate the invoice. In the common case, this will be - a list of events whose timestamp property falls within the billing period - specified by the invoice. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1085,30 +1026,13 @@ async def search( """ return await self._post( "/events/search", - body=maybe_transform( - { - "event_ids": event_ids, - "invoice_id": invoice_id, - }, - event_search_params.EventSearchParams, - ), + body=maybe_transform({"event_ids": event_ids}, event_search_params.EventSearchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, idempotency_key=idempotency_key, - query=maybe_transform( - { - "cursor": cursor, - "limit": limit, - "timestamp_gt": timestamp_gt, - "timestamp_gte": timestamp_gte, - "timestamp_lt": timestamp_lt, - "timestamp_lte": timestamp_lte, - }, - event_search_params.EventSearchParams, - ), ), cast_to=EventSearchResponse, ) diff --git a/src/orb/resources/subscriptions.py b/src/orb/resources/subscriptions.py index 5b87111b..7f5d29f1 100644 --- a/src/orb/resources/subscriptions.py +++ b/src/orb/resources/subscriptions.py @@ -464,7 +464,7 @@ def create( Orb supports invoicing for a subscription when a preconfigured usage threshold is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is specified in the subscription's invoicing currency, when creating a - subscription. Ex. pass in `10.00` to issue an invoice when usage amounts hit + subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit $10.00 for a subscription that invoices in USD. Args: @@ -2067,7 +2067,7 @@ async def create( Orb supports invoicing for a subscription when a preconfigured usage threshold is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is specified in the subscription's invoicing currency, when creating a - subscription. Ex. pass in `10.00` to issue an invoice when usage amounts hit + subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit $10.00 for a subscription that invoices in USD. Args: diff --git a/src/orb/types/event_search_params.py b/src/orb/types/event_search_params.py index e7882b48..1a4009b3 100644 --- a/src/orb/types/event_search_params.py +++ b/src/orb/types/event_search_params.py @@ -2,45 +2,16 @@ from __future__ import annotations -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Annotated, TypedDict - -from .._utils import PropertyInfo +from typing import List +from typing_extensions import Required, TypedDict __all__ = ["EventSearchParams"] class EventSearchParams(TypedDict, total=False): - cursor: Optional[str] - """Cursor for pagination. - - This can be populated by the `next_cursor` value returned from the initial - request. - """ - - limit: int - """The number of items to fetch. Defaults to 20.""" - - timestamp_gt: Annotated[Union[str, datetime, None], PropertyInfo(alias="timestamp[gt]", format="iso8601")] - - timestamp_gte: Annotated[Union[str, datetime, None], PropertyInfo(alias="timestamp[gte]", format="iso8601")] - - timestamp_lt: Annotated[Union[str, datetime, None], PropertyInfo(alias="timestamp[lt]", format="iso8601")] - - timestamp_lte: Annotated[Union[str, datetime, None], PropertyInfo(alias="timestamp[lte]", format="iso8601")] - - event_ids: Optional[List[str]] + event_ids: Required[List[str]] """This is an explicit array of IDs to filter by. Note that an event's ID is the idempotency_key that was originally used for ingestion. Values in this array will be treated case sensitively. """ - - invoice_id: Optional[str] - """This is an issued Orb invoice ID (see also List Invoices). - - Orb will fetch all events that were used to calculate the invoice. In the common - case, this will be a list of events whose timestamp property falls within the - billing period specified by the invoice. - """ diff --git a/src/orb/types/event_search_response.py b/src/orb/types/event_search_response.py index acaa276e..504388f3 100644 --- a/src/orb/types/event_search_response.py +++ b/src/orb/types/event_search_response.py @@ -5,7 +5,7 @@ from .._models import BaseModel -__all__ = ["EventSearchResponse", "Data", "PaginationMetadata"] +__all__ = ["EventSearchResponse", "Data"] class Data(BaseModel): @@ -43,13 +43,5 @@ class Data(BaseModel): """ -class PaginationMetadata(BaseModel): - has_more: bool - - next_cursor: Optional[str] - - class EventSearchResponse(BaseModel): data: List[Data] - - pagination_metadata: PaginationMetadata diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index a4e819db..9bdbc8c4 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -166,26 +166,16 @@ def test_raw_response_ingest(self, client: Orb) -> None: @parametrize def test_method_search(self, client: Orb) -> None: - event = client.events.search() - assert_matches_type(EventSearchResponse, event, path=["response"]) - - @parametrize - def test_method_search_with_all_params(self, client: Orb) -> None: event = client.events.search( - cursor="string", - limit=0, - timestamp_gt=parse_datetime("2019-12-27T18:11:19.117Z"), - timestamp_gte=parse_datetime("2019-12-27T18:11:19.117Z"), - timestamp_lt=parse_datetime("2019-12-27T18:11:19.117Z"), - timestamp_lte=parse_datetime("2019-12-27T18:11:19.117Z"), event_ids=["string", "string", "string"], - invoice_id="string", ) assert_matches_type(EventSearchResponse, event, path=["response"]) @parametrize def test_raw_response_search(self, client: Orb) -> None: - response = client.events.with_raw_response.search() + response = client.events.with_raw_response.search( + event_ids=["string", "string", "string"], + ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() assert_matches_type(EventSearchResponse, event, path=["response"]) @@ -336,26 +326,16 @@ async def test_raw_response_ingest(self, client: AsyncOrb) -> None: @parametrize async def test_method_search(self, client: AsyncOrb) -> None: - event = await client.events.search() - assert_matches_type(EventSearchResponse, event, path=["response"]) - - @parametrize - async def test_method_search_with_all_params(self, client: AsyncOrb) -> None: event = await client.events.search( - cursor="string", - limit=0, - timestamp_gt=parse_datetime("2019-12-27T18:11:19.117Z"), - timestamp_gte=parse_datetime("2019-12-27T18:11:19.117Z"), - timestamp_lt=parse_datetime("2019-12-27T18:11:19.117Z"), - timestamp_lte=parse_datetime("2019-12-27T18:11:19.117Z"), event_ids=["string", "string", "string"], - invoice_id="string", ) assert_matches_type(EventSearchResponse, event, path=["response"]) @parametrize async def test_raw_response_search(self, client: AsyncOrb) -> None: - response = await client.events.with_raw_response.search() + response = await client.events.with_raw_response.search( + event_ids=["string", "string", "string"], + ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() assert_matches_type(EventSearchResponse, event, path=["response"])