Skip to content
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
89 changes: 89 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.20.0
3.21.0
2 changes: 2 additions & 0 deletions chargebee/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(
self.Event = chargebee.Event(self.env)
self.Export = chargebee.Export(self.env)
self.Feature = chargebee.Feature(self.env)
self.FilterCondition = chargebee.FilterCondition(self.env)
self.GatewayErrorDetail = chargebee.GatewayErrorDetail(self.env)
self.Gift = chargebee.Gift(self.env)
self.Hierarchy = chargebee.Hierarchy(self.env)
Expand Down Expand Up @@ -120,6 +121,7 @@ def __init__(
self.PromotionalCredit = chargebee.PromotionalCredit(self.env)
self.Purchase = chargebee.Purchase(self.env)
self.Quote = chargebee.Quote(self.env)
self.QuoteEntitlement = chargebee.QuoteEntitlement(self.env)
self.QuoteLineGroup = chargebee.QuoteLineGroup(self.env)
self.QuotedCharge = chargebee.QuotedCharge(self.env)
self.QuotedDeltaRamp = chargebee.QuotedDeltaRamp(self.env)
Expand Down
7 changes: 6 additions & 1 deletion chargebee/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
AccountReceivablesHandling,
AccountType,
Action,
AlarmStatus,
ApiVersion,
ApplyOn,
AutoCollection,
Expand Down Expand Up @@ -47,6 +48,7 @@
InvoiceDunningHandling,
ItemType,
Layout,
Mode,
NotifyReferralSystem,
OfflinePaymentMethod,
OnEvent,
Expand Down Expand Up @@ -88,7 +90,6 @@
VoucherType,
WindowSize,
ChargeOn,
AlertStatus,
EnabledEvents,
)

Expand Down Expand Up @@ -162,6 +163,8 @@

from chargebee.models.feature.operations import Feature

from chargebee.models.filter_condition.operations import FilterCondition

from chargebee.models.gateway_error_detail.operations import GatewayErrorDetail

from chargebee.models.gift.operations import Gift
Expand Down Expand Up @@ -256,6 +259,8 @@

from chargebee.models.quote.operations import Quote

from chargebee.models.quote_entitlement.operations import QuoteEntitlement

from chargebee.models.quote_line_group.operations import QuoteLineGroup

from chargebee.models.quoted_charge.operations import QuotedCharge
Expand Down
150 changes: 144 additions & 6 deletions chargebee/models/alert/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from chargebee import request, environment
from typing import TypedDict, Required, NotRequired, Dict, List, Any, cast
from enum import Enum
from chargebee.filters import Filters
from chargebee.models import enums, filter_condition


@dataclass
Expand All @@ -15,11 +17,147 @@ class Status(Enum):
def __str__(self):
return self.value

class Scope(Enum):
GLOBAL = "global"
SUBSCRIPTION = "subscription"
class CreateThresholdParams(TypedDict):
mode: Required[enums.Mode]
value: Required[float]

def __str__(self):
return self.value
class CreateFilterConditionParams(TypedDict):
field: NotRequired["filter_condition.FilterCondition.Field"]
operator: NotRequired["filter_condition.FilterCondition.Operator"]
value: NotRequired[str]

class UpdateThresholdParams(TypedDict):
mode: NotRequired[enums.Mode]
value: NotRequired[float]

class CreateParams(TypedDict):
type: Required[enums.Type]
name: Required[str]
description: NotRequired[str]
metered_feature_id: Required[str]
subscription_id: NotRequired[str]
threshold: Required["Alert.CreateThresholdParams"]
meta: NotRequired[str]
filter_conditions: NotRequired[List["Alert.CreateFilterConditionParams"]]

class ListParams(TypedDict):
limit: NotRequired[int]
offset: NotRequired[str]
id: NotRequired[Filters.StringFilter]
type: NotRequired[Filters.EnumFilter]
subscription_id: NotRequired[Filters.StringFilter]
status: NotRequired[Filters.EnumFilter]

class UpdateParams(TypedDict):
threshold: NotRequired["Alert.UpdateThresholdParams"]
status: NotRequired["Alert.Status"]

class ApplicationAlertsForSubscriptionParams(TypedDict):
limit: NotRequired[int]
offset: NotRequired[str]
status: NotRequired[Filters.EnumFilter]
type: NotRequired[Filters.EnumFilter]

def create(self, params: CreateParams, headers=None) -> CreateResponse:
jsonKeys = {}
options = {
"isIdempotent": True,
}
return request.send(
"post",
request.uri_path("alerts"),
self.env,
cast(Dict[Any, Any], params),
headers,
CreateResponse,
None,
False,
jsonKeys,
options,
)

def retrieve(self, id, headers=None) -> RetrieveResponse:
jsonKeys = {}
options = {}
return request.send(
"get",
request.uri_path("alerts", id),
self.env,
None,
headers,
RetrieveResponse,
None,
False,
jsonKeys,
options,
)

def list(self, params: ListParams = None, headers=None) -> ListResponse:
jsonKeys = {}
options = {}
return request.send_list_request(
"get",
request.uri_path("alerts"),
self.env,
cast(Dict[Any, Any], params),
headers,
ListResponse,
None,
False,
jsonKeys,
options,
)

def update(self, id, params: UpdateParams = None, headers=None) -> UpdateResponse:
jsonKeys = {}
options = {
"isIdempotent": True,
}
return request.send(
"post",
request.uri_path("alerts", id),
self.env,
cast(Dict[Any, Any], params),
headers,
UpdateResponse,
None,
False,
jsonKeys,
options,
)

def delete(self, id, headers=None) -> DeleteResponse:
jsonKeys = {}
options = {
"isIdempotent": True,
}
return request.send(
"post",
request.uri_path("alerts", id, "delete"),
self.env,
None,
headers,
DeleteResponse,
None,
False,
jsonKeys,
options,
)

pass
def application_alerts_for_subscription(
self, id, params: ApplicationAlertsForSubscriptionParams = None, headers=None
) -> ApplicationAlertsForSubscriptionResponse:
jsonKeys = {}
options = {}
return request.send(
"get",
request.uri_path("subscriptions", id, "applicable_alerts"),
self.env,
cast(Dict[Any, Any], params),
headers,
ApplicationAlertsForSubscriptionResponse,
None,
False,
jsonKeys,
options,
)
49 changes: 47 additions & 2 deletions chargebee/models/alert/responses.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from dataclasses import dataclass
from chargebee.model import Model
from typing import Dict, List, Any
from chargebee.response import Response
from chargebee.models import filter_condition


@dataclass
Expand All @@ -13,8 +15,51 @@ class AlertResponse(Model):
metered_feature_id: str = None
subscription_id: str = None
status: str = None
alarm_triggered_at: int = None
scope: str = None
meta: str = None
created_at: int = None
updated_at: int = None


@dataclass
class CreateResponse(Response):
is_idempotency_replayed: bool
alert: AlertResponse


@dataclass
class RetrieveResponse(Response):
alert: AlertResponse


@dataclass
class ListAlertResponse:
alert: AlertResponse


@dataclass
class ListResponse(Response):
list: List[ListAlertResponse]
next_offset: str = None


@dataclass
class UpdateResponse(Response):
is_idempotency_replayed: bool
alert: AlertResponse


@dataclass
class DeleteResponse(Response):
is_idempotency_replayed: bool
alert: AlertResponse


@dataclass
class ApplicationAlertsForSubscriptionAlertResponse:
alert: AlertResponse


@dataclass
class ApplicationAlertsForSubscriptionResponse(Response):
list: List[ApplicationAlertsForSubscriptionAlertResponse]
next_offset: str = None
48 changes: 47 additions & 1 deletion chargebee/models/alert_status/operations.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,56 @@
from .responses import *
from chargebee import request, environment
from typing import TypedDict, Required, NotRequired, Dict, List, Any, cast
from chargebee.filters import Filters


@dataclass
class AlertStatus:
env: environment.Environment

pass
class AlertStatusesForSubscriptionParams(TypedDict):
limit: NotRequired[int]
offset: NotRequired[str]
alarm_status: NotRequired[Filters.EnumFilter]
alert_id: NotRequired[Filters.StringFilter]

class AlertStatusesForAlertParams(TypedDict):
limit: NotRequired[int]
offset: NotRequired[str]
alarm_status: NotRequired[Filters.EnumFilter]

def alert_statuses_for_subscription(
self, id, params: AlertStatusesForSubscriptionParams = None, headers=None
) -> AlertStatusesForSubscriptionResponse:
jsonKeys = {}
options = {}
return request.send(
"get",
request.uri_path("subscriptions", id, "alert_statuses"),
self.env,
cast(Dict[Any, Any], params),
headers,
AlertStatusesForSubscriptionResponse,
None,
False,
jsonKeys,
options,
)

def alert_statuses_for_alert(
self, id, params: AlertStatusesForAlertParams = None, headers=None
) -> AlertStatusesForAlertResponse:
jsonKeys = {}
options = {}
return request.send(
"get",
request.uri_path("alerts", id, "alert_statuses"),
self.env,
cast(Dict[Any, Any], params),
headers,
AlertStatusesForAlertResponse,
None,
False,
jsonKeys,
options,
)
25 changes: 24 additions & 1 deletion chargebee/models/alert_status/responses.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
from dataclasses import dataclass
from chargebee.model import Model
from typing import Dict, List, Any
from chargebee.response import Response


@dataclass
class AlertStatusResponse(Model):
raw_data: Dict[Any, Any] = None
alert_id: str = None
subscription_id: str = None
alert_status: str = None
alarm_status: str = None
alarm_triggered_at: int = None


@dataclass
class AlertStatusesForSubscriptionAlertStatusResponse:
alert_status: AlertStatusResponse


@dataclass
class AlertStatusesForSubscriptionResponse(Response):
list: List[AlertStatusesForSubscriptionAlertStatusResponse]
next_offset: str = None


@dataclass
class AlertStatusesForAlertAlertStatusResponse:
alert_status: AlertStatusResponse


@dataclass
class AlertStatusesForAlertResponse(Response):
list: List[AlertStatusesForAlertAlertStatusResponse]
next_offset: str = None
1 change: 1 addition & 0 deletions chargebee/models/card/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CardType(Enum):
MAESTRO = "maestro"
DANKORT = "dankort"
CARTES_BANCAIRES = "cartes_bancaires"
MADA = "mada"
OTHER = "other"
NOT_APPLICABLE = "not_applicable"

Expand Down
Loading
Loading