openmeter 1.0.0b54__py3-none-any.whl → 2.0.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.
Potentially problematic release.
This version of openmeter might be problematic. Click here for more details.
- openmeter/__init__.py +89 -15
- openmeter/_base_client.py +2041 -0
- openmeter/_client.py +518 -70
- openmeter/_compat.py +221 -0
- openmeter/_constants.py +14 -0
- openmeter/_exceptions.py +108 -0
- openmeter/_files.py +127 -0
- openmeter/_models.py +777 -0
- openmeter/_qs.py +150 -0
- openmeter/_resource.py +43 -0
- openmeter/_response.py +820 -0
- openmeter/_streaming.py +333 -0
- openmeter/_types.py +222 -0
- openmeter/_utils/__init__.py +56 -0
- openmeter/_utils/_logs.py +25 -0
- openmeter/_utils/_proxy.py +63 -0
- openmeter/_utils/_reflection.py +42 -0
- openmeter/_utils/_streams.py +12 -0
- openmeter/_utils/_sync.py +81 -0
- openmeter/_utils/_transform.py +387 -0
- openmeter/_utils/_typing.py +120 -0
- openmeter/_utils/_utils.py +419 -0
- openmeter/_version.py +4 -0
- openmeter/lib/.keep +4 -0
- openmeter/py.typed +0 -1
- openmeter/resources/__init__.py +103 -0
- openmeter/resources/debug/__init__.py +33 -0
- openmeter/resources/debug/debug.py +102 -0
- openmeter/resources/debug/metrics.py +146 -0
- openmeter/resources/entitlements/__init__.py +47 -0
- openmeter/resources/entitlements/entitlements.py +450 -0
- openmeter/resources/entitlements/features.py +578 -0
- openmeter/resources/entitlements/grants.py +389 -0
- openmeter/resources/events.py +442 -0
- openmeter/resources/meters/__init__.py +33 -0
- openmeter/resources/meters/meters.py +666 -0
- openmeter/resources/meters/subjects.py +163 -0
- openmeter/resources/notifications/__init__.py +75 -0
- openmeter/resources/notifications/channels.py +686 -0
- openmeter/resources/notifications/events.py +365 -0
- openmeter/resources/notifications/notifications.py +198 -0
- openmeter/resources/notifications/rules.py +781 -0
- openmeter/resources/notifications/webhook.py +208 -0
- openmeter/resources/portal/__init__.py +47 -0
- openmeter/resources/portal/meters.py +230 -0
- openmeter/resources/portal/portal.py +112 -0
- openmeter/resources/portal/tokens.py +359 -0
- openmeter/resources/subjects/entitlements/__init__.py +33 -0
- openmeter/resources/subjects/entitlements/entitlements.py +1881 -0
- openmeter/resources/subjects/entitlements/grants.py +453 -0
- openmeter/resources/subjects.py +419 -0
- openmeter/types/__init__.py +21 -0
- openmeter/types/debug/__init__.py +5 -0
- openmeter/types/debug/metric_list_response.py +7 -0
- openmeter/types/entitlement.py +238 -0
- openmeter/types/entitlements/__init__.py +11 -0
- openmeter/types/entitlements/feature.py +61 -0
- openmeter/types/entitlements/feature_create_params.py +43 -0
- openmeter/types/entitlements/feature_list_params.py +23 -0
- openmeter/types/entitlements/grant_list_params.py +57 -0
- openmeter/types/entitlements/grant_list_response.py +11 -0
- openmeter/types/entitlements/grant_paginated_response.py +24 -0
- openmeter/types/entitlements/list_features_result.py +28 -0
- openmeter/types/event_ingest_params.py +46 -0
- openmeter/types/event_ingest_response.py +43 -0
- openmeter/types/event_list_params.py +22 -0
- openmeter/types/event_list_response.py +9 -0
- openmeter/types/ingested_event.py +59 -0
- openmeter/types/list_entitlements_result.py +28 -0
- openmeter/types/meter.py +53 -0
- openmeter/types/meter_create_params.py +50 -0
- openmeter/types/meter_list_response.py +9 -0
- openmeter/types/meter_query_params.py +50 -0
- openmeter/types/meter_query_result.py +35 -0
- openmeter/types/meters/__init__.py +5 -0
- openmeter/types/meters/subject_list_response.py +8 -0
- openmeter/types/notifications/__init__.py +18 -0
- openmeter/types/notifications/channel_create_params.py +34 -0
- openmeter/types/notifications/channel_list_params.py +41 -0
- openmeter/types/notifications/channel_list_response.py +24 -0
- openmeter/types/notifications/channel_update_params.py +34 -0
- openmeter/types/notifications/event_list_params.py +61 -0
- openmeter/types/notifications/event_list_response.py +24 -0
- openmeter/types/notifications/notification_channel.py +47 -0
- openmeter/types/notifications/notification_event.py +215 -0
- openmeter/types/notifications/notification_rule.py +70 -0
- openmeter/types/notifications/rule_create_params.py +39 -0
- openmeter/types/notifications/rule_list_params.py +54 -0
- openmeter/types/notifications/rule_list_response.py +24 -0
- openmeter/types/notifications/rule_update_params.py +39 -0
- openmeter/types/notifications/webhook_svix_params.py +26 -0
- openmeter/types/portal/__init__.py +10 -0
- openmeter/types/portal/meter_query_params.py +44 -0
- openmeter/types/portal/portal_token.py +28 -0
- openmeter/types/portal/token_create_params.py +17 -0
- openmeter/types/portal/token_invalidate_params.py +15 -0
- openmeter/types/portal/token_list_params.py +12 -0
- openmeter/types/portal/token_list_response.py +9 -0
- openmeter/types/shared/__init__.py +3 -0
- openmeter/types/subject.py +37 -0
- openmeter/types/subject_list_response.py +9 -0
- openmeter/types/subject_param.py +27 -0
- openmeter/types/subject_upsert_params.py +39 -0
- openmeter/types/subject_upsert_response.py +10 -0
- openmeter/types/subjects/__init__.py +13 -0
- openmeter/types/subjects/entitlement_history_params.py +35 -0
- openmeter/types/subjects/entitlement_history_response.py +98 -0
- openmeter/types/subjects/entitlement_list_response.py +10 -0
- openmeter/types/subjects/entitlements/__init__.py +8 -0
- openmeter/types/subjects/entitlements/entitlement_grant.py +103 -0
- openmeter/types/subjects/entitlements/grant_list_response.py +10 -0
- openmeter-2.0.0.dist-info/METADATA +396 -0
- openmeter-2.0.0.dist-info/RECORD +115 -0
- {openmeter-1.0.0b54.dist-info → openmeter-2.0.0.dist-info}/WHEEL +1 -1
- openmeter-2.0.0.dist-info/licenses/LICENSE +201 -0
- openmeter/_configuration.py +0 -36
- openmeter/_operations/__init__.py +0 -17
- openmeter/_operations/_operations.py +0 -2105
- openmeter/_operations/_patch.py +0 -20
- openmeter/_patch.py +0 -20
- openmeter/_serialization.py +0 -2008
- openmeter/_vendor.py +0 -24
- openmeter/aio/__init__.py +0 -21
- openmeter/aio/_client.py +0 -83
- openmeter/aio/_configuration.py +0 -36
- openmeter/aio/_operations/__init__.py +0 -17
- openmeter/aio/_operations/_operations.py +0 -1778
- openmeter/aio/_operations/_patch.py +0 -20
- openmeter/aio/_patch.py +0 -20
- openmeter/aio/_vendor.py +0 -24
- openmeter-1.0.0b54.dist-info/METADATA +0 -92
- openmeter-1.0.0b54.dist-info/RECORD +0 -21
|
@@ -0,0 +1,54 @@
|
|
|
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 List
|
|
6
|
+
from typing_extensions import Literal, Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._utils import PropertyInfo
|
|
9
|
+
|
|
10
|
+
__all__ = ["RuleListParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class RuleListParams(TypedDict, total=False):
|
|
14
|
+
channel: List[str]
|
|
15
|
+
"""Filtering by multiple notifiaction channel ids.
|
|
16
|
+
|
|
17
|
+
Usage: `?channel=01ARZ3NDEKTSV4RRFFQ69G5FAV&channel=01J8J2Y5X4NNGQS32CF81W95E3`
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
feature: List[str]
|
|
21
|
+
"""Filtering by multiple feature ids/keys.
|
|
22
|
+
|
|
23
|
+
Usage: `?feature=feature-1&feature=feature-2`
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
include_deleted: Annotated[bool, PropertyInfo(alias="includeDeleted")]
|
|
27
|
+
"""Include deleted notification rules in response.
|
|
28
|
+
|
|
29
|
+
Usage: `?includeDeleted=true`
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
include_disabled: Annotated[bool, PropertyInfo(alias="includeDisabled")]
|
|
33
|
+
"""Include disabled notification rules in response.
|
|
34
|
+
|
|
35
|
+
Usage: `?includeDisabled=false`
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
order: Literal["ASC", "DESC"]
|
|
39
|
+
"""The order direction."""
|
|
40
|
+
|
|
41
|
+
order_by: Annotated[Literal["id", "type", "createdAt", "updatedAt"], PropertyInfo(alias="orderBy")]
|
|
42
|
+
"""The order by field."""
|
|
43
|
+
|
|
44
|
+
page: int
|
|
45
|
+
"""Start date-time in RFC 3339 format.
|
|
46
|
+
|
|
47
|
+
Inclusive.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
page_size: Annotated[int, PropertyInfo(alias="pageSize")]
|
|
51
|
+
"""Number of items per page.
|
|
52
|
+
|
|
53
|
+
Default is 100.
|
|
54
|
+
"""
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from pydantic import Field as FieldInfo
|
|
6
|
+
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from .notification_rule import NotificationRule
|
|
9
|
+
|
|
10
|
+
__all__ = ["RuleListResponse"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class RuleListResponse(BaseModel):
|
|
14
|
+
items: List[NotificationRule]
|
|
15
|
+
"""The items in the current page."""
|
|
16
|
+
|
|
17
|
+
page: int
|
|
18
|
+
"""The items in the current page."""
|
|
19
|
+
|
|
20
|
+
page_size: int = FieldInfo(alias="pageSize")
|
|
21
|
+
"""The items in the current page."""
|
|
22
|
+
|
|
23
|
+
total_count: int = FieldInfo(alias="totalCount")
|
|
24
|
+
"""The items in the current page."""
|
|
@@ -0,0 +1,39 @@
|
|
|
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 List, Iterable
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["RuleUpdateParams", "Threshold"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RuleUpdateParams(TypedDict, total=False):
|
|
12
|
+
channels: Required[List[str]]
|
|
13
|
+
"""List of notification channels the rule is applied to."""
|
|
14
|
+
|
|
15
|
+
name: Required[str]
|
|
16
|
+
"""The user friendly name of the notification rule."""
|
|
17
|
+
|
|
18
|
+
thresholds: Required[Iterable[Threshold]]
|
|
19
|
+
"""List of thresholds the rule suppose to be triggered."""
|
|
20
|
+
|
|
21
|
+
type: Required[Literal["entitlements.balance.threshold"]]
|
|
22
|
+
"""Notification rule type."""
|
|
23
|
+
|
|
24
|
+
disabled: bool
|
|
25
|
+
"""Whether the rule is disabled or not."""
|
|
26
|
+
|
|
27
|
+
features: List[str]
|
|
28
|
+
"""Optional field for defining the scope of notification by feature.
|
|
29
|
+
|
|
30
|
+
It may contain features by id or key.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class Threshold(TypedDict, total=False):
|
|
35
|
+
type: Required[Literal["PERCENT", "NUMBER"]]
|
|
36
|
+
"""Type of the rule in the balance threshold specification."""
|
|
37
|
+
|
|
38
|
+
value: Required[float]
|
|
39
|
+
"""Value of the threshold."""
|
|
@@ -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 Dict
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["WebhookSvixParams"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class WebhookSvixParams(TypedDict, total=False):
|
|
12
|
+
data: Required[Dict[str, str]]
|
|
13
|
+
"""The payload of the Svix operational webhook request."""
|
|
14
|
+
|
|
15
|
+
type: Required[
|
|
16
|
+
Literal[
|
|
17
|
+
"endpoint.created",
|
|
18
|
+
"endpoint.deleted",
|
|
19
|
+
"endpoint.disabled",
|
|
20
|
+
"endpoint.updated",
|
|
21
|
+
"message.attempt.exhausted",
|
|
22
|
+
"message.attempt.failing",
|
|
23
|
+
"message.attempt.recovered",
|
|
24
|
+
]
|
|
25
|
+
]
|
|
26
|
+
"""The type of the Svix operational webhook request."""
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .portal_token import PortalToken as PortalToken
|
|
6
|
+
from .token_list_params import TokenListParams as TokenListParams
|
|
7
|
+
from .meter_query_params import MeterQueryParams as MeterQueryParams
|
|
8
|
+
from .token_create_params import TokenCreateParams as TokenCreateParams
|
|
9
|
+
from .token_list_response import TokenListResponse as TokenListResponse
|
|
10
|
+
from .token_invalidate_params import TokenInvalidateParams as TokenInvalidateParams
|
|
@@ -0,0 +1,44 @@
|
|
|
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, List, Union
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Literal, Annotated, TypedDict
|
|
8
|
+
|
|
9
|
+
from ..._utils import PropertyInfo
|
|
10
|
+
|
|
11
|
+
__all__ = ["MeterQueryParams"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class MeterQueryParams(TypedDict, total=False):
|
|
15
|
+
filter_group_by: Annotated[Dict[str, str], PropertyInfo(alias="filterGroupBy")]
|
|
16
|
+
"""Simple filter for group bys with exact match.
|
|
17
|
+
|
|
18
|
+
Usage: `?filterGroupBy[type]=input&filterGroupBy[model]=gpt-4`
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from_: Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]
|
|
22
|
+
"""Start date-time in RFC 3339 format. Inclusive."""
|
|
23
|
+
|
|
24
|
+
group_by: Annotated[List[str], PropertyInfo(alias="groupBy")]
|
|
25
|
+
"""
|
|
26
|
+
If not specified a single aggregate will be returned for each subject and time
|
|
27
|
+
window. `subject` is a reserved group by value.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
|
31
|
+
"""End date-time in RFC 3339 format. Inclusive."""
|
|
32
|
+
|
|
33
|
+
window_size: Annotated[Literal["MINUTE", "HOUR", "DAY"], PropertyInfo(alias="windowSize")]
|
|
34
|
+
"""
|
|
35
|
+
If not specified, a single usage aggregate will be returned for the entirety of
|
|
36
|
+
the specified period for each subject and group.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
window_time_zone: Annotated[str, PropertyInfo(alias="windowTimeZone")]
|
|
40
|
+
"""
|
|
41
|
+
The value is the name of the time zone as defined in the IANA Time Zone Database
|
|
42
|
+
(http://www.iana.org/time-zones). If not specified, the UTC timezone will be
|
|
43
|
+
used.
|
|
44
|
+
"""
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from ..._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = ["PortalToken"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PortalToken(BaseModel):
|
|
14
|
+
subject: str
|
|
15
|
+
|
|
16
|
+
id: Optional[str] = None
|
|
17
|
+
|
|
18
|
+
token: Optional[str] = None
|
|
19
|
+
"""The token is only returned at creation."""
|
|
20
|
+
|
|
21
|
+
allowed_meter_slugs: Optional[List[str]] = FieldInfo(alias="allowedMeterSlugs", default=None)
|
|
22
|
+
"""Optional, if defined only the specified meters will be allowed"""
|
|
23
|
+
|
|
24
|
+
created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None)
|
|
25
|
+
|
|
26
|
+
expired: Optional[bool] = None
|
|
27
|
+
|
|
28
|
+
expires_at: Optional[datetime] = FieldInfo(alias="expiresAt", default=None)
|
|
@@ -0,0 +1,17 @@
|
|
|
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 List
|
|
6
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..._utils import PropertyInfo
|
|
9
|
+
|
|
10
|
+
__all__ = ["TokenCreateParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TokenCreateParams(TypedDict, total=False):
|
|
14
|
+
subject: Required[str]
|
|
15
|
+
|
|
16
|
+
allowed_meter_slugs: Annotated[List[str], PropertyInfo(alias="allowedMeterSlugs")]
|
|
17
|
+
"""Optional, if defined only the specified meters will be allowed"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["TokenInvalidateParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TokenInvalidateParams(TypedDict, total=False):
|
|
11
|
+
id: str
|
|
12
|
+
"""Invalidate a portal token by ID."""
|
|
13
|
+
|
|
14
|
+
subject: str
|
|
15
|
+
"""Invalidate all portal tokens for a subject."""
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["TokenListParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TokenListParams(TypedDict, total=False):
|
|
11
|
+
limit: int
|
|
12
|
+
"""Number of portal tokens to return. Default is 25."""
|
|
@@ -0,0 +1,37 @@
|
|
|
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 pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = ["Subject"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Subject(BaseModel):
|
|
14
|
+
id: str
|
|
15
|
+
"""A unique identifier for the subject."""
|
|
16
|
+
|
|
17
|
+
key: str
|
|
18
|
+
"""A unique, human-readable identifier for the subject."""
|
|
19
|
+
|
|
20
|
+
current_period_end: Optional[datetime] = FieldInfo(alias="currentPeriodEnd", default=None)
|
|
21
|
+
"""
|
|
22
|
+
[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in
|
|
23
|
+
UTC.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
current_period_start: Optional[datetime] = FieldInfo(alias="currentPeriodStart", default=None)
|
|
27
|
+
"""
|
|
28
|
+
[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in
|
|
29
|
+
UTC.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
display_name: Optional[str] = FieldInfo(alias="displayName", default=None)
|
|
33
|
+
"""A human-readable display name for the subject."""
|
|
34
|
+
|
|
35
|
+
metadata: Optional[Dict[str, object]] = None
|
|
36
|
+
|
|
37
|
+
stripe_customer_id: Optional[str] = FieldInfo(alias="stripeCustomerId", default=None)
|
|
@@ -0,0 +1,27 @@
|
|
|
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, Optional
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
8
|
+
|
|
9
|
+
from .._utils import PropertyInfo
|
|
10
|
+
|
|
11
|
+
__all__ = ["SubjectParam"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SubjectParam(TypedDict, total=False):
|
|
15
|
+
key: Required[str]
|
|
16
|
+
|
|
17
|
+
current_period_end: Annotated[Union[str, datetime, None], PropertyInfo(alias="currentPeriodEnd", format="iso8601")]
|
|
18
|
+
|
|
19
|
+
current_period_start: Annotated[
|
|
20
|
+
Union[str, datetime, None], PropertyInfo(alias="currentPeriodStart", format="iso8601")
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
display_name: Annotated[Optional[str], PropertyInfo(alias="displayName")]
|
|
24
|
+
|
|
25
|
+
metadata: Optional[Dict[str, object]]
|
|
26
|
+
|
|
27
|
+
stripe_customer_id: Annotated[Optional[str], PropertyInfo(alias="stripeCustomerId")]
|
|
@@ -0,0 +1,39 @@
|
|
|
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, Iterable, Optional
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
8
|
+
|
|
9
|
+
from .._utils import PropertyInfo
|
|
10
|
+
|
|
11
|
+
__all__ = ["SubjectUpsertParams", "Body"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SubjectUpsertParams(TypedDict, total=False):
|
|
15
|
+
body: Required[Iterable[Body]]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Body(TypedDict, total=False):
|
|
19
|
+
key: Required[str]
|
|
20
|
+
"""A unique, human-readable identifier for the subject."""
|
|
21
|
+
|
|
22
|
+
current_period_end: Annotated[Union[str, datetime], PropertyInfo(alias="currentPeriodEnd", format="iso8601")]
|
|
23
|
+
"""
|
|
24
|
+
[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in
|
|
25
|
+
UTC.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
current_period_start: Annotated[Union[str, datetime], PropertyInfo(alias="currentPeriodStart", format="iso8601")]
|
|
29
|
+
"""
|
|
30
|
+
[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in
|
|
31
|
+
UTC.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
display_name: Annotated[Optional[str], PropertyInfo(alias="displayName")]
|
|
35
|
+
"""A human-readable display name for the subject."""
|
|
36
|
+
|
|
37
|
+
metadata: Optional[Dict[str, object]]
|
|
38
|
+
|
|
39
|
+
stripe_customer_id: Annotated[Optional[str], PropertyInfo(alias="stripeCustomerId")]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
from typing_extensions import TypeAlias
|
|
5
|
+
|
|
6
|
+
from .subject import Subject
|
|
7
|
+
|
|
8
|
+
__all__ = ["SubjectUpsertResponse"]
|
|
9
|
+
|
|
10
|
+
SubjectUpsertResponse: TypeAlias = List[Subject]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .entitlement_value import EntitlementValue as EntitlementValue
|
|
6
|
+
from .entitlement_list_params import EntitlementListParams as EntitlementListParams
|
|
7
|
+
from .entitlement_reset_params import EntitlementResetParams as EntitlementResetParams
|
|
8
|
+
from .entitlement_value_params import EntitlementValueParams as EntitlementValueParams
|
|
9
|
+
from .entitlement_create_params import EntitlementCreateParams as EntitlementCreateParams
|
|
10
|
+
from .entitlement_list_response import EntitlementListResponse as EntitlementListResponse
|
|
11
|
+
from .entitlement_history_params import EntitlementHistoryParams as EntitlementHistoryParams
|
|
12
|
+
from .entitlement_override_params import EntitlementOverrideParams as EntitlementOverrideParams
|
|
13
|
+
from .entitlement_history_response import EntitlementHistoryResponse as EntitlementHistoryResponse
|
|
@@ -0,0 +1,35 @@
|
|
|
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 Union
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from typing_extensions import Literal, Required, Annotated, TypedDict
|
|
8
|
+
|
|
9
|
+
from ..._utils import PropertyInfo
|
|
10
|
+
|
|
11
|
+
__all__ = ["EntitlementHistoryParams"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class EntitlementHistoryParams(TypedDict, total=False):
|
|
15
|
+
subject_id_or_key: Required[Annotated[str, PropertyInfo(alias="subjectIdOrKey")]]
|
|
16
|
+
|
|
17
|
+
window_size: Required[Annotated[Literal["MINUTE", "HOUR", "DAY"], PropertyInfo(alias="windowSize")]]
|
|
18
|
+
"""Windowsize"""
|
|
19
|
+
|
|
20
|
+
from_: Annotated[Union[str, datetime], PropertyInfo(alias="from", format="iso8601")]
|
|
21
|
+
"""Start of time range to query entitlement: date-time in RFC 3339 format.
|
|
22
|
+
|
|
23
|
+
Defaults to the last reset. Gets truncated to the granularity of the underlying
|
|
24
|
+
meter.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
to: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
|
|
28
|
+
"""End of time range to query entitlement: date-time in RFC 3339 format.
|
|
29
|
+
|
|
30
|
+
Defaults to now. If not now then gets truncated to the granularity of the
|
|
31
|
+
underlying meter.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
window_time_zone: Annotated[str, PropertyInfo(alias="windowTimeZone")]
|
|
35
|
+
"""The timezone used when calculating the windows."""
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from ..._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"EntitlementHistoryResponse",
|
|
12
|
+
"BurndownHistory",
|
|
13
|
+
"BurndownHistoryGrantUsage",
|
|
14
|
+
"BurndownHistoryPeriod",
|
|
15
|
+
"WindowedHistory",
|
|
16
|
+
"WindowedHistoryPeriod",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class BurndownHistoryGrantUsage(BaseModel):
|
|
21
|
+
grant_id: str = FieldInfo(alias="grantId")
|
|
22
|
+
"""The id of the grant"""
|
|
23
|
+
|
|
24
|
+
usage: float
|
|
25
|
+
"""The usage in the period"""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class BurndownHistoryPeriod(BaseModel):
|
|
29
|
+
from_: datetime = FieldInfo(alias="from")
|
|
30
|
+
"""Period start time."""
|
|
31
|
+
|
|
32
|
+
to: datetime
|
|
33
|
+
"""Period end time."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class BurndownHistory(BaseModel):
|
|
37
|
+
balance_at_end: float = FieldInfo(alias="balanceAtEnd")
|
|
38
|
+
"""The entitlement balance at the end of the period."""
|
|
39
|
+
|
|
40
|
+
balance_at_start: float = FieldInfo(alias="balanceAtStart")
|
|
41
|
+
"""entitlement balance at the start of the period."""
|
|
42
|
+
|
|
43
|
+
grant_balances_at_end: Dict[str, float] = FieldInfo(alias="grantBalancesAtEnd")
|
|
44
|
+
"""
|
|
45
|
+
The balance breakdown of each active grant at the end of the period: GrantID:
|
|
46
|
+
Balance
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
grant_balances_at_start: Dict[str, float] = FieldInfo(alias="grantBalancesAtStart")
|
|
50
|
+
"""
|
|
51
|
+
The balance breakdown of each active grant at the start of the period: GrantID:
|
|
52
|
+
Balance
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
grant_usages: List[BurndownHistoryGrantUsage] = FieldInfo(alias="grantUsages")
|
|
56
|
+
"""Which grants were actually burnt down in the period and by what amount."""
|
|
57
|
+
|
|
58
|
+
overage: float
|
|
59
|
+
"""Overuse that wasn't covered by grants."""
|
|
60
|
+
|
|
61
|
+
period: BurndownHistoryPeriod
|
|
62
|
+
"""A period with a start and end time."""
|
|
63
|
+
|
|
64
|
+
usage: float
|
|
65
|
+
"""The total usage of the grant in the period."""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class WindowedHistoryPeriod(BaseModel):
|
|
69
|
+
from_: datetime = FieldInfo(alias="from")
|
|
70
|
+
"""Period start time."""
|
|
71
|
+
|
|
72
|
+
to: datetime
|
|
73
|
+
"""Period end time."""
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class WindowedHistory(BaseModel):
|
|
77
|
+
balance_at_start: float = FieldInfo(alias="balanceAtStart")
|
|
78
|
+
"""The entitlement balance at the start of the period."""
|
|
79
|
+
|
|
80
|
+
period: WindowedHistoryPeriod
|
|
81
|
+
"""A period with a start and end time."""
|
|
82
|
+
|
|
83
|
+
usage: float
|
|
84
|
+
"""The total usage of the feature in the period."""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class EntitlementHistoryResponse(BaseModel):
|
|
88
|
+
burndown_history: List[BurndownHistory] = FieldInfo(alias="burndownHistory")
|
|
89
|
+
"""Grant burndown history."""
|
|
90
|
+
|
|
91
|
+
windowed_history: List[WindowedHistory] = FieldInfo(alias="windowedHistory")
|
|
92
|
+
"""The windowed balance history.
|
|
93
|
+
|
|
94
|
+
- It only returns rows for windows where there was usage.
|
|
95
|
+
- The windows are inclusive at their start and exclusive at their end.
|
|
96
|
+
- The last window may be smaller than the window size and is inclusive at both
|
|
97
|
+
ends.
|
|
98
|
+
"""
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
from typing_extensions import TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..entitlement import Entitlement
|
|
7
|
+
|
|
8
|
+
__all__ = ["EntitlementListResponse"]
|
|
9
|
+
|
|
10
|
+
EntitlementListResponse: TypeAlias = List[Entitlement]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .entitlement_grant import EntitlementGrant as EntitlementGrant
|
|
6
|
+
from .grant_list_params import GrantListParams as GrantListParams
|
|
7
|
+
from .grant_create_params import GrantCreateParams as GrantCreateParams
|
|
8
|
+
from .grant_list_response import GrantListResponse as GrantListResponse
|