levelfour 0.1.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.
- levelfour/__init__.py +495 -0
- levelfour/api_keys/__init__.py +34 -0
- levelfour/api_keys/client.py +337 -0
- levelfour/api_keys/raw_client.py +621 -0
- levelfour/api_keys/types/__init__.py +34 -0
- levelfour/api_keys/types/create_api_key_request_scope.py +5 -0
- levelfour/async_levelfour_client.py +39 -0
- levelfour/base_client.py +346 -0
- levelfour/client.py +54 -0
- levelfour/core/__init__.py +127 -0
- levelfour/core/api_error.py +23 -0
- levelfour/core/client_wrapper.py +105 -0
- levelfour/core/datetime_utils.py +70 -0
- levelfour/core/file.py +67 -0
- levelfour/core/force_multipart.py +18 -0
- levelfour/core/http_client.py +776 -0
- levelfour/core/http_response.py +59 -0
- levelfour/core/http_sse/__init__.py +42 -0
- levelfour/core/http_sse/_api.py +112 -0
- levelfour/core/http_sse/_decoders.py +61 -0
- levelfour/core/http_sse/_exceptions.py +7 -0
- levelfour/core/http_sse/_models.py +17 -0
- levelfour/core/jsonable_encoder.py +108 -0
- levelfour/core/logging.py +107 -0
- levelfour/core/pagination.py +82 -0
- levelfour/core/pydantic_utilities.py +577 -0
- levelfour/core/query_encoder.py +58 -0
- levelfour/core/remove_none_from_dict.py +11 -0
- levelfour/core/request_options.py +35 -0
- levelfour/core/serialization.py +276 -0
- levelfour/errors/__init__.py +40 -0
- levelfour/errors/forbidden_error.py +11 -0
- levelfour/errors/unauthorized_error.py +11 -0
- levelfour/errors/unprocessable_entity_error.py +11 -0
- levelfour/evaluation/__init__.py +4 -0
- levelfour/evaluation/client.py +102 -0
- levelfour/evaluation/raw_client.py +141 -0
- levelfour/exceptions.py +63 -0
- levelfour/health/__init__.py +4 -0
- levelfour/health/client.py +163 -0
- levelfour/health/raw_client.py +164 -0
- levelfour/integrations/__init__.py +0 -0
- levelfour/integrations/django.py +26 -0
- levelfour/integrations/fastapi.py +39 -0
- levelfour/integrations/telemetry.py +66 -0
- levelfour/levelfour_client.py +47 -0
- levelfour/pagination.py +84 -0
- levelfour/pr_analysis/__init__.py +4 -0
- levelfour/pr_analysis/client.py +408 -0
- levelfour/pr_analysis/raw_client.py +620 -0
- levelfour/pr_analysis_actions/__init__.py +4 -0
- levelfour/pr_analysis_actions/client.py +588 -0
- levelfour/pr_analysis_actions/raw_client.py +939 -0
- levelfour/pr_analysis_installations/__init__.py +4 -0
- levelfour/pr_analysis_installations/client.py +470 -0
- levelfour/pr_analysis_installations/raw_client.py +868 -0
- levelfour/providers/__init__.py +34 -0
- levelfour/providers/client.py +1504 -0
- levelfour/providers/raw_client.py +2398 -0
- levelfour/providers/types/__init__.py +36 -0
- levelfour/providers/types/list_spending_breakdown_providers_response.py +11 -0
- levelfour/py.typed +0 -0
- levelfour/recommendations/__init__.py +4 -0
- levelfour/recommendations/client.py +1018 -0
- levelfour/recommendations/raw_client.py +1810 -0
- levelfour/savings/__init__.py +4 -0
- levelfour/savings/client.py +401 -0
- levelfour/savings/raw_client.py +624 -0
- levelfour/spending/__init__.py +34 -0
- levelfour/spending/client.py +437 -0
- levelfour/spending/raw_client.py +684 -0
- levelfour/spending/types/__init__.py +34 -0
- levelfour/spending/types/list_breakdown_spending_response.py +12 -0
- levelfour/types/__init__.py +413 -0
- levelfour/types/accept_terms_data.py +25 -0
- levelfour/types/accept_terms_response.py +27 -0
- levelfour/types/action_request.py +42 -0
- levelfour/types/api_key_created_data.py +28 -0
- levelfour/types/api_key_data.py +27 -0
- levelfour/types/authentication_error.py +5 -0
- levelfour/types/authorization_error.py +5 -0
- levelfour/types/bad_request_error.py +5 -0
- levelfour/types/comparison_item.py +32 -0
- levelfour/types/complete_wizard_data.py +27 -0
- levelfour/types/complete_wizard_response.py +27 -0
- levelfour/types/conflict_error.py +5 -0
- levelfour/types/cost_breakdown_data.py +35 -0
- levelfour/types/cost_breakdown_item.py +71 -0
- levelfour/types/cost_breakdown_raw_data.py +37 -0
- levelfour/types/cost_breakdown_raw_response.py +27 -0
- levelfour/types/cost_breakdown_response.py +27 -0
- levelfour/types/costs_breakdown_chart_data.py +48 -0
- levelfour/types/costs_breakdown_chart_response.py +27 -0
- levelfour/types/costs_breakdown_data_point.py +46 -0
- levelfour/types/costs_breakdown_grouped_chart_data.py +52 -0
- levelfour/types/costs_breakdown_grouped_chart_response.py +27 -0
- levelfour/types/costs_breakdown_grouped_data_point.py +36 -0
- levelfour/types/costs_breakdown_totals.py +41 -0
- levelfour/types/create_api_key_response.py +23 -0
- levelfour/types/daily_spending_breakdown_data.py +42 -0
- levelfour/types/daily_spending_breakdown_response.py +27 -0
- levelfour/types/daily_spending_data_point.py +31 -0
- levelfour/types/dashboard_summary_data.py +72 -0
- levelfour/types/dashboard_summary_response.py +27 -0
- levelfour/types/delete_endpoint_data.py +20 -0
- levelfour/types/delete_endpoint_response.py +23 -0
- levelfour/types/endpoint_data.py +23 -0
- levelfour/types/error_response.py +23 -0
- levelfour/types/error_response_error.py +21 -0
- levelfour/types/evaluation_status_data.py +71 -0
- levelfour/types/evaluation_status_response.py +27 -0
- levelfour/types/execution_log_command.py +21 -0
- levelfour/types/execution_log_entry.py +23 -0
- levelfour/types/execution_step_schema.py +23 -0
- levelfour/types/http_validation_error.py +20 -0
- levelfour/types/implementation_method_data.py +25 -0
- levelfour/types/implementation_method_response.py +27 -0
- levelfour/types/implementation_step.py +27 -0
- levelfour/types/internal_server_error.py +5 -0
- levelfour/types/list_api_keys_data.py +21 -0
- levelfour/types/list_api_keys_response.py +23 -0
- levelfour/types/list_endpoints_response.py +23 -0
- levelfour/types/metric_data_point.py +27 -0
- levelfour/types/metric_series.py +40 -0
- levelfour/types/metric_series_entry.py +25 -0
- levelfour/types/monthly_spending_data.py +27 -0
- levelfour/types/monthly_spending_data_point.py +31 -0
- levelfour/types/monthly_spending_response.py +27 -0
- levelfour/types/not_found_error.py +5 -0
- levelfour/types/pagination_meta.py +51 -0
- levelfour/types/processing_recommendation_item.py +61 -0
- levelfour/types/processing_recommendations_data.py +28 -0
- levelfour/types/processing_recommendations_response.py +27 -0
- levelfour/types/provider.py +46 -0
- levelfour/types/provider_breakdown_data.py +31 -0
- levelfour/types/provider_breakdown_item.py +77 -0
- levelfour/types/provider_breakdown_response.py +27 -0
- levelfour/types/provider_filter_options_data.py +51 -0
- levelfour/types/provider_filter_options_response.py +27 -0
- levelfour/types/provider_potential_savings_summary_data.py +46 -0
- levelfour/types/provider_potential_savings_summary_response.py +27 -0
- levelfour/types/provider_recommendations_summary_data.py +37 -0
- levelfour/types/provider_recommendations_summary_response.py +27 -0
- levelfour/types/provider_saved_summary_data.py +56 -0
- levelfour/types/provider_saved_summary_response.py +27 -0
- levelfour/types/provider_service_breakdown_data.py +65 -0
- levelfour/types/provider_service_breakdown_item.py +72 -0
- levelfour/types/provider_service_breakdown_raw_data.py +62 -0
- levelfour/types/provider_service_breakdown_raw_response.py +27 -0
- levelfour/types/provider_service_breakdown_response.py +27 -0
- levelfour/types/provider_service_costs_breakdown_data.py +62 -0
- levelfour/types/provider_service_costs_breakdown_response.py +27 -0
- levelfour/types/provider_service_costs_data_point.py +36 -0
- levelfour/types/provider_spending.py +61 -0
- levelfour/types/provider_spending_summary_data.py +67 -0
- levelfour/types/provider_spending_summary_response.py +27 -0
- levelfour/types/provider_timeline_data.py +57 -0
- levelfour/types/provider_timeline_response.py +27 -0
- levelfour/types/provider_top_service.py +36 -0
- levelfour/types/providers_summary_data.py +24 -0
- levelfour/types/providers_summary_response.py +27 -0
- levelfour/types/rate_limit_error.py +5 -0
- levelfour/types/recommendation_actions.py +60 -0
- levelfour/types/recommendation_detail.py +42 -0
- levelfour/types/recommendation_detail_response.py +27 -0
- levelfour/types/recommendation_filter_options_data.py +41 -0
- levelfour/types/recommendation_filter_options_response.py +27 -0
- levelfour/types/recommendation_item.py +36 -0
- levelfour/types/recommendation_wizard_data.py +173 -0
- levelfour/types/recommendation_wizard_data_metrics.py +7 -0
- levelfour/types/recommendation_wizard_response.py +27 -0
- levelfour/types/recommendations_breakdown_data.py +26 -0
- levelfour/types/recommendations_breakdown_response.py +27 -0
- levelfour/types/recommendations_overview_data.py +51 -0
- levelfour/types/recommendations_overview_response.py +27 -0
- levelfour/types/register_endpoint_response.py +23 -0
- levelfour/types/resource_change.py +42 -0
- levelfour/types/resource_snapshot.py +21 -0
- levelfour/types/revoke_api_key_data.py +20 -0
- levelfour/types/revoke_api_key_response.py +23 -0
- levelfour/types/risk_assessment.py +29 -0
- levelfour/types/risk_factor.py +27 -0
- levelfour/types/saved_breakdown_data.py +31 -0
- levelfour/types/saved_breakdown_response.py +27 -0
- levelfour/types/saved_by_provider_breakdown_data.py +31 -0
- levelfour/types/saved_by_provider_breakdown_response.py +27 -0
- levelfour/types/saved_by_provider_item.py +76 -0
- levelfour/types/saved_item.py +35 -0
- levelfour/types/saved_provider_summary.py +36 -0
- levelfour/types/saved_summary_data.py +57 -0
- levelfour/types/saved_summary_response.py +27 -0
- levelfour/types/savings_decision_data.py +28 -0
- levelfour/types/savings_decision_response.py +27 -0
- levelfour/types/spending_by_date_item.py +36 -0
- levelfour/types/top_recommendation.py +56 -0
- levelfour/types/trigger_info.py +22 -0
- levelfour/types/update_tag_data.py +20 -0
- levelfour/types/update_tag_response.py +23 -0
- levelfour/types/validation_error.py +24 -0
- levelfour/types/validation_error_loc_item.py +5 -0
- levelfour/webhooks/__init__.py +4 -0
- levelfour/webhooks/client.py +273 -0
- levelfour/webhooks/raw_client.py +483 -0
- levelfour/webhooks/verifier.py +61 -0
- levelfour-0.1.0.dist-info/METADATA +12 -0
- levelfour-0.1.0.dist-info/RECORD +208 -0
- levelfour-0.1.0.dist-info/WHEEL +5 -0
- levelfour-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
class TopRecommendation(UniversalBaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Top recommendation for a specific provider
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
recommendation_id: str = pydantic.Field()
|
|
15
|
+
"""
|
|
16
|
+
Unique identifier for the recommendation
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
service: str = pydantic.Field()
|
|
20
|
+
"""
|
|
21
|
+
Service name (e.g., EC2, Cloud SQL, Virtual Machines)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
monthly_savings: float = pydantic.Field()
|
|
25
|
+
"""
|
|
26
|
+
Monthly savings amount
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
annual_savings: float = pydantic.Field()
|
|
30
|
+
"""
|
|
31
|
+
Annual savings amount
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
current_monthly_spending: float = pydantic.Field()
|
|
35
|
+
"""
|
|
36
|
+
Current monthly spending for this resource
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
savings_percentage: float = pydantic.Field()
|
|
40
|
+
"""
|
|
41
|
+
Savings as percentage of current spending
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
status: str = pydantic.Field()
|
|
45
|
+
"""
|
|
46
|
+
Display status: available, pending, processing, optimized, rejected, unavailable
|
|
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,22 @@
|
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
class TriggerInfo(UniversalBaseModel):
|
|
10
|
+
triggered_via: str
|
|
11
|
+
triggered_by_email: str
|
|
12
|
+
triggered_at: typing.Optional[str] = None
|
|
13
|
+
approved_by: typing.Optional[typing.List[str]] = None
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
class UpdateTagData(UniversalBaseModel):
|
|
10
|
+
recommendation_id: str
|
|
11
|
+
tag: typing.Optional[str] = None
|
|
12
|
+
|
|
13
|
+
if IS_PYDANTIC_V2:
|
|
14
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
15
|
+
else:
|
|
16
|
+
|
|
17
|
+
class Config:
|
|
18
|
+
frozen = True
|
|
19
|
+
smart_union = True
|
|
20
|
+
extra = pydantic.Extra.allow
|
|
@@ -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
|
+
from .update_tag_data import UpdateTagData
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class UpdateTagResponse(UniversalBaseModel):
|
|
12
|
+
success: typing.Optional[bool] = None
|
|
13
|
+
timestamp: typing.Optional[dt.datetime] = None
|
|
14
|
+
data: UpdateTagData
|
|
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
|
|
@@ -0,0 +1,24 @@
|
|
|
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 .validation_error_loc_item import ValidationErrorLocItem
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ValidationError(UniversalBaseModel):
|
|
11
|
+
loc: typing.List[ValidationErrorLocItem]
|
|
12
|
+
msg: str
|
|
13
|
+
type: str
|
|
14
|
+
input: typing.Optional[typing.Any] = None
|
|
15
|
+
ctx: typing.Optional[typing.Dict[str, typing.Any]] = None
|
|
16
|
+
|
|
17
|
+
if IS_PYDANTIC_V2:
|
|
18
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
19
|
+
else:
|
|
20
|
+
|
|
21
|
+
class Config:
|
|
22
|
+
frozen = True
|
|
23
|
+
smart_union = True
|
|
24
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.delete_endpoint_response import DeleteEndpointResponse
|
|
8
|
+
from ..types.list_endpoints_response import ListEndpointsResponse
|
|
9
|
+
from ..types.register_endpoint_response import RegisterEndpointResponse
|
|
10
|
+
from .raw_client import AsyncRawWebhooksClient, RawWebhooksClient
|
|
11
|
+
|
|
12
|
+
# this is used as the default value for optional parameters
|
|
13
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class WebhooksClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._raw_client = RawWebhooksClient(client_wrapper=client_wrapper)
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def with_raw_response(self) -> RawWebhooksClient:
|
|
22
|
+
"""
|
|
23
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
RawWebhooksClient
|
|
28
|
+
"""
|
|
29
|
+
return self._raw_client
|
|
30
|
+
|
|
31
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListEndpointsResponse:
|
|
32
|
+
"""
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
request_options : typing.Optional[RequestOptions]
|
|
36
|
+
Request-specific configuration.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
ListEndpointsResponse
|
|
41
|
+
Successful Response
|
|
42
|
+
|
|
43
|
+
Examples
|
|
44
|
+
--------
|
|
45
|
+
from levelfour import BaseLevelFour
|
|
46
|
+
|
|
47
|
+
client = BaseLevelFour(
|
|
48
|
+
token="YOUR_TOKEN",
|
|
49
|
+
base_url="https://yourhost.com/path/to/api",
|
|
50
|
+
)
|
|
51
|
+
client.webhooks.list()
|
|
52
|
+
"""
|
|
53
|
+
_response = self._raw_client.list(request_options=request_options)
|
|
54
|
+
return _response.data
|
|
55
|
+
|
|
56
|
+
def register(
|
|
57
|
+
self,
|
|
58
|
+
*,
|
|
59
|
+
url: str,
|
|
60
|
+
event_types: typing.Sequence[str],
|
|
61
|
+
description: typing.Optional[str] = OMIT,
|
|
62
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
63
|
+
) -> RegisterEndpointResponse:
|
|
64
|
+
"""
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
url : str
|
|
68
|
+
Webhook endpoint URL
|
|
69
|
+
|
|
70
|
+
event_types : typing.Sequence[str]
|
|
71
|
+
Event types to subscribe to
|
|
72
|
+
|
|
73
|
+
description : typing.Optional[str]
|
|
74
|
+
|
|
75
|
+
request_options : typing.Optional[RequestOptions]
|
|
76
|
+
Request-specific configuration.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
RegisterEndpointResponse
|
|
81
|
+
Successful Response
|
|
82
|
+
|
|
83
|
+
Examples
|
|
84
|
+
--------
|
|
85
|
+
from levelfour import BaseLevelFour
|
|
86
|
+
|
|
87
|
+
client = BaseLevelFour(
|
|
88
|
+
token="YOUR_TOKEN",
|
|
89
|
+
base_url="https://yourhost.com/path/to/api",
|
|
90
|
+
)
|
|
91
|
+
client.webhooks.register(
|
|
92
|
+
url="url",
|
|
93
|
+
event_types=["event_types"],
|
|
94
|
+
)
|
|
95
|
+
"""
|
|
96
|
+
_response = self._raw_client.register(
|
|
97
|
+
url=url, event_types=event_types, description=description, request_options=request_options
|
|
98
|
+
)
|
|
99
|
+
return _response.data
|
|
100
|
+
|
|
101
|
+
def delete(
|
|
102
|
+
self, endpoint_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
103
|
+
) -> DeleteEndpointResponse:
|
|
104
|
+
"""
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
endpoint_id : str
|
|
108
|
+
Webhook endpoint ID
|
|
109
|
+
|
|
110
|
+
request_options : typing.Optional[RequestOptions]
|
|
111
|
+
Request-specific configuration.
|
|
112
|
+
|
|
113
|
+
Returns
|
|
114
|
+
-------
|
|
115
|
+
DeleteEndpointResponse
|
|
116
|
+
Successful Response
|
|
117
|
+
|
|
118
|
+
Examples
|
|
119
|
+
--------
|
|
120
|
+
from levelfour import BaseLevelFour
|
|
121
|
+
|
|
122
|
+
client = BaseLevelFour(
|
|
123
|
+
token="YOUR_TOKEN",
|
|
124
|
+
base_url="https://yourhost.com/path/to/api",
|
|
125
|
+
)
|
|
126
|
+
client.webhooks.delete(
|
|
127
|
+
endpoint_id="endpoint_id",
|
|
128
|
+
)
|
|
129
|
+
"""
|
|
130
|
+
_response = self._raw_client.delete(endpoint_id, request_options=request_options)
|
|
131
|
+
return _response.data
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class AsyncWebhooksClient:
|
|
135
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
136
|
+
self._raw_client = AsyncRawWebhooksClient(client_wrapper=client_wrapper)
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def with_raw_response(self) -> AsyncRawWebhooksClient:
|
|
140
|
+
"""
|
|
141
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
142
|
+
|
|
143
|
+
Returns
|
|
144
|
+
-------
|
|
145
|
+
AsyncRawWebhooksClient
|
|
146
|
+
"""
|
|
147
|
+
return self._raw_client
|
|
148
|
+
|
|
149
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListEndpointsResponse:
|
|
150
|
+
"""
|
|
151
|
+
Parameters
|
|
152
|
+
----------
|
|
153
|
+
request_options : typing.Optional[RequestOptions]
|
|
154
|
+
Request-specific configuration.
|
|
155
|
+
|
|
156
|
+
Returns
|
|
157
|
+
-------
|
|
158
|
+
ListEndpointsResponse
|
|
159
|
+
Successful Response
|
|
160
|
+
|
|
161
|
+
Examples
|
|
162
|
+
--------
|
|
163
|
+
import asyncio
|
|
164
|
+
|
|
165
|
+
from levelfour import AsyncBaseLevelFour
|
|
166
|
+
|
|
167
|
+
client = AsyncBaseLevelFour(
|
|
168
|
+
token="YOUR_TOKEN",
|
|
169
|
+
base_url="https://yourhost.com/path/to/api",
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
async def main() -> None:
|
|
174
|
+
await client.webhooks.list()
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
asyncio.run(main())
|
|
178
|
+
"""
|
|
179
|
+
_response = await self._raw_client.list(request_options=request_options)
|
|
180
|
+
return _response.data
|
|
181
|
+
|
|
182
|
+
async def register(
|
|
183
|
+
self,
|
|
184
|
+
*,
|
|
185
|
+
url: str,
|
|
186
|
+
event_types: typing.Sequence[str],
|
|
187
|
+
description: typing.Optional[str] = OMIT,
|
|
188
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
189
|
+
) -> RegisterEndpointResponse:
|
|
190
|
+
"""
|
|
191
|
+
Parameters
|
|
192
|
+
----------
|
|
193
|
+
url : str
|
|
194
|
+
Webhook endpoint URL
|
|
195
|
+
|
|
196
|
+
event_types : typing.Sequence[str]
|
|
197
|
+
Event types to subscribe to
|
|
198
|
+
|
|
199
|
+
description : typing.Optional[str]
|
|
200
|
+
|
|
201
|
+
request_options : typing.Optional[RequestOptions]
|
|
202
|
+
Request-specific configuration.
|
|
203
|
+
|
|
204
|
+
Returns
|
|
205
|
+
-------
|
|
206
|
+
RegisterEndpointResponse
|
|
207
|
+
Successful Response
|
|
208
|
+
|
|
209
|
+
Examples
|
|
210
|
+
--------
|
|
211
|
+
import asyncio
|
|
212
|
+
|
|
213
|
+
from levelfour import AsyncBaseLevelFour
|
|
214
|
+
|
|
215
|
+
client = AsyncBaseLevelFour(
|
|
216
|
+
token="YOUR_TOKEN",
|
|
217
|
+
base_url="https://yourhost.com/path/to/api",
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
async def main() -> None:
|
|
222
|
+
await client.webhooks.register(
|
|
223
|
+
url="url",
|
|
224
|
+
event_types=["event_types"],
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
asyncio.run(main())
|
|
229
|
+
"""
|
|
230
|
+
_response = await self._raw_client.register(
|
|
231
|
+
url=url, event_types=event_types, description=description, request_options=request_options
|
|
232
|
+
)
|
|
233
|
+
return _response.data
|
|
234
|
+
|
|
235
|
+
async def delete(
|
|
236
|
+
self, endpoint_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
237
|
+
) -> DeleteEndpointResponse:
|
|
238
|
+
"""
|
|
239
|
+
Parameters
|
|
240
|
+
----------
|
|
241
|
+
endpoint_id : str
|
|
242
|
+
Webhook endpoint ID
|
|
243
|
+
|
|
244
|
+
request_options : typing.Optional[RequestOptions]
|
|
245
|
+
Request-specific configuration.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
DeleteEndpointResponse
|
|
250
|
+
Successful Response
|
|
251
|
+
|
|
252
|
+
Examples
|
|
253
|
+
--------
|
|
254
|
+
import asyncio
|
|
255
|
+
|
|
256
|
+
from levelfour import AsyncBaseLevelFour
|
|
257
|
+
|
|
258
|
+
client = AsyncBaseLevelFour(
|
|
259
|
+
token="YOUR_TOKEN",
|
|
260
|
+
base_url="https://yourhost.com/path/to/api",
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
async def main() -> None:
|
|
265
|
+
await client.webhooks.delete(
|
|
266
|
+
endpoint_id="endpoint_id",
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
asyncio.run(main())
|
|
271
|
+
"""
|
|
272
|
+
_response = await self._raw_client.delete(endpoint_id, request_options=request_options)
|
|
273
|
+
return _response.data
|