| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._api_mode import ApiMode |
| 4 |
from stripe._stripe_object import StripeObject |
| 5 |
from stripe._stripe_response import StripeResponse |
| 6 |
from stripe.v2.core._event import Event, EventNotification |
| 7 |
from typing import Any, Dict, List, Optional, cast |
| 8 |
from typing_extensions import Literal, TYPE_CHECKING, override |
| 9 |
|
| 10 |
if TYPE_CHECKING: |
| 11 |
from stripe._api_requestor import _APIRequestor |
| 12 |
|
| 13 |
|
| 14 |
class V1BillingMeterNoMeterFoundEventNotification(EventNotification): |
| 15 |
LOOKUP_TYPE = "v1.billing.meter.no_meter_found" |
| 16 |
type: Literal["v1.billing.meter.no_meter_found"] |
| 17 |
|
| 18 |
@override |
| 19 |
def fetch_event(self) -> "V1BillingMeterNoMeterFoundEvent": |
| 20 |
return cast( |
| 21 |
"V1BillingMeterNoMeterFoundEvent", |
| 22 |
super().fetch_event(), |
| 23 |
) |
| 24 |
|
| 25 |
@override |
| 26 |
async def fetch_event_async(self) -> "V1BillingMeterNoMeterFoundEvent": |
| 27 |
return cast( |
| 28 |
"V1BillingMeterNoMeterFoundEvent", |
| 29 |
await super().fetch_event_async(), |
| 30 |
) |
| 31 |
|
| 32 |
|
| 33 |
class V1BillingMeterNoMeterFoundEvent(Event): |
| 34 |
LOOKUP_TYPE = "v1.billing.meter.no_meter_found" |
| 35 |
type: Literal["v1.billing.meter.no_meter_found"] |
| 36 |
|
| 37 |
class V1BillingMeterNoMeterFoundEventData(StripeObject): |
| 38 |
class Reason(StripeObject): |
| 39 |
class ErrorType(StripeObject): |
| 40 |
class SampleError(StripeObject): |
| 41 |
class Request(StripeObject): |
| 42 |
identifier: str |
| 43 |
""" |
| 44 |
The request idempotency key. |
| 45 |
""" |
| 46 |
|
| 47 |
error_message: str |
| 48 |
""" |
| 49 |
The error message. |
| 50 |
""" |
| 51 |
request: Request |
| 52 |
""" |
| 53 |
The request causes the error. |
| 54 |
""" |
| 55 |
_inner_class_types = {"request": Request} |
| 56 |
|
| 57 |
code: Literal[ |
| 58 |
"archived_meter", |
| 59 |
"meter_event_customer_not_found", |
| 60 |
"meter_event_dimension_count_too_high", |
| 61 |
"meter_event_invalid_value", |
| 62 |
"meter_event_no_customer_defined", |
| 63 |
"missing_dimension_payload_keys", |
| 64 |
"no_meter", |
| 65 |
"timestamp_in_future", |
| 66 |
"timestamp_too_far_in_past", |
| 67 |
] |
| 68 |
""" |
| 69 |
Open Enum. |
| 70 |
""" |
| 71 |
error_count: int |
| 72 |
""" |
| 73 |
The number of errors of this type. |
| 74 |
""" |
| 75 |
sample_errors: List[SampleError] |
| 76 |
""" |
| 77 |
A list of sample errors of this type. |
| 78 |
""" |
| 79 |
_inner_class_types = {"sample_errors": SampleError} |
| 80 |
|
| 81 |
error_count: int |
| 82 |
""" |
| 83 |
The total error count within this window. |
| 84 |
""" |
| 85 |
error_types: List[ErrorType] |
| 86 |
""" |
| 87 |
The error details. |
| 88 |
""" |
| 89 |
_inner_class_types = {"error_types": ErrorType} |
| 90 |
|
| 91 |
developer_message_summary: str |
| 92 |
""" |
| 93 |
Extra field included in the event's `data` when fetched from /v2/events. |
| 94 |
""" |
| 95 |
reason: Reason |
| 96 |
""" |
| 97 |
This contains information about why meter error happens. |
| 98 |
""" |
| 99 |
validation_end: str |
| 100 |
""" |
| 101 |
The end of the window that is encapsulated by this summary. |
| 102 |
""" |
| 103 |
validation_start: str |
| 104 |
""" |
| 105 |
The start of the window that is encapsulated by this summary. |
| 106 |
""" |
| 107 |
_inner_class_types = {"reason": Reason} |
| 108 |
|
| 109 |
data: V1BillingMeterNoMeterFoundEventData |
| 110 |
""" |
| 111 |
Data for the v1.billing.meter.no_meter_found event |
| 112 |
""" |
| 113 |
|
| 114 |
@classmethod |
| 115 |
def _construct_from( |
| 116 |
cls, |
| 117 |
*, |
| 118 |
values: Dict[str, Any], |
| 119 |
last_response: Optional[StripeResponse] = None, |
| 120 |
requestor: "_APIRequestor", |
| 121 |
api_mode: ApiMode, |
| 122 |
) -> "V1BillingMeterNoMeterFoundEvent": |
| 123 |
evt = super()._construct_from( |
| 124 |
values=values, |
| 125 |
last_response=last_response, |
| 126 |
requestor=requestor, |
| 127 |
api_mode=api_mode, |
| 128 |
) |
| 129 |
if hasattr(evt, "data"): |
| 130 |
evt.data = V1BillingMeterNoMeterFoundEvent.V1BillingMeterNoMeterFoundEventData._construct_from( |
| 131 |
values=evt.data, |
| 132 |
last_response=last_response, |
| 133 |
requestor=requestor, |
| 134 |
api_mode=api_mode, |
| 135 |
) |
| 136 |
return evt |