Debian Codegraph @

stripe/params/billing/_meter_create_params.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._request_options import RequestOptions
4 from typing import List
5 from typing_extensions import Literal, NotRequired, TypedDict
6
7
8 class MeterCreateParams(RequestOptions):
9 customer_mapping: NotRequired["MeterCreateParamsCustomerMapping"]
10 """
11 Fields that specify how to map a meter event to a customer.
12 """
13 default_aggregation: "MeterCreateParamsDefaultAggregation"
14 """
15 The default settings to aggregate a meter's events with.
16 """
17 display_name: str
18 """
19 The meter's name. Not visible to the customer.
20 """
21 event_name: str
22 """
23 The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events.
24 """
25 event_time_window: NotRequired[Literal["day", "hour"]]
26 """
27 The time window which meter events have been pre-aggregated for, if any.
28 """
29 expand: NotRequired[List[str]]
30 """
31 Specifies which fields in the response should be expanded.
32 """
33 value_settings: NotRequired["MeterCreateParamsValueSettings"]
34 """
35 Fields that specify how to calculate a meter event's value.
36 """
37
38
39 class MeterCreateParamsCustomerMapping(TypedDict):
40 event_payload_key: str
41 """
42 The key in the meter event payload to use for mapping the event to a customer.
43 """
44 type: Literal["by_id"]
45 """
46 The method for mapping a meter event to a customer. Must be `by_id`.
47 """
48
49
50 class MeterCreateParamsDefaultAggregation(TypedDict):
51 formula: Literal["count", "last", "sum"]
52 """
53 Specifies how events are aggregated. Allowed values are `count` to count the number of events, `sum` to sum each event's value and `last` to take the last event's value in the window.
54 """
55
56
57 class MeterCreateParamsValueSettings(TypedDict):
58 event_payload_key: str
59 """
60 The key in the usage event payload to use as the value for this meter. For example, if the event payload contains usage on a `bytes_used` field, then set the event_payload_key to "bytes_used".
61 """