Debian Codegraph @

stripe/billing/_meter_event_adjustment.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._createable_api_resource import CreateableAPIResource
4 from stripe._stripe_object import StripeObject
5 from typing import ClassVar, Optional, cast
6 from typing_extensions import Literal, Unpack, TYPE_CHECKING
7
8 if TYPE_CHECKING:
9 from stripe.params.billing._meter_event_adjustment_create_params import (
10 MeterEventAdjustmentCreateParams,
11 )
12
13
14 class MeterEventAdjustment(CreateableAPIResource["MeterEventAdjustment"]):
15 """
16 A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer.
17 """
18
19 OBJECT_NAME: ClassVar[Literal["billing.meter_event_adjustment"]] = (
20 "billing.meter_event_adjustment"
21 )
22
23 class Cancel(StripeObject):
24 identifier: Optional[str]
25 """
26 Unique identifier for the event.
27 """
28
29 cancel: Optional[Cancel]
30 """
31 Specifies which event to cancel.
32 """
33 event_name: str
34 """
35 The name of the meter event. Corresponds with the `event_name` field on a meter.
36 """
37 livemode: bool
38 """
39 Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
40 """
41 object: Literal["billing.meter_event_adjustment"]
42 """
43 String representing the object's type. Objects of the same type share the same value.
44 """
45 status: Literal["complete", "pending"]
46 """
47 The meter event adjustment's status.
48 """
49 type: Literal["cancel"]
50 """
51 Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
52 """
53
54 @classmethod
55 def create(
56 cls, **params: Unpack["MeterEventAdjustmentCreateParams"]
57 ) -> "MeterEventAdjustment":
58 """
59 Creates a billing meter event adjustment.
60 """
61 return cast(
62 "MeterEventAdjustment",
63 cls._static_request(
64 "post",
65 cls.class_url(),
66 params=params,
67 ),
68 )
69
70 @classmethod
71 async def create_async(
72 cls, **params: Unpack["MeterEventAdjustmentCreateParams"]
73 ) -> "MeterEventAdjustment":
74 """
75 Creates a billing meter event adjustment.
76 """
77 return cast(
78 "MeterEventAdjustment",
79 await cls._static_request_async(
80 "post",
81 cls.class_url(),
82 params=params,
83 ),
84 )
85
86 _inner_class_types = {"cancel": Cancel}