diff --git a/webknossos/__generate_client.py b/webknossos/__generate_client.py index 5ab17a842..73f12c26d 100644 --- a/webknossos/__generate_client.py +++ b/webknossos/__generate_client.py @@ -317,7 +317,7 @@ def iterate_request_ids_with_responses() -> Iterable[Tuple[str, bytes]]: "projectId", "dataSet", "status", - "open", + "pending", "active", "finished", ##### Annotation ##### diff --git a/webknossos/examples/annotation_project_administration.py b/webknossos/examples/annotation_project_administration.py index e151675b1..f0a7e7b5d 100644 --- a/webknossos/examples/annotation_project_administration.py +++ b/webknossos/examples/annotation_project_administration.py @@ -9,9 +9,9 @@ def main() -> None: sample_project = Project.get_by_name("sampleProject") tasks = sample_project.get_tasks() total_active_instances = sum([task.status.active_instance_count for task in tasks]) - total_open_instances = sum([task.status.open_instance_count for task in tasks]) + total_pending_instances = sum([task.status.pending_instance_count for task in tasks]) print( - f"There are {total_active_instances} active and {total_open_instances} open task instances." + f"There are {total_active_instances} active and {total_pending_instances} pending task instances." ) # Find and download all of the project’s annotations that are already finished by annotators diff --git a/webknossos/poetry.lock b/webknossos/poetry.lock index 8d9b8f6cb..312255e76 100644 --- a/webknossos/poetry.lock +++ b/webknossos/poetry.lock @@ -1009,54 +1009,58 @@ requests = ["requests (>=2.20.0,<3.0.0.dev0)"] [[package]] name = "h11" -version = "0.12.0" +version = "0.14.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "h11-0.12.0-py3-none-any.whl", hash = "sha256:36a3cb8c0a032f56e2da7084577878a035d3b61d104230d4bd49c0c6b555a9c6"}, - {file = "h11-0.12.0.tar.gz", hash = "sha256:47222cb6067e4a307d535814917cd98fd0a57b6788ce715755fa2b6c28b56042"}, + {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, + {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, ] [[package]] name = "httpcore" -version = "0.13.7" +version = "0.17.3" description = "A minimal low-level HTTP client." optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "httpcore-0.13.7-py3-none-any.whl", hash = "sha256:369aa481b014cf046f7067fddd67d00560f2f00426e79569d99cb11245134af0"}, - {file = "httpcore-0.13.7.tar.gz", hash = "sha256:036f960468759e633574d7c121afba48af6419615d36ab8ede979f1ad6276fa3"}, + {file = "httpcore-0.17.3-py3-none-any.whl", hash = "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87"}, + {file = "httpcore-0.17.3.tar.gz", hash = "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888"}, ] [package.dependencies] -anyio = "==3.*" -h11 = ">=0.11,<0.13" +anyio = ">=3.0,<5.0" +certifi = "*" +h11 = ">=0.13,<0.15" sniffio = "==1.*" [package.extras] http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] [[package]] name = "httpx" -version = "0.18.2" +version = "0.24.1" description = "The next generation HTTP client." optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "httpx-0.18.2-py3-none-any.whl", hash = "sha256:979afafecb7d22a1d10340bafb403cf2cb75aff214426ff206521fc79d26408c"}, - {file = "httpx-0.18.2.tar.gz", hash = "sha256:9f99c15d33642d38bce8405df088c1c4cfd940284b4290cacbfb02e64f4877c6"}, + {file = "httpx-0.24.1-py3-none-any.whl", hash = "sha256:06781eb9ac53cde990577af654bd990a4949de37a28bdb4a230d434f3a30b9bd"}, + {file = "httpx-0.24.1.tar.gz", hash = "sha256:5853a43053df830c20f8110c5e69fe44d035d850b2dfe795e196f00fdb774bdd"}, ] [package.dependencies] certifi = "*" -httpcore = ">=0.13.3,<0.14.0" -rfc3986 = {version = ">=1.3,<2", extras = ["idna2008"]} +httpcore = ">=0.15.0,<0.18.0" +idna = "*" sniffio = "*" [package.extras] -brotli = ["brotlicffi (==1.*)"] -http2 = ["h2 (==3.*)"] +brotli = ["brotli", "brotlicffi"] +cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] [[package]] name = "hypothesis" @@ -2627,23 +2631,6 @@ files = [ [package.dependencies] six = "*" -[[package]] -name = "rfc3986" -version = "1.5.0" -description = "Validating URI References per RFC 3986" -optional = false -python-versions = "*" -files = [ - {file = "rfc3986-1.5.0-py2.py3-none-any.whl", hash = "sha256:a86d6e1f5b1dc238b218b012df0aa79409667bb209e58da56d0b94704e712a97"}, - {file = "rfc3986-1.5.0.tar.gz", hash = "sha256:270aaf10d87d0d4e095063c65bf3ddbc6ee3d0b226328ce21e036f946e421835"}, -] - -[package.dependencies] -idna = {version = "*", optional = true, markers = "extra == \"idna2008\""} - -[package.extras] -idna2008 = ["idna"] - [[package]] name = "rich" version = "10.16.2" @@ -3365,4 +3352,4 @@ tifffile = ["pims", "tifffile"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12" -content-hash = "74647410aeb5f42f69d7861f7d63a66e1ba7d9eb34d1301f92ffd9aae56fbbad" +content-hash = "49ea78f5eb0e1bd29db10d86c9c4e2e17e8de4b6cf3638efa13132546e05c8e1" diff --git a/webknossos/pyproject.toml b/webknossos/pyproject.toml index 11f15794f..ad63f3642 100644 --- a/webknossos/pyproject.toml +++ b/webknossos/pyproject.toml @@ -35,7 +35,7 @@ boltons = "~21.0.0" cattrs = "^22.2.0" cluster_tools = { path = "../cluster_tools/", develop = true } fsspec = "^2022.2.0" -httpx = ">=0.15.4,<0.19.0" +httpx = ">=0.20.0,<=0.24.1" loxun = "^2.0" natsort = "^6.2.0" networkx = "^2.6.2" diff --git a/webknossos/webknossos/administration/task.py b/webknossos/webknossos/administration/task.py index a2f4eedb9..7674c3eee 100644 --- a/webknossos/webknossos/administration/task.py +++ b/webknossos/webknossos/administration/task.py @@ -28,7 +28,7 @@ @attr.frozen class TaskStatus: - open_instance_count: int + pending_instance_count: int active_instance_count: int finished_instance_count: int @@ -78,7 +78,7 @@ def create_from_annotations( "domain": needed_experience_domain, "value": needed_experience_value, }, - "openInstances": instances, + "pendingInstances": instances, "projectName": project_name, "scriptId": script_id, "boundingBox": bounding_box.to_wkw_dict() @@ -131,7 +131,7 @@ def create( "domain": needed_experience_domain, "value": needed_experience_value, }, - "openInstances": instances, + "pendingInstances": instances, "projectName": project_name, "scriptId": script_id, "dataSet": dataset_name, diff --git a/webknossos/webknossos/client/_generated/api/datastore/dataset_cancel_upload.py b/webknossos/webknossos/client/_generated/api/datastore/dataset_cancel_upload.py index d54a424cf..98f9427b9 100644 --- a/webknossos/webknossos/client/_generated/api/datastore/dataset_cancel_upload.py +++ b/webknossos/webknossos/client/_generated/api/datastore/dataset_cancel_upload.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...models.dataset_cancel_upload_json_body import DatasetCancelUploadJsonBody from ...types import UNSET, Response, Unset @@ -32,17 +33,29 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -63,6 +76,10 @@ def sync_detailed( token (Union[Unset, None, str]): json_body (DatasetCancelUploadJsonBody): + 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] """ @@ -78,7 +95,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -98,6 +115,10 @@ async def asyncio_detailed( token (Union[Unset, None, str]): json_body (DatasetCancelUploadJsonBody): + 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] """ @@ -111,4 +132,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/datastore/dataset_download.py b/webknossos/webknossos/client/_generated/api/datastore/dataset_download.py index 85ff695a5..c4dabe2cf 100644 --- a/webknossos/webknossos/client/_generated/api/datastore/dataset_download.py +++ b/webknossos/webknossos/client/_generated/api/datastore/dataset_download.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...types import UNSET, Response, Unset @@ -63,16 +64,28 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -110,6 +123,10 @@ def sync_detailed( half_byte (Union[Unset, None, bool]): mapping_name (Union[Unset, None, 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] """ @@ -136,7 +153,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -173,6 +190,10 @@ async def asyncio_detailed( half_byte (Union[Unset, None, bool]): mapping_name (Union[Unset, None, 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] """ @@ -197,4 +218,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/datastore/dataset_finish_upload.py b/webknossos/webknossos/client/_generated/api/datastore/dataset_finish_upload.py index e6a504f0c..e6d29bb45 100644 --- a/webknossos/webknossos/client/_generated/api/datastore/dataset_finish_upload.py +++ b/webknossos/webknossos/client/_generated/api/datastore/dataset_finish_upload.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...models.dataset_finish_upload_json_body import DatasetFinishUploadJsonBody from ...types import UNSET, Response, Unset @@ -32,17 +33,29 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -67,6 +80,10 @@ def sync_detailed( token (Union[Unset, None, str]): json_body (DatasetFinishUploadJsonBody): + 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] """ @@ -82,7 +99,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -106,6 +123,10 @@ async def asyncio_detailed( token (Union[Unset, None, str]): json_body (DatasetFinishUploadJsonBody): + 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] """ @@ -119,4 +140,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/datastore/dataset_reserve_upload.py b/webknossos/webknossos/client/_generated/api/datastore/dataset_reserve_upload.py index beb7a0be6..d1aa716a7 100644 --- a/webknossos/webknossos/client/_generated/api/datastore/dataset_reserve_upload.py +++ b/webknossos/webknossos/client/_generated/api/datastore/dataset_reserve_upload.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...models.dataset_reserve_upload_json_body import DatasetReserveUploadJsonBody from ...types import UNSET, Response, Unset @@ -32,17 +33,25 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -68,6 +77,10 @@ def sync_detailed( token (Union[Unset, None, str]): json_body (DatasetReserveUploadJsonBody): + 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] """ @@ -83,7 +96,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -108,6 +121,10 @@ async def asyncio_detailed( token (Union[Unset, None, str]): json_body (DatasetReserveUploadJsonBody): + 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] """ @@ -121,4 +138,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/datastore/dataset_upload_chunk.py b/webknossos/webknossos/client/_generated/api/datastore/dataset_upload_chunk.py index a09eaff6d..cd8d3cc0b 100644 --- a/webknossos/webknossos/client/_generated/api/datastore/dataset_upload_chunk.py +++ b/webknossos/webknossos/client/_generated/api/datastore/dataset_upload_chunk.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...types import UNSET, Response, Unset @@ -28,16 +29,28 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -46,7 +59,7 @@ def sync_detailed( client: Client, token: Union[Unset, None, str] = UNSET, ) -> Response[Any]: - """Upload a byte chunk for a new dataset + r"""Upload a byte chunk for a new dataset Expects: - As file attachment: A raw byte chunk of the dataset - As form parameter: @@ -64,6 +77,10 @@ def sync_detailed( Args: token (Union[Unset, None, 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] """ @@ -78,7 +95,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -86,7 +103,7 @@ async def asyncio_detailed( client: Client, token: Union[Unset, None, str] = UNSET, ) -> Response[Any]: - """Upload a byte chunk for a new dataset + r"""Upload a byte chunk for a new dataset Expects: - As file attachment: A raw byte chunk of the dataset - As form parameter: @@ -104,6 +121,10 @@ async def asyncio_detailed( Args: token (Union[Unset, None, 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] """ @@ -116,4 +137,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/add_annotation_layer.py b/webknossos/webknossos/client/_generated/api/default/add_annotation_layer.py index 198059551..6cad95bb3 100644 --- a/webknossos/webknossos/client/_generated/api/default/add_annotation_layer.py +++ b/webknossos/webknossos/client/_generated/api/default/add_annotation_layer.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -26,15 +27,23 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -49,6 +58,10 @@ def sync_detailed( typ (str): id (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] """ @@ -64,7 +77,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -78,6 +91,10 @@ async def asyncio_detailed( typ (str): id (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] """ @@ -91,4 +108,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/annotation_download.py b/webknossos/webknossos/client/_generated/api/default/annotation_download.py index 3e476f9dd..1ac27c469 100644 --- a/webknossos/webknossos/client/_generated/api/default/annotation_download.py +++ b/webknossos/webknossos/client/_generated/api/default/annotation_download.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...types import UNSET, Response, Unset @@ -35,16 +36,28 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -64,6 +77,10 @@ def sync_detailed( volume_version (Union[Unset, None, int]): skip_volume_data (Union[Unset, None, bool]): + 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] """ @@ -81,7 +98,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -100,6 +117,10 @@ async def asyncio_detailed( volume_version (Union[Unset, None, int]): skip_volume_data (Union[Unset, None, bool]): + 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] """ @@ -115,4 +136,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/annotation_download_by_type.py b/webknossos/webknossos/client/_generated/api/default/annotation_download_by_type.py index c8db4dd0d..e42707c46 100644 --- a/webknossos/webknossos/client/_generated/api/default/annotation_download_by_type.py +++ b/webknossos/webknossos/client/_generated/api/default/annotation_download_by_type.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, Union +from typing import Any, Dict, Optional, Union import httpx +from ... import errors from ...client import Client from ...types import UNSET, Response, Unset @@ -38,16 +39,28 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -69,6 +82,10 @@ def sync_detailed( volume_version (Union[Unset, None, int]): skip_volume_data (Union[Unset, None, bool]): + 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] """ @@ -87,7 +104,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -108,6 +125,10 @@ async def asyncio_detailed( volume_version (Union[Unset, None, int]): skip_volume_data (Union[Unset, None, bool]): + 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] """ @@ -124,4 +145,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/annotation_info.py b/webknossos/webknossos/client/_generated/api/default/annotation_info.py index b59191c91..ffd1f332f 100644 --- a/webknossos/webknossos/client/_generated/api/default/annotation_info.py +++ b/webknossos/webknossos/client/_generated/api/default/annotation_info.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.annotation_info_response_200 import AnnotationInfoResponse200 from ...types import UNSET, Response @@ -30,12 +31,13 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[AnnotationInfoResponse200, Any]]: if response.status_code == HTTPStatus.OK: response_200 = AnnotationInfoResponse200.from_dict(response.json()) @@ -44,17 +46,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[AnnotationInfoResponse200, Any]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -70,6 +75,10 @@ def sync_detailed( id (str): timestamp (int): + 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[Union[AnnotationInfoResponse200, Any]] """ @@ -85,7 +94,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -100,8 +109,12 @@ def sync( id (str): timestamp (int): + 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[Union[AnnotationInfoResponse200, Any]] + Union[AnnotationInfoResponse200, Any] """ return sync_detailed( @@ -123,6 +136,10 @@ async def asyncio_detailed( id (str): timestamp (int): + 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[Union[AnnotationInfoResponse200, Any]] """ @@ -136,7 +153,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -151,8 +168,12 @@ async def asyncio( id (str): timestamp (int): + 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[Union[AnnotationInfoResponse200, Any]] + Union[AnnotationInfoResponse200, Any] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/annotation_info_by_type.py b/webknossos/webknossos/client/_generated/api/default/annotation_info_by_type.py index ded96d87b..c33e45599 100644 --- a/webknossos/webknossos/client/_generated/api/default/annotation_info_by_type.py +++ b/webknossos/webknossos/client/_generated/api/default/annotation_info_by_type.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import UNSET, Response @@ -30,16 +31,28 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -57,6 +70,10 @@ def sync_detailed( id (str): timestamp (int): + 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] """ @@ -73,7 +90,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -90,6 +107,10 @@ async def asyncio_detailed( id (str): timestamp (int): + 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] """ @@ -104,4 +125,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/annotation_infos_by_task_id.py b/webknossos/webknossos/client/_generated/api/default/annotation_infos_by_task_id.py index 44106f950..7458d66e0 100644 --- a/webknossos/webknossos/client/_generated/api/default/annotation_infos_by_task_id.py +++ b/webknossos/webknossos/client/_generated/api/default/annotation_infos_by_task_id.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.annotation_infos_by_task_id_response_200_item import ( AnnotationInfosByTaskIdResponse200Item, @@ -26,11 +27,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, List["AnnotationInfosByTaskIdResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -46,17 +48,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, List["AnnotationInfosByTaskIdResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -70,6 +75,10 @@ def sync_detailed( Args: id (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[Union[Any, List['AnnotationInfosByTaskIdResponse200Item']]] """ @@ -84,7 +93,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -97,8 +106,12 @@ def sync( Args: id (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[Union[Any, List['AnnotationInfosByTaskIdResponse200Item']]] + Union[Any, List['AnnotationInfosByTaskIdResponse200Item']] """ return sync_detailed( @@ -117,6 +130,10 @@ async def asyncio_detailed( Args: id (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[Union[Any, List['AnnotationInfosByTaskIdResponse200Item']]] """ @@ -129,7 +146,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -142,8 +159,12 @@ async def asyncio( Args: id (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[Union[Any, List['AnnotationInfosByTaskIdResponse200Item']]] + Union[Any, List['AnnotationInfosByTaskIdResponse200Item']] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/annotation_upload.py b/webknossos/webknossos/client/_generated/api/default/annotation_upload.py index 8037585b6..da8c766bb 100644 --- a/webknossos/webknossos/client/_generated/api/default/annotation_upload.py +++ b/webknossos/webknossos/client/_generated/api/default/annotation_upload.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -22,15 +23,27 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -38,7 +51,7 @@ def sync_detailed( *, client: Client, ) -> Response[Any]: - """Upload NML(s) or ZIP(s) of NML(s) to create a new explorative annotation. + r"""Upload NML(s) or ZIP(s) of NML(s) to create a new explorative annotation. Expects: - As file attachment: - Any number of NML files or ZIP files containing NMLs, optionally with volume data ZIPs @@ -49,6 +62,10 @@ def sync_detailed( - If \"true\": in merged annotation, create tree group wrapping the trees of each file - If \"false\": in merged annotation, rename trees with the respective file name as prefix + 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] """ @@ -62,14 +79,14 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( *, client: Client, ) -> Response[Any]: - """Upload NML(s) or ZIP(s) of NML(s) to create a new explorative annotation. + r"""Upload NML(s) or ZIP(s) of NML(s) to create a new explorative annotation. Expects: - As file attachment: - Any number of NML files or ZIP files containing NMLs, optionally with volume data ZIPs @@ -80,6 +97,10 @@ async def asyncio_detailed( - If \"true\": in merged annotation, create tree group wrapping the trees of each file - If \"false\": in merged annotation, rename trees with the respective file name as prefix + 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] """ @@ -91,4 +112,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/build_info.py b/webknossos/webknossos/client/_generated/api/default/build_info.py index 018cd0dd5..a3e364dd4 100644 --- a/webknossos/webknossos/client/_generated/api/default/build_info.py +++ b/webknossos/webknossos/client/_generated/api/default/build_info.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.build_info_response_200 import BuildInfoResponse200 from ...types import Response @@ -23,11 +24,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, BuildInfoResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = BuildInfoResponse200.from_dict(response.json()) @@ -36,17 +38,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, BuildInfoResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -56,6 +61,10 @@ def sync_detailed( ) -> Response[Union[Any, BuildInfoResponse200]]: """Information about the version of WEBKNOSSOS + 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[Union[Any, BuildInfoResponse200]] """ @@ -69,7 +78,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -78,8 +87,12 @@ def sync( ) -> Optional[Union[Any, BuildInfoResponse200]]: """Information about the version of WEBKNOSSOS + 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[Union[Any, BuildInfoResponse200]] + Union[Any, BuildInfoResponse200] """ return sync_detailed( @@ -93,6 +106,10 @@ async def asyncio_detailed( ) -> Response[Union[Any, BuildInfoResponse200]]: """Information about the version of WEBKNOSSOS + 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[Union[Any, BuildInfoResponse200]] """ @@ -104,7 +121,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -113,8 +130,12 @@ async def asyncio( ) -> Optional[Union[Any, BuildInfoResponse200]]: """Information about the version of WEBKNOSSOS + 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[Union[Any, BuildInfoResponse200]] + Union[Any, BuildInfoResponse200] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/create_private_link.py b/webknossos/webknossos/client/_generated/api/default/create_private_link.py index 8f6eeeacc..2159df67c 100644 --- a/webknossos/webknossos/client/_generated/api/default/create_private_link.py +++ b/webknossos/webknossos/client/_generated/api/default/create_private_link.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...models.create_private_link_json_body import CreatePrivateLinkJsonBody from ...types import Response @@ -26,16 +27,32 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if response.status_code == HTTPStatus.FORBIDDEN: + return None + if response.status_code == HTTPStatus.NOT_FOUND: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -54,6 +71,10 @@ def sync_detailed( Args: json_body (CreatePrivateLinkJsonBody): + 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] """ @@ -68,7 +89,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -86,6 +107,10 @@ async def asyncio_detailed( Args: json_body (CreatePrivateLinkJsonBody): + 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] """ @@ -98,4 +123,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/create_project.py b/webknossos/webknossos/client/_generated/api/default/create_project.py index 7873e5831..12287946a 100644 --- a/webknossos/webknossos/client/_generated/api/default/create_project.py +++ b/webknossos/webknossos/client/_generated/api/default/create_project.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...models.create_project_json_body import CreateProjectJsonBody from ...types import Response @@ -26,16 +27,24 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -59,6 +68,10 @@ def sync_detailed( Args: json_body (CreateProjectJsonBody): + 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] """ @@ -73,7 +86,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -96,6 +109,10 @@ async def asyncio_detailed( Args: json_body (CreateProjectJsonBody): + 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] """ @@ -108,4 +125,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/current_user_info.py b/webknossos/webknossos/client/_generated/api/default/current_user_info.py index d594b5465..09bfd8d9b 100644 --- a/webknossos/webknossos/client/_generated/api/default/current_user_info.py +++ b/webknossos/webknossos/client/_generated/api/default/current_user_info.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.current_user_info_response_200 import CurrentUserInfoResponse200 from ...types import Response @@ -23,27 +24,31 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[CurrentUserInfoResponse200]: if response.status_code == HTTPStatus.OK: response_200 = CurrentUserInfoResponse200.from_dict(response.json()) return response_200 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[CurrentUserInfoResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -53,6 +58,10 @@ def sync_detailed( ) -> Response[CurrentUserInfoResponse200]: """Returns a json with information about the requesting user + 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[CurrentUserInfoResponse200] """ @@ -66,7 +75,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -75,8 +84,12 @@ def sync( ) -> Optional[CurrentUserInfoResponse200]: """Returns a json with information about the requesting user + 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[CurrentUserInfoResponse200] + CurrentUserInfoResponse200 """ return sync_detailed( @@ -90,6 +103,10 @@ async def asyncio_detailed( ) -> Response[CurrentUserInfoResponse200]: """Returns a json with information about the requesting user + 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[CurrentUserInfoResponse200] """ @@ -101,7 +118,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -110,8 +127,12 @@ async def asyncio( ) -> Optional[CurrentUserInfoResponse200]: """Returns a json with information about the requesting user + 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[CurrentUserInfoResponse200] + CurrentUserInfoResponse200 """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/dataset_info.py b/webknossos/webknossos/client/_generated/api/default/dataset_info.py index bc0b181b7..723f68ae4 100644 --- a/webknossos/webknossos/client/_generated/api/default/dataset_info.py +++ b/webknossos/webknossos/client/_generated/api/default/dataset_info.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.dataset_info_response_200 import DatasetInfoResponse200 from ...types import UNSET, Response, Unset @@ -33,12 +34,13 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, DatasetInfoResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = DatasetInfoResponse200.from_dict(response.json()) @@ -47,17 +49,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, DatasetInfoResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -75,6 +80,10 @@ def sync_detailed( data_set_name (str): sharing_token (Union[Unset, None, 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[Union[Any, DatasetInfoResponse200]] """ @@ -91,7 +100,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -108,8 +117,12 @@ def sync( data_set_name (str): sharing_token (Union[Unset, None, 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[Union[Any, DatasetInfoResponse200]] + Union[Any, DatasetInfoResponse200] """ return sync_detailed( @@ -134,6 +147,10 @@ async def asyncio_detailed( data_set_name (str): sharing_token (Union[Unset, None, 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[Union[Any, DatasetInfoResponse200]] """ @@ -148,7 +165,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -165,8 +182,12 @@ async def asyncio( data_set_name (str): sharing_token (Union[Unset, None, 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[Union[Any, DatasetInfoResponse200]] + Union[Any, DatasetInfoResponse200] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/dataset_list.py b/webknossos/webknossos/client/_generated/api/default/dataset_list.py index cd2f6919a..1b4ede71f 100644 --- a/webknossos/webknossos/client/_generated/api/default/dataset_list.py +++ b/webknossos/webknossos/client/_generated/api/default/dataset_list.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.dataset_list_response_200_item import DatasetListResponse200Item from ...types import UNSET, Response, Unset @@ -56,12 +57,13 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, List["DatasetListResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -77,17 +79,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, List["DatasetListResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -119,6 +124,10 @@ def sync_detailed( limit (Union[Unset, None, int]): compact (Union[Unset, None, bool]): + 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[Union[Any, List['DatasetListResponse200Item']]] """ @@ -142,7 +151,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -173,8 +182,12 @@ def sync( limit (Union[Unset, None, int]): compact (Union[Unset, None, bool]): + 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[Union[Any, List['DatasetListResponse200Item']]] + Union[Any, List['DatasetListResponse200Item']] """ return sync_detailed( @@ -220,6 +233,10 @@ async def asyncio_detailed( limit (Union[Unset, None, int]): compact (Union[Unset, None, bool]): + 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[Union[Any, List['DatasetListResponse200Item']]] """ @@ -241,7 +258,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -272,8 +289,12 @@ async def asyncio( limit (Union[Unset, None, int]): compact (Union[Unset, None, bool]): + 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[Union[Any, List['DatasetListResponse200Item']]] + Union[Any, List['DatasetListResponse200Item']] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/dataset_sharing_token.py b/webknossos/webknossos/client/_generated/api/default/dataset_sharing_token.py index cff03e6c9..007ad373c 100644 --- a/webknossos/webknossos/client/_generated/api/default/dataset_sharing_token.py +++ b/webknossos/webknossos/client/_generated/api/default/dataset_sharing_token.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.dataset_sharing_token_response_200 import DatasetSharingTokenResponse200 from ...types import Response @@ -27,11 +28,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, DatasetSharingTokenResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = DatasetSharingTokenResponse200.from_dict(response.json()) @@ -40,17 +42,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, DatasetSharingTokenResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -66,6 +71,10 @@ def sync_detailed( organization_name (str): data_set_name (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[Union[Any, DatasetSharingTokenResponse200]] """ @@ -81,7 +90,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -96,8 +105,12 @@ def sync( organization_name (str): data_set_name (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[Union[Any, DatasetSharingTokenResponse200]] + Union[Any, DatasetSharingTokenResponse200] """ return sync_detailed( @@ -119,6 +132,10 @@ async def asyncio_detailed( organization_name (str): data_set_name (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[Union[Any, DatasetSharingTokenResponse200]] """ @@ -132,7 +149,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -147,8 +164,12 @@ async def asyncio( organization_name (str): data_set_name (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[Union[Any, DatasetSharingTokenResponse200]] + Union[Any, DatasetSharingTokenResponse200] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/dataset_update.py b/webknossos/webknossos/client/_generated/api/default/dataset_update.py index 6b0a0cc19..01bac961f 100644 --- a/webknossos/webknossos/client/_generated/api/default/dataset_update.py +++ b/webknossos/webknossos/client/_generated/api/default/dataset_update.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...models.dataset_update_json_body import DatasetUpdateJsonBody from ...types import Response @@ -30,16 +31,24 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -68,6 +77,10 @@ def sync_detailed( data_set_name (str): json_body (DatasetUpdateJsonBody): + 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] """ @@ -84,7 +97,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -112,6 +125,10 @@ async def asyncio_detailed( data_set_name (str): json_body (DatasetUpdateJsonBody): + 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] """ @@ -126,4 +143,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/dataset_update_partial.py b/webknossos/webknossos/client/_generated/api/default/dataset_update_partial.py index 849d13549..fc066b93a 100644 --- a/webknossos/webknossos/client/_generated/api/default/dataset_update_partial.py +++ b/webknossos/webknossos/client/_generated/api/default/dataset_update_partial.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...models.dataset_update_partial_json_body import DatasetUpdatePartialJsonBody from ...types import Response @@ -30,16 +31,24 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -69,6 +78,10 @@ def sync_detailed( data_set_name (str): json_body (DatasetUpdatePartialJsonBody): + 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] """ @@ -85,7 +98,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -114,6 +127,10 @@ async def asyncio_detailed( data_set_name (str): json_body (DatasetUpdatePartialJsonBody): + 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] """ @@ -128,4 +145,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/dataset_update_teams.py b/webknossos/webknossos/client/_generated/api/default/dataset_update_teams.py index 29d445ad7..14fd0ed45 100644 --- a/webknossos/webknossos/client/_generated/api/default/dataset_update_teams.py +++ b/webknossos/webknossos/client/_generated/api/default/dataset_update_teams.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict, List +from typing import Any, Dict, List, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -29,16 +30,24 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -49,7 +58,7 @@ def sync_detailed( client: Client, json_body: List[str], ) -> Response[Any]: - """\"Update teams of a dataset + r"""\"Update teams of a dataset Expects: - As JSON object body: List of team strings. @@ -62,6 +71,10 @@ def sync_detailed( data_set_name (str): json_body (List[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] """ @@ -78,7 +91,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -88,7 +101,7 @@ async def asyncio_detailed( client: Client, json_body: List[str], ) -> Response[Any]: - """\"Update teams of a dataset + r"""\"Update teams of a dataset Expects: - As JSON object body: List of team strings. @@ -101,6 +114,10 @@ async def asyncio_detailed( data_set_name (str): json_body (List[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] """ @@ -115,4 +132,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/datastore_list.py b/webknossos/webknossos/client/_generated/api/default/datastore_list.py index 406b8bc2e..e21c8a8ef 100644 --- a/webknossos/webknossos/client/_generated/api/default/datastore_list.py +++ b/webknossos/webknossos/client/_generated/api/default/datastore_list.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.datastore_list_response_200_item import DatastoreListResponse200Item from ...types import Response @@ -23,11 +24,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, List["DatastoreListResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -43,17 +45,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, List["DatastoreListResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -63,6 +68,10 @@ def sync_detailed( ) -> Response[Union[Any, List["DatastoreListResponse200Item"]]]: """List all available datastores + 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[Union[Any, List['DatastoreListResponse200Item']]] """ @@ -76,7 +85,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -85,8 +94,12 @@ def sync( ) -> Optional[Union[Any, List["DatastoreListResponse200Item"]]]: """List all available datastores + 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[Union[Any, List['DatastoreListResponse200Item']]] + Union[Any, List['DatastoreListResponse200Item']] """ return sync_detailed( @@ -100,6 +113,10 @@ async def asyncio_detailed( ) -> Response[Union[Any, List["DatastoreListResponse200Item"]]]: """List all available datastores + 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[Union[Any, List['DatastoreListResponse200Item']]] """ @@ -111,7 +128,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -120,8 +137,12 @@ async def asyncio( ) -> Optional[Union[Any, List["DatastoreListResponse200Item"]]]: """List all available datastores + 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[Union[Any, List['DatastoreListResponse200Item']]] + Union[Any, List['DatastoreListResponse200Item']] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/delete_private_link.py b/webknossos/webknossos/client/_generated/api/default/delete_private_link.py index c85eb7e8e..f1e46d187 100644 --- a/webknossos/webknossos/client/_generated/api/default/delete_private_link.py +++ b/webknossos/webknossos/client/_generated/api/default/delete_private_link.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -23,15 +24,31 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if response.status_code == HTTPStatus.FORBIDDEN: + return None + if response.status_code == HTTPStatus.NOT_FOUND: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -45,6 +62,10 @@ def sync_detailed( Args: id (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] """ @@ -59,7 +80,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -72,6 +93,10 @@ async def asyncio_detailed( Args: id (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] """ @@ -84,4 +109,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/folder_tree.py b/webknossos/webknossos/client/_generated/api/default/folder_tree.py index cebbc4945..6cec1f17d 100644 --- a/webknossos/webknossos/client/_generated/api/default/folder_tree.py +++ b/webknossos/webknossos/client/_generated/api/default/folder_tree.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.folder_tree_response_200_item import FolderTreeResponse200Item from ...types import Response @@ -23,11 +24,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, List["FolderTreeResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -43,17 +45,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, List["FolderTreeResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -63,6 +68,10 @@ def sync_detailed( ) -> Response[Union[Any, List["FolderTreeResponse200Item"]]]: """List all accessible folders hierarchically. + 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[Union[Any, List['FolderTreeResponse200Item']]] """ @@ -76,7 +85,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -85,8 +94,12 @@ def sync( ) -> Optional[Union[Any, List["FolderTreeResponse200Item"]]]: """List all accessible folders hierarchically. + 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[Union[Any, List['FolderTreeResponse200Item']]] + Union[Any, List['FolderTreeResponse200Item']] """ return sync_detailed( @@ -100,6 +113,10 @@ async def asyncio_detailed( ) -> Response[Union[Any, List["FolderTreeResponse200Item"]]]: """List all accessible folders hierarchically. + 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[Union[Any, List['FolderTreeResponse200Item']]] """ @@ -111,7 +128,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -120,8 +137,12 @@ async def asyncio( ) -> Optional[Union[Any, List["FolderTreeResponse200Item"]]]: """List all accessible folders hierarchically. + 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[Union[Any, List['FolderTreeResponse200Item']]] + Union[Any, List['FolderTreeResponse200Item']] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/generate_token_for_data_store.py b/webknossos/webknossos/client/_generated/api/default/generate_token_for_data_store.py index 749786598..70a51e77d 100644 --- a/webknossos/webknossos/client/_generated/api/default/generate_token_for_data_store.py +++ b/webknossos/webknossos/client/_generated/api/default/generate_token_for_data_store.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.generate_token_for_data_store_response_200 import ( GenerateTokenForDataStoreResponse200, @@ -25,27 +26,31 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[GenerateTokenForDataStoreResponse200]: if response.status_code == HTTPStatus.OK: response_200 = GenerateTokenForDataStoreResponse200.from_dict(response.json()) return response_200 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[GenerateTokenForDataStoreResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -56,6 +61,10 @@ def sync_detailed( """Generates a token that can be used for requests to a datastore. The token is valid for 1 day by default. + 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[GenerateTokenForDataStoreResponse200] """ @@ -69,7 +78,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -79,8 +88,12 @@ def sync( """Generates a token that can be used for requests to a datastore. The token is valid for 1 day by default. + 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[GenerateTokenForDataStoreResponse200] + GenerateTokenForDataStoreResponse200 """ return sync_detailed( @@ -95,6 +108,10 @@ async def asyncio_detailed( """Generates a token that can be used for requests to a datastore. The token is valid for 1 day by default. + 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[GenerateTokenForDataStoreResponse200] """ @@ -106,7 +123,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -116,8 +133,12 @@ async def asyncio( """Generates a token that can be used for requests to a datastore. The token is valid for 1 day by default. + 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[GenerateTokenForDataStoreResponse200] + GenerateTokenForDataStoreResponse200 """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/get_private_link.py b/webknossos/webknossos/client/_generated/api/default/get_private_link.py index e6c9d09b6..68cf8f089 100644 --- a/webknossos/webknossos/client/_generated/api/default/get_private_link.py +++ b/webknossos/webknossos/client/_generated/api/default/get_private_link.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -23,15 +24,29 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if response.status_code == HTTPStatus.NOT_FOUND: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -45,6 +60,10 @@ def sync_detailed( Args: id (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] """ @@ -59,7 +78,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -72,6 +91,10 @@ async def asyncio_detailed( Args: id (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] """ @@ -84,4 +107,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/get_security_txt.py b/webknossos/webknossos/client/_generated/api/default/get_security_txt.py new file mode 100644 index 000000000..6f7ed8b20 --- /dev/null +++ b/webknossos/webknossos/client/_generated/api/default/get_security_txt.py @@ -0,0 +1,91 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional + +import httpx + +from ... import errors +from ...client import Client +from ...types import Response + + +def _get_kwargs( + *, + client: Client, +) -> Dict[str, Any]: + url = "{}/api/.well-known/security.txt".format(client.base_url) + + headers: Dict[str, str] = client.get_headers() + cookies: Dict[str, Any] = client.get_cookies() + + return { + "method": "get", + "url": url, + "headers": headers, + "cookies": cookies, + "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, + } + + +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: 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( + *, + client: Client, +) -> Response[Any]: + """ + 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( + client=client, + ) + + response = httpx.request( + verify=client.verify_ssl, + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + *, + client: Client, +) -> Response[Any]: + """ + 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( + client=client, + ) + + async with httpx.AsyncClient(verify=client.verify_ssl) as _client: + response = await _client.request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/health.py b/webknossos/webknossos/client/_generated/api/default/health.py index dabdb1274..a3d411622 100644 --- a/webknossos/webknossos/client/_generated/api/default/health.py +++ b/webknossos/webknossos/client/_generated/api/default/health.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -22,15 +23,23 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -40,6 +49,10 @@ def sync_detailed( ) -> Response[Any]: """Health endpoint + 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] """ @@ -53,7 +66,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -62,6 +75,10 @@ async def asyncio_detailed( ) -> Response[Any]: """Health endpoint + 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] """ @@ -73,4 +90,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/list_private_links.py b/webknossos/webknossos/client/_generated/api/default/list_private_links.py index 05f2c5374..1da884486 100644 --- a/webknossos/webknossos/client/_generated/api/default/list_private_links.py +++ b/webknossos/webknossos/client/_generated/api/default/list_private_links.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -22,15 +23,27 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -40,6 +53,10 @@ def sync_detailed( ) -> Response[Any]: """List all existing private zarr links for a user + 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] """ @@ -53,7 +70,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -62,6 +79,10 @@ async def asyncio_detailed( ) -> Response[Any]: """List all existing private zarr links for a user + 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] """ @@ -73,4 +94,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/list_private_links_by_annotation.py b/webknossos/webknossos/client/_generated/api/default/list_private_links_by_annotation.py index 4f117e8f8..42bac6420 100644 --- a/webknossos/webknossos/client/_generated/api/default/list_private_links_by_annotation.py +++ b/webknossos/webknossos/client/_generated/api/default/list_private_links_by_annotation.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -25,15 +26,27 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -47,6 +60,10 @@ def sync_detailed( Args: annotation_id (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] """ @@ -61,7 +78,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -74,6 +91,10 @@ async def asyncio_detailed( Args: annotation_id (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] """ @@ -86,4 +107,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/list_publications.py b/webknossos/webknossos/client/_generated/api/default/list_publications.py index 7b0a333e8..aef4ef3e7 100644 --- a/webknossos/webknossos/client/_generated/api/default/list_publications.py +++ b/webknossos/webknossos/client/_generated/api/default/list_publications.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -22,15 +23,23 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -39,6 +48,10 @@ def sync_detailed( client: Client, ) -> Response[Any]: """ + 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] """ @@ -52,7 +65,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -60,6 +73,10 @@ async def asyncio_detailed( client: Client, ) -> Response[Any]: """ + 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] """ @@ -71,4 +88,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/new_dataset_name_is_valid.py b/webknossos/webknossos/client/_generated/api/default/new_dataset_name_is_valid.py index 166313323..decbf7020 100644 --- a/webknossos/webknossos/client/_generated/api/default/new_dataset_name_is_valid.py +++ b/webknossos/webknossos/client/_generated/api/default/new_dataset_name_is_valid.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -26,15 +27,27 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -50,6 +63,10 @@ def sync_detailed( organization_name (str): data_set_name (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] """ @@ -65,7 +82,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -80,6 +97,10 @@ async def asyncio_detailed( organization_name (str): data_set_name (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] """ @@ -93,4 +114,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/project_info_by_id.py b/webknossos/webknossos/client/_generated/api/default/project_info_by_id.py index 52c16ce1e..f74fd723f 100644 --- a/webknossos/webknossos/client/_generated/api/default/project_info_by_id.py +++ b/webknossos/webknossos/client/_generated/api/default/project_info_by_id.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.project_info_by_id_response_200 import ProjectInfoByIdResponse200 from ...types import Response @@ -24,11 +25,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, ProjectInfoByIdResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = ProjectInfoByIdResponse200.from_dict(response.json()) @@ -37,17 +39,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, ProjectInfoByIdResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -61,6 +66,10 @@ def sync_detailed( Args: id (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[Union[Any, ProjectInfoByIdResponse200]] """ @@ -75,7 +84,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -88,8 +97,12 @@ def sync( Args: id (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[Union[Any, ProjectInfoByIdResponse200]] + Union[Any, ProjectInfoByIdResponse200] """ return sync_detailed( @@ -108,6 +121,10 @@ async def asyncio_detailed( Args: id (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[Union[Any, ProjectInfoByIdResponse200]] """ @@ -120,7 +137,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -133,8 +150,12 @@ async def asyncio( Args: id (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[Union[Any, ProjectInfoByIdResponse200]] + Union[Any, ProjectInfoByIdResponse200] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/project_info_by_name.py b/webknossos/webknossos/client/_generated/api/default/project_info_by_name.py index 948fa11fb..e0bbbb514 100644 --- a/webknossos/webknossos/client/_generated/api/default/project_info_by_name.py +++ b/webknossos/webknossos/client/_generated/api/default/project_info_by_name.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.project_info_by_name_response_200 import ProjectInfoByNameResponse200 from ...types import Response @@ -24,11 +25,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, ProjectInfoByNameResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = ProjectInfoByNameResponse200.from_dict(response.json()) @@ -37,17 +39,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, ProjectInfoByNameResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -61,6 +66,10 @@ def sync_detailed( Args: name (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[Union[Any, ProjectInfoByNameResponse200]] """ @@ -75,7 +84,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -88,8 +97,12 @@ def sync( Args: name (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[Union[Any, ProjectInfoByNameResponse200]] + Union[Any, ProjectInfoByNameResponse200] """ return sync_detailed( @@ -108,6 +121,10 @@ async def asyncio_detailed( Args: name (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[Union[Any, ProjectInfoByNameResponse200]] """ @@ -120,7 +137,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -133,8 +150,12 @@ async def asyncio( Args: name (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[Union[Any, ProjectInfoByNameResponse200]] + Union[Any, ProjectInfoByNameResponse200] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/publication_info.py b/webknossos/webknossos/client/_generated/api/default/publication_info.py index 50dae5502..21dc51dea 100644 --- a/webknossos/webknossos/client/_generated/api/default/publication_info.py +++ b/webknossos/webknossos/client/_generated/api/default/publication_info.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...types import Response @@ -23,15 +24,27 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -45,6 +58,10 @@ def sync_detailed( Args: id (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] """ @@ -59,7 +76,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -72,6 +89,10 @@ async def asyncio_detailed( Args: id (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] """ @@ -84,4 +105,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/short_link_by_key.py b/webknossos/webknossos/client/_generated/api/default/short_link_by_key.py index 597331a74..12611c5f0 100644 --- a/webknossos/webknossos/client/_generated/api/default/short_link_by_key.py +++ b/webknossos/webknossos/client/_generated/api/default/short_link_by_key.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.short_link_by_key_response_200 import ShortLinkByKeyResponse200 from ...types import Response @@ -24,23 +25,31 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _parse_response(*, response: httpx.Response) -> Optional[ShortLinkByKeyResponse200]: +def _parse_response( + *, client: Client, response: httpx.Response +) -> Optional[ShortLinkByKeyResponse200]: if response.status_code == HTTPStatus.OK: response_200 = ShortLinkByKeyResponse200.from_dict(response.json()) return response_200 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None -def _build_response(*, response: httpx.Response) -> Response[ShortLinkByKeyResponse200]: +def _build_response( + *, client: Client, response: httpx.Response +) -> Response[ShortLinkByKeyResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -54,6 +63,10 @@ def sync_detailed( Args: key (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[ShortLinkByKeyResponse200] """ @@ -68,7 +81,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -81,8 +94,12 @@ def sync( Args: key (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[ShortLinkByKeyResponse200] + ShortLinkByKeyResponse200 """ return sync_detailed( @@ -101,6 +118,10 @@ async def asyncio_detailed( Args: key (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[ShortLinkByKeyResponse200] """ @@ -113,7 +134,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -126,8 +147,12 @@ async def asyncio( Args: key (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[ShortLinkByKeyResponse200] + ShortLinkByKeyResponse200 """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/task_create_from_files.py b/webknossos/webknossos/client/_generated/api/default/task_create_from_files.py index 9c13aee49..f6d516278 100644 --- a/webknossos/webknossos/client/_generated/api/default/task_create_from_files.py +++ b/webknossos/webknossos/client/_generated/api/default/task_create_from_files.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...models.task_create_from_files_json_body import TaskCreateFromFilesJsonBody from ...types import Response @@ -26,16 +27,24 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -50,8 +59,8 @@ def sync_detailed( - taskTypeId (string) id of the task type to be used for the new tasks - neededExperience (Experience) experience domain and level that selects which users can get the new tasks - - openInstances (int) if greater than one, multiple instances of the task will be given to users - to annotate + - pendingInstances (int) if greater than one, multiple instances of the task will be given to + users to annotate - projectName (string) name of the project the task should be part of - scriptId (string, optional) id of a user script that should be loaded for the annotators of the new tasks @@ -64,6 +73,10 @@ def sync_detailed( Args: json_body (TaskCreateFromFilesJsonBody): + 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] """ @@ -78,7 +91,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -92,8 +105,8 @@ async def asyncio_detailed( - taskTypeId (string) id of the task type to be used for the new tasks - neededExperience (Experience) experience domain and level that selects which users can get the new tasks - - openInstances (int) if greater than one, multiple instances of the task will be given to users - to annotate + - pendingInstances (int) if greater than one, multiple instances of the task will be given to + users to annotate - projectName (string) name of the project the task should be part of - scriptId (string, optional) id of a user script that should be loaded for the annotators of the new tasks @@ -106,6 +119,10 @@ async def asyncio_detailed( Args: json_body (TaskCreateFromFilesJsonBody): + 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] """ @@ -118,4 +135,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/task_info.py b/webknossos/webknossos/client/_generated/api/default/task_info.py index a9063420d..fcda12664 100644 --- a/webknossos/webknossos/client/_generated/api/default/task_info.py +++ b/webknossos/webknossos/client/_generated/api/default/task_info.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.task_info_response_200 import TaskInfoResponse200 from ...types import Response @@ -24,11 +25,12 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, TaskInfoResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = TaskInfoResponse200.from_dict(response.json()) @@ -37,17 +39,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, TaskInfoResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -61,6 +66,10 @@ def sync_detailed( Args: id (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[Union[Any, TaskInfoResponse200]] """ @@ -75,7 +84,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -88,8 +97,12 @@ def sync( Args: id (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[Union[Any, TaskInfoResponse200]] + Union[Any, TaskInfoResponse200] """ return sync_detailed( @@ -108,6 +121,10 @@ async def asyncio_detailed( Args: id (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[Union[Any, TaskInfoResponse200]] """ @@ -120,7 +137,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -133,8 +150,12 @@ async def asyncio( Args: id (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[Union[Any, TaskInfoResponse200]] + Union[Any, TaskInfoResponse200] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/task_infos_by_project_id.py b/webknossos/webknossos/client/_generated/api/default/task_infos_by_project_id.py index aaa6cca82..7ebfe5271 100644 --- a/webknossos/webknossos/client/_generated/api/default/task_infos_by_project_id.py +++ b/webknossos/webknossos/client/_generated/api/default/task_infos_by_project_id.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.task_infos_by_project_id_response_200_item import ( TaskInfosByProjectIdResponse200Item, @@ -38,12 +39,13 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, List["TaskInfosByProjectIdResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -59,17 +61,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, List["TaskInfosByProjectIdResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -89,6 +94,10 @@ def sync_detailed( page_number (Union[Unset, None, int]): include_total_count (Union[Unset, None, bool]): + 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[Union[Any, List['TaskInfosByProjectIdResponse200Item']]] """ @@ -106,7 +115,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -125,8 +134,12 @@ def sync( page_number (Union[Unset, None, int]): include_total_count (Union[Unset, None, bool]): + 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[Union[Any, List['TaskInfosByProjectIdResponse200Item']]] + Union[Any, List['TaskInfosByProjectIdResponse200Item']] """ return sync_detailed( @@ -154,6 +167,10 @@ async def asyncio_detailed( page_number (Union[Unset, None, int]): include_total_count (Union[Unset, None, bool]): + 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[Union[Any, List['TaskInfosByProjectIdResponse200Item']]] """ @@ -169,7 +186,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -188,8 +205,12 @@ async def asyncio( page_number (Union[Unset, None, int]): include_total_count (Union[Unset, None, bool]): + 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[Union[Any, List['TaskInfosByProjectIdResponse200Item']]] + Union[Any, List['TaskInfosByProjectIdResponse200Item']] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/team_list.py b/webknossos/webknossos/client/_generated/api/default/team_list.py index a4fdf9c08..8660fa560 100644 --- a/webknossos/webknossos/client/_generated/api/default/team_list.py +++ b/webknossos/webknossos/client/_generated/api/default/team_list.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.team_list_response_200_item import TeamListResponse200Item from ...types import UNSET, Response, Unset @@ -29,12 +30,13 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[Union[Any, List["TeamListResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -50,17 +52,20 @@ def _parse_response( if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[Union[Any, List["TeamListResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -74,6 +79,10 @@ def sync_detailed( Args: is_editable (Union[Unset, None, bool]): + 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[Union[Any, List['TeamListResponse200Item']]] """ @@ -88,7 +97,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -101,8 +110,12 @@ def sync( Args: is_editable (Union[Unset, None, bool]): + 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[Union[Any, List['TeamListResponse200Item']]] + Union[Any, List['TeamListResponse200Item']] """ return sync_detailed( @@ -121,6 +134,10 @@ async def asyncio_detailed( Args: is_editable (Union[Unset, None, bool]): + 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[Union[Any, List['TeamListResponse200Item']]] """ @@ -133,7 +150,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -146,8 +163,12 @@ async def asyncio( Args: is_editable (Union[Unset, None, bool]): + 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[Union[Any, List['TeamListResponse200Item']]] + Union[Any, List['TeamListResponse200Item']] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/update_private_link.py b/webknossos/webknossos/client/_generated/api/default/update_private_link.py index dd7029ab5..0d770d612 100644 --- a/webknossos/webknossos/client/_generated/api/default/update_private_link.py +++ b/webknossos/webknossos/client/_generated/api/default/update_private_link.py @@ -1,8 +1,9 @@ from http import HTTPStatus -from typing import Any, Dict +from typing import Any, Dict, Optional import httpx +from ... import errors from ...client import Client from ...models.update_private_link_json_body import UpdatePrivateLinkJsonBody from ...types import Response @@ -27,16 +28,32 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "json": json_json_body, } -def _build_response(*, response: httpx.Response) -> Response[Any]: +def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.OK: + return None + if response.status_code == HTTPStatus.BAD_REQUEST: + return None + if response.status_code == HTTPStatus.FORBIDDEN: + return None + if response.status_code == HTTPStatus.NOT_FOUND: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=None, + parsed=_parse_response(client=client, response=response), ) @@ -57,6 +74,10 @@ def sync_detailed( id (str): json_body (UpdatePrivateLinkJsonBody): + 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] """ @@ -72,7 +93,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio_detailed( @@ -92,6 +113,10 @@ async def asyncio_detailed( id (str): json_body (UpdatePrivateLinkJsonBody): + 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] """ @@ -105,4 +130,4 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) diff --git a/webknossos/webknossos/client/_generated/api/default/user_info_by_id.py b/webknossos/webknossos/client/_generated/api/default/user_info_by_id.py index c7996db00..d51192c68 100644 --- a/webknossos/webknossos/client/_generated/api/default/user_info_by_id.py +++ b/webknossos/webknossos/client/_generated/api/default/user_info_by_id.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.user_info_by_id_response_200 import UserInfoByIdResponse200 from ...types import Response @@ -24,23 +25,31 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _parse_response(*, response: httpx.Response) -> Optional[UserInfoByIdResponse200]: +def _parse_response( + *, client: Client, response: httpx.Response +) -> Optional[UserInfoByIdResponse200]: if response.status_code == HTTPStatus.OK: response_200 = UserInfoByIdResponse200.from_dict(response.json()) return response_200 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None -def _build_response(*, response: httpx.Response) -> Response[UserInfoByIdResponse200]: +def _build_response( + *, client: Client, response: httpx.Response +) -> Response[UserInfoByIdResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -54,6 +63,10 @@ def sync_detailed( Args: id (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[UserInfoByIdResponse200] """ @@ -68,7 +81,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -81,8 +94,12 @@ def sync( Args: id (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[UserInfoByIdResponse200] + UserInfoByIdResponse200 """ return sync_detailed( @@ -101,6 +118,10 @@ async def asyncio_detailed( Args: id (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[UserInfoByIdResponse200] """ @@ -113,7 +134,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -126,8 +147,12 @@ async def asyncio( Args: id (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[UserInfoByIdResponse200] + UserInfoByIdResponse200 """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/user_list.py b/webknossos/webknossos/client/_generated/api/default/user_list.py index c12cdbb61..aab7c6d41 100644 --- a/webknossos/webknossos/client/_generated/api/default/user_list.py +++ b/webknossos/webknossos/client/_generated/api/default/user_list.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.user_list_response_200_item import UserListResponse200Item from ...types import UNSET, Response, Unset @@ -35,12 +36,13 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, "params": params, } def _parse_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Optional[List["UserListResponse200Item"]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -53,17 +55,20 @@ def _parse_response( response_200.append(response_200_item) return response_200 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None def _build_response( - *, response: httpx.Response + *, client: Client, response: httpx.Response ) -> Response[List["UserListResponse200Item"]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -82,6 +87,10 @@ def sync_detailed( is_team_manager_or_admin (Union[Unset, None, bool]): is_admin (Union[Unset, None, bool]): + 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['UserListResponse200Item']] """ @@ -98,7 +107,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -116,8 +125,12 @@ def sync( is_team_manager_or_admin (Union[Unset, None, bool]): is_admin (Union[Unset, None, bool]): + 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['UserListResponse200Item']] + List['UserListResponse200Item'] """ return sync_detailed( @@ -143,6 +156,10 @@ async def asyncio_detailed( is_team_manager_or_admin (Union[Unset, None, bool]): is_admin (Union[Unset, None, bool]): + 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['UserListResponse200Item']] """ @@ -157,7 +174,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -175,8 +192,12 @@ async def asyncio( is_team_manager_or_admin (Union[Unset, None, bool]): is_admin (Union[Unset, None, bool]): + 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['UserListResponse200Item']] + List['UserListResponse200Item'] """ return ( diff --git a/webknossos/webknossos/client/_generated/api/default/user_logged_time.py b/webknossos/webknossos/client/_generated/api/default/user_logged_time.py index 0b5925771..15cc252e2 100644 --- a/webknossos/webknossos/client/_generated/api/default/user_logged_time.py +++ b/webknossos/webknossos/client/_generated/api/default/user_logged_time.py @@ -3,6 +3,7 @@ import httpx +from ... import errors from ...client import Client from ...models.user_logged_time_response_200 import UserLoggedTimeResponse200 from ...types import Response @@ -24,23 +25,31 @@ def _get_kwargs( "headers": headers, "cookies": cookies, "timeout": client.get_timeout(), + "follow_redirects": client.follow_redirects, } -def _parse_response(*, response: httpx.Response) -> Optional[UserLoggedTimeResponse200]: +def _parse_response( + *, client: Client, response: httpx.Response +) -> Optional[UserLoggedTimeResponse200]: if response.status_code == HTTPStatus.OK: response_200 = UserLoggedTimeResponse200.from_dict(response.json()) return response_200 - return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None -def _build_response(*, response: httpx.Response) -> Response[UserLoggedTimeResponse200]: +def _build_response( + *, client: Client, response: httpx.Response +) -> Response[UserLoggedTimeResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, headers=response.headers, - parsed=_parse_response(response=response), + parsed=_parse_response(client=client, response=response), ) @@ -55,6 +64,10 @@ def sync_detailed( Args: id (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[UserLoggedTimeResponse200] """ @@ -69,7 +82,7 @@ def sync_detailed( **kwargs, ) - return _build_response(response=response) + return _build_response(client=client, response=response) def sync( @@ -83,8 +96,12 @@ def sync( Args: id (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[UserLoggedTimeResponse200] + UserLoggedTimeResponse200 """ return sync_detailed( @@ -104,6 +121,10 @@ async def asyncio_detailed( Args: id (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[UserLoggedTimeResponse200] """ @@ -116,7 +137,7 @@ async def asyncio_detailed( async with httpx.AsyncClient(verify=client.verify_ssl) as _client: response = await _client.request(**kwargs) - return _build_response(response=response) + return _build_response(client=client, response=response) async def asyncio( @@ -130,8 +151,12 @@ async def asyncio( Args: id (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[UserLoggedTimeResponse200] + UserLoggedTimeResponse200 """ return ( diff --git a/webknossos/webknossos/client/_generated/client.py b/webknossos/webknossos/client/_generated/client.py index 1a39694de..2f45c655b 100644 --- a/webknossos/webknossos/client/_generated/client.py +++ b/webknossos/webknossos/client/_generated/client.py @@ -6,13 +6,28 @@ @attr.s(auto_attribs=True) class Client: - """A class for keeping track of data related to the API""" + """A class for keeping track of data related to the API + + Attributes: + base_url: The base URL for the API, all requests are made to a relative path to this URL + cookies: A dictionary of cookies to be sent with every request + headers: A dictionary of headers to be sent with every request + timeout: The maximum amount of a time in seconds a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + verify_ssl: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. + follow_redirects: Whether or not to follow redirects. Default value is False. + """ base_url: str cookies: Dict[str, str] = attr.ib(factory=dict, kw_only=True) headers: Dict[str, str] = attr.ib(factory=dict, kw_only=True) timeout: float = attr.ib(5.0, kw_only=True) verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True) + raise_on_unexpected_status: bool = attr.ib(False, kw_only=True) + follow_redirects: bool = attr.ib(False, kw_only=True) def get_headers(self) -> Dict[str, str]: """Get headers to be used in all endpoints""" @@ -46,6 +61,6 @@ class AuthenticatedClient(Client): auth_header_name: str = "Authorization" def get_headers(self) -> Dict[str, str]: - auth_header_value = f"{self.prefix} {self.token}" if self.prefix else self.token """Get headers to be used in authenticated endpoints""" + auth_header_value = f"{self.prefix} {self.token}" if self.prefix else self.token return {self.auth_header_name: auth_header_value, **self.headers} diff --git a/webknossos/webknossos/client/_generated/errors.py b/webknossos/webknossos/client/_generated/errors.py new file mode 100644 index 000000000..426f8a2ed --- /dev/null +++ b/webknossos/webknossos/client/_generated/errors.py @@ -0,0 +1,14 @@ +""" Contains shared errors types that can be raised from API functions """ + + +class UnexpectedStatus(Exception): + """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" + + def __init__(self, status_code: int, content: bytes): + self.status_code = status_code + self.content = content + + super().__init__(f"Unexpected status code: {status_code}") + + +__all__ = ["UnexpectedStatus"] diff --git a/webknossos/webknossos/client/_generated/models/annotation_info_response_200_task_status.py b/webknossos/webknossos/client/_generated/models/annotation_info_response_200_task_status.py index 1691c26ae..c6c48d335 100644 --- a/webknossos/webknossos/client/_generated/models/annotation_info_response_200_task_status.py +++ b/webknossos/webknossos/client/_generated/models/annotation_info_response_200_task_status.py @@ -9,18 +9,18 @@ class AnnotationInfoResponse200TaskStatus: """ Attributes: - open_ (int): + pending (int): active (int): finished (int): """ - open_: int + pending: int active: int finished: int additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: - open_ = self.open_ + pending = self.pending active = self.active finished = self.finished @@ -28,7 +28,7 @@ def to_dict(self) -> Dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { - "open": open_, + "pending": pending, "active": active, "finished": finished, } @@ -39,14 +39,14 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() - open_ = d.pop("open") + pending = d.pop("pending") active = d.pop("active") finished = d.pop("finished") annotation_info_response_200_task_status = cls( - open_=open_, + pending=pending, active=active, finished=finished, ) diff --git a/webknossos/webknossos/client/_generated/models/annotation_infos_by_task_id_response_200_item_task_status.py b/webknossos/webknossos/client/_generated/models/annotation_infos_by_task_id_response_200_item_task_status.py index 5f46f30f3..5d72565ed 100644 --- a/webknossos/webknossos/client/_generated/models/annotation_infos_by_task_id_response_200_item_task_status.py +++ b/webknossos/webknossos/client/_generated/models/annotation_infos_by_task_id_response_200_item_task_status.py @@ -9,18 +9,18 @@ class AnnotationInfosByTaskIdResponse200ItemTaskStatus: """ Attributes: - open_ (int): + pending (int): active (int): finished (int): """ - open_: int + pending: int active: int finished: int additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: - open_ = self.open_ + pending = self.pending active = self.active finished = self.finished @@ -28,7 +28,7 @@ def to_dict(self) -> Dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { - "open": open_, + "pending": pending, "active": active, "finished": finished, } @@ -39,14 +39,14 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() - open_ = d.pop("open") + pending = d.pop("pending") active = d.pop("active") finished = d.pop("finished") annotation_infos_by_task_id_response_200_item_task_status = cls( - open_=open_, + pending=pending, active=active, finished=finished, ) diff --git a/webknossos/webknossos/client/_generated/models/short_link_by_key_response_200.py b/webknossos/webknossos/client/_generated/models/short_link_by_key_response_200.py index 8923b6317..faa372ec0 100644 --- a/webknossos/webknossos/client/_generated/models/short_link_by_key_response_200.py +++ b/webknossos/webknossos/client/_generated/models/short_link_by_key_response_200.py @@ -12,18 +12,18 @@ class ShortLinkByKeyResponse200: """ Attributes: long_link (str): - id (Union[Unset, str]): + field_id (Union[Unset, str]): key (Union[Unset, str]): """ long_link: str - id: Union[Unset, str] = UNSET + field_id: Union[Unset, str] = UNSET key: Union[Unset, str] = UNSET additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: long_link = self.long_link - id = self.id + field_id = self.field_id key = self.key field_dict: Dict[str, Any] = {} @@ -33,8 +33,8 @@ def to_dict(self) -> Dict[str, Any]: "longLink": long_link, } ) - if id is not UNSET: - field_dict["_id"] = id + if field_id is not UNSET: + field_dict["_id"] = field_id if key is not UNSET: field_dict["key"] = key @@ -45,13 +45,13 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() long_link = d.pop("longLink") - id = d.pop("_id", UNSET) + field_id = d.pop("_id", UNSET) key = d.pop("key", UNSET) short_link_by_key_response_200 = cls( long_link=long_link, - id=id, + field_id=field_id, key=key, ) diff --git a/webknossos/webknossos/client/_generated/models/task_info_response_200_status.py b/webknossos/webknossos/client/_generated/models/task_info_response_200_status.py index 636d9ccca..1bbe82018 100644 --- a/webknossos/webknossos/client/_generated/models/task_info_response_200_status.py +++ b/webknossos/webknossos/client/_generated/models/task_info_response_200_status.py @@ -9,18 +9,18 @@ class TaskInfoResponse200Status: """ Attributes: - open_ (int): + pending (int): active (int): finished (int): """ - open_: int + pending: int active: int finished: int additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: - open_ = self.open_ + pending = self.pending active = self.active finished = self.finished @@ -28,7 +28,7 @@ def to_dict(self) -> Dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { - "open": open_, + "pending": pending, "active": active, "finished": finished, } @@ -39,14 +39,14 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() - open_ = d.pop("open") + pending = d.pop("pending") active = d.pop("active") finished = d.pop("finished") task_info_response_200_status = cls( - open_=open_, + pending=pending, active=active, finished=finished, ) diff --git a/webknossos/webknossos/client/_generated/models/task_infos_by_project_id_response_200_item_status.py b/webknossos/webknossos/client/_generated/models/task_infos_by_project_id_response_200_item_status.py index 9e303ad88..66e6935d0 100644 --- a/webknossos/webknossos/client/_generated/models/task_infos_by_project_id_response_200_item_status.py +++ b/webknossos/webknossos/client/_generated/models/task_infos_by_project_id_response_200_item_status.py @@ -9,18 +9,18 @@ class TaskInfosByProjectIdResponse200ItemStatus: """ Attributes: - open_ (int): + pending (int): active (int): finished (int): """ - open_: int + pending: int active: int finished: int additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict) def to_dict(self) -> Dict[str, Any]: - open_ = self.open_ + pending = self.pending active = self.active finished = self.finished @@ -28,7 +28,7 @@ def to_dict(self) -> Dict[str, Any]: field_dict.update(self.additional_properties) field_dict.update( { - "open": open_, + "pending": pending, "active": active, "finished": finished, } @@ -39,14 +39,14 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: d = src_dict.copy() - open_ = d.pop("open") + pending = d.pop("pending") active = d.pop("active") finished = d.pop("finished") task_infos_by_project_id_response_200_item_status = cls( - open_=open_, + pending=pending, active=active, finished=finished, ) diff --git a/webknossos/webknossos/client/_generated/types.py b/webknossos/webknossos/client/_generated/types.py index 230efea92..599eeb9f5 100644 --- a/webknossos/webknossos/client/_generated/types.py +++ b/webknossos/webknossos/client/_generated/types.py @@ -1,12 +1,12 @@ """ Contains some shared types for properties """ from http import HTTPStatus -from typing import BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar +from typing import BinaryIO, Generic, Literal, MutableMapping, Optional, Tuple, TypeVar import attr class Unset: - def __bool__(self) -> bool: + def __bool__(self) -> Literal[False]: return False