-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged branch feature/several-things into develop
- Loading branch information
Showing
22 changed files
with
732 additions
and
97 deletions.
There are no files selected for viewing
177 changes: 177 additions & 0 deletions
177
...py/webapi-client/jupiter_webapi_client/api/activity/time_plan_activity_find_for_target.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
from http import HTTPStatus | ||
from typing import Any, Dict, Optional, Union, cast | ||
|
||
import httpx | ||
|
||
from ... import errors | ||
from ...client import AuthenticatedClient, Client | ||
from ...models.time_plan_activity_find_for_target_args import TimePlanActivityFindForTargetArgs | ||
from ...models.time_plan_activity_find_for_target_result import TimePlanActivityFindForTargetResult | ||
from ...types import Response | ||
|
||
|
||
def _get_kwargs( | ||
*, | ||
body: TimePlanActivityFindForTargetArgs, | ||
) -> Dict[str, Any]: | ||
headers: Dict[str, Any] = {} | ||
|
||
_kwargs: Dict[str, Any] = { | ||
"method": "post", | ||
"url": "/time-plan-activity-find-for-target", | ||
} | ||
|
||
_body = body.to_dict() | ||
|
||
_kwargs["json"] = _body | ||
headers["Content-Type"] = "application/json" | ||
|
||
_kwargs["headers"] = headers | ||
return _kwargs | ||
|
||
|
||
def _parse_response( | ||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response | ||
) -> Optional[Union[Any, TimePlanActivityFindForTargetResult]]: | ||
if response.status_code == HTTPStatus.OK: | ||
response_200 = TimePlanActivityFindForTargetResult.from_dict(response.json()) | ||
|
||
return response_200 | ||
if response.status_code == HTTPStatus.GONE: | ||
response_410 = cast(Any, None) | ||
return response_410 | ||
if response.status_code == HTTPStatus.NOT_ACCEPTABLE: | ||
response_406 = cast(Any, None) | ||
return response_406 | ||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: | ||
response_422 = cast(Any, None) | ||
return response_422 | ||
if client.raise_on_unexpected_status: | ||
raise errors.UnexpectedStatus(response.status_code, response.content) | ||
else: | ||
return None | ||
|
||
|
||
def _build_response( | ||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response | ||
) -> Response[Union[Any, TimePlanActivityFindForTargetResult]]: | ||
return Response( | ||
status_code=HTTPStatus(response.status_code), | ||
content=response.content, | ||
headers=response.headers, | ||
parsed=_parse_response(client=client, response=response), | ||
) | ||
|
||
|
||
def sync_detailed( | ||
*, | ||
client: AuthenticatedClient, | ||
body: TimePlanActivityFindForTargetArgs, | ||
) -> Response[Union[Any, TimePlanActivityFindForTargetResult]]: | ||
"""The command for finding time plan activities for a particular target. | ||
The command for finding time plan activities for a particular target. | ||
Args: | ||
body (TimePlanActivityFindForTargetArgs): Args. | ||
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, TimePlanActivityFindForTargetResult]] | ||
""" | ||
|
||
kwargs = _get_kwargs( | ||
body=body, | ||
) | ||
|
||
response = client.get_httpx_client().request( | ||
**kwargs, | ||
) | ||
|
||
return _build_response(client=client, response=response) | ||
|
||
|
||
def sync( | ||
*, | ||
client: AuthenticatedClient, | ||
body: TimePlanActivityFindForTargetArgs, | ||
) -> Optional[Union[Any, TimePlanActivityFindForTargetResult]]: | ||
"""The command for finding time plan activities for a particular target. | ||
The command for finding time plan activities for a particular target. | ||
Args: | ||
body (TimePlanActivityFindForTargetArgs): Args. | ||
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: | ||
Union[Any, TimePlanActivityFindForTargetResult] | ||
""" | ||
|
||
return sync_detailed( | ||
client=client, | ||
body=body, | ||
).parsed | ||
|
||
|
||
async def asyncio_detailed( | ||
*, | ||
client: AuthenticatedClient, | ||
body: TimePlanActivityFindForTargetArgs, | ||
) -> Response[Union[Any, TimePlanActivityFindForTargetResult]]: | ||
"""The command for finding time plan activities for a particular target. | ||
The command for finding time plan activities for a particular target. | ||
Args: | ||
body (TimePlanActivityFindForTargetArgs): Args. | ||
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, TimePlanActivityFindForTargetResult]] | ||
""" | ||
|
||
kwargs = _get_kwargs( | ||
body=body, | ||
) | ||
|
||
response = await client.get_async_httpx_client().request(**kwargs) | ||
|
||
return _build_response(client=client, response=response) | ||
|
||
|
||
async def asyncio( | ||
*, | ||
client: AuthenticatedClient, | ||
body: TimePlanActivityFindForTargetArgs, | ||
) -> Optional[Union[Any, TimePlanActivityFindForTargetResult]]: | ||
"""The command for finding time plan activities for a particular target. | ||
The command for finding time plan activities for a particular target. | ||
Args: | ||
body (TimePlanActivityFindForTargetArgs): Args. | ||
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: | ||
Union[Any, TimePlanActivityFindForTargetResult] | ||
""" | ||
|
||
return ( | ||
await asyncio_detailed( | ||
client=client, | ||
body=body, | ||
) | ||
).parsed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.