lark-billing 0.5.0__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.
- lark/__init__.py +92 -0
- lark/_base_client.py +1995 -0
- lark/_client.py +459 -0
- lark/_compat.py +219 -0
- lark/_constants.py +14 -0
- lark/_exceptions.py +108 -0
- lark/_files.py +123 -0
- lark/_models.py +857 -0
- lark/_qs.py +150 -0
- lark/_resource.py +43 -0
- lark/_response.py +830 -0
- lark/_streaming.py +333 -0
- lark/_types.py +261 -0
- lark/_utils/__init__.py +64 -0
- lark/_utils/_compat.py +45 -0
- lark/_utils/_datetime_parse.py +136 -0
- lark/_utils/_logs.py +25 -0
- lark/_utils/_proxy.py +65 -0
- lark/_utils/_reflection.py +42 -0
- lark/_utils/_resources_proxy.py +24 -0
- lark/_utils/_streams.py +12 -0
- lark/_utils/_sync.py +58 -0
- lark/_utils/_transform.py +457 -0
- lark/_utils/_typing.py +156 -0
- lark/_utils/_utils.py +421 -0
- lark/_version.py +4 -0
- lark/lib/.keep +4 -0
- lark/py.typed +0 -0
- lark/resources/__init__.py +117 -0
- lark/resources/customer_access.py +167 -0
- lark/resources/customer_portal.py +187 -0
- lark/resources/invoices.py +191 -0
- lark/resources/pricing_metrics.py +499 -0
- lark/resources/rate_cards.py +395 -0
- lark/resources/subjects.py +579 -0
- lark/resources/subscriptions.py +647 -0
- lark/resources/usage_events.py +221 -0
- lark/types/__init__.py +53 -0
- lark/types/amount_input_param.py +16 -0
- lark/types/amount_output.py +13 -0
- lark/types/checkout_callback_param.py +15 -0
- lark/types/customer_access_retrieve_billing_state_response.py +40 -0
- lark/types/customer_portal_create_session_params.py +18 -0
- lark/types/customer_portal_create_session_response.py +18 -0
- lark/types/flat_price_input_param.py +17 -0
- lark/types/flat_price_output.py +17 -0
- lark/types/invoice_list_params.py +16 -0
- lark/types/invoice_list_response.py +49 -0
- lark/types/package_price_input_param.py +24 -0
- lark/types/package_price_output.py +24 -0
- lark/types/period.py +18 -0
- lark/types/period_param.py +21 -0
- lark/types/pricing_metric_create_params.py +98 -0
- lark/types/pricing_metric_create_summary_params.py +25 -0
- lark/types/pricing_metric_create_summary_response.py +36 -0
- lark/types/pricing_metric_list_params.py +11 -0
- lark/types/pricing_metric_list_response.py +14 -0
- lark/types/pricing_metric_resource.py +72 -0
- lark/types/rate_card_create_params.py +148 -0
- lark/types/rate_card_list_params.py +13 -0
- lark/types/rate_card_list_response.py +14 -0
- lark/types/rate_card_resource.py +141 -0
- lark/types/subject_create_params.py +29 -0
- lark/types/subject_create_response.py +34 -0
- lark/types/subject_list_params.py +13 -0
- lark/types/subject_list_response.py +14 -0
- lark/types/subject_resource.py +34 -0
- lark/types/subject_update_params.py +22 -0
- lark/types/subscription_cancel_params.py +16 -0
- lark/types/subscription_change_rate_card_params.py +29 -0
- lark/types/subscription_change_rate_card_response.py +55 -0
- lark/types/subscription_create_params.py +38 -0
- lark/types/subscription_create_response.py +55 -0
- lark/types/subscription_list_params.py +26 -0
- lark/types/subscription_list_response.py +14 -0
- lark/types/subscription_resource.py +49 -0
- lark/types/usage_event_create_params.py +41 -0
- lark_billing-0.5.0.dist-info/METADATA +431 -0
- lark_billing-0.5.0.dist-info/RECORD +81 -0
- lark_billing-0.5.0.dist-info/WHEEL +4 -0
- lark_billing-0.5.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["SubjectResource"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SubjectResource(BaseModel):
|
|
12
|
+
id: str
|
|
13
|
+
"""The ID of the subject."""
|
|
14
|
+
|
|
15
|
+
created_at: datetime
|
|
16
|
+
"""The date and time the subject was created."""
|
|
17
|
+
|
|
18
|
+
email: Optional[str] = None
|
|
19
|
+
"""The email of the subject."""
|
|
20
|
+
|
|
21
|
+
external_id: Optional[str] = None
|
|
22
|
+
"""The ID of the subject in your system.
|
|
23
|
+
|
|
24
|
+
You may pass it to the API in place of the subject ID.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
metadata: Dict[str, str]
|
|
28
|
+
"""Additional metadata about the subject.
|
|
29
|
+
|
|
30
|
+
You may use this to store any custom data about the subject.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
name: Optional[str] = None
|
|
34
|
+
"""The name of the subject. Used for display in the dashboard."""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Optional
|
|
6
|
+
from typing_extensions import Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["SubjectUpdateParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SubjectUpdateParams(TypedDict, total=False):
|
|
12
|
+
email: Required[Optional[str]]
|
|
13
|
+
"""The email of the subject. Must be a valid email address."""
|
|
14
|
+
|
|
15
|
+
metadata: Required[Optional[Dict[str, str]]]
|
|
16
|
+
"""Additional metadata about the subject.
|
|
17
|
+
|
|
18
|
+
You may use this to store any custom data about the subject.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
name: Required[Optional[str]]
|
|
22
|
+
"""The name of the subject. Used for display in the dashboard."""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["SubscriptionCancelParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SubscriptionCancelParams(TypedDict, total=False):
|
|
12
|
+
cancel_at_end_of_cycle: Literal[True]
|
|
13
|
+
"""Whether to cancel the subscription at end of cycle."""
|
|
14
|
+
|
|
15
|
+
reason: Optional[str]
|
|
16
|
+
"""The reason for cancelling the subscription."""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .checkout_callback_param import CheckoutCallbackParam
|
|
9
|
+
|
|
10
|
+
__all__ = ["SubscriptionChangeRateCardParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SubscriptionChangeRateCardParams(TypedDict, total=False):
|
|
14
|
+
rate_card_id: Required[str]
|
|
15
|
+
"""The ID of the rate card to change the subscription to."""
|
|
16
|
+
|
|
17
|
+
checkout_callback_urls: Optional[CheckoutCallbackParam]
|
|
18
|
+
"""
|
|
19
|
+
The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
20
|
+
checkout is required.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
upgrade_behavior: Literal["prorate", "rate_difference"]
|
|
24
|
+
"""The behavior to use when upgrading the subscription.
|
|
25
|
+
|
|
26
|
+
If 'prorate', the customer will be charged for the prorated difference. If
|
|
27
|
+
'rate_difference', the customer will be charged for the difference in the rate
|
|
28
|
+
cards without respect to time.
|
|
29
|
+
"""
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from .._utils import PropertyInfo
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
from .subscription_resource import SubscriptionResource
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"SubscriptionChangeRateCardResponse",
|
|
12
|
+
"Result",
|
|
13
|
+
"ResultChangeSubscriptionRateCardRequiresActionResponse",
|
|
14
|
+
"ResultChangeSubscriptionRateCardRequiresActionResponseAction",
|
|
15
|
+
"ResultChangeSubscriptionRateCardSuccessResponse",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ResultChangeSubscriptionRateCardRequiresActionResponseAction(BaseModel):
|
|
20
|
+
"""The action to take to complete the request."""
|
|
21
|
+
|
|
22
|
+
checkout_url: str
|
|
23
|
+
"""The URL of the checkout page to redirect to in order to complete the request."""
|
|
24
|
+
|
|
25
|
+
type: Literal["checkout"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ResultChangeSubscriptionRateCardRequiresActionResponse(BaseModel):
|
|
29
|
+
action: ResultChangeSubscriptionRateCardRequiresActionResponseAction
|
|
30
|
+
"""The action to take to complete the request."""
|
|
31
|
+
|
|
32
|
+
type: Literal["requires_action"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ResultChangeSubscriptionRateCardSuccessResponse(BaseModel):
|
|
36
|
+
subscription: SubscriptionResource
|
|
37
|
+
"""The updated subscription resource."""
|
|
38
|
+
|
|
39
|
+
type: Literal["success"]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Result: TypeAlias = Annotated[
|
|
43
|
+
Union[ResultChangeSubscriptionRateCardRequiresActionResponse, ResultChangeSubscriptionRateCardSuccessResponse],
|
|
44
|
+
PropertyInfo(discriminator="type"),
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class SubscriptionChangeRateCardResponse(BaseModel):
|
|
49
|
+
result: Result
|
|
50
|
+
"""The result of the request.
|
|
51
|
+
|
|
52
|
+
If the request is successful, the subscription resource will be returned. If the
|
|
53
|
+
request is requires action, the action to take to complete the request will be
|
|
54
|
+
returned.
|
|
55
|
+
"""
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .checkout_callback_param import CheckoutCallbackParam
|
|
9
|
+
|
|
10
|
+
__all__ = ["SubscriptionCreateParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SubscriptionCreateParams(TypedDict, total=False):
|
|
14
|
+
rate_card_id: Required[str]
|
|
15
|
+
"""The ID of the rate card to use for the subscription."""
|
|
16
|
+
|
|
17
|
+
subject_id: Required[str]
|
|
18
|
+
"""The ID or external ID of the subject to create the subscription for."""
|
|
19
|
+
|
|
20
|
+
checkout_callback_urls: Optional[CheckoutCallbackParam]
|
|
21
|
+
"""
|
|
22
|
+
The URLs to redirect to after the checkout is completed or cancelled, if a
|
|
23
|
+
checkout is required.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
create_checkout_session: Literal["when_required", "always"]
|
|
27
|
+
"""
|
|
28
|
+
Determines whether a checkout session is always required even if the subject has
|
|
29
|
+
a payment method on file. By default, if the subject has a payment method on
|
|
30
|
+
file or the subscription is for a free plan, the subscription will be created
|
|
31
|
+
and billed for immediately (if for a paid plan).
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
metadata: Dict[str, str]
|
|
35
|
+
"""Additional metadata about the subscription.
|
|
36
|
+
|
|
37
|
+
You may use this to store any custom data about the subscription.
|
|
38
|
+
"""
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from .._utils import PropertyInfo
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
from .subscription_resource import SubscriptionResource
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"SubscriptionCreateResponse",
|
|
12
|
+
"Result",
|
|
13
|
+
"ResultCreateSubscriptionRequiresActionResponse",
|
|
14
|
+
"ResultCreateSubscriptionRequiresActionResponseAction",
|
|
15
|
+
"ResultCreateSubscriptionSuccessResponse",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ResultCreateSubscriptionRequiresActionResponseAction(BaseModel):
|
|
20
|
+
"""The action to take to complete the request."""
|
|
21
|
+
|
|
22
|
+
checkout_url: str
|
|
23
|
+
"""The URL of the checkout page to redirect to in order to complete the request."""
|
|
24
|
+
|
|
25
|
+
requires_action_type: Literal["checkout"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ResultCreateSubscriptionRequiresActionResponse(BaseModel):
|
|
29
|
+
action: ResultCreateSubscriptionRequiresActionResponseAction
|
|
30
|
+
"""The action to take to complete the request."""
|
|
31
|
+
|
|
32
|
+
result_type: Literal["requires_action"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ResultCreateSubscriptionSuccessResponse(BaseModel):
|
|
36
|
+
result_type: Literal["success"]
|
|
37
|
+
|
|
38
|
+
subscription: SubscriptionResource
|
|
39
|
+
"""The created subscription resource."""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Result: TypeAlias = Annotated[
|
|
43
|
+
Union[ResultCreateSubscriptionRequiresActionResponse, ResultCreateSubscriptionSuccessResponse],
|
|
44
|
+
PropertyInfo(discriminator="result_type"),
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class SubscriptionCreateResponse(BaseModel):
|
|
49
|
+
result: Result
|
|
50
|
+
"""The result of the request.
|
|
51
|
+
|
|
52
|
+
If the request is successful, the subscription resource will be returned. If the
|
|
53
|
+
request is requires action, the action to take to complete the request will be
|
|
54
|
+
returned.
|
|
55
|
+
"""
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["SubscriptionListParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SubscriptionListParams(TypedDict, total=False):
|
|
12
|
+
limit: int
|
|
13
|
+
|
|
14
|
+
offset: int
|
|
15
|
+
|
|
16
|
+
rate_card_id: Optional[str]
|
|
17
|
+
"""The ID of the rate card to list subscriptions for.
|
|
18
|
+
|
|
19
|
+
Cannot be used with subject_id.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
subject_id: Optional[str]
|
|
23
|
+
"""The ID or external ID of the subject to list subscriptions for.
|
|
24
|
+
|
|
25
|
+
Cannot be used with rate_card_id.
|
|
26
|
+
"""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
from .subscription_resource import SubscriptionResource
|
|
7
|
+
|
|
8
|
+
__all__ = ["SubscriptionListResponse"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SubscriptionListResponse(BaseModel):
|
|
12
|
+
has_more: bool
|
|
13
|
+
|
|
14
|
+
subscriptions: List[SubscriptionResource]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing_extensions import Literal
|
|
6
|
+
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
|
|
9
|
+
__all__ = ["SubscriptionResource", "CurrentPeriod"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CurrentPeriod(BaseModel):
|
|
13
|
+
"""The current period of the subscription if it is active."""
|
|
14
|
+
|
|
15
|
+
end: datetime
|
|
16
|
+
|
|
17
|
+
start: datetime
|
|
18
|
+
|
|
19
|
+
inclusive_end: Optional[bool] = None
|
|
20
|
+
|
|
21
|
+
inclusive_start: Optional[bool] = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SubscriptionResource(BaseModel):
|
|
25
|
+
id: str
|
|
26
|
+
"""The ID of the subscription."""
|
|
27
|
+
|
|
28
|
+
cancels_at_end_of_cycle: bool
|
|
29
|
+
"""Whether the subscription will be cancelled at the end of the current cycle."""
|
|
30
|
+
|
|
31
|
+
current_period: Optional[CurrentPeriod] = None
|
|
32
|
+
"""The current period of the subscription if it is active."""
|
|
33
|
+
|
|
34
|
+
cycles_next_at: Optional[datetime] = None
|
|
35
|
+
"""The date and time the next cycle of the subscription will start."""
|
|
36
|
+
|
|
37
|
+
effective_at: datetime
|
|
38
|
+
"""The date and time the subscription became effective."""
|
|
39
|
+
|
|
40
|
+
metadata: Dict[str, str]
|
|
41
|
+
|
|
42
|
+
rate_card_id: str
|
|
43
|
+
"""The ID of the rate card of the subscription."""
|
|
44
|
+
|
|
45
|
+
status: Literal["active", "cancelled", "paused"]
|
|
46
|
+
"""The status of the subscription."""
|
|
47
|
+
|
|
48
|
+
subject_id: str
|
|
49
|
+
"""The ID of the subject that the subscription is for."""
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Union
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
8
|
+
|
|
9
|
+
from .._utils import PropertyInfo
|
|
10
|
+
|
|
11
|
+
__all__ = ["UsageEventCreateParams"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class UsageEventCreateParams(TypedDict, total=False):
|
|
15
|
+
data: Required[Dict[str, Union[str, int]]]
|
|
16
|
+
"""The data of the usage event.
|
|
17
|
+
|
|
18
|
+
This should contain any data that is needed to aggregate the usage event.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
event_name: Required[str]
|
|
22
|
+
"""The name of the event.
|
|
23
|
+
|
|
24
|
+
This is used by pricing metrics to aggregate usage events.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
idempotency_key: Required[str]
|
|
28
|
+
"""The idempotency key for the usage event.
|
|
29
|
+
|
|
30
|
+
This ensures that the same event is not processed multiple times.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
subject_id: Required[str]
|
|
34
|
+
"""The ID or external ID of the subject that the usage event is for."""
|
|
35
|
+
|
|
36
|
+
timestamp: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
|
|
37
|
+
"""The timestamp of the usage event.
|
|
38
|
+
|
|
39
|
+
It is highly recommended to provide a timestamp. If not provided, the current
|
|
40
|
+
timestamp will be used.
|
|
41
|
+
"""
|