Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
from http import HTTPStatus
from typing import Any

import httpx

from ... import errors
from ...client import Client
from ...models.app_registration_template import AppRegistrationTemplate
from ...types import Response


def _get_kwargs() -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/app-registration-templates",
}

return _kwargs


def _parse_response(*, client: Client, response: httpx.Response) -> list[AppRegistrationTemplate] | None:
if response.status_code == 200:
response_200 = []
_response_200 = response.json()
for response_200_item_data in _response_200:
response_200_item = AppRegistrationTemplate.from_dict(response_200_item_data)

response_200.append(response_200_item)

return response_200

errors.handle_error_response(response, client.raise_on_unexpected_status)


def _build_response(*, client: Client, response: httpx.Response) -> Response[list[AppRegistrationTemplate]]:
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: Client,
) -> Response[list[AppRegistrationTemplate]]:
"""List app registration templates

Lists pre-defined application templates to register.

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[list[AppRegistrationTemplate]]
"""

kwargs = _get_kwargs()

response = client.get_httpx_client().request(
auth=client.get_auth(),
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: Client,
) -> list[AppRegistrationTemplate] | None:
"""List app registration templates

Lists pre-defined application templates to register.

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:
list[AppRegistrationTemplate]
"""

try:
return sync_detailed(
client=client,
).parsed
except errors.NotFoundException:
return None


async def asyncio_detailed(
*,
client: Client,
) -> Response[list[AppRegistrationTemplate]]:
"""List app registration templates

Lists pre-defined application templates to register.

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[list[AppRegistrationTemplate]]
"""

kwargs = _get_kwargs()

response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: Client,
) -> list[AppRegistrationTemplate] | None:
"""List app registration templates

Lists pre-defined application templates to register.

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:
list[AppRegistrationTemplate]
"""

try:
return (
await asyncio_detailed(
client=client,
)
).parsed
except errors.NotFoundException:
return None
194 changes: 194 additions & 0 deletions cirro_api_client/v1/api/execution/get_task_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
from http import HTTPStatus
from typing import Any
from urllib.parse import quote

import httpx

from ... import errors
from ...client import Client
from ...models.get_task_files_response import GetTaskFilesResponse
from ...types import Response


def _get_kwargs(
project_id: str,
dataset_id: str,
task_id: str,
) -> dict[str, Any]:
_kwargs: dict[str, Any] = {
"method": "get",
"url": "/projects/{project_id}/execution/{dataset_id}/tasks/{task_id}/files".format(
project_id=quote(str(project_id), safe=""),
dataset_id=quote(str(dataset_id), safe=""),
task_id=quote(str(task_id), safe=""),
),
}

return _kwargs


def _parse_response(*, client: Client, response: httpx.Response) -> GetTaskFilesResponse | None:
if response.status_code == 200:
response_200 = GetTaskFilesResponse.from_dict(response.json())

return response_200

errors.handle_error_response(response, client.raise_on_unexpected_status)


def _build_response(*, client: Client, response: httpx.Response) -> Response[GetTaskFilesResponse]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
project_id: str,
dataset_id: str,
task_id: str,
*,
client: Client,
) -> Response[GetTaskFilesResponse]:
"""Get task files

Gets the input and output files for an individual Nextflow task

Args:
project_id (str):
dataset_id (str):
task_id (str):
client (Client): instance of the API client

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[GetTaskFilesResponse]
"""

kwargs = _get_kwargs(
project_id=project_id,
dataset_id=dataset_id,
task_id=task_id,
)

response = client.get_httpx_client().request(
auth=client.get_auth(),
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
project_id: str,
dataset_id: str,
task_id: str,
*,
client: Client,
) -> GetTaskFilesResponse | None:
"""Get task files

Gets the input and output files for an individual Nextflow task

Args:
project_id (str):
dataset_id (str):
task_id (str):
client (Client): instance of the API client

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:
GetTaskFilesResponse
"""

try:
return sync_detailed(
project_id=project_id,
dataset_id=dataset_id,
task_id=task_id,
client=client,
).parsed
except errors.NotFoundException:
return None


async def asyncio_detailed(
project_id: str,
dataset_id: str,
task_id: str,
*,
client: Client,
) -> Response[GetTaskFilesResponse]:
"""Get task files

Gets the input and output files for an individual Nextflow task

Args:
project_id (str):
dataset_id (str):
task_id (str):
client (Client): instance of the API client

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[GetTaskFilesResponse]
"""

kwargs = _get_kwargs(
project_id=project_id,
dataset_id=dataset_id,
task_id=task_id,
)

response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs)

return _build_response(client=client, response=response)


async def asyncio(
project_id: str,
dataset_id: str,
task_id: str,
*,
client: Client,
) -> GetTaskFilesResponse | None:
"""Get task files

Gets the input and output files for an individual Nextflow task

Args:
project_id (str):
dataset_id (str):
task_id (str):
client (Client): instance of the API client

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:
GetTaskFilesResponse
"""

try:
return (
await asyncio_detailed(
project_id=project_id,
dataset_id=dataset_id,
task_id=task_id,
client=client,
)
).parsed
except errors.NotFoundException:
return None
Loading
Loading