-
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/more-polish into develop
- Loading branch information
Showing
39 changed files
with
852 additions
and
216 deletions.
There are no files selected for viewing
113 changes: 113 additions & 0 deletions
113
gen/py/webapi-client/jupiter_webapi_client/api/metrics/metric_regen.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,113 @@ | ||
from http import HTTPStatus | ||
from typing import Any, Dict, Optional, Union | ||
|
||
import httpx | ||
|
||
from ... import errors | ||
from ...client import AuthenticatedClient, Client | ||
from ...models.metric_regen_args import MetricRegenArgs | ||
from ...types import Response | ||
|
||
|
||
def _get_kwargs( | ||
*, | ||
body: MetricRegenArgs, | ||
) -> Dict[str, Any]: | ||
headers: Dict[str, Any] = {} | ||
|
||
_kwargs: Dict[str, Any] = { | ||
"method": "post", | ||
"url": "/metric-regen", | ||
} | ||
|
||
_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[Any]: | ||
if response.status_code == HTTPStatus.OK: | ||
return None | ||
if response.status_code == HTTPStatus.GONE: | ||
return None | ||
if response.status_code == HTTPStatus.NOT_ACCEPTABLE: | ||
return None | ||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: | ||
return None | ||
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[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: AuthenticatedClient, | ||
body: MetricRegenArgs, | ||
) -> Response[Any]: | ||
"""A use case for regenerating tasks associated with metrics. | ||
A use case for regenerating tasks associated with metrics. | ||
Args: | ||
body (MetricRegenArgs): The arguments for the metric regen use case. | ||
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( | ||
body=body, | ||
) | ||
|
||
response = client.get_httpx_client().request( | ||
**kwargs, | ||
) | ||
|
||
return _build_response(client=client, response=response) | ||
|
||
|
||
async def asyncio_detailed( | ||
*, | ||
client: AuthenticatedClient, | ||
body: MetricRegenArgs, | ||
) -> Response[Any]: | ||
"""A use case for regenerating tasks associated with metrics. | ||
A use case for regenerating tasks associated with metrics. | ||
Args: | ||
body (MetricRegenArgs): The arguments for the metric regen use case. | ||
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( | ||
body=body, | ||
) | ||
|
||
response = await client.get_async_httpx_client().request(**kwargs) | ||
|
||
return _build_response(client=client, response=response) |
113 changes: 113 additions & 0 deletions
113
gen/py/webapi-client/jupiter_webapi_client/api/persons/person_regen.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,113 @@ | ||
from http import HTTPStatus | ||
from typing import Any, Dict, Optional, Union | ||
|
||
import httpx | ||
|
||
from ... import errors | ||
from ...client import AuthenticatedClient, Client | ||
from ...models.person_regen_args import PersonRegenArgs | ||
from ...types import Response | ||
|
||
|
||
def _get_kwargs( | ||
*, | ||
body: PersonRegenArgs, | ||
) -> Dict[str, Any]: | ||
headers: Dict[str, Any] = {} | ||
|
||
_kwargs: Dict[str, Any] = { | ||
"method": "post", | ||
"url": "/person-regen", | ||
} | ||
|
||
_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[Any]: | ||
if response.status_code == HTTPStatus.OK: | ||
return None | ||
if response.status_code == HTTPStatus.GONE: | ||
return None | ||
if response.status_code == HTTPStatus.NOT_ACCEPTABLE: | ||
return None | ||
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY: | ||
return None | ||
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[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: AuthenticatedClient, | ||
body: PersonRegenArgs, | ||
) -> Response[Any]: | ||
"""A use case for regenerating tasks associated with persons. | ||
A use case for regenerating tasks associated with persons. | ||
Args: | ||
body (PersonRegenArgs): The arguments for the person regen use case. | ||
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( | ||
body=body, | ||
) | ||
|
||
response = client.get_httpx_client().request( | ||
**kwargs, | ||
) | ||
|
||
return _build_response(client=client, response=response) | ||
|
||
|
||
async def asyncio_detailed( | ||
*, | ||
client: AuthenticatedClient, | ||
body: PersonRegenArgs, | ||
) -> Response[Any]: | ||
"""A use case for regenerating tasks associated with persons. | ||
A use case for regenerating tasks associated with persons. | ||
Args: | ||
body (PersonRegenArgs): The arguments for the person regen use case. | ||
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( | ||
body=body, | ||
) | ||
|
||
response = await client.get_async_httpx_client().request(**kwargs) | ||
|
||
return _build_response(client=client, response=response) |
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
59 changes: 59 additions & 0 deletions
59
gen/py/webapi-client/jupiter_webapi_client/models/metric_regen_args.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,59 @@ | ||
from typing import Any, Dict, List, Type, TypeVar | ||
|
||
from attrs import define as _attrs_define | ||
from attrs import field as _attrs_field | ||
|
||
T = TypeVar("T", bound="MetricRegenArgs") | ||
|
||
|
||
@_attrs_define | ||
class MetricRegenArgs: | ||
"""The arguments for the metric regen use case. | ||
Attributes: | ||
ref_id (str): A generic entity id. | ||
""" | ||
|
||
ref_id: str | ||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
ref_id = self.ref_id | ||
|
||
field_dict: Dict[str, Any] = {} | ||
field_dict.update(self.additional_properties) | ||
field_dict.update( | ||
{ | ||
"ref_id": ref_id, | ||
} | ||
) | ||
|
||
return field_dict | ||
|
||
@classmethod | ||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: | ||
d = src_dict.copy() | ||
ref_id = d.pop("ref_id") | ||
|
||
metric_regen_args = cls( | ||
ref_id=ref_id, | ||
) | ||
|
||
metric_regen_args.additional_properties = d | ||
return metric_regen_args | ||
|
||
@property | ||
def additional_keys(self) -> List[str]: | ||
return list(self.additional_properties.keys()) | ||
|
||
def __getitem__(self, key: str) -> Any: | ||
return self.additional_properties[key] | ||
|
||
def __setitem__(self, key: str, value: Any) -> None: | ||
self.additional_properties[key] = value | ||
|
||
def __delitem__(self, key: str) -> None: | ||
del self.additional_properties[key] | ||
|
||
def __contains__(self, key: str) -> bool: | ||
return key in self.additional_properties |
59 changes: 59 additions & 0 deletions
59
gen/py/webapi-client/jupiter_webapi_client/models/person_regen_args.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,59 @@ | ||
from typing import Any, Dict, List, Type, TypeVar | ||
|
||
from attrs import define as _attrs_define | ||
from attrs import field as _attrs_field | ||
|
||
T = TypeVar("T", bound="PersonRegenArgs") | ||
|
||
|
||
@_attrs_define | ||
class PersonRegenArgs: | ||
"""The arguments for the person regen use case. | ||
Attributes: | ||
ref_id (str): A generic entity id. | ||
""" | ||
|
||
ref_id: str | ||
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict) | ||
|
||
def to_dict(self) -> Dict[str, Any]: | ||
ref_id = self.ref_id | ||
|
||
field_dict: Dict[str, Any] = {} | ||
field_dict.update(self.additional_properties) | ||
field_dict.update( | ||
{ | ||
"ref_id": ref_id, | ||
} | ||
) | ||
|
||
return field_dict | ||
|
||
@classmethod | ||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: | ||
d = src_dict.copy() | ||
ref_id = d.pop("ref_id") | ||
|
||
person_regen_args = cls( | ||
ref_id=ref_id, | ||
) | ||
|
||
person_regen_args.additional_properties = d | ||
return person_regen_args | ||
|
||
@property | ||
def additional_keys(self) -> List[str]: | ||
return list(self.additional_properties.keys()) | ||
|
||
def __getitem__(self, key: str) -> Any: | ||
return self.additional_properties[key] | ||
|
||
def __setitem__(self, key: str, value: Any) -> None: | ||
self.additional_properties[key] = value | ||
|
||
def __delitem__(self, key: str) -> None: | ||
del self.additional_properties[key] | ||
|
||
def __contains__(self, key: str) -> bool: | ||
return key in self.additional_properties |
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.