Skip to content

Commit

Permalink
Merged branch feature/several-things into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
horia141 committed Oct 18, 2024
1 parent 6378e31 commit ed41bba
Show file tree
Hide file tree
Showing 22 changed files with 732 additions and 97 deletions.
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
4 changes: 4 additions & 0 deletions gen/py/webapi-client/jupiter_webapi_client/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@
from .time_plan_activity import TimePlanActivity
from .time_plan_activity_archive_args import TimePlanActivityArchiveArgs
from .time_plan_activity_feasability import TimePlanActivityFeasability
from .time_plan_activity_find_for_target_args import TimePlanActivityFindForTargetArgs
from .time_plan_activity_find_for_target_result import TimePlanActivityFindForTargetResult
from .time_plan_activity_kind import TimePlanActivityKind
from .time_plan_activity_load_args import TimePlanActivityLoadArgs
from .time_plan_activity_load_result import TimePlanActivityLoadResult
Expand Down Expand Up @@ -1050,6 +1052,8 @@
"TimePlanActivity",
"TimePlanActivityArchiveArgs",
"TimePlanActivityFeasability",
"TimePlanActivityFindForTargetArgs",
"TimePlanActivityFindForTargetResult",
"TimePlanActivityKind",
"TimePlanActivityLoadArgs",
"TimePlanActivityLoadResult",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GetSummariesArgs:
Attributes:
allow_archived (Union[None, Unset, bool]):
include_workspace (Union[None, Unset, bool]):
include_schedule_streams (Union[None, Unset, bool]):
include_vacations (Union[None, Unset, bool]):
include_projects (Union[None, Unset, bool]):
Expand All @@ -27,6 +28,7 @@ class GetSummariesArgs:
"""

allow_archived: Union[None, Unset, bool] = UNSET
include_workspace: Union[None, Unset, bool] = UNSET
include_schedule_streams: Union[None, Unset, bool] = UNSET
include_vacations: Union[None, Unset, bool] = UNSET
include_projects: Union[None, Unset, bool] = UNSET
Expand All @@ -46,6 +48,12 @@ def to_dict(self) -> Dict[str, Any]:
else:
allow_archived = self.allow_archived

include_workspace: Union[None, Unset, bool]
if isinstance(self.include_workspace, Unset):
include_workspace = UNSET
else:
include_workspace = self.include_workspace

include_schedule_streams: Union[None, Unset, bool]
if isinstance(self.include_schedule_streams, Unset):
include_schedule_streams = UNSET
Expand Down Expand Up @@ -111,6 +119,8 @@ def to_dict(self) -> Dict[str, Any]:
field_dict.update({})
if allow_archived is not UNSET:
field_dict["allow_archived"] = allow_archived
if include_workspace is not UNSET:
field_dict["include_workspace"] = include_workspace
if include_schedule_streams is not UNSET:
field_dict["include_schedule_streams"] = include_schedule_streams
if include_vacations is not UNSET:
Expand Down Expand Up @@ -147,6 +157,15 @@ def _parse_allow_archived(data: object) -> Union[None, Unset, bool]:

allow_archived = _parse_allow_archived(d.pop("allow_archived", UNSET))

def _parse_include_workspace(data: object) -> Union[None, Unset, bool]:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(Union[None, Unset, bool], data)

include_workspace = _parse_include_workspace(d.pop("include_workspace", UNSET))

def _parse_include_schedule_streams(data: object) -> Union[None, Unset, bool]:
if data is None:
return data
Expand Down Expand Up @@ -239,6 +258,7 @@ def _parse_include_persons(data: object) -> Union[None, Unset, bool]:

get_summaries_args = cls(
allow_archived=allow_archived,
include_workspace=include_workspace,
include_schedule_streams=include_schedule_streams,
include_vacations=include_vacations,
include_projects=include_projects,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ..models.schedule_stream_summary import ScheduleStreamSummary
from ..models.smart_list_summary import SmartListSummary
from ..models.vacation_summary import VacationSummary
from ..models.workspace import Workspace


T = TypeVar("T", bound="GetSummariesResult")
Expand All @@ -26,6 +27,7 @@ class GetSummariesResult:
"""Get summaries result.
Attributes:
workspace (Union['Workspace', None, Unset]):
vacations (Union[List['VacationSummary'], None, Unset]):
schedule_streams (Union[List['ScheduleStreamSummary'], None, Unset]):
root_project (Union['ProjectSummary', None, Unset]):
Expand All @@ -39,6 +41,7 @@ class GetSummariesResult:
persons (Union[List['PersonSummary'], None, Unset]):
"""

workspace: Union["Workspace", None, Unset] = UNSET
vacations: Union[List["VacationSummary"], None, Unset] = UNSET
schedule_streams: Union[List["ScheduleStreamSummary"], None, Unset] = UNSET
root_project: Union["ProjectSummary", None, Unset] = UNSET
Expand All @@ -54,6 +57,15 @@ class GetSummariesResult:

def to_dict(self) -> Dict[str, Any]:
from ..models.project_summary import ProjectSummary
from ..models.workspace import Workspace

workspace: Union[Dict[str, Any], None, Unset]
if isinstance(self.workspace, Unset):
workspace = UNSET
elif isinstance(self.workspace, Workspace):
workspace = self.workspace.to_dict()
else:
workspace = self.workspace

vacations: Union[List[Dict[str, Any]], None, Unset]
if isinstance(self.vacations, Unset):
Expand Down Expand Up @@ -186,6 +198,8 @@ def to_dict(self) -> Dict[str, Any]:
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update({})
if workspace is not UNSET:
field_dict["workspace"] = workspace
if vacations is not UNSET:
field_dict["vacations"] = vacations
if schedule_streams is not UNSET:
Expand Down Expand Up @@ -223,9 +237,27 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
from ..models.schedule_stream_summary import ScheduleStreamSummary
from ..models.smart_list_summary import SmartListSummary
from ..models.vacation_summary import VacationSummary
from ..models.workspace import Workspace

d = src_dict.copy()

def _parse_workspace(data: object) -> Union["Workspace", None, Unset]:
if data is None:
return data
if isinstance(data, Unset):
return data
try:
if not isinstance(data, dict):
raise TypeError()
workspace_type_0 = Workspace.from_dict(data)

return workspace_type_0
except: # noqa: E722
pass
return cast(Union["Workspace", None, Unset], data)

workspace = _parse_workspace(d.pop("workspace", UNSET))

def _parse_vacations(data: object) -> Union[List["VacationSummary"], None, Unset]:
if data is None:
return data
Expand Down Expand Up @@ -464,6 +496,7 @@ def _parse_persons(data: object) -> Union[List["PersonSummary"], None, Unset]:
persons = _parse_persons(d.pop("persons", UNSET))

get_summaries_result = cls(
workspace=workspace,
vacations=vacations,
schedule_streams=schedule_streams,
root_project=root_project,
Expand Down
Loading

0 comments on commit ed41bba

Please sign in to comment.