pulse-python-sdk 0.0.52__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.
- pulse/__init__.py +42 -0
- pulse/client.py +666 -0
- pulse/core/__init__.py +34 -0
- pulse/core/api_error.py +23 -0
- pulse/core/client_wrapper.py +89 -0
- pulse/core/datetime_utils.py +28 -0
- pulse/core/file.py +67 -0
- pulse/core/force_multipart.py +18 -0
- pulse/core/http_client.py +663 -0
- pulse/core/http_response.py +55 -0
- pulse/core/http_sse/__init__.py +42 -0
- pulse/core/http_sse/_api.py +112 -0
- pulse/core/http_sse/_decoders.py +61 -0
- pulse/core/http_sse/_exceptions.py +7 -0
- pulse/core/http_sse/_models.py +17 -0
- pulse/core/jsonable_encoder.py +100 -0
- pulse/core/pydantic_utilities.py +260 -0
- pulse/core/query_encoder.py +58 -0
- pulse/core/remove_none_from_dict.py +11 -0
- pulse/core/request_options.py +35 -0
- pulse/core/serialization.py +276 -0
- pulse/core/unchecked_base_model.py +396 -0
- pulse/environment.py +7 -0
- pulse/errors/__init__.py +4 -0
- pulse/errors/bad_request_error.py +10 -0
- pulse/errors/forbidden_error.py +10 -0
- pulse/errors/internal_server_error.py +10 -0
- pulse/errors/not_found_error.py +10 -0
- pulse/errors/too_many_requests_error.py +10 -0
- pulse/errors/unauthorized_error.py +10 -0
- pulse/jobs/__init__.py +4 -0
- pulse/jobs/client.py +191 -0
- pulse/jobs/raw_client.py +408 -0
- pulse/py.typed +0 -0
- pulse/raw_client.py +661 -0
- pulse/types/__init__.py +4 -0
- pulse/types/extract_async_input.py +5 -0
- pulse/types/extract_async_response.py +43 -0
- pulse/types/extract_async_submission_response_status.py +7 -0
- pulse/types/extract_input.py +5 -0
- pulse/types/extract_json_input.py +116 -0
- pulse/types/extract_json_input_experimental_schema.py +5 -0
- pulse/types/extract_json_input_schema.py +5 -0
- pulse/types/extract_json_input_storage.py +36 -0
- pulse/types/extract_json_input_structured_output.py +38 -0
- pulse/types/extract_multipart_input.py +111 -0
- pulse/types/extract_multipart_input_experimental_schema.py +5 -0
- pulse/types/extract_multipart_input_schema.py +5 -0
- pulse/types/extract_multipart_input_storage.py +36 -0
- pulse/types/extract_multipart_input_structured_output.py +38 -0
- pulse/types/extract_options.py +111 -0
- pulse/types/extract_options_experimental_schema.py +5 -0
- pulse/types/extract_options_schema.py +5 -0
- pulse/types/extract_options_storage.py +36 -0
- pulse/types/extract_options_structured_output.py +38 -0
- pulse/types/extract_response.py +47 -0
- pulse/types/extract_source_multipart_one.py +27 -0
- pulse/types/extract_source_multipart_zero.py +27 -0
- pulse/types/job_cancellation_response.py +32 -0
- pulse/types/job_status.py +5 -0
- pulse/types/job_status_response.py +50 -0
- pulse/types/json_source.py +29 -0
- pulse/types/multipart_source.py +8 -0
- pulse/version.py +3 -0
- pulse/webhooks/__init__.py +4 -0
- pulse/webhooks/client.py +104 -0
- pulse/webhooks/raw_client.py +139 -0
- pulse/webhooks/types/__init__.py +4 -0
- pulse/webhooks/types/create_webhook_link_response.py +23 -0
- pulse_python_sdk-0.0.52.dist-info/METADATA +197 -0
- pulse_python_sdk-0.0.52.dist-info/RECORD +72 -0
- pulse_python_sdk-0.0.52.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,47 @@
|
|
|
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
|
|
7
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ExtractResponse(UncheckedBaseModel):
|
|
11
|
+
"""
|
|
12
|
+
High-level structure returned by the synchronous extract API.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
content: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Primary markdown content extracted from the document.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
html: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
Optional HTML representation when returnHtml is true.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
job_id: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Identifier assigned to the extraction job.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
warnings: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
31
|
+
"""
|
|
32
|
+
Non-fatal warnings generated during extraction.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
|
|
36
|
+
"""
|
|
37
|
+
Additional metadata supplied by the backend.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
if IS_PYDANTIC_V2:
|
|
41
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
42
|
+
else:
|
|
43
|
+
|
|
44
|
+
class Config:
|
|
45
|
+
frozen = True
|
|
46
|
+
smart_union = True
|
|
47
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
from ..core.serialization import FieldMetadata
|
|
9
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExtractSourceMultipartOne(UncheckedBaseModel):
|
|
13
|
+
file_url: typing_extensions.Annotated[str, FieldMetadata(alias="fileUrl")] = pydantic.Field()
|
|
14
|
+
"""
|
|
15
|
+
Public or pre-signed URL that Pulse will download and extract.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
file: typing.Optional[typing.Any] = None
|
|
19
|
+
|
|
20
|
+
if IS_PYDANTIC_V2:
|
|
21
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
from ..core.serialization import FieldMetadata
|
|
9
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ExtractSourceMultipartZero(UncheckedBaseModel):
|
|
13
|
+
file: str = pydantic.Field()
|
|
14
|
+
"""
|
|
15
|
+
Document to upload directly.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
file_url: typing_extensions.Annotated[typing.Optional[typing.Any], FieldMetadata(alias="fileUrl")] = None
|
|
19
|
+
|
|
20
|
+
if IS_PYDANTIC_V2:
|
|
21
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
|
7
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class JobCancellationResponse(UncheckedBaseModel):
|
|
11
|
+
"""
|
|
12
|
+
Confirmation payload returned after successfully canceling a job.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
job_id: str = pydantic.Field()
|
|
16
|
+
"""
|
|
17
|
+
Identifier of the job that was cancelled.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
message: str = pydantic.Field()
|
|
21
|
+
"""
|
|
22
|
+
Human-readable confirmation message.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
if IS_PYDANTIC_V2:
|
|
26
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
27
|
+
else:
|
|
28
|
+
|
|
29
|
+
class Config:
|
|
30
|
+
frozen = True
|
|
31
|
+
smart_union = True
|
|
32
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
|
8
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
9
|
+
from .job_status import JobStatus
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class JobStatusResponse(UncheckedBaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Current status and metadata for an asynchronous extraction job.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
job_id: str = pydantic.Field()
|
|
18
|
+
"""
|
|
19
|
+
Identifier assigned to the asynchronous extraction job.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
status: JobStatus
|
|
23
|
+
created_at: dt.datetime = pydantic.Field()
|
|
24
|
+
"""
|
|
25
|
+
Timestamp when the job was accepted.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
|
|
29
|
+
"""
|
|
30
|
+
Timestamp of the last status update, if available.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
result: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
|
|
34
|
+
"""
|
|
35
|
+
Structured payload that contains extraction output when the job is completed.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
error: typing.Optional[str] = pydantic.Field(default=None)
|
|
39
|
+
"""
|
|
40
|
+
Error message describing why the job failed, if applicable.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
if IS_PYDANTIC_V2:
|
|
44
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
45
|
+
else:
|
|
46
|
+
|
|
47
|
+
class Config:
|
|
48
|
+
frozen = True
|
|
49
|
+
smart_union = True
|
|
50
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
8
|
+
from ..core.serialization import FieldMetadata
|
|
9
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class JsonSource(UncheckedBaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Document source definition for JSON requests.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
file_url: typing_extensions.Annotated[str, FieldMetadata(alias="fileUrl")] = pydantic.Field()
|
|
18
|
+
"""
|
|
19
|
+
Public or pre-signed URL that Pulse will download and extract.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
if IS_PYDANTIC_V2:
|
|
23
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
24
|
+
else:
|
|
25
|
+
|
|
26
|
+
class Config:
|
|
27
|
+
frozen = True
|
|
28
|
+
smart_union = True
|
|
29
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from .extract_source_multipart_one import ExtractSourceMultipartOne
|
|
6
|
+
from .extract_source_multipart_zero import ExtractSourceMultipartZero
|
|
7
|
+
|
|
8
|
+
MultipartSource = typing.Union[ExtractSourceMultipartZero, ExtractSourceMultipartOne]
|
pulse/version.py
ADDED
pulse/webhooks/client.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
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 .raw_client import AsyncRawWebhooksClient, RawWebhooksClient
|
|
8
|
+
from .types.create_webhook_link_response import CreateWebhookLinkResponse
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class WebhooksClient:
|
|
12
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
13
|
+
self._raw_client = RawWebhooksClient(client_wrapper=client_wrapper)
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def with_raw_response(self) -> RawWebhooksClient:
|
|
17
|
+
"""
|
|
18
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
RawWebhooksClient
|
|
23
|
+
"""
|
|
24
|
+
return self._raw_client
|
|
25
|
+
|
|
26
|
+
def create_webhook_link(
|
|
27
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
28
|
+
) -> CreateWebhookLinkResponse:
|
|
29
|
+
"""
|
|
30
|
+
Generates a temporary link to the Svix webhook portal where users can manage their webhook endpoints and view message logs.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
request_options : typing.Optional[RequestOptions]
|
|
35
|
+
Request-specific configuration.
|
|
36
|
+
|
|
37
|
+
Returns
|
|
38
|
+
-------
|
|
39
|
+
CreateWebhookLinkResponse
|
|
40
|
+
Webhook portal link created
|
|
41
|
+
|
|
42
|
+
Examples
|
|
43
|
+
--------
|
|
44
|
+
from pulse import Pulse
|
|
45
|
+
|
|
46
|
+
client = Pulse(
|
|
47
|
+
api_key="YOUR_API_KEY",
|
|
48
|
+
)
|
|
49
|
+
client.webhooks.create_webhook_link()
|
|
50
|
+
"""
|
|
51
|
+
_response = self._raw_client.create_webhook_link(request_options=request_options)
|
|
52
|
+
return _response.data
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class AsyncWebhooksClient:
|
|
56
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
57
|
+
self._raw_client = AsyncRawWebhooksClient(client_wrapper=client_wrapper)
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def with_raw_response(self) -> AsyncRawWebhooksClient:
|
|
61
|
+
"""
|
|
62
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
63
|
+
|
|
64
|
+
Returns
|
|
65
|
+
-------
|
|
66
|
+
AsyncRawWebhooksClient
|
|
67
|
+
"""
|
|
68
|
+
return self._raw_client
|
|
69
|
+
|
|
70
|
+
async def create_webhook_link(
|
|
71
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
72
|
+
) -> CreateWebhookLinkResponse:
|
|
73
|
+
"""
|
|
74
|
+
Generates a temporary link to the Svix webhook portal where users can manage their webhook endpoints and view message logs.
|
|
75
|
+
|
|
76
|
+
Parameters
|
|
77
|
+
----------
|
|
78
|
+
request_options : typing.Optional[RequestOptions]
|
|
79
|
+
Request-specific configuration.
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
CreateWebhookLinkResponse
|
|
84
|
+
Webhook portal link created
|
|
85
|
+
|
|
86
|
+
Examples
|
|
87
|
+
--------
|
|
88
|
+
import asyncio
|
|
89
|
+
|
|
90
|
+
from pulse import AsyncPulse
|
|
91
|
+
|
|
92
|
+
client = AsyncPulse(
|
|
93
|
+
api_key="YOUR_API_KEY",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
async def main() -> None:
|
|
98
|
+
await client.webhooks.create_webhook_link()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
asyncio.run(main())
|
|
102
|
+
"""
|
|
103
|
+
_response = await self._raw_client.create_webhook_link(request_options=request_options)
|
|
104
|
+
return _response.data
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.request_options import RequestOptions
|
|
10
|
+
from ..core.unchecked_base_model import construct_type
|
|
11
|
+
from ..errors.internal_server_error import InternalServerError
|
|
12
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
13
|
+
from .types.create_webhook_link_response import CreateWebhookLinkResponse
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class RawWebhooksClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._client_wrapper = client_wrapper
|
|
19
|
+
|
|
20
|
+
def create_webhook_link(
|
|
21
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
22
|
+
) -> HttpResponse[CreateWebhookLinkResponse]:
|
|
23
|
+
"""
|
|
24
|
+
Generates a temporary link to the Svix webhook portal where users can manage their webhook endpoints and view message logs.
|
|
25
|
+
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
request_options : typing.Optional[RequestOptions]
|
|
29
|
+
Request-specific configuration.
|
|
30
|
+
|
|
31
|
+
Returns
|
|
32
|
+
-------
|
|
33
|
+
HttpResponse[CreateWebhookLinkResponse]
|
|
34
|
+
Webhook portal link created
|
|
35
|
+
"""
|
|
36
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
37
|
+
"webhook",
|
|
38
|
+
method="POST",
|
|
39
|
+
request_options=request_options,
|
|
40
|
+
)
|
|
41
|
+
try:
|
|
42
|
+
if 200 <= _response.status_code < 300:
|
|
43
|
+
_data = typing.cast(
|
|
44
|
+
CreateWebhookLinkResponse,
|
|
45
|
+
construct_type(
|
|
46
|
+
type_=CreateWebhookLinkResponse, # type: ignore
|
|
47
|
+
object_=_response.json(),
|
|
48
|
+
),
|
|
49
|
+
)
|
|
50
|
+
return HttpResponse(response=_response, data=_data)
|
|
51
|
+
if _response.status_code == 401:
|
|
52
|
+
raise UnauthorizedError(
|
|
53
|
+
headers=dict(_response.headers),
|
|
54
|
+
body=typing.cast(
|
|
55
|
+
typing.Any,
|
|
56
|
+
construct_type(
|
|
57
|
+
type_=typing.Any, # type: ignore
|
|
58
|
+
object_=_response.json(),
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
if _response.status_code == 500:
|
|
63
|
+
raise InternalServerError(
|
|
64
|
+
headers=dict(_response.headers),
|
|
65
|
+
body=typing.cast(
|
|
66
|
+
typing.Any,
|
|
67
|
+
construct_type(
|
|
68
|
+
type_=typing.Any, # type: ignore
|
|
69
|
+
object_=_response.json(),
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
_response_json = _response.json()
|
|
74
|
+
except JSONDecodeError:
|
|
75
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
76
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class AsyncRawWebhooksClient:
|
|
80
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
81
|
+
self._client_wrapper = client_wrapper
|
|
82
|
+
|
|
83
|
+
async def create_webhook_link(
|
|
84
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
85
|
+
) -> AsyncHttpResponse[CreateWebhookLinkResponse]:
|
|
86
|
+
"""
|
|
87
|
+
Generates a temporary link to the Svix webhook portal where users can manage their webhook endpoints and view message logs.
|
|
88
|
+
|
|
89
|
+
Parameters
|
|
90
|
+
----------
|
|
91
|
+
request_options : typing.Optional[RequestOptions]
|
|
92
|
+
Request-specific configuration.
|
|
93
|
+
|
|
94
|
+
Returns
|
|
95
|
+
-------
|
|
96
|
+
AsyncHttpResponse[CreateWebhookLinkResponse]
|
|
97
|
+
Webhook portal link created
|
|
98
|
+
"""
|
|
99
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
100
|
+
"webhook",
|
|
101
|
+
method="POST",
|
|
102
|
+
request_options=request_options,
|
|
103
|
+
)
|
|
104
|
+
try:
|
|
105
|
+
if 200 <= _response.status_code < 300:
|
|
106
|
+
_data = typing.cast(
|
|
107
|
+
CreateWebhookLinkResponse,
|
|
108
|
+
construct_type(
|
|
109
|
+
type_=CreateWebhookLinkResponse, # type: ignore
|
|
110
|
+
object_=_response.json(),
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
114
|
+
if _response.status_code == 401:
|
|
115
|
+
raise UnauthorizedError(
|
|
116
|
+
headers=dict(_response.headers),
|
|
117
|
+
body=typing.cast(
|
|
118
|
+
typing.Any,
|
|
119
|
+
construct_type(
|
|
120
|
+
type_=typing.Any, # type: ignore
|
|
121
|
+
object_=_response.json(),
|
|
122
|
+
),
|
|
123
|
+
),
|
|
124
|
+
)
|
|
125
|
+
if _response.status_code == 500:
|
|
126
|
+
raise InternalServerError(
|
|
127
|
+
headers=dict(_response.headers),
|
|
128
|
+
body=typing.cast(
|
|
129
|
+
typing.Any,
|
|
130
|
+
construct_type(
|
|
131
|
+
type_=typing.Any, # type: ignore
|
|
132
|
+
object_=_response.json(),
|
|
133
|
+
),
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
_response_json = _response.json()
|
|
137
|
+
except JSONDecodeError:
|
|
138
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
139
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
7
|
+
from ...core.unchecked_base_model import UncheckedBaseModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CreateWebhookLinkResponse(UncheckedBaseModel):
|
|
11
|
+
link: str = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
URL to the Svix webhook portal
|
|
14
|
+
"""
|
|
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
|