Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 1.29.0 #34

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.28.1"
".": "1.29.0"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/orb/_version.py
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions src/orb/resources/customers/credits/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
92 changes: 8 additions & 84 deletions src/orb/resources/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -507,31 +500,17 @@ 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.

By default, Orb will not throw a `404` if no events matched, Orb will return an
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
Expand All @@ -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,
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -1048,31 +1003,17 @@ 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.

By default, Orb will not throw a `404` if no events matched, Orb will return an
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
Expand All @@ -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,
)
Expand Down
4 changes: 2 additions & 2 deletions src/orb/resources/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
35 changes: 3 additions & 32 deletions src/orb/types/event_search_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
10 changes: 1 addition & 9 deletions src/orb/types/event_search_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from .._models import BaseModel

__all__ = ["EventSearchResponse", "Data", "PaginationMetadata"]
__all__ = ["EventSearchResponse", "Data"]


class Data(BaseModel):
Expand Down Expand Up @@ -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
Loading