This commit is contained in:
Iliyan Angelov
2025-11-17 18:26:30 +02:00
parent 48353cde9c
commit 0c59fe1173
2535 changed files with 278997 additions and 2480 deletions

View File

@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from importlib import import_module
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe.v2.billing._meter_event import MeterEvent as MeterEvent
from stripe.v2.billing._meter_event_adjustment import (
MeterEventAdjustment as MeterEventAdjustment,
)
from stripe.v2.billing._meter_event_adjustment_service import (
MeterEventAdjustmentService as MeterEventAdjustmentService,
)
from stripe.v2.billing._meter_event_service import (
MeterEventService as MeterEventService,
)
from stripe.v2.billing._meter_event_session import (
MeterEventSession as MeterEventSession,
)
from stripe.v2.billing._meter_event_session_service import (
MeterEventSessionService as MeterEventSessionService,
)
from stripe.v2.billing._meter_event_stream_service import (
MeterEventStreamService as MeterEventStreamService,
)
# name -> (import_target, is_submodule)
_import_map = {
"MeterEvent": ("stripe.v2.billing._meter_event", False),
"MeterEventAdjustment": (
"stripe.v2.billing._meter_event_adjustment",
False,
),
"MeterEventAdjustmentService": (
"stripe.v2.billing._meter_event_adjustment_service",
False,
),
"MeterEventService": ("stripe.v2.billing._meter_event_service", False),
"MeterEventSession": ("stripe.v2.billing._meter_event_session", False),
"MeterEventSessionService": (
"stripe.v2.billing._meter_event_session_service",
False,
),
"MeterEventStreamService": (
"stripe.v2.billing._meter_event_stream_service",
False,
),
}
if not TYPE_CHECKING:
def __getattr__(name):
try:
target, is_submodule = _import_map[name]
module = import_module(target)
if is_submodule:
return module
return getattr(
module,
name,
)
except KeyError:
raise AttributeError()

