lark-billing 0.0.7__py3-none-any.whl → 0.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lark-billing might be problematic. Click here for more details.

Files changed (58) hide show
  1. lark/__init__.py +45 -29
  2. lark/checkout/client.py +34 -12
  3. lark/checkout/raw_client.py +22 -6
  4. lark/client.py +19 -0
  5. lark/core/client_wrapper.py +2 -2
  6. lark/core/http_sse/__init__.py +42 -0
  7. lark/core/http_sse/_api.py +112 -0
  8. lark/core/http_sse/_decoders.py +61 -0
  9. lark/core/http_sse/_exceptions.py +7 -0
  10. lark/core/http_sse/_models.py +17 -0
  11. lark/core/pydantic_utilities.py +3 -1
  12. lark/customer_portal/client.py +4 -2
  13. lark/customer_portal/raw_client.py +2 -0
  14. lark/invoices/__init__.py +4 -0
  15. lark/invoices/client.py +136 -0
  16. lark/invoices/raw_client.py +147 -0
  17. lark/pricing_metrics/client.py +69 -0
  18. lark/pricing_metrics/raw_client.py +101 -0
  19. lark/rate_cards/__init__.py +15 -3
  20. lark/rate_cards/client.py +20 -14
  21. lark/rate_cards/raw_client.py +26 -20
  22. lark/rate_cards/types/__init__.py +12 -2
  23. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +30 -0
  24. lark/subjects/client.py +16 -18
  25. lark/subjects/raw_client.py +14 -8
  26. lark/subscriptions/client.py +194 -8
  27. lark/subscriptions/raw_client.py +256 -4
  28. lark/types/__init__.py +31 -32
  29. lark/types/aggregation.py +1 -43
  30. lark/types/amount.py +4 -1
  31. lark/types/create_customer_portal_session_response.py +9 -2
  32. lark/types/{create_simple_usage_based_rate_interface.py → create_fixed_rate_request.py} +11 -6
  33. lark/types/create_simple_usage_based_rate_request.py +39 -0
  34. lark/types/create_subject_response.py +29 -6
  35. lark/types/create_subscription_checkout_session_response.py +14 -3
  36. lark/types/fixed_rate_interface.py +1 -1
  37. lark/types/{custom_pricing_metric_resource.py → invoice_line_item_resource.py} +6 -2
  38. lark/types/invoice_resource.py +56 -0
  39. lark/types/invoice_status.py +5 -0
  40. lark/types/{max_aggregation_pricing_metric_resource.py → list_invoices_response.py} +4 -2
  41. lark/types/{create_fixed_rate_interface.py → list_pricing_metrics_response.py} +4 -5
  42. lark/types/period_resource.py +23 -0
  43. lark/types/{last_aggregation_pricing_metric_resource.py → pricing_metric_resource.py} +7 -2
  44. lark/types/rate_card_resource.py +36 -7
  45. lark/types/rate_card_resource_usage_based_rates_item.py +1 -2
  46. lark/types/simple_usage_based_rate_interface.py +1 -6
  47. lark/types/subject_resource.py +29 -6
  48. lark/types/subscription_resource.py +42 -8
  49. lark/types/subscription_status.py +5 -0
  50. lark/usage_events/__init__.py +6 -3
  51. lark/usage_events/client.py +15 -4
  52. lark/usage_events/raw_client.py +21 -6
  53. lark/usage_events/types/__init__.py +4 -2
  54. lark/{types/status.py → usage_events/types/create_usage_event_request_data_value.py} +1 -1
  55. {lark_billing-0.0.7.dist-info → lark_billing-0.0.9.dist-info}/METADATA +8 -7
  56. lark_billing-0.0.9.dist-info/RECORD +108 -0
  57. lark_billing-0.0.7.dist-info/RECORD +0 -94
  58. {lark_billing-0.0.7.dist-info → lark_billing-0.0.9.dist-info}/WHEEL +0 -0
lark/types/__init__.py CHANGED
@@ -6,40 +6,37 @@ import typing
6
6
  from importlib import import_module
