Skip to content

Commit 213fba1

Browse files
author
Release Automation Bot
committed
chore: bump version to 0.29.0
1 parent 39980f7 commit 213fba1

30 files changed

Lines changed: 1557 additions & 116 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
from http import HTTPStatus
2+
from typing import Any
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import AuthenticatedClient, Client
8+
from ...models.error import Error
9+
from ...models.recording_config import RecordingConfig
10+
from ...models.recording_details_response import RecordingDetailsResponse
11+
from ...types import Response
12+
13+
14+
def _get_kwargs(
15+
*,
16+
body: RecordingConfig,
17+
) -> dict[str, Any]:
18+
headers: dict[str, Any] = {}
19+
20+
_kwargs: dict[str, Any] = {
21+
"method": "post",
22+
"url": "/recordings",
23+
}
24+
25+
_kwargs["json"] = body.to_dict()
26+
27+
headers["Content-Type"] = "application/json"
28+
29+
_kwargs["headers"] = headers
30+
return _kwargs
31+
32+
33+
def _parse_response(
34+
*, client: AuthenticatedClient | Client, response: httpx.Response
35+
) -> Error | RecordingDetailsResponse | None:
36+
if response.status_code == 201:
37+
response_201 = RecordingDetailsResponse.from_dict(response.json())
38+
39+
return response_201
40+
41+
if response.status_code == 400:
42+
response_400 = Error.from_dict(response.json())
43+
44+
return response_400
45+
46+
if response.status_code == 401:
47+
response_401 = Error.from_dict(response.json())
48+
49+
return response_401
50+
51+
if response.status_code == 402:
52+
response_402 = Error.from_dict(response.json())
53+
54+
return response_402
55+
56+
if response.status_code == 503:
57+
response_503 = Error.from_dict(response.json())
58+
59+
return response_503
60+
61+
if client.raise_on_unexpected_status:
62+
raise errors.UnexpectedStatus(response.status_code, response.content)
63+
else:
64+
return None
65+
66+
67+
def _build_response(
68+
*, client: AuthenticatedClient | Client, response: httpx.Response
69+
) -> Response[Error | RecordingDetailsResponse]:
70+
return Response(
71+
status_code=HTTPStatus(response.status_code),
72+
content=response.content,
73+
headers=response.headers,
74+
parsed=_parse_response(client=client, response=response),
75+
)
76+
77+
78+
def sync_detailed(
79+
*,
80+
client: AuthenticatedClient,
81+
body: RecordingConfig,
82+
) -> Response[Error | RecordingDetailsResponse]:
83+
"""Create a recording
84+
85+
Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
86+
87+
Args:
88+
body (RecordingConfig): Recording configuration
89+
90+
Raises:
91+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
92+
httpx.TimeoutException: If the request takes longer than Client.timeout.
93+
94+
Returns:
95+
Response[Error | RecordingDetailsResponse]
96+
"""
97+
98+
kwargs = _get_kwargs(
99+
body=body,
100+
)
101+
102+
response = client.get_httpx_client().request(
103+
**kwargs,
104+
)
105+
106+
return _build_response(client=client, response=response)
107+
108+
109+
def sync(
110+
*,
111+
client: AuthenticatedClient,
112+
body: RecordingConfig,
113+
) -> Error | RecordingDetailsResponse | None:
114+
"""Create a recording
115+
116+
Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
117+
118+
Args:
119+
body (RecordingConfig): Recording configuration
120+
121+
Raises:
122+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
123+
httpx.TimeoutException: If the request takes longer than Client.timeout.
124+
125+
Returns:
126+
Error | RecordingDetailsResponse
127+
"""
128+
129+
return sync_detailed(
130+
client=client,
131+
body=body,
132+
).parsed
133+
134+
135+
async def asyncio_detailed(
136+
*,
137+
client: AuthenticatedClient,
138+
body: RecordingConfig,
139+
) -> Response[Error | RecordingDetailsResponse]:
140+
"""Create a recording
141+
142+
Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
143+
144+
Args:
145+
body (RecordingConfig): Recording configuration
146+
147+
Raises:
148+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
149+
httpx.TimeoutException: If the request takes longer than Client.timeout.
150+
151+
Returns:
152+
Response[Error | RecordingDetailsResponse]
153+
"""
154+
155+
kwargs = _get_kwargs(
156+
body=body,
157+
)
158+
159+
response = await client.get_async_httpx_client().request(**kwargs)
160+
161+
return _build_response(client=client, response=response)
162+
163+
164+
async def asyncio(
165+
*,
166+
client: AuthenticatedClient,
167+
body: RecordingConfig,
168+
) -> Error | RecordingDetailsResponse | None:
169+
"""Create a recording
170+
171+
Create a recording resource. Capturing starts synchronously, so it is returned with status `active`.
172+
173+
Args:
174+
body (RecordingConfig): Recording configuration
175+
176+
Raises:
177+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
178+
httpx.TimeoutException: If the request takes longer than Client.timeout.
179+
180+
Returns:
181+
Error | RecordingDetailsResponse
182+
"""
183+
184+
return (
185+
await asyncio_detailed(
186+
client=client,
187+
body=body,
188+
)
189+
).parsed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
from http import HTTPStatus
2+
from typing import Any, cast
3+
from urllib.parse import quote
4+
5+
import httpx
6+
7+
from ... import errors
8+
from ...client import AuthenticatedClient, Client
9+
from ...models.error import Error
10+
from ...types import Response
11+
12+
13+
def _get_kwargs(
14+
recording_id: str,
15+
) -> dict[str, Any]:
16+
_kwargs: dict[str, Any] = {
17+
"method": "delete",
18+
"url": "/recordings/{recording_id}".format(
19+
recording_id=quote(str(recording_id), safe=""),
20+
),
21+
}
22+
23+
return _kwargs
24+
25+
26+
def _parse_response(
27+
*, client: AuthenticatedClient | Client, response: httpx.Response
28+
) -> Any | Error | None:
29+
if response.status_code == 204:
30+
response_204 = cast(Any, None)
31+
return response_204
32+
33+
if response.status_code == 401:
34+
response_401 = Error.from_dict(response.json())
35+
36+
return response_401
37+
38+
if response.status_code == 503:
39+
response_503 = Error.from_dict(response.json())
40+
41+
return response_503
42+
43+
if client.raise_on_unexpected_status:
44+
raise errors.UnexpectedStatus(response.status_code, response.content)
45+
else:
46+
return None
47+
48+
49+
def _build_response(
50+
*, client: AuthenticatedClient | Client, response: httpx.Response
51+
) -> Response[Any | Error]:
52+
return Response(
53+
status_code=HTTPStatus(response.status_code),
54+
content=response.content,
55+
headers=response.headers,
56+
parsed=_parse_response(client=client, response=response),
57+
)
58+
59+
60+
def sync_detailed(
61+
recording_id: str,
62+
*,
63+
client: AuthenticatedClient,
64+
) -> Response[Any | Error]:
65+
"""Delete a recording
66+
67+
Delete a recording by id.
68+
69+
Args:
70+
recording_id (str):
71+
72+
Raises:
73+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
74+
httpx.TimeoutException: If the request takes longer than Client.timeout.
75+
76+
Returns:
77+
Response[Any | Error]
78+
"""
79+
80+
kwargs = _get_kwargs(
81+
recording_id=recording_id,
82+
)
83+
84+
response = client.get_httpx_client().request(
85+
**kwargs,
86+
)
87+
88+
return _build_response(client=client, response=response)
89+
90+
91+
def sync(
92+
recording_id: str,
93+
*,
94+
client: AuthenticatedClient,
95+
) -> Any | Error | None:
96+
"""Delete a recording
97+
98+
Delete a recording by id.
99+
100+
Args:
101+
recording_id (str):
102+
103+
Raises:
104+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
105+
httpx.TimeoutException: If the request takes longer than Client.timeout.
106+
107+
Returns:
108+
Any | Error
109+
"""
110+
111+
return sync_detailed(
112+
recording_id=recording_id,
113+
client=client,
114+
).parsed
115+
116+
117+
async def asyncio_detailed(
118+
recording_id: str,
119+
*,
120+
client: AuthenticatedClient,
121+
) -> Response[Any | Error]:
122+
"""Delete a recording
123+
124+
Delete a recording by id.
125+
126+
Args:
127+
recording_id (str):
128+
129+
Raises:
130+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131+
httpx.TimeoutException: If the request takes longer than Client.timeout.
132+
133+
Returns:
134+
Response[Any | Error]
135+
"""
136+
137+
kwargs = _get_kwargs(
138+
recording_id=recording_id,
139+
)
140+
141+
response = await client.get_async_httpx_client().request(**kwargs)
142+
143+
return _build_response(client=client, response=response)
144+
145+
146+
async def asyncio(
147+
recording_id: str,
148+
*,
149+
client: AuthenticatedClient,
150+
) -> Any | Error | None:
151+
"""Delete a recording
152+
153+
Delete a recording by id.
154+
155+
Args:
156+
recording_id (str):
157+
158+
Raises:
159+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
160+
httpx.TimeoutException: If the request takes longer than Client.timeout.
161+
162+
Returns:
163+
Any | Error
164+
"""
165+
166+
return (
167+
await asyncio_detailed(
168+
recording_id=recording_id,
169+
client=client,
170+
)
171+
).parsed

0 commit comments

Comments
 (0)