Skip to content

Commit

Permalink
Merged branch feature/more-polish into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
horia141 committed Feb 18, 2025
1 parent 845a760 commit 75f4e8c
Show file tree
Hide file tree
Showing 39 changed files with 852 additions and 216 deletions.
113 changes: 113 additions & 0 deletions gen/py/webapi-client/jupiter_webapi_client/api/metrics/metric_regen.py
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 gen/py/webapi-client/jupiter_webapi_client/api/persons/person_regen.py
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)
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 @@ -249,6 +249,7 @@
from .metric_load_result import MetricLoadResult
from .metric_load_settings_args import MetricLoadSettingsArgs
from .metric_load_settings_result import MetricLoadSettingsResult
from .metric_regen_args import MetricRegenArgs
from .metric_remove_args import MetricRemoveArgs
from .metric_summary import MetricSummary
from .metric_unit import MetricUnit
Expand Down Expand Up @@ -298,6 +299,7 @@
from .person_load_result import PersonLoadResult
from .person_load_settings_args import PersonLoadSettingsArgs
from .person_load_settings_result import PersonLoadSettingsResult
from .person_regen_args import PersonRegenArgs
from .person_relationship import PersonRelationship
from .person_remove_args import PersonRemoveArgs
from .person_summary import PersonSummary
Expand Down Expand Up @@ -836,6 +838,7 @@
"MetricLoadResult",
"MetricLoadSettingsArgs",
"MetricLoadSettingsResult",
"MetricRegenArgs",
"MetricRemoveArgs",
"MetricSummary",
"MetricUnit",
Expand Down Expand Up @@ -885,6 +888,7 @@
"PersonLoadResult",
"PersonLoadSettingsArgs",
"PersonLoadSettingsResult",
"PersonRegenArgs",
"PersonRelationship",
"PersonRemoveArgs",
"PersonSummary",
Expand Down
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
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
2 changes: 2 additions & 0 deletions gen/ts/webapi-client/gen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export type { MetricLoadResult } from './models/MetricLoadResult';
export type { MetricLoadSettingsArgs } from './models/MetricLoadSettingsArgs';
export type { MetricLoadSettingsResult } from './models/MetricLoadSettingsResult';
export type { MetricName } from './models/MetricName';
export type { MetricRegenArgs } from './models/MetricRegenArgs';
export type { MetricRemoveArgs } from './models/MetricRemoveArgs';
export type { MetricSummary } from './models/MetricSummary';
export { MetricUnit } from './models/MetricUnit';
Expand Down Expand Up @@ -256,6 +257,7 @@ export type { PersonLoadResult } from './models/PersonLoadResult';
export type { PersonLoadSettingsArgs } from './models/PersonLoadSettingsArgs';
export type { PersonLoadSettingsResult } from './models/PersonLoadSettingsResult';
export type { PersonName } from './models/PersonName';
export type { PersonRegenArgs } from './models/PersonRegenArgs';
export { PersonRelationship } from './models/PersonRelationship';
export type { PersonRemoveArgs } from './models/PersonRemoveArgs';
export type { PersonSummary } from './models/PersonSummary';
Expand Down
Loading

0 comments on commit 75f4e8c

Please sign in to comment.