7
7
 
8
8
  if typing.TYPE_CHECKING:
9
- from .aggregation import (
10
- Aggregation,
11
- Aggregation_Count,
12
- Aggregation_Custom,
13
- Aggregation_Last,
14
- Aggregation_Max,
15
- Aggregation_Sum,
16
- )
9
+ from .aggregation import Aggregation, Aggregation_Count, Aggregation_Sum
17
10
  from .amount import Amount
18
11
  from .billing_state_response import BillingStateResponse
19
12
  from .count_aggregation_pricing_metric_interface import CountAggregationPricingMetricInterface
20
13
  from .count_aggregation_pricing_metric_resource import CountAggregationPricingMetricResource
21
14
  from .create_customer_portal_session_response import CreateCustomerPortalSessionResponse
22
- from .create_fixed_rate_interface import CreateFixedRateInterface
15
+ from .create_fixed_rate_request import CreateFixedRateRequest
23
16
  from .create_pricing_metric_response import CreatePricingMetricResponse
24
- from .create_simple_usage_based_rate_interface import CreateSimpleUsageBasedRateInterface
17
+ from .create_simple_usage_based_rate_request import CreateSimpleUsageBasedRateRequest
25
18
  from .create_subject_response import CreateSubjectResponse
26
19
  from .create_subscription_checkout_session_response import CreateSubscriptionCheckoutSessionResponse
27
20
  from .create_usage_event_summary_response import CreateUsageEventSummaryResponse
28
- from .custom_pricing_metric_resource import CustomPricingMetricResource
29
21
  from .fixed_rate_interface import FixedRateInterface
30
22
  from .flat_price import FlatPrice
31
23
  from .get_pricing_metric_response import GetPricingMetricResponse
32
24
  from .http_validation_error import HttpValidationError
33
- from .last_aggregation_pricing_metric_resource import LastAggregationPricingMetricResource
25
+ from .invoice_line_item_resource import InvoiceLineItemResource
26
+ from .invoice_resource import InvoiceResource
27
+ from .invoice_status import InvoiceStatus
28
+ from .list_invoices_response import ListInvoicesResponse
29
+ from .list_pricing_metrics_response import ListPricingMetricsResponse
34
30
  from .list_rate_cards_response import ListRateCardsResponse
35
31
  from .list_subjects_response import ListSubjectsResponse
36
32
  from .list_subscriptions_response import ListSubscriptionsResponse
37
- from .max_aggregation_pricing_metric_resource import MaxAggregationPricingMetricResource
38
33
  from .package_price import PackagePrice
39
34
  from .package_price_input_rounding_behavior import PackagePriceInputRoundingBehavior
40
35
  from .package_price_output_rounding_behavior import PackagePriceOutputRoundingBehavior
41
36
  from .period import Period
37
+ from .period_resource import PeriodResource
42
38
  from .price import Price, Price_Flat, Price_Package
39
+ from .pricing_metric_resource import PricingMetricResource
43
40
  from .rate_card_resource import RateCardResource
44
41
  from .rate_card_resource_billing_interval import RateCardResourceBillingInterval
45
42
  from .rate_card_resource_usage_based_rates_item import (
@@ -47,9 +44,9 @@ if typing.TYPE_CHECKING:
47
44
  RateCardResourceUsageBasedRatesItem_Simple,
48
45
  )
49
46
  from .simple_usage_based_rate_interface import SimpleUsageBasedRateInterface
50
- from .status import Status
51
47
  from .subject_resource import SubjectResource
52
48
  from .subscription_resource import SubscriptionResource
49
+ from .subscription_status import SubscriptionStatus
53
50
  from .sum_aggregation_pricing_metric_interface import SumAggregationPricingMetricInterface
54
51
  from .sum_aggregation_pricing_metric_resource import SumAggregationPricingMetricResource
55
52
  from .validation_error import ValidationError
