Skip to content

feat(api): manual updates #572

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
Mar 5, 2025
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
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ from orb.types import (
ReplaceSubscriptionPriceParams,
TrialDiscount,
UpdatePriceRequestParams,
UsageDiscount,
)
```

Expand Down
1 change: 1 addition & 0 deletions src/orb/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .shared import (
Discount as Discount,
TrialDiscount as TrialDiscount,
UsageDiscount as UsageDiscount,
AmountDiscount as AmountDiscount,
PaginationMetadata as PaginationMetadata,
PercentageDiscount as PercentageDiscount,
Expand Down
1 change: 1 addition & 0 deletions src/orb/types/shared/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from .discount import Discount as Discount
from .trial_discount import TrialDiscount as TrialDiscount
from .usage_discount import UsageDiscount as UsageDiscount
from .amount_discount import AmountDiscount as AmountDiscount
from .pagination_metadata import PaginationMetadata as PaginationMetadata
from .percentage_discount import PercentageDiscount as PercentageDiscount
Expand Down
27 changes: 4 additions & 23 deletions src/orb/types/shared/discount.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias
from typing import Union
from typing_extensions import Annotated, TypeAlias

from ..._utils import PropertyInfo
from ..._models import BaseModel
from .trial_discount import TrialDiscount
from .usage_discount import UsageDiscount
from .amount_discount import AmountDiscount
from .percentage_discount import PercentageDiscount

__all__ = ["Discount", "UsageDiscount"]


class UsageDiscount(BaseModel):
applies_to_price_ids: List[str]
"""List of price_ids that this discount applies to.

For plan/plan phase discounts, this can be a subset of prices.
"""

discount_type: Literal["usage"]

usage_discount: float
"""Only available if discount_type is `usage`.

Number of usage units that this discount is for
"""

reason: Optional[str] = None

__all__ = ["Discount"]

Discount: TypeAlias = Annotated[
Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount], PropertyInfo(discriminator="discount_type")
Expand Down
26 changes: 26 additions & 0 deletions src/orb/types/shared/usage_discount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing_extensions import Literal

from ..._models import BaseModel

__all__ = ["UsageDiscount"]


class UsageDiscount(BaseModel):
applies_to_price_ids: List[str]
"""List of price_ids that this discount applies to.

For plan/plan phase discounts, this can be a subset of prices.
"""

discount_type: Literal["usage"]

usage_discount: float
"""Only available if discount_type is `usage`.

Number of usage units that this discount is for
"""

reason: Optional[str] = None
1 change: 1 addition & 0 deletions src/orb/types/shared_params/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from .discount import Discount as Discount
from .trial_discount import TrialDiscount as TrialDiscount
from .usage_discount import UsageDiscount as UsageDiscount
from .amount_discount import AmountDiscount as AmountDiscount
from .percentage_discount import PercentageDiscount as PercentageDiscount
from .billing_cycle_relative_date import BillingCycleRelativeDate as BillingCycleRelativeDate
Expand Down
26 changes: 4 additions & 22 deletions src/orb/types/shared_params/discount.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,14 @@

from __future__ import annotations

from typing import List, Union, Optional
from typing_extensions import Literal, Required, TypeAlias, TypedDict
from typing import Union
from typing_extensions import TypeAlias

from .trial_discount import TrialDiscount
from .usage_discount import UsageDiscount
from .amount_discount import AmountDiscount
from .percentage_discount import PercentageDiscount

__all__ = ["Discount", "UsageDiscount"]


class UsageDiscount(TypedDict, total=False):
applies_to_price_ids: Required[List[str]]
"""List of price_ids that this discount applies to.

For plan/plan phase discounts, this can be a subset of prices.
"""

discount_type: Required[Literal["usage"]]

usage_discount: Required[float]
"""Only available if discount_type is `usage`.

Number of usage units that this discount is for
"""

reason: Optional[str]

__all__ = ["Discount"]

Discount: TypeAlias = Union[PercentageDiscount, TrialDiscount, UsageDiscount, AmountDiscount]
26 changes: 26 additions & 0 deletions src/orb/types/shared_params/usage_discount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List, Optional
from typing_extensions import Literal, Required, TypedDict

__all__ = ["UsageDiscount"]


class UsageDiscount(TypedDict, total=False):
applies_to_price_ids: Required[List[str]]
"""List of price_ids that this discount applies to.

For plan/plan phase discounts, this can be a subset of prices.
"""

discount_type: Required[Literal["usage"]]

usage_discount: Required[float]
"""Only available if discount_type is `usage`.

Number of usage units that this discount is for
"""

reason: Optional[str]