View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from typing import ClassVar, Dict
from typing_extensions import Literal
class MeterEvent(StripeObject):
"""
Fix me empty_doc_string.
"""
OBJECT_NAME: ClassVar[Literal["v2.billing.meter_event"]] = (
"v2.billing.meter_event"
)
created: str
"""
The creation time of this meter event.
"""
event_name: str
"""
The name of the meter event. Corresponds with the `event_name` field on a meter.
"""
identifier: str
"""
A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We'll enforce uniqueness within a rolling 24 hour period.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["v2.billing.meter_event"]
"""
String representing the object's type. Objects of the same type share the same value of the object field.
"""
payload: Dict[str, str]
"""
The payload of the event. This must contain the fields corresponding to a meter's
`customer_mapping.event_payload_key` (default is `stripe_customer_id`) and
`value_settings.event_payload_key` (default is `value`). Read more about
the [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides)..
"""
timestamp: str
"""
The time of the event. Must be within the past 35 calendar days or up to
5 minutes in the future. Defaults to current timestamp if not specified.
"""

View File

@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from typing import ClassVar
from typing_extensions import Literal
class MeterEventAdjustment(StripeObject):
OBJECT_NAME: ClassVar[Literal["v2.billing.meter_event_adjustment"]] = (
"v2.billing.meter_event_adjustment"
)
class Cancel(StripeObject):
identifier: str
"""
Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them.
"""
cancel: Cancel
"""
Specifies which event to cancel.
"""
created: str
"""
The time the adjustment was created.
"""
event_name: str
"""
The name of the meter event. Corresponds with the `event_name` field on a meter.
"""
id: str
"""
The unique id of this meter event adjustment.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["v2.billing.meter_event_adjustment"]
"""
String representing the object's type. Objects of the same type share the same value of the object field.
"""
status: Literal["complete", "pending"]
"""
Open Enum. The meter event adjustment's status.
"""
type: Literal["cancel"]
"""
Open Enum. Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
"""
_inner_class_types = {"cancel": Cancel}

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.params.v2.billing._meter_event_adjustment_create_params import (
MeterEventAdjustmentCreateParams,
)
from stripe.v2.billing._meter_event_adjustment import MeterEventAdjustment
class MeterEventAdjustmentService(StripeService):
def create(
self,
params: "MeterEventAdjustmentCreateParams",
options: Optional["RequestOptions"] = None,
) -> "MeterEventAdjustment":
"""
Creates a meter event adjustment to cancel a previously sent meter event.
"""
return cast(
"MeterEventAdjustment",
self._request(
"post",
"/v2/billing/meter_event_adjustments",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "MeterEventAdjustmentCreateParams",
options: Optional["RequestOptions"] = None,
) -> "MeterEventAdjustment":
"""
Creates a meter event adjustment to cancel a previously sent meter event.
"""
return cast(
"MeterEventAdjustment",
await self._request_async(
"post",
"/v2/billing/meter_event_adjustments",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.params.v2.billing._meter_event_create_params import (
MeterEventCreateParams,
)
from stripe.v2.billing._meter_event import MeterEvent
class MeterEventService(StripeService):
def create(
self,
params: "MeterEventCreateParams",
options: Optional["RequestOptions"] = None,
) -> "MeterEvent":
"""
Creates a meter event. Events are validated synchronously, but are processed asynchronously. Supports up to 1,000 events per second in livemode. For higher rate-limits, please use meter event streams instead.
"""
return cast(
"MeterEvent",
self._request(
"post",
"/v2/billing/meter_events",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: "MeterEventCreateParams",
options: Optional["RequestOptions"] = None,
) -> "MeterEvent":
"""
Creates a meter event. Events are validated synchronously, but are processed asynchronously. Supports up to 1,000 events per second in livemode. For higher rate-limits, please use meter event streams instead.
"""
return cast(
"MeterEvent",
await self._request_async(
"post",
"/v2/billing/meter_events",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_object import StripeObject
from typing import ClassVar
from typing_extensions import Literal
class MeterEventSession(StripeObject):
OBJECT_NAME: ClassVar[Literal["v2.billing.meter_event_session"]] = (
"v2.billing.meter_event_session"
)
authentication_token: str
"""
The authentication token for this session. Use this token when calling the
high-throughput meter event API.
"""
created: str
"""
The creation time of this session.
"""
expires_at: str
"""
The time at which this session will expire.
"""
id: str
"""
The unique id of this auth session.
"""
livemode: bool
"""
Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
"""
object: Literal["v2.billing.meter_event_session"]
"""
String representing the object's type. Objects of the same type share the same value of the object field.
"""

View File

@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional, cast
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.params.v2.billing._meter_event_session_create_params import (
MeterEventSessionCreateParams,
)
from stripe.v2.billing._meter_event_session import MeterEventSession
class MeterEventSessionService(StripeService):
def create(
self,
params: Optional["MeterEventSessionCreateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "MeterEventSession":
"""
Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you will need to create a new meter event session when your token expires.
"""
return cast(
"MeterEventSession",
self._request(
"post",
"/v2/billing/meter_event_session",
base_address="api",
params=params,
options=options,
),
)
async def create_async(
self,
params: Optional["MeterEventSessionCreateParams"] = None,
options: Optional["RequestOptions"] = None,
) -> "MeterEventSession":
"""
Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you will need to create a new meter event session when your token expires.
"""
return cast(
"MeterEventSession",
await self._request_async(
"post",
"/v2/billing/meter_event_session",
base_address="api",
params=params,
options=options,
),
)

View File

@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# File generated from our OpenAPI spec
from stripe._stripe_service import StripeService
from typing import Optional
from typing_extensions import TYPE_CHECKING
if TYPE_CHECKING:
from stripe._request_options import RequestOptions
from stripe.params.v2.billing._meter_event_stream_create_params import (
MeterEventStreamCreateParams,
)
class MeterEventStreamService(StripeService):
def create(
self,
params: "MeterEventStreamCreateParams",
options: Optional["RequestOptions"] = None,
) -> "None":
"""
Creates meter events. Events are processed asynchronously, including validation. Requires a meter event session for authentication. Supports up to 10,000 requests per second in livemode. For even higher rate-limits, contact sales.
"""
self._request(
"post",
"/v2/billing/meter_event_stream",
base_address="meter_events",
params=params,
options=options,
)
async def create_async(
self,
params: "MeterEventStreamCreateParams",
options: Optional["RequestOptions"] = None,
) -> "None":
"""
Creates meter events. Events are processed asynchronously, including validation. Requires a meter event session for authentication. Supports up to 10,000 requests per second in livemode. For even higher rate-limits, contact sales.
"""
await self._request_async(
"post",
"/v2/billing/meter_event_stream",
base_address="meter_events",
params=params,
options=options,
)