re-uploading work
This commit is contained in:
1
tests/generated_client/api/packs/__init__.py
Normal file
1
tests/generated_client/api/packs/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
""" Contains endpoint functions for accessing the API """
|
||||
187
tests/generated_client/api/packs/create_pack.py
Normal file
187
tests/generated_client/api/packs/create_pack.py
Normal file
@@ -0,0 +1,187 @@
|
||||
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_pack_request import CreatePackRequest
|
||||
from ...models.create_pack_response_201 import CreatePackResponse201
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CreatePackRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/packs",
|
||||
}
|
||||
|
||||
_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 | CreatePackResponse201 | None:
|
||||
if response.status_code == 201:
|
||||
response_201 = CreatePackResponse201.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
|
||||
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 | CreatePackResponse201]:
|
||||
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: CreatePackRequest,
|
||||
|
||||
) -> Response[Any | CreatePackResponse201]:
|
||||
""" Create a new pack
|
||||
|
||||
Args:
|
||||
body (CreatePackRequest): Request DTO for creating a new pack
|
||||
|
||||
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 | CreatePackResponse201]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreatePackRequest,
|
||||
|
||||
) -> Any | CreatePackResponse201 | None:
|
||||
""" Create a new pack
|
||||
|
||||
Args:
|
||||
body (CreatePackRequest): Request DTO for creating a new pack
|
||||
|
||||
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 | CreatePackResponse201
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: CreatePackRequest,
|
||||
|
||||
) -> Response[Any | CreatePackResponse201]:
|
||||
""" Create a new pack
|
||||
|
||||
Args:
|
||||
body (CreatePackRequest): Request DTO for creating a new pack
|
||||
|
||||
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 | CreatePackResponse201]
|
||||
"""
|
||||
|
||||
|
||||
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: CreatePackRequest,
|
||||
|
||||
) -> Any | CreatePackResponse201 | None:
|
||||
""" Create a new pack
|
||||
|
||||
Args:
|
||||
body (CreatePackRequest): Request DTO for creating a new pack
|
||||
|
||||
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 | CreatePackResponse201
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
175
tests/generated_client/api/packs/delete_pack.py
Normal file
175
tests/generated_client/api/packs/delete_pack.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/packs/{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 a pack
|
||||
|
||||
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 a pack
|
||||
|
||||
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 a pack
|
||||
|
||||
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 a pack
|
||||
|
||||
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/packs/get_pack.py
Normal file
175
tests/generated_client/api/packs/get_pack.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_pack_response_200 import GetPackResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/packs/{ref}".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | GetPackResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = GetPackResponse200.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 | GetPackResponse200]:
|
||||
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 | GetPackResponse200]:
|
||||
""" Get a single pack 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 | GetPackResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | GetPackResponse200 | None:
|
||||
""" Get a single pack 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 | GetPackResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | GetPackResponse200]:
|
||||
""" Get a single pack 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 | GetPackResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | GetPackResponse200 | None:
|
||||
""" Get a single pack 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 | GetPackResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
118
tests/generated_client/api/packs/get_pack_latest_test.py
Normal file
118
tests/generated_client/api/packs/get_pack_latest_test.py
Normal file
@@ -0,0 +1,118 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/api/v1/packs/{ref}/tests/latest".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None:
|
||||
if response.status_code == 200:
|
||||
return None
|
||||
|
||||
if response.status_code == 404:
|
||||
return None
|
||||
|
||||
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]:
|
||||
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]:
|
||||
""" Get latest test result for a pack
|
||||
|
||||
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]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any]:
|
||||
""" Get latest test result for a pack
|
||||
|
||||
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]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
212
tests/generated_client/api/packs/get_pack_test_history.py
Normal file
212
tests/generated_client/api/packs/get_pack_test_history.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.get_pack_test_history_response_200 import GetPackTestHistoryResponse200
|
||||
from ...types import UNSET, Unset
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
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/{ref}/tests".format(ref=quote(str(ref), safe=""),),
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | GetPackTestHistoryResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = GetPackTestHistoryResponse200.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 | GetPackTestHistoryResponse200]:
|
||||
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,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Response[Any | GetPackTestHistoryResponse200]:
|
||||
""" Get test history for a pack
|
||||
|
||||
Args:
|
||||
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 | GetPackTestHistoryResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=ref,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Any | GetPackTestHistoryResponse200 | None:
|
||||
""" Get test history for a pack
|
||||
|
||||
Args:
|
||||
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 | GetPackTestHistoryResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Response[Any | GetPackTestHistoryResponse200]:
|
||||
""" Get test history for a pack
|
||||
|
||||
Args:
|
||||
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 | GetPackTestHistoryResponse200]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
ref=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(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
page: int | Unset = UNSET,
|
||||
page_size: int | Unset = UNSET,
|
||||
|
||||
) -> Any | GetPackTestHistoryResponse200 | None:
|
||||
""" Get test history for a pack
|
||||
|
||||
Args:
|
||||
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 | GetPackTestHistoryResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)).parsed
|
||||
201
tests/generated_client/api/packs/install_pack.py
Normal file
201
tests/generated_client/api/packs/install_pack.py
Normal file
@@ -0,0 +1,201 @@
|
||||
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.api_response_pack_install_response import ApiResponsePackInstallResponse
|
||||
from ...models.api_response_string import ApiResponseString
|
||||
from ...models.install_pack_request import InstallPackRequest
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: InstallPackRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/packs/install",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> ApiResponsePackInstallResponse | ApiResponseString | None:
|
||||
if response.status_code == 201:
|
||||
response_201 = ApiResponsePackInstallResponse.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = ApiResponseString.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_400
|
||||
|
||||
if response.status_code == 409:
|
||||
response_409 = ApiResponseString.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_409
|
||||
|
||||
if response.status_code == 501:
|
||||
response_501 = ApiResponseString.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_501
|
||||
|
||||
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[ApiResponsePackInstallResponse | ApiResponseString]:
|
||||
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: InstallPackRequest,
|
||||
|
||||
) -> Response[ApiResponsePackInstallResponse | ApiResponseString]:
|
||||
""" Install a pack from remote source (git repository)
|
||||
|
||||
Args:
|
||||
body (InstallPackRequest): Request DTO for installing a pack from remote source
|
||||
|
||||
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[ApiResponsePackInstallResponse | ApiResponseString]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: InstallPackRequest,
|
||||
|
||||
) -> ApiResponsePackInstallResponse | ApiResponseString | None:
|
||||
""" Install a pack from remote source (git repository)
|
||||
|
||||
Args:
|
||||
body (InstallPackRequest): Request DTO for installing a pack from remote source
|
||||
|
||||
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:
|
||||
ApiResponsePackInstallResponse | ApiResponseString
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: InstallPackRequest,
|
||||
|
||||
) -> Response[ApiResponsePackInstallResponse | ApiResponseString]:
|
||||
""" Install a pack from remote source (git repository)
|
||||
|
||||
Args:
|
||||
body (InstallPackRequest): Request DTO for installing a pack from remote source
|
||||
|
||||
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[ApiResponsePackInstallResponse | ApiResponseString]
|
||||
"""
|
||||
|
||||
|
||||
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: InstallPackRequest,
|
||||
|
||||
) -> ApiResponsePackInstallResponse | ApiResponseString | None:
|
||||
""" Install a pack from remote source (git repository)
|
||||
|
||||
Args:
|
||||
body (InstallPackRequest): Request DTO for installing a pack from remote source
|
||||
|
||||
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:
|
||||
ApiResponsePackInstallResponse | ApiResponseString
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
195
tests/generated_client/api/packs/list_packs.py
Normal file
195
tests/generated_client/api/packs/list_packs.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_pack_summary import PaginatedResponsePackSummary
|
||||
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/packs",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> PaginatedResponsePackSummary | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = PaginatedResponsePackSummary.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[PaginatedResponsePackSummary]:
|
||||
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[PaginatedResponsePackSummary]:
|
||||
""" List all packs 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[PaginatedResponsePackSummary]
|
||||
"""
|
||||
|
||||
|
||||
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,
|
||||
|
||||
) -> PaginatedResponsePackSummary | None:
|
||||
""" List all packs 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:
|
||||
PaginatedResponsePackSummary
|
||||
"""
|
||||
|
||||
|
||||
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[PaginatedResponsePackSummary]:
|
||||
""" List all packs 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[PaginatedResponsePackSummary]
|
||||
"""
|
||||
|
||||
|
||||
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,
|
||||
|
||||
) -> PaginatedResponsePackSummary | None:
|
||||
""" List all packs 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:
|
||||
PaginatedResponsePackSummary
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
|
||||
)).parsed
|
||||
194
tests/generated_client/api/packs/register_pack.py
Normal file
194
tests/generated_client/api/packs/register_pack.py
Normal file
@@ -0,0 +1,194 @@
|
||||
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.api_response_pack_install_response import ApiResponsePackInstallResponse
|
||||
from ...models.api_response_string import ApiResponseString
|
||||
from ...models.register_pack_request import RegisterPackRequest
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: RegisterPackRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/packs/register",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> ApiResponsePackInstallResponse | ApiResponseString | None:
|
||||
if response.status_code == 201:
|
||||
response_201 = ApiResponsePackInstallResponse.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 400:
|
||||
response_400 = ApiResponseString.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_400
|
||||
|
||||
if response.status_code == 409:
|
||||
response_409 = ApiResponseString.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
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[ApiResponsePackInstallResponse | ApiResponseString]:
|
||||
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: RegisterPackRequest,
|
||||
|
||||
) -> Response[ApiResponsePackInstallResponse | ApiResponseString]:
|
||||
""" Register a pack from local filesystem
|
||||
|
||||
Args:
|
||||
body (RegisterPackRequest): Request DTO for registering a pack from local filesystem
|
||||
|
||||
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[ApiResponsePackInstallResponse | ApiResponseString]
|
||||
"""
|
||||
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RegisterPackRequest,
|
||||
|
||||
) -> ApiResponsePackInstallResponse | ApiResponseString | None:
|
||||
""" Register a pack from local filesystem
|
||||
|
||||
Args:
|
||||
body (RegisterPackRequest): Request DTO for registering a pack from local filesystem
|
||||
|
||||
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:
|
||||
ApiResponsePackInstallResponse | ApiResponseString
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: RegisterPackRequest,
|
||||
|
||||
) -> Response[ApiResponsePackInstallResponse | ApiResponseString]:
|
||||
""" Register a pack from local filesystem
|
||||
|
||||
Args:
|
||||
body (RegisterPackRequest): Request DTO for registering a pack from local filesystem
|
||||
|
||||
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[ApiResponsePackInstallResponse | ApiResponseString]
|
||||
"""
|
||||
|
||||
|
||||
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: RegisterPackRequest,
|
||||
|
||||
) -> ApiResponsePackInstallResponse | ApiResponseString | None:
|
||||
""" Register a pack from local filesystem
|
||||
|
||||
Args:
|
||||
body (RegisterPackRequest): Request DTO for registering a pack from local filesystem
|
||||
|
||||
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:
|
||||
ApiResponsePackInstallResponse | ApiResponseString
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
179
tests/generated_client/api/packs/sync_pack_workflows.py
Normal file
179
tests/generated_client/api/packs/sync_pack_workflows.py
Normal file
@@ -0,0 +1,179 @@
|
||||
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.sync_pack_workflows_response_200 import SyncPackWorkflowsResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/packs/{ref}/workflows/sync".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | SyncPackWorkflowsResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = SyncPackWorkflowsResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if response.status_code == 500:
|
||||
response_500 = cast(Any, None)
|
||||
return response_500
|
||||
|
||||
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 | SyncPackWorkflowsResponse200]:
|
||||
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 | SyncPackWorkflowsResponse200]:
|
||||
""" Sync workflows from filesystem to database for a pack
|
||||
|
||||
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 | SyncPackWorkflowsResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | SyncPackWorkflowsResponse200 | None:
|
||||
""" Sync workflows from filesystem to database for a pack
|
||||
|
||||
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 | SyncPackWorkflowsResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | SyncPackWorkflowsResponse200]:
|
||||
""" Sync workflows from filesystem to database for a pack
|
||||
|
||||
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 | SyncPackWorkflowsResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | SyncPackWorkflowsResponse200 | None:
|
||||
""" Sync workflows from filesystem to database for a pack
|
||||
|
||||
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 | SyncPackWorkflowsResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
179
tests/generated_client/api/packs/test_pack.py
Normal file
179
tests/generated_client/api/packs/test_pack.py
Normal file
@@ -0,0 +1,179 @@
|
||||
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.test_pack_response_200 import TestPackResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/packs/{ref}/test".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | TestPackResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = TestPackResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if response.status_code == 500:
|
||||
response_500 = cast(Any, None)
|
||||
return response_500
|
||||
|
||||
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 | TestPackResponse200]:
|
||||
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 | TestPackResponse200]:
|
||||
""" Execute tests for a pack
|
||||
|
||||
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 | TestPackResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | TestPackResponse200 | None:
|
||||
""" Execute tests for a pack
|
||||
|
||||
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 | TestPackResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | TestPackResponse200]:
|
||||
""" Execute tests for a pack
|
||||
|
||||
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 | TestPackResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | TestPackResponse200 | None:
|
||||
""" Execute tests for a pack
|
||||
|
||||
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 | TestPackResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
200
tests/generated_client/api/packs/update_pack.py
Normal file
200
tests/generated_client/api/packs/update_pack.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_pack_request import UpdatePackRequest
|
||||
from ...models.update_pack_response_200 import UpdatePackResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
*,
|
||||
body: UpdatePackRequest,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": "/api/v1/packs/{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 | UpdatePackResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = UpdatePackResponse200.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 | UpdatePackResponse200]:
|
||||
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: UpdatePackRequest,
|
||||
|
||||
) -> Response[Any | UpdatePackResponse200]:
|
||||
""" Update an existing pack
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdatePackRequest): Request DTO for updating a pack
|
||||
|
||||
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 | UpdatePackResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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: UpdatePackRequest,
|
||||
|
||||
) -> Any | UpdatePackResponse200 | None:
|
||||
""" Update an existing pack
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdatePackRequest): Request DTO for updating a pack
|
||||
|
||||
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 | UpdatePackResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
body: UpdatePackRequest,
|
||||
|
||||
) -> Response[Any | UpdatePackResponse200]:
|
||||
""" Update an existing pack
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdatePackRequest): Request DTO for updating a pack
|
||||
|
||||
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 | UpdatePackResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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: UpdatePackRequest,
|
||||
|
||||
) -> Any | UpdatePackResponse200 | None:
|
||||
""" Update an existing pack
|
||||
|
||||
Args:
|
||||
ref (str):
|
||||
body (UpdatePackRequest): Request DTO for updating a pack
|
||||
|
||||
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 | UpdatePackResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
body=body,
|
||||
|
||||
)).parsed
|
||||
179
tests/generated_client/api/packs/validate_pack_workflows.py
Normal file
179
tests/generated_client/api/packs/validate_pack_workflows.py
Normal file
@@ -0,0 +1,179 @@
|
||||
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.validate_pack_workflows_response_200 import ValidatePackWorkflowsResponse200
|
||||
from typing import cast
|
||||
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
ref: str,
|
||||
|
||||
) -> dict[str, Any]:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/api/v1/packs/{ref}/workflows/validate".format(ref=quote(str(ref), safe=""),),
|
||||
}
|
||||
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
|
||||
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | ValidatePackWorkflowsResponse200 | None:
|
||||
if response.status_code == 200:
|
||||
response_200 = ValidatePackWorkflowsResponse200.from_dict(response.json())
|
||||
|
||||
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 404:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
|
||||
if response.status_code == 500:
|
||||
response_500 = cast(Any, None)
|
||||
return response_500
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200]:
|
||||
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 | ValidatePackWorkflowsResponse200]:
|
||||
""" Validate workflows for a pack without syncing
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200 | None:
|
||||
""" Validate workflows for a pack without syncing
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200
|
||||
"""
|
||||
|
||||
|
||||
return sync_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
).parsed
|
||||
|
||||
async def asyncio_detailed(
|
||||
ref: str,
|
||||
*,
|
||||
client: AuthenticatedClient,
|
||||
|
||||
) -> Response[Any | ValidatePackWorkflowsResponse200]:
|
||||
""" Validate workflows for a pack without syncing
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200]
|
||||
"""
|
||||
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200 | None:
|
||||
""" Validate workflows for a pack without syncing
|
||||
|
||||
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 | ValidatePackWorkflowsResponse200
|
||||
"""
|
||||
|
||||
|
||||
return (await asyncio_detailed(
|
||||
ref=ref,
|
||||
client=client,
|
||||
|
||||
)).parsed
|
||||
Reference in New Issue
Block a user