Skip to content

feat(api): updates #8

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

Merged
merged 1 commit into from
Oct 26, 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
12 changes: 9 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Shared Types

```python
from orb.types import Discount
```

# TopLevel

Types:
Expand Down Expand Up @@ -196,7 +202,7 @@ Methods:
Types:

```python
from orb.types import Invoice, InvoiceDiscount, InvoiceFetchUpcomingResponse
from orb.types import Invoice, InvoiceFetchUpcomingResponse
```

Methods:
Expand Down Expand Up @@ -263,7 +269,7 @@ Methods:
Types:

```python
from orb.types import Discount, Price
from orb.types import Price
```

Methods:
Expand All @@ -285,8 +291,8 @@ Types:
```python
from orb.types import (
Subscription,
Subscriptions,
SubscriptionUsage,
Subscriptions,
SubscriptionFetchCostsResponse,
SubscriptionFetchScheduleResponse,
)
Expand Down
4 changes: 2 additions & 2 deletions src/orb/resources/coupons/coupons.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, client: Orb) -> None:
def create(
self,
*,
discount: object,
discount: coupon_create_params.Discount,
redemption_code: str,
duration_in_months: Optional[int] | NotGiven = NOT_GIVEN,
max_redemptions: Optional[int] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -232,7 +232,7 @@ def __init__(self, client: AsyncOrb) -> None:
async def create(
self,
*,
discount: object,
discount: coupon_create_params.Discount,
redemption_code: str,
duration_in_months: Optional[int] | NotGiven = NOT_GIVEN,
max_redemptions: Optional[int] | NotGiven = NOT_GIVEN,
Expand Down
510 changes: 510 additions & 0 deletions src/orb/resources/customers/customers.py

Large diffs are not rendered by default.

182 changes: 41 additions & 141 deletions src/orb/resources/customers/usage.py

Large diffs are not rendered by default.

160 changes: 80 additions & 80 deletions src/orb/resources/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,47 +246,47 @@ def ingest(
Events are the starting point for all usage calculations in the system, and are
simple at their core:

```json
```ts
{
// customer_id and external_customer_id are used to
// attribute usage to a given Customer. Exactly one of these
// should be specified in a given ingestion event.

// `customer_id` is the Orb generated identifier for the Customer,
// which is returned from the Create customer API call.
customer_id: string,

// external_customer_id is an alternate identifier which is associated
// with a Customer at creation time. This is treated as an alias for
// customer_id, and is usually set to an identifier native to your system.
external_customer_id: string,

// A string name identifying the event, usually a usage
// action. By convention, this should not contain any whitespace.
event_name: string,

// An ISO 8601 format date with no timezone offset.
// This should represent the time that usage occurred
// and is important to attribute usage to a given
// billing period. See the notes below on determining the timestamp.
// e.g. 2020-12-09T16:09:53Z
timestamp: string,

// A unique value, generated by the client, that is
// used to de-duplicate events.
// Exactly one event with a given
// idempotency key will be ingested, which allows for
// safe request retries.
idempotency_key: string

// Optional custom metadata to attach to the event.
// This might include a numeric value used for aggregation,
// or a string/boolean value used for filtering.
// The schema of this dictionary need not be pre-declared, and
// properties can be added at any time.
properties: {
[key: string]?: string | number | boolean,
},
// customer_id and external_customer_id are used to
// attribute usage to a given Customer. Exactly one of these
// should be specified in a given ingestion event.

// `customer_id` is the Orb generated identifier for the Customer,
// which is returned from the Create customer API call.
customer_id: string,

// external_customer_id is an alternate identifier which is associated
// with a Customer at creation time. This is treated as an alias for
// customer_id, and is usually set to an identifier native to your system.
external_customer_id: string,

// A string name identifying the event, usually a usage
// action. By convention, this should not contain any whitespace.
event_name: string,

// An ISO 8601 format date with no timezone offset.
// This should represent the time that usage occurred
// and is important to attribute usage to a given
// billing period. See the notes below on determining the timestamp.
// e.g. 2020-12-09T16:09:53Z
timestamp: string,

// A unique value, generated by the client, that is
// used to de-duplicate events.
// Exactly one event with a given
// idempotency key will be ingested, which allows for
// safe request retries.
idempotency_key: string

// Optional custom metadata to attach to the event.
// This might include a numeric value used for aggregation,
// or a string/boolean value used for filtering.
// The schema of this dictionary need not be pre-declared, and
// properties can be added at any time.
properties: {
[key: string]?: string | number | boolean,
},
}
```

Expand Down Expand Up @@ -785,47 +785,47 @@ async def ingest(
Events are the starting point for all usage calculations in the system, and are
simple at their core:

```json
```ts
{
// customer_id and external_customer_id are used to
// attribute usage to a given Customer. Exactly one of these
// should be specified in a given ingestion event.

// `customer_id` is the Orb generated identifier for the Customer,
// which is returned from the Create customer API call.
customer_id: string,

// external_customer_id is an alternate identifier which is associated
// with a Customer at creation time. This is treated as an alias for
// customer_id, and is usually set to an identifier native to your system.
external_customer_id: string,

// A string name identifying the event, usually a usage
// action. By convention, this should not contain any whitespace.
event_name: string,

// An ISO 8601 format date with no timezone offset.
// This should represent the time that usage occurred
// and is important to attribute usage to a given
// billing period. See the notes below on determining the timestamp.
// e.g. 2020-12-09T16:09:53Z
timestamp: string,

// A unique value, generated by the client, that is
// used to de-duplicate events.
// Exactly one event with a given
// idempotency key will be ingested, which allows for
// safe request retries.
idempotency_key: string

// Optional custom metadata to attach to the event.
// This might include a numeric value used for aggregation,
// or a string/boolean value used for filtering.
// The schema of this dictionary need not be pre-declared, and
// properties can be added at any time.
properties: {
[key: string]?: string | number | boolean,
},
// customer_id and external_customer_id are used to
// attribute usage to a given Customer. Exactly one of these
// should be specified in a given ingestion event.

// `customer_id` is the Orb generated identifier for the Customer,
// which is returned from the Create customer API call.
customer_id: string,

// external_customer_id is an alternate identifier which is associated
// with a Customer at creation time. This is treated as an alias for
// customer_id, and is usually set to an identifier native to your system.
external_customer_id: string,

// A string name identifying the event, usually a usage
// action. By convention, this should not contain any whitespace.
event_name: string,

// An ISO 8601 format date with no timezone offset.
// This should represent the time that usage occurred
// and is important to attribute usage to a given
// billing period. See the notes below on determining the timestamp.
// e.g. 2020-12-09T16:09:53Z
timestamp: string,

// A unique value, generated by the client, that is
// used to de-duplicate events.
// Exactly one event with a given
// idempotency key will be ingested, which allows for
// safe request retries.
idempotency_key: string

// Optional custom metadata to attach to the event.
// This might include a numeric value used for aggregation,
// or a string/boolean value used for filtering.
// The schema of this dictionary need not be pre-declared, and
// properties can be added at any time.
properties: {
[key: string]?: string | number | boolean,
},
}
```

Expand Down
4 changes: 2 additions & 2 deletions src/orb/resources/invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def list(
invoice_date_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
is_recurring: Optional[bool] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] | NotGiven = NOT_GIVEN,
status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] | NotGiven = NOT_GIVEN,
subscription_id: Optional[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.
Expand Down Expand Up @@ -513,7 +513,7 @@ def list(
invoice_date_lte: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
is_recurring: Optional[bool] | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
status: Optional[Literal["draft", "issued", "paid", "synced", "void"]] | NotGiven = NOT_GIVEN,
status: Optional[List[Literal["draft", "issued", "paid", "synced", "void"]]] | NotGiven = NOT_GIVEN,
subscription_id: Optional[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.
Expand Down
4 changes: 2 additions & 2 deletions src/orb/resources/plans/plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def create(
*,
currency: str,
name: str,
prices: List[object],
prices: List[plan_create_params.Price],
default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN,
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -273,7 +273,7 @@ async def create(
*,
currency: str,
name: str,
prices: List[object],
prices: List[plan_create_params.Price],
default_invoice_memo: Optional[str] | NotGiven = NOT_GIVEN,
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[object] | NotGiven = NOT_GIVEN,
Expand Down
Loading