Skip to content

feat(api): updates #270

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
May 13, 2024
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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 89
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-762f50aa6ea13f42e719339aa5cb31233984499720a7be832182357f949927a1.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb-03945a99974ac1e7218fd458dceef31887a249cc048bcbbbe3828c1d893f95ea.yml
20 changes: 8 additions & 12 deletions src/orb/resources/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,10 @@ def ingest(
We validate the following:

- Exactly one of `customer_id` and `external_customer_id` should be specified.
- If specified, `customer_id` must identify a Customer resource within Orb. We
do not support sending events for customers that have not been provisioned.
Similarly, if specified, `external_customer_id` must be an identifier that is
associated with an Orb Customer resource. Note: During our initial integration
period, this enforcement will be temporarily turned into a warning to ensure
smooth customer migration.
- If the `customer_id` is specified, the customer in Orb must exist.
- If the `external_customer_id` is specified, the customer in Orb does not need
to exist. Events will be attributed to any future customers with the
`external_customer_id` on subscription creation.
- `timestamp` must conform to ISO 8601 and represent a timestamp at most 1 hour
in the future. This timestamp should be sent in UTC timezone (no timezone
offset).
Expand Down Expand Up @@ -900,12 +898,10 @@ async def ingest(
We validate the following:

- Exactly one of `customer_id` and `external_customer_id` should be specified.
- If specified, `customer_id` must identify a Customer resource within Orb. We
do not support sending events for customers that have not been provisioned.
Similarly, if specified, `external_customer_id` must be an identifier that is
associated with an Orb Customer resource. Note: During our initial integration
period, this enforcement will be temporarily turned into a warning to ensure
smooth customer migration.
- If the `customer_id` is specified, the customer in Orb must exist.
- If the `external_customer_id` is specified, the customer in Orb does not need
to exist. Events will be attributed to any future customers with the
`external_customer_id` on subscription creation.
- `timestamp` must conform to ISO 8601 and represent a timestamp at most 1 hour
in the future. This timestamp should be sent in UTC timezone (no timezone
offset).
Expand Down
8 changes: 4 additions & 4 deletions src/orb/resources/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def create(
invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[str] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[float] | NotGiven = NOT_GIVEN,
plan_id: Optional[str] | NotGiven = NOT_GIVEN,
price_overrides: Optional[Iterable[subscription_create_params.PriceOverride]] | NotGiven = NOT_GIVEN,
start_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1366,7 +1366,7 @@ def schedule_plan_change(
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
initial_phase_order: Optional[int] | NotGiven = NOT_GIVEN,
invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[str] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[float] | NotGiven = NOT_GIVEN,
plan_id: Optional[str] | NotGiven = NOT_GIVEN,
price_overrides: Optional[Iterable[subscription_schedule_plan_change_params.PriceOverride]]
| NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1784,7 +1784,7 @@ async def create(
invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN,
metadata: Optional[Dict[str, Optional[str]]] | NotGiven = NOT_GIVEN,
net_terms: Optional[int] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[str] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[float] | NotGiven = NOT_GIVEN,
plan_id: Optional[str] | NotGiven = NOT_GIVEN,
price_overrides: Optional[Iterable[subscription_create_params.PriceOverride]] | NotGiven = NOT_GIVEN,
start_date: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -3078,7 +3078,7 @@ async def schedule_plan_change(
external_plan_id: Optional[str] | NotGiven = NOT_GIVEN,
initial_phase_order: Optional[int] | NotGiven = NOT_GIVEN,
invoicing_threshold: Optional[str] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[str] | NotGiven = NOT_GIVEN,
per_credit_overage_amount: Optional[float] | NotGiven = NOT_GIVEN,
plan_id: Optional[str] | NotGiven = NOT_GIVEN,
price_overrides: Optional[Iterable[subscription_schedule_plan_change_params.PriceOverride]]
| NotGiven = NOT_GIVEN,
Expand Down
2 changes: 1 addition & 1 deletion src/orb/types/subscription_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class SubscriptionCreateParams(TypedDict, total=False):

net_terms: Optional[int]

per_credit_overage_amount: Optional[str]
per_credit_overage_amount: Optional[float]

plan_id: Optional[str]
"""The plan that the given subscription should be switched to.
Expand Down
2 changes: 1 addition & 1 deletion src/orb/types/subscription_schedule_plan_change_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class SubscriptionSchedulePlanChangeParams(TypedDict, total=False):
at the end of the billing period.
"""

per_credit_overage_amount: Optional[str]
per_credit_overage_amount: Optional[float]

plan_id: Optional[str]
"""The plan that the given subscription should be switched to.
Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/coupons/test_subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
subscription = client.coupons.subscriptions.list(
"string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[Subscription], subscription, path=["response"])

Expand Down Expand Up @@ -81,7 +81,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
subscription = await async_client.coupons.subscriptions.list(
"string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[Subscription], subscription, path=["response"])

Expand Down
8 changes: 4 additions & 4 deletions tests/api_resources/customers/credits/test_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
cursor="string",
entry_status="committed",
entry_type="increment",
limit=0,
limit=1,
minimum_amount="string",
)
assert_matches_type(SyncPage[LedgerListResponse], ledger, path=["response"])
Expand Down Expand Up @@ -732,7 +732,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None:
cursor="string",
entry_status="committed",
entry_type="increment",
limit=0,
limit=1,
minimum_amount="string",
)
assert_matches_type(SyncPage[LedgerListByExternalIDResponse], ledger, path=["response"])
Expand Down Expand Up @@ -791,7 +791,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
cursor="string",
entry_status="committed",
entry_type="increment",
limit=0,
limit=1,
minimum_amount="string",
)
assert_matches_type(AsyncPage[LedgerListResponse], ledger, path=["response"])
Expand Down Expand Up @@ -1480,7 +1480,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As
cursor="string",
entry_status="committed",
entry_type="increment",
limit=0,
limit=1,
minimum_amount="string",
)
assert_matches_type(AsyncPage[LedgerListByExternalIDResponse], ledger, path=["response"])
Expand Down
8 changes: 4 additions & 4 deletions tests/api_resources/customers/credits/test_top_ups.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
top_up = client.customers.credits.top_ups.list(
"string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[TopUpListResponse], top_up, path=["response"])

Expand Down Expand Up @@ -356,7 +356,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None:
top_up = client.customers.credits.top_ups.list_by_external_id(
"string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[TopUpListByExternalIDResponse], top_up, path=["response"])

Expand Down Expand Up @@ -496,7 +496,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
top_up = await async_client.customers.credits.top_ups.list(
"string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[TopUpListResponse], top_up, path=["response"])

Expand Down Expand Up @@ -728,7 +728,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As
top_up = await async_client.customers.credits.top_ups.list_by_external_id(
"string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[TopUpListByExternalIDResponse], top_up, path=["response"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/customers/test_balance_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
balance_transaction = client.customers.balance_transactions.list(
"string",
cursor="string",
limit=0,
limit=1,
operation_time_gt=parse_datetime("2019-12-27T18:11:19.117Z"),
operation_time_gte=parse_datetime("2019-12-27T18:11:19.117Z"),
operation_time_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
Expand Down Expand Up @@ -201,7 +201,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
balance_transaction = await async_client.customers.balance_transactions.list(
"string",
cursor="string",
limit=0,
limit=1,
operation_time_gt=parse_datetime("2019-12-27T18:11:19.117Z"),
operation_time_gte=parse_datetime("2019-12-27T18:11:19.117Z"),
operation_time_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
Expand Down
8 changes: 4 additions & 4 deletions tests/api_resources/customers/test_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
"string",
currency="string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[CreditListResponse], credit, path=["response"])

Expand Down Expand Up @@ -82,7 +82,7 @@ def test_method_list_by_external_id_with_all_params(self, client: Orb) -> None:
"string",
currency="string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[CreditListByExternalIDResponse], credit, path=["response"])

Expand Down Expand Up @@ -134,7 +134,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
"string",
currency="string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[CreditListResponse], credit, path=["response"])

Expand Down Expand Up @@ -182,7 +182,7 @@ async def test_method_list_by_external_id_with_all_params(self, async_client: As
"string",
currency="string",
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[CreditListByExternalIDResponse], credit, path=["response"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/events/test_backfills.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_method_list(self, client: Orb) -> None:
def test_method_list_with_all_params(self, client: Orb) -> None:
backfill = client.events.backfills.list(
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[BackfillListResponse], backfill, path=["response"])

Expand Down Expand Up @@ -277,7 +277,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None:
async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None:
backfill = await async_client.events.backfills.list(
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[BackfillListResponse], backfill, path=["response"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
cursor="string",
customer_id="string",
external_customer_id="string",
limit=0,
limit=1,
subscription_id="string",
)
assert_matches_type(SyncPage[Alert], alert, path=["response"])
Expand Down Expand Up @@ -410,7 +410,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
cursor="string",
customer_id="string",
external_customer_id="string",
limit=0,
limit=1,
subscription_id="string",
)
assert_matches_type(AsyncPage[Alert], alert, path=["response"])
Expand Down
8 changes: 4 additions & 4 deletions tests/api_resources/test_coupons.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_method_create_with_all_params(self, client: Orb) -> None:
},
redemption_code="HALFOFF",
duration_in_months=12,
max_redemptions=0,
max_redemptions=1,
)
assert_matches_type(Coupon, coupon, path=["response"])

Expand Down Expand Up @@ -83,7 +83,7 @@ def test_method_list(self, client: Orb) -> None:
def test_method_list_with_all_params(self, client: Orb) -> None:
coupon = client.coupons.list(
cursor="string",
limit=0,
limit=1,
redemption_code="string",
show_archived=True,
)
Expand Down Expand Up @@ -209,7 +209,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOrb) -> No
},
redemption_code="HALFOFF",
duration_in_months=12,
max_redemptions=0,
max_redemptions=1,
)
assert_matches_type(Coupon, coupon, path=["response"])

Expand Down Expand Up @@ -254,7 +254,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None:
async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None:
coupon = await async_client.coupons.list(
cursor="string",
limit=0,
limit=1,
redemption_code="string",
show_archived=True,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_credit_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_method_list(self, client: Orb) -> None:
def test_method_list_with_all_params(self, client: Orb) -> None:
credit_note = client.credit_notes.list(
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[CreditNote], credit_note, path=["response"])

Expand Down Expand Up @@ -102,7 +102,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None:
async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None:
credit_note = await async_client.credit_notes.list(
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[CreditNote], credit_note, path=["response"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[Customer], customer, path=["response"])

Expand Down Expand Up @@ -652,7 +652,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[Customer], customer, path=["response"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_invoices.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
invoice_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
invoice_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
is_recurring=True,
limit=0,
limit=1,
status=["draft", "issued", "paid"],
subscription_id="string",
)
Expand Down Expand Up @@ -632,7 +632,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
invoice_date_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
invoice_date_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
is_recurring=True,
limit=0,
limit=1,
status=["draft", "issued", "paid"],
subscription_id="string",
)
Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_method_list(self, client: Orb) -> None:
def test_method_list_with_all_params(self, client: Orb) -> None:
item = client.items.list(
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[Item], item, path=["response"])

Expand Down Expand Up @@ -164,7 +164,7 @@ async def test_method_list(self, async_client: AsyncOrb) -> None:
async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None:
item = await async_client.items.list(
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[Item], item, path=["response"])

Expand Down
4 changes: 2 additions & 2 deletions tests/api_resources/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_method_list_with_all_params(self, client: Orb) -> None:
created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(SyncPage[MetricListResponse], metric, path=["response"])

Expand Down Expand Up @@ -217,7 +217,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOrb) -> None
created_at_lt=parse_datetime("2019-12-27T18:11:19.117Z"),
created_at_lte=parse_datetime("2019-12-27T18:11:19.117Z"),
cursor="string",
limit=0,
limit=1,
)
assert_matches_type(AsyncPage[MetricListResponse], metric, path=["response"])

Expand Down
Loading