re-uploading work
This commit is contained in:
1
tests/generated_client/api/actions/__init__.py
Normal file
1
tests/generated_client/api/actions/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
""" Contains endpoint functions for accessing the API """
|
||||
191
tests/generated_client/api/actions/create_action.py
Normal file
191
tests/generated_client/api/actions/create_action.py
Normal file
@@ -0,0 +1,191 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.create_action_request import CreateActionRequest
|
||||
from ...models.create_action_response_201 import CreateActionResponse201
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CreateActionRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/actions",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | CreateActionResponse201 | None:
|
||||
if response.status_code == 201:
|
||||
response_201 = CreateActionResponse201.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if response.status_code == 409:
|
||||
response_409 = cast(Any, None)
|
||||
return response_409
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | CreateActionResponse201]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateActionRequest,
|
||||
|
||||
) -> Response[Any | CreateActionResponse201]:
|
||||
""" Create a new action
|
||||
|
||||
Args:
|
||||
body (CreateActionRequest): Request DTO for creating a new action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | CreateActionResponse201]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateActionRequest,
|
||||
|
||||
) -> Any | CreateActionResponse201 | None:
|
||||
""" Create a new action
|
||||
|
||||
Args:
|
||||
body (CreateActionRequest): Request DTO for creating a new action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | CreateActionResponse201
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateActionRequest,
|
||||
|
||||
) -> Response[Any | CreateActionResponse201]:
|
||||
""" Create a new action
|
||||
|
||||
Args:
|
||||
body (CreateActionRequest): Request DTO for creating a new action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | CreateActionResponse201]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreateActionRequest,
|
||||
|
||||
) -> Any | CreateActionResponse201 | None:
|
||||
""" Create a new action
|
||||
|
||||
Args:
|
||||
body (CreateActionRequest): Request DTO for creating a new action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | CreateActionResponse201
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
175
tests/generated_client/api/actions/delete_action.py
Normal file
175
tests/generated_client/api/actions/delete_action.py
Normal file
@@ -0,0 +1,175 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.success_response import SuccessResponse
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": "/api/v1/actions/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | SuccessResponse | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = SuccessResponse.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | SuccessResponse]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | SuccessResponse]:
|
||||
""" Delete an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | SuccessResponse]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | SuccessResponse | None:
|
||||
""" Delete an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | SuccessResponse
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | SuccessResponse]:
|
||||
""" Delete an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | SuccessResponse]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | SuccessResponse | None:
|
||||
""" Delete an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | SuccessResponse
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
175
tests/generated_client/api/actions/get_action.py
Normal file
175
tests/generated_client/api/actions/get_action.py
Normal file
@@ -0,0 +1,175 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.get_action_response_200 import GetActionResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/actions/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | GetActionResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = GetActionResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | GetActionResponse200]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetActionResponse200]:
|
||||
""" Get a single action by reference
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | GetActionResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | GetActionResponse200 | None:
|
||||
""" Get a single action by reference
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | GetActionResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetActionResponse200]:
|
||||
""" Get a single action by reference
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | GetActionResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | GetActionResponse200 | None:
|
||||
""" Get a single action by reference
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | GetActionResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
175
tests/generated_client/api/actions/get_queue_stats.py
Normal file
175
tests/generated_client/api/actions/get_queue_stats.py
Normal file
@@ -0,0 +1,175 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.get_queue_stats_response_200 import GetQueueStatsResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/actions/{ref}/queue-stats".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | GetQueueStatsResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = GetQueueStatsResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | GetQueueStatsResponse200]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetQueueStatsResponse200]:
|
||||
""" Get queue statistics for an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | GetQueueStatsResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | GetQueueStatsResponse200 | None:
|
||||
""" Get queue statistics for an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | GetQueueStatsResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetQueueStatsResponse200]:
|
||||
""" Get queue statistics for an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | GetQueueStatsResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Any | GetQueueStatsResponse200 | None:
|
||||
""" Get queue statistics for an action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | GetQueueStatsResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
195
tests/generated_client/api/actions/list_actions.py
Normal file
195
tests/generated_client/api/actions/list_actions.py
Normal file
@@ -0,0 +1,195 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.paginated_response_action_summary import PaginatedResponseActionSummary
|
||||
from ...types import UNSET, Unset
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["page_size"] = page_size
|
||||
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/actions",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> PaginatedResponseActionSummary | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedResponseActionSummary.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[PaginatedResponseActionSummary]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Response[PaginatedResponseActionSummary]:
|
||||
""" List all actions with pagination
|
||||
|
||||
Args:
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedResponseActionSummary]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> PaginatedResponseActionSummary | None:
|
||||
""" List all actions with pagination
|
||||
|
||||
Args:
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedResponseActionSummary
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Response[PaginatedResponseActionSummary]:
|
||||
""" List all actions with pagination
|
||||
|
||||
Args:
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[PaginatedResponseActionSummary]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> PaginatedResponseActionSummary | None:
|
||||
""" List all actions with pagination
|
||||
|
||||
Args:
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
PaginatedResponseActionSummary
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)).parsed
|
||||
212
tests/generated_client/api/actions/list_actions_by_pack.py
Normal file
212
tests/generated_client/api/actions/list_actions_by_pack.py
Normal file
@@ -0,0 +1,212 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.paginated_response_action_summary import PaginatedResponseActionSummary
|
||||
from ...types import UNSET, Unset
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
pack_ref: str,
|
||||
*,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["page_size"] = page_size
|
||||
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/packs/{pack_ref}/actions".format(pack_ref=quote(str(pack_ref), safe=""),),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | PaginatedResponseActionSummary | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedResponseActionSummary.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | PaginatedResponseActionSummary]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
pack_ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Response[Any | PaginatedResponseActionSummary]:
|
||||
""" List actions by pack reference
|
||||
|
||||
Args:
|
||||
pack_ref (str):
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | PaginatedResponseActionSummary]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
pack_ref=pack_ref,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
pack_ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Any | PaginatedResponseActionSummary | None:
|
||||
""" List actions by pack reference
|
||||
|
||||
Args:
|
||||
pack_ref (str):
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | PaginatedResponseActionSummary
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
pack_ref=pack_ref,
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
pack_ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Response[Any | PaginatedResponseActionSummary]:
|
||||
""" List actions by pack reference
|
||||
|
||||
Args:
|
||||
pack_ref (str):
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | PaginatedResponseActionSummary]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
pack_ref=pack_ref,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
pack_ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Any | PaginatedResponseActionSummary | None:
|
||||
""" List actions by pack reference
|
||||
|
||||
Args:
|
||||
pack_ref (str):
|
||||
page (int | Unset):
|
||||
page_size (int | Unset):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | PaginatedResponseActionSummary
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
pack_ref=pack_ref,
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)).parsed
|
||||
200
tests/generated_client/api/actions/update_action.py
Normal file
200
tests/generated_client/api/actions/update_action.py
Normal file
@@ -0,0 +1,200 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, cast
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response, UNSET
|
||||
from ... import errors
|
||||
|
||||
from ...models.update_action_request import UpdateActionRequest
|
||||
from ...models.update_action_response_200 import UpdateActionResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
*,
|
||||
body: UpdateActionRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": "/api/v1/actions/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | UpdateActionResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = UpdateActionResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | UpdateActionResponse200]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateActionRequest,
|
||||
|
||||
) -> Response[Any | UpdateActionResponse200]:
|
||||
""" Update an existing action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateActionRequest): Request DTO for updating an action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | UpdateActionResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateActionRequest,
|
||||
|
||||
) -> Any | UpdateActionResponse200 | None:
|
||||
""" Update an existing action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateActionRequest): Request DTO for updating an action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | UpdateActionResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateActionRequest,
|
||||
|
||||
) -> Response[Any | UpdateActionResponse200]:
|
||||
""" Update an existing action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateActionRequest): Request DTO for updating an action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any | UpdateActionResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
async def asyncio(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdateActionRequest,
|
||||
|
||||
) -> Any | UpdateActionResponse200 | None:
|
||||
""" Update an existing action
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdateActionRequest): Request DTO for updating an action
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Any | UpdateActionResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
Reference in New Issue
Block a user