@@ -58,46 +55,47 @@ if typing.TYPE_CHECKING:
58
55
  _dynamic_imports: typing.Dict[str, str] = {
59
56
  "Aggregation": ".aggregation",
60
57
  "Aggregation_Count": ".aggregation",
61
- "Aggregation_Custom": ".aggregation",
62
- "Aggregation_Last": ".aggregation",
63
- "Aggregation_Max": ".aggregation",
64
58
  "Aggregation_Sum": ".aggregation",
65
59
  "Amount": ".amount",
66
60
  "BillingStateResponse": ".billing_state_response",
67
61
  "CountAggregationPricingMetricInterface": ".count_aggregation_pricing_metric_interface",
68
62
  "CountAggregationPricingMetricResource": ".count_aggregation_pricing_metric_resource",
69
63
  "CreateCustomerPortalSessionResponse": ".create_customer_portal_session_response",
70
- "CreateFixedRateInterface": ".create_fixed_rate_interface",
64
+ "CreateFixedRateRequest": ".create_fixed_rate_request",
71
65
  "CreatePricingMetricResponse": ".create_pricing_metric_response",
72
- "CreateSimpleUsageBasedRateInterface": ".create_simple_usage_based_rate_interface",
66
+ "CreateSimpleUsageBasedRateRequest": ".create_simple_usage_based_rate_request",
73
67
  "CreateSubjectResponse": ".create_subject_response",
74
68
  "CreateSubscriptionCheckoutSessionResponse": ".create_subscription_checkout_session_response",
75
69
  "CreateUsageEventSummaryResponse": ".create_usage_event_summary_response",
76
- "CustomPricingMetricResource": ".custom_pricing_metric_resource",
77
70
  "FixedRateInterface": ".fixed_rate_interface",
78
71
  "FlatPrice": ".flat_price",
79
72
  "GetPricingMetricResponse": ".get_pricing_metric_response",
80
73
  "HttpValidationError": ".http_validation_error",
81
- "LastAggregationPricingMetricResource": ".last_aggregation_pricing_metric_resource",
74
+ "InvoiceLineItemResource": ".invoice_line_item_resource",
75
+ "InvoiceResource": ".invoice_resource",
76
+ "InvoiceStatus": ".invoice_status",
77
+ "ListInvoicesResponse": ".list_invoices_response",
78
+ "ListPricingMetricsResponse": ".list_pricing_metrics_response",
82
79
  "ListRateCardsResponse": ".list_rate_cards_response",
83
80
  "ListSubjectsResponse": ".list_subjects_response",
84
81
  "ListSubscriptionsResponse": ".list_subscriptions_response",
85
- "MaxAggregationPricingMetricResource": ".max_aggregation_pricing_metric_resource",
86
82
  "PackagePrice": ".package_price",
87
83
  "PackagePriceInputRoundingBehavior": ".package_price_input_rounding_behavior",
88
84
  "PackagePriceOutputRoundingBehavior": ".package_price_output_rounding_behavior",
89
85
  "Period": ".period",
86
+ "PeriodResource": ".period_resource",
90
87
  "Price": ".price",
91
88
  "Price_Flat": ".price",
92
89
  "Price_Package": ".price",
90
+ "PricingMetricResource": ".pricing_metric_resource",
93
91
  "RateCardResource": ".rate_card_resource",
94
92
  "RateCardResourceBillingInterval": ".rate_card_resource_billing_interval",
95
93
  "RateCardResourceUsageBasedRatesItem": ".rate_card_resource_usage_based_rates_item",
96
94
  "RateCardResourceUsageBasedRatesItem_Simple": ".rate_card_resource_usage_based_rates_item",
97
95
  "SimpleUsageBasedRateInterface": ".simple_usage_based_rate_interface",
98
- "Status": ".status",
99
96
  "SubjectResource": ".subject_resource",
100
97
  "SubscriptionResource": ".subscription_resource",
98
+ "SubscriptionStatus": ".subscription_status",
101
99
  "SumAggregationPricingMetricInterface": ".sum_aggregation_pricing_metric_interface",
102
100
  "SumAggregationPricingMetricResource": ".sum_aggregation_pricing_metric_resource",
103
101
  "ValidationError": ".validation_error",
@@ -130,46 +128,47 @@ def __dir__():
130
128
  __all__ = [
131
129
  "Aggregation",
132
130
  "Aggregation_Count",
133
- "Aggregation_Custom",
134
- "Aggregation_Last",
135
- "Aggregation_Max",
136
131
  "Aggregation_Sum",
137
132
  "Amount",
138
133
  "BillingStateResponse",
139
134
  "CountAggregationPricingMetricInterface",
140
135
  "CountAggregationPricingMetricResource",
141
136
  "CreateCustomerPortalSessionResponse",
142
- "CreateFixedRateInterface",
137
+ "CreateFixedRateRequest",
143
138
  "CreatePricingMetricResponse",
144
- "CreateSimpleUsageBasedRateInterface",
139
+ "CreateSimpleUsageBasedRateRequest",
145
140
  "CreateSubjectResponse",
146
141
  "CreateSubscriptionCheckoutSessionResponse",
147
142
  "CreateUsageEventSummaryResponse",
148
- "CustomPricingMetricResource",
149
143
  "FixedRateInterface",
150
144
  "FlatPrice",
151
145
  "GetPricingMetricResponse",
152
146
  "HttpValidationError",
153
- "LastAggregationPricingMetricResource",
147
+ "InvoiceLineItemResource",
148
+ "InvoiceResource",
149
+ "InvoiceStatus",
150
+ "ListInvoicesResponse",
151
+ "ListPricingMetricsResponse",
154
152
  "ListRateCardsResponse",
155
153
  "ListSubjectsResponse",
156
154
  "ListSubscriptionsResponse",
157
- "MaxAggregationPricingMetricResource",
158
155
  "PackagePrice",
159
156
  "PackagePriceInputRoundingBehavior",
160
157
  "PackagePriceOutputRoundingBehavior",
161
158
  "Period",
159
+ "PeriodResource",
162
160
  "Price",
163
161
  "Price_Flat",
164
162
  "Price_Package",
163
+ "PricingMetricResource",
165
164
  "RateCardResource",
166
165
  "RateCardResourceBillingInterval",
167
166
  "RateCardResourceUsageBasedRatesItem",
168
167
  "RateCardResourceUsageBasedRatesItem_Simple",
169
168
  "SimpleUsageBasedRateInterface",
170
- "Status",
171
169
  "SubjectResource",
172
170
  "SubscriptionResource",
171
+ "SubscriptionStatus",
173
172
  "SumAggregationPricingMetricInterface",
174
173
  "SumAggregationPricingMetricResource",
175
174
  "ValidationError",
lark/types/aggregation.py CHANGED
@@ -21,48 +21,6 @@ class Aggregation_Count(UniversalBaseModel):
21
21
  extra = pydantic.Extra.allow
22
22
 
23
23
 
24
- class Aggregation_Custom(UniversalBaseModel):
25
- aggregation_type: typing.Literal["custom"] = "custom"
26
- sql: str
27
-
28
- if IS_PYDANTIC_V2:
29
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
30
- else:
31
-
32
- class Config:
33
- frozen = True
34
- smart_union = True
35
- extra = pydantic.Extra.allow
36
-
37
-
38
- class Aggregation_Last(UniversalBaseModel):
39
- aggregation_type: typing.Literal["last"] = "last"
40
- value_field: str
41
-
42
- if IS_PYDANTIC_V2:
43
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
44
- else:
45
-
46
- class Config:
47
- frozen = True
48
- smart_union = True
49
- extra = pydantic.Extra.allow
50
-
51
-
52
- class Aggregation_Max(UniversalBaseModel):
53
- aggregation_type: typing.Literal["max"] = "max"
54
- value_field: str
55
-
56
- if IS_PYDANTIC_V2:
57
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
58
- else:
59
-
60
- class Config:
61
- frozen = True
62
- smart_union = True
63
- extra = pydantic.Extra.allow
64
-
65
-
66
24
  class Aggregation_Sum(UniversalBaseModel):
67
25
  aggregation_type: typing.Literal["sum"] = "sum"
68
26
  value_field: str
@@ -77,4 +35,4 @@ class Aggregation_Sum(UniversalBaseModel):
77
35
  extra = pydantic.Extra.allow
78
36
 
79
37
 
80
- Aggregation = typing.Union[Aggregation_Count, Aggregation_Custom, Aggregation_Last, Aggregation_Max, Aggregation_Sum]
38
+ Aggregation = typing.Union[Aggregation_Count, Aggregation_Sum]
lark/types/amount.py CHANGED
@@ -12,7 +12,10 @@ class Amount(UniversalBaseModel):
12
12
  The value of the amount in the smallest unit of the currency.
13
13
  """
14
14
 
15
- currency_code: str
15
+ currency_code: str = pydantic.Field()
16
+ """
17
+ The currency code of the amount.
18
+ """
16
19
 
17
20
  if IS_PYDANTIC_V2:
18
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -7,8 +7,15 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
 
8
8
 
9
9
  class CreateCustomerPortalSessionResponse(UniversalBaseModel):
10
- subject_id: str
11
- url: str
10
+ subject_id: str = pydantic.Field()
11
+ """
12
+ The ID of the subject for the customer portal session.
13
+ """
14
+
15
+ url: str = pydantic.Field()
16
+ """
17
+ The URL to redirect to the customer portal session.
18
+ """
12
19
 
13
20
  if IS_PYDANTIC_V2:
14
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -7,13 +7,18 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
  from .price import Price
8
8
 
9
9
 
10
- class CreateSimpleUsageBasedRateInterface(UniversalBaseModel):
11
- usage_based_rate_type: typing.Optional[typing.Literal["simple"]] = None
12
- name: typing.Optional[str] = None
13
- description: typing.Optional[str] = None
10
+ class CreateFixedRateRequest(UniversalBaseModel):
11
+ name: str = pydantic.Field()
12
+ """
13
+ The name of the rate displayed to the customer.
14
+ """
15
+
16
+ description: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ The description of the rate displayed to the customer.
19
+ """
20
+
14
21
  price: Price
15
- included_units: typing.Optional[int] = None
16
- pricing_metric_id: str
17
22
 
18
23
  if IS_PYDANTIC_V2:
19
24
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,39 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .price import Price
8
+
9
+
10
+ class CreateSimpleUsageBasedRateRequest(UniversalBaseModel):
11
+ name: str = pydantic.Field()
12
+ """
13
+ The name of the rate displayed to the customer.
14
+ """
15
+
16
+ description: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ The description of the rate displayed to the customer.
19
+ """
20
+
21
+ price: Price
22
+ included_units: typing.Optional[int] = pydantic.Field(default=None)
23
+ """
24
+ The number of units included in the rate before the price is applied.
25
+ """
26
+
27
+ pricing_metric_id: str = pydantic.Field()
28
+ """
29
+ The ID of the pricing metric to use for this rate.
30
+ """
31
+
32
+ if IS_PYDANTIC_V2:
33
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
34
+ else:
35
+
36
+ class Config:
37
+ frozen = True
38
+ smart_union = True
39
+ extra = pydantic.Extra.allow
@@ -8,12 +8,35 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
8
 
9
9
 
10
10
  class CreateSubjectResponse(UniversalBaseModel):
11
- id: str
12
- external_id: typing.Optional[str] = None
13
- name: typing.Optional[str] = None
14
- email: typing.Optional[str] = None
15
- metadata: typing.Dict[str, str]
16
- created_at: dt.datetime
11
+ id: str = pydantic.Field()
12
+ """
13
+ The ID of the subject.
14
+ """
15
+
16
+ external_id: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ The ID of the subject in your system. You may pass it to the API in place of the subject ID.
19
+ """
20
+
21
+ name: typing.Optional[str] = pydantic.Field(default=None)
22
+ """
23
+ The name of the subject. Used for display in the dashboard.
24
+ """
25
+
26
+ email: typing.Optional[str] = pydantic.Field(default=None)
27
+ """
28
+ The email of the subject.
29
+ """
30
+
31
+ metadata: typing.Dict[str, str] = pydantic.Field()
32
+ """
33
+ Additional metadata about the subject. You may use this to store any custom data about the subject.
34
+ """
35
+
36
+ created_at: dt.datetime = pydantic.Field()
37
+ """
38
+ The date and time the subject was created.
39
+ """
17
40
 
18
41
  if IS_PYDANTIC_V2:
19
42
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -8,9 +8,20 @@ from .amount import Amount
8
8
 
9
9
 
10
10
  class CreateSubscriptionCheckoutSessionResponse(UniversalBaseModel):
11
- id: str
12
- amount: Amount
13
- url: str
11
+ id: str = pydantic.Field()
12
+ """
13
+ The ID of the checkout session.
14
+ """
15
+
16
+ amount: Amount = pydantic.Field()
17
+ """
18
+ The amount of the checkout session.
19
+ """
20
+
21
+ url: str = pydantic.Field()
22
+ """
23
+ The URL to redirect to the checkout session.
24
+ """
14
25
 
15
26
  if IS_PYDANTIC_V2:
16
27
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -10,7 +10,7 @@ from .price import Price
10
10
  class FixedRateInterface(UniversalBaseModel):
11
11
  id: str
12
12
  name: str
13
- description: str
13
+ description: typing.Optional[str] = None
14
14
  price: Price
15
15
 
16
16
  if IS_PYDANTIC_V2:
@@ -4,10 +4,14 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .amount import Amount
7
8
 
8
9
 
9
- class CustomPricingMetricResource(UniversalBaseModel):
10
- sql: str
10
+ class InvoiceLineItemResource(UniversalBaseModel):
11
+ amount: Amount
12
+ description: str
13
+ quantity: int
14
+ price_in_unit_amount: Amount
11
15
 
12
16
  if IS_PYDANTIC_V2:
13
17
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,56 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ import pydantic
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+ from .amount import Amount
9
+ from .invoice_line_item_resource import InvoiceLineItemResource
10
+ from .invoice_status import InvoiceStatus
11
+
12
+
13
+ class InvoiceResource(UniversalBaseModel):
14
+ id: str = pydantic.Field()
15
+ """
16
+ The ID of the invoice.
17
+ """
18
+
19
+ total_amount: Amount = pydantic.Field()
20
+ """
21
+ The total amount of the invoice.
22
+ """
23
+
24
+ subject_id: str = pydantic.Field()
25
+ """
26
+ The ID of the subject for the invoice.
27
+ """
28
+
29
+ created_at: dt.datetime = pydantic.Field()
30
+ """
31
+ The date and time the invoice was created.
32
+ """
33
+
34
+ status: InvoiceStatus = pydantic.Field()
35
+ """
36
+ The status of the invoice.
37
+ """
38
+
39
+ hosted_url: typing.Optional[str] = pydantic.Field(default=None)
40
+ """
41
+ The URL of the hosted invoice.
42
+ """
43
+
44
+ line_items: typing.List[InvoiceLineItemResource] = pydantic.Field()
45
+ """
46
+ The line items of the invoice.
47
+ """
48
+
49
+ if IS_PYDANTIC_V2:
50
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
51
+ else:
52
+
53
+ class Config:
54
+ frozen = True
55
+ smart_union = True
56
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ InvoiceStatus = typing.Union[typing.Literal["draft", "open", "paid", "uncollectible", "void"], typing.Any]
@@ -4,10 +4,12 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .invoice_resource import InvoiceResource
7
8
 
8
9
 
9
- class MaxAggregationPricingMetricResource(UniversalBaseModel):
10
- value_field: str
10
+ class ListInvoicesResponse(UniversalBaseModel):
11
+ invoices: typing.List[InvoiceResource]
12
+ has_more: bool
11
13
 
12
14
  if IS_PYDANTIC_V2:
13
15
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -4,13 +4,12 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from .price import Price
7
+ from .pricing_metric_resource import PricingMetricResource
8
8
 
9
9
 
10
- class CreateFixedRateInterface(UniversalBaseModel):
11
- name: typing.Optional[str] = None
12
- description: typing.Optional[str] = None
13
- price: Price
10
+ class ListPricingMetricsResponse(UniversalBaseModel):
11
+ pricing_metrics: typing.List[PricingMetricResource]
12
+ has_more: bool
14
13
 
15
14
  if IS_PYDANTIC_V2:
16
15
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ import pydantic
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+
9
+
10
+ class PeriodResource(UniversalBaseModel):
11
+ inclusive_start: typing.Optional[bool] = None
12
+ inclusive_end: typing.Optional[bool] = None
13
+ start: dt.datetime
14
+ end: dt.datetime
15
+
16
+ if IS_PYDANTIC_V2:
17
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -4,10 +4,15 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .aggregation import Aggregation
7
8
 
8
9
 
9
- class LastAggregationPricingMetricResource(UniversalBaseModel):
10
- value_field: str
10
+ class PricingMetricResource(UniversalBaseModel):
11
+ id: str
12
+ name: str
13
+ event_name: str
14
+ aggregation: Aggregation
15
+ unit: str
11
16
 
12
17
  if IS_PYDANTIC_V2:
13
18
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -1,5 +1,6 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ import datetime as dt
3
4
  import typing
4
5
 
5
6
  import pydantic
@@ -10,14 +11,42 @@ from .rate_card_resource_usage_based_rates_item import RateCardResourceUsageBase
10
11
 
11
12
 
12
13
  class RateCardResource(UniversalBaseModel):
13
- id: str
14
- name: str
15
- description: str
16
- usage_based_rates: typing.List[RateCardResourceUsageBasedRatesItem]
17
- fixed_rates: typing.List[FixedRateInterface]
14
+ id: str = pydantic.Field()
15
+ """
16
+ The ID of the rate card.
17
+ """
18
+
19
+ name: str = pydantic.Field()
20
+ """
21
+ The name of the rate card.
22
+ """
23
+
24
+ description: typing.Optional[str] = pydantic.Field(default=None)
25
+ """
26
+ The description of the rate card.
27
+ """
28
+
29
+ usage_based_rates: typing.List[RateCardResourceUsageBasedRatesItem] = pydantic.Field()
30
+ """
31
+ The usage based rates of the rate card.
32
+ """
33
+
34
+ fixed_rates: typing.List[FixedRateInterface] = pydantic.Field()
35
+ """
36
+ The fixed rates of the rate card.
37
+ """
38
+
18
39
  billing_interval: RateCardResourceBillingInterval
19
- created_at: str
20
- updated_at: str
40
+ created_at: dt.datetime = pydantic.Field()
41
+ """
42
+ The date and time the rate card was created.
43
+ """
44
+
45
+ updated_at: dt.datetime = pydantic.Field()
46
+ """
47
+ The date and time the rate card was last updated.
48
+ """
49
+
21
50
  metadata: typing.Dict[str, str]
22
51
 
23
52
  if IS_PYDANTIC_V2:
@@ -12,9 +12,8 @@ from .price import Price
12
12
  class RateCardResourceUsageBasedRatesItem_Simple(UniversalBaseModel):
13
13
  usage_based_rate_type: typing.Literal["simple"] = "simple"
14
14
  id: str
15
- code: str
16
15
  name: str
17
- description: str
16
+ description: typing.Optional[str] = None
18
17
  price: Price
19
18
  included_units: int
20
19
  pricing_metric_id: str
@@ -9,13 +9,8 @@ from .price import Price
9
9
 
10
10
  class SimpleUsageBasedRateInterface(UniversalBaseModel):
11
11
  id: str
12
- code: str = pydantic.Field()
13
- """
14
- Code of this rate to be used for overrides and external reference.
15
- """
16
-
17
12
  name: str
18
- description: str
13
+ description: typing.Optional[str] = None
19
14
  price: Price
20
15
  included_units: int
21
16
  pricing_metric_id: str