bump (#80)
* bump Signed-off-by: Jess Frazelle <github@jessfraz.com> * some fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * YOYO NEW API SPEC! * reformat Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * for now force true Signed-off-by: Jess Frazelle <github@jessfraz.com> * run the tests on generations Signed-off-by: Jess Frazelle <github@jessfraz.com> * add tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix some types Signed-off-by: Jess Frazelle <github@jessfraz.com> * float to top Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix mypy Signed-off-by: Jess Frazelle <github@jessfraz.com> * more noqa Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * ruff pass Signed-off-by: Jess Frazelle <github@jessfraz.com> * add docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * even less mypy errors Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * new path Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes for mypy Signed-off-by: Jess Frazelle <github@jessfraz.com> * skip tests Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -1 +1 @@
|
||||
""" Contains methods for accessing the unit API paths: Unit conversion operations. """
|
||||
""" Contains methods for accessing the unit API paths: Unit conversion operations. """ # noqa: E501
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_acceleration_conversion import UnitAccelerationConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_acceleration_format import UnitAccelerationFormat
|
||||
from ...models.unit_acceleration_conversion import UnitAccelerationConversion
|
||||
from ...models.unit_acceleration_format import UnitAccelerationFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/acceleration/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/acceleration/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAccelerationConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAccelerationConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
""" Convert an acceleration unit value to another acceleration unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an acceleration unit value to another acceleration unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAccelerationFormat,
|
||||
src_format: UnitAccelerationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAccelerationConversion, Error]]:
|
||||
""" Convert an acceleration unit value to another acceleration unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an acceleration unit value to another acceleration unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_angle_conversion import UnitAngleConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_angle_format import UnitAngleFormat
|
||||
from ...models.unit_angle_conversion import UnitAngleConversion
|
||||
from ...models.unit_angle_format import UnitAngleFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/angle/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/angle/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitAngleConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAngleConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitAngleConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAngleConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitAngleConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitAngleConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAngleConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAngleConversion, Error]]:
|
||||
""" Convert an angle unit value to another angle unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an angle unit value to another angle unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAngleConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngleFormat,
|
||||
src_format: UnitAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAngleConversion, Error]]:
|
||||
""" Convert an angle unit value to another angle unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an angle unit value to another angle unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_angular_velocity_conversion import UnitAngularVelocityConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_angular_velocity_format import UnitAngularVelocityFormat
|
||||
from ...models.unit_angular_velocity_conversion import UnitAngularVelocityConversion
|
||||
from ...models.unit_angular_velocity_format import UnitAngularVelocityFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/angular-velocity/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/angular-velocity/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAngularVelocityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAngularVelocityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
""" Convert an angular velocity unit value to another angular velocity unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an angular velocity unit value to another angular velocity unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAngularVelocityFormat,
|
||||
src_format: UnitAngularVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAngularVelocityConversion, Error]]:
|
||||
""" Convert an angular velocity unit value to another angular velocity unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an angular velocity unit value to another angular velocity unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_area_conversion import UnitAreaConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_area_format import UnitAreaFormat
|
||||
from ...models.unit_area_conversion import UnitAreaConversion
|
||||
from ...models.unit_area_format import UnitAreaFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/area/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/area/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitAreaConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAreaConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitAreaConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitAreaConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitAreaConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitAreaConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAreaConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAreaConversion, Error]]:
|
||||
""" Convert an area unit value to another area unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an area unit value to another area unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitAreaConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitAreaFormat,
|
||||
src_format: UnitAreaFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitAreaConversion, Error]]:
|
||||
""" Convert an area unit value to another area unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert an area unit value to another area unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_charge_conversion import UnitChargeConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_charge_format import UnitChargeFormat
|
||||
from ...models.unit_charge_conversion import UnitChargeConversion
|
||||
from ...models.unit_charge_format import UnitChargeFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/charge/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/charge/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitChargeConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitChargeConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitChargeConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitChargeConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitChargeConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitChargeConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitChargeConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitChargeConversion, Error]]:
|
||||
""" Convert a charge unit value to another charge unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a charge unit value to another charge unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitChargeConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitChargeFormat,
|
||||
src_format: UnitChargeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitChargeConversion, Error]]:
|
||||
""" Convert a charge unit value to another charge unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a charge unit value to another charge unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_concentration_conversion import UnitConcentrationConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_concentration_format import UnitConcentrationFormat
|
||||
from ...models.unit_concentration_conversion import UnitConcentrationConversion
|
||||
from ...models.unit_concentration_format import UnitConcentrationFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/concentration/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/concentration/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitConcentrationConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitConcentrationConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
""" Convert a concentration unit value to another concentration unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a concentration unit value to another concentration unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitConcentrationFormat,
|
||||
src_format: UnitConcentrationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitConcentrationConversion, Error]]:
|
||||
""" Convert a concentration unit value to another concentration unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a concentration unit value to another concentration unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_data_transfer_rate_conversion import UnitDataTransferRateConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_data_transfer_rate_format import UnitDataTransferRateFormat
|
||||
from ...models.unit_data_transfer_rate_conversion import UnitDataTransferRateConversion
|
||||
from ...models.unit_data_transfer_rate_format import UnitDataTransferRateFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/data-transfer-rate/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/data-transfer-rate/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitDataTransferRateConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitDataTransferRateConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
""" Convert a data transfer rate unit value to another data transfer rate unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a data transfer rate unit value to another data transfer rate unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataTransferRateFormat,
|
||||
src_format: UnitDataTransferRateFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitDataTransferRateConversion, Error]]:
|
||||
""" Convert a data transfer rate unit value to another data transfer rate unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a data transfer rate unit value to another data transfer rate unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_data_conversion import UnitDataConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_data_format import UnitDataFormat
|
||||
from ...models.unit_data_conversion import UnitDataConversion
|
||||
from ...models.unit_data_format import UnitDataFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/data/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/data/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitDataConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitDataConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitDataConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitDataConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitDataConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitDataConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitDataConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitDataConversion, Error]]:
|
||||
""" Convert a data unit value to another data unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a data unit value to another data unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitDataConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDataFormat,
|
||||
src_format: UnitDataFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitDataConversion, Error]]:
|
||||
""" Convert a data unit value to another data unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a data unit value to another data unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_density_conversion import UnitDensityConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_density_format import UnitDensityFormat
|
||||
from ...models.unit_density_conversion import UnitDensityConversion
|
||||
from ...models.unit_density_format import UnitDensityFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/density/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/density/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitDensityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitDensityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitDensityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitDensityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitDensityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitDensityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitDensityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitDensityConversion, Error]]:
|
||||
""" Convert a density unit value to another density unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a density unit value to another density unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitDensityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitDensityFormat,
|
||||
src_format: UnitDensityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitDensityConversion, Error]]:
|
||||
""" Convert a density unit value to another density unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a density unit value to another density unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_energy_conversion import UnitEnergyConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_energy_format import UnitEnergyFormat
|
||||
from ...models.unit_energy_conversion import UnitEnergyConversion
|
||||
from ...models.unit_energy_format import UnitEnergyFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/energy/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/energy/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitEnergyConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitEnergyConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitEnergyConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitEnergyConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitEnergyConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitEnergyConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitEnergyConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitEnergyConversion, Error]]:
|
||||
""" Convert a energy unit value to another energy unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a energy unit value to another energy unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitEnergyConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitEnergyFormat,
|
||||
src_format: UnitEnergyFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitEnergyConversion, Error]]:
|
||||
""" Convert a energy unit value to another energy unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a energy unit value to another energy unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_force_conversion import UnitForceConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_force_format import UnitForceFormat
|
||||
from ...models.unit_force_conversion import UnitForceConversion
|
||||
from ...models.unit_force_format import UnitForceFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/force/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/force/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitForceConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitForceConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitForceConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitForceConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitForceConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitForceConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitForceConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitForceConversion, Error]]:
|
||||
""" Convert a force unit value to another force unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a force unit value to another force unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitForceConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitForceFormat,
|
||||
src_format: UnitForceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitForceConversion, Error]]:
|
||||
""" Convert a force unit value to another force unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a force unit value to another force unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_illuminance_conversion import UnitIlluminanceConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_illuminance_format import UnitIlluminanceFormat
|
||||
from ...models.unit_illuminance_conversion import UnitIlluminanceConversion
|
||||
from ...models.unit_illuminance_format import UnitIlluminanceFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/illuminance/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/illuminance/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitIlluminanceConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitIlluminanceConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
""" Convert a illuminance unit value to another illuminance unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a illuminance unit value to another illuminance unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitIlluminanceFormat,
|
||||
src_format: UnitIlluminanceFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitIlluminanceConversion, Error]]:
|
||||
""" Convert a illuminance unit value to another illuminance unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a illuminance unit value to another illuminance unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_length_conversion import UnitLengthConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_length_format import UnitLengthFormat
|
||||
from ...models.unit_length_conversion import UnitLengthConversion
|
||||
from ...models.unit_length_format import UnitLengthFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/length/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/length/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitLengthConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitLengthConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitLengthConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitLengthConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitLengthConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitLengthConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitLengthConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitLengthConversion, Error]]:
|
||||
""" Convert a length unit value to another length unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a length unit value to another length unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitLengthConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitLengthFormat,
|
||||
src_format: UnitLengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitLengthConversion, Error]]:
|
||||
""" Convert a length unit value to another length unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a length unit value to another length unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,144 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_magnetic_field_strength_conversion import UnitMagneticFieldStrengthConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_magnetic_field_strength_format import UnitMagneticFieldStrengthFormat
|
||||
from ...models.unit_magnetic_field_strength_format import UnitMagneticFieldStrengthFormat
|
||||
from ...models.unit_magnetic_field_strength_conversion import (
|
||||
UnitMagneticFieldStrengthConversion,
|
||||
)
|
||||
from ...models.unit_magnetic_field_strength_format import (
|
||||
UnitMagneticFieldStrengthFormat,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/magnetic-field-strength/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/magnetic-field-strength/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMagneticFieldStrengthConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMagneticFieldStrengthConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
""" Convert a magnetic field strength unit value to another magnetic field strength unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a magnetic field strength unit value to another magnetic field strength unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFieldStrengthFormat,
|
||||
src_format: UnitMagneticFieldStrengthFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMagneticFieldStrengthConversion, Error]]:
|
||||
""" Convert a magnetic field strength unit value to another magnetic field strength unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a magnetic field strength unit value to another magnetic field strength unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_magnetic_flux_conversion import UnitMagneticFluxConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_magnetic_flux_format import UnitMagneticFluxFormat
|
||||
from ...models.unit_magnetic_flux_conversion import UnitMagneticFluxConversion
|
||||
from ...models.unit_magnetic_flux_format import UnitMagneticFluxFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/magnetic-flux/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/magnetic-flux/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMagneticFluxConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMagneticFluxConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
""" Convert a magnetic flux unit value to another magnetic flux unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a magnetic flux unit value to another magnetic flux unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMagneticFluxFormat,
|
||||
src_format: UnitMagneticFluxFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMagneticFluxConversion, Error]]:
|
||||
""" Convert a magnetic flux unit value to another magnetic flux unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a magnetic flux unit value to another magnetic flux unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_mass_conversion import UnitMassConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_mass_format import UnitMassFormat
|
||||
from ...models.unit_mass_conversion import UnitMassConversion
|
||||
from ...models.unit_mass_format import UnitMassFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/mass/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/mass/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitMassConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMassConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitMassConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMassConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitMassConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitMassConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMassConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMassConversion, Error]]:
|
||||
""" Convert a mass unit value to another mass unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a mass unit value to another mass unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMassConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMassFormat,
|
||||
src_format: UnitMassFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMassConversion, Error]]:
|
||||
""" Convert a mass unit value to another mass unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a mass unit value to another mass unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_metric_power_cubed_conversion import UnitMetricPowerCubedConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_metric_power import UnitMetricPower
|
||||
from ...models.unit_metric_power import UnitMetricPower
|
||||
from ...models.unit_metric_power_cubed_conversion import UnitMetricPowerCubedConversion
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/metric/cubed/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/metric/cubed/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMetricPowerCubedConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMetricPowerCubedConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
""" Convert a metric cubed unit value to another metric cubed unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a metric cubed unit value to another metric cubed unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMetricPowerCubedConversion, Error]]:
|
||||
""" Convert a metric cubed unit value to another metric cubed unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a metric cubed unit value to another metric cubed unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,142 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_metric_power_squared_conversion import UnitMetricPowerSquaredConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_metric_power import UnitMetricPower
|
||||
from ...models.unit_metric_power import UnitMetricPower
|
||||
from ...models.unit_metric_power_squared_conversion import (
|
||||
UnitMetricPowerSquaredConversion,
|
||||
)
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/metric/squared/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/metric/squared/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMetricPowerSquaredConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMetricPowerSquaredConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
""" Convert a metric squared unit value to another metric squared unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a metric squared unit value to another metric squared unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMetricPowerSquaredConversion, Error]]:
|
||||
""" Convert a metric squared unit value to another metric squared unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a metric squared unit value to another metric squared unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_metric_power_conversion import UnitMetricPowerConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_metric_power import UnitMetricPower
|
||||
from ...models.unit_metric_power import UnitMetricPower
|
||||
from ...models.unit_metric_power_conversion import UnitMetricPowerConversion
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/metric/power/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/metric/power/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMetricPowerConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitMetricPowerConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
""" Convert a metric unit value to another metric unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a metric unit value to another metric unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitMetricPower,
|
||||
src_format: UnitMetricPower,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitMetricPowerConversion, Error]]:
|
||||
""" Convert a metric unit value to another metric unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a metric unit value to another metric unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_power_conversion import UnitPowerConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_power_format import UnitPowerFormat
|
||||
from ...models.unit_power_conversion import UnitPowerConversion
|
||||
from ...models.unit_power_format import UnitPowerFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/power/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/power/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitPowerConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitPowerConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitPowerConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitPowerConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitPowerConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitPowerConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitPowerConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitPowerConversion, Error]]:
|
||||
""" Convert a power unit value to another power unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a power unit value to another power unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitPowerConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPowerFormat,
|
||||
src_format: UnitPowerFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitPowerConversion, Error]]:
|
||||
""" Convert a power unit value to another power unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a power unit value to another power unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_pressure_conversion import UnitPressureConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_pressure_format import UnitPressureFormat
|
||||
from ...models.unit_pressure_conversion import UnitPressureConversion
|
||||
from ...models.unit_pressure_format import UnitPressureFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/pressure/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/pressure/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitPressureConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitPressureConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitPressureConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitPressureConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitPressureConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitPressureConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitPressureConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitPressureConversion, Error]]:
|
||||
""" Convert a pressure unit value to another pressure unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a pressure unit value to another pressure unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitPressureConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitPressureFormat,
|
||||
src_format: UnitPressureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitPressureConversion, Error]]:
|
||||
""" Convert a pressure unit value to another pressure unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a pressure unit value to another pressure unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_radiation_conversion import UnitRadiationConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_radiation_format import UnitRadiationFormat
|
||||
from ...models.unit_radiation_conversion import UnitRadiationConversion
|
||||
from ...models.unit_radiation_format import UnitRadiationFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/radiation/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/radiation/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitRadiationConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitRadiationConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitRadiationConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitRadiationConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitRadiationConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitRadiationConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitRadiationConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitRadiationConversion, Error]]:
|
||||
""" Convert a radiation unit value to another radiation unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a radiation unit value to another radiation unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitRadiationConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadiationFormat,
|
||||
src_format: UnitRadiationFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitRadiationConversion, Error]]:
|
||||
""" Convert a radiation unit value to another radiation unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a radiation unit value to another radiation unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_radioactivity_conversion import UnitRadioactivityConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_radioactivity_format import UnitRadioactivityFormat
|
||||
from ...models.unit_radioactivity_conversion import UnitRadioactivityConversion
|
||||
from ...models.unit_radioactivity_format import UnitRadioactivityFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/radioactivity/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/radioactivity/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitRadioactivityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitRadioactivityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
""" Convert a radioactivity unit value to another radioactivity unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a radioactivity unit value to another radioactivity unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitRadioactivityFormat,
|
||||
src_format: UnitRadioactivityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitRadioactivityConversion, Error]]:
|
||||
""" Convert a radioactivity unit value to another radioactivity unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a radioactivity unit value to another radioactivity unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_solid_angle_conversion import UnitSolidAngleConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_solid_angle_format import UnitSolidAngleFormat
|
||||
from ...models.unit_solid_angle_conversion import UnitSolidAngleConversion
|
||||
from ...models.unit_solid_angle_format import UnitSolidAngleFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/solid-angle/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/solid-angle/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitSolidAngleConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitSolidAngleConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
""" Convert a solid angle unit value to another solid angle unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a solid angle unit value to another solid angle unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitSolidAngleFormat,
|
||||
src_format: UnitSolidAngleFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitSolidAngleConversion, Error]]:
|
||||
""" Convert a solid angle unit value to another solid angle unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a solid angle unit value to another solid angle unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_temperature_conversion import UnitTemperatureConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_temperature_format import UnitTemperatureFormat
|
||||
from ...models.unit_temperature_conversion import UnitTemperatureConversion
|
||||
from ...models.unit_temperature_format import UnitTemperatureFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/temperature/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/temperature/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitTemperatureConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitTemperatureConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
""" Convert a temperature unit value to another temperature unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a temperature unit value to another temperature unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTemperatureFormat,
|
||||
src_format: UnitTemperatureFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitTemperatureConversion, Error]]:
|
||||
""" Convert a temperature unit value to another temperature unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a temperature unit value to another temperature unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_time_conversion import UnitTimeConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_time_format import UnitTimeFormat
|
||||
from ...models.unit_time_conversion import UnitTimeConversion
|
||||
from ...models.unit_time_format import UnitTimeFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/time/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/time/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitTimeConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitTimeConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitTimeConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitTimeConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitTimeConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitTimeConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitTimeConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitTimeConversion, Error]]:
|
||||
""" Convert a time unit value to another time unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a time unit value to another time unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitTimeConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitTimeFormat,
|
||||
src_format: UnitTimeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitTimeConversion, Error]]:
|
||||
""" Convert a time unit value to another time unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a time unit value to another time unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_velocity_conversion import UnitVelocityConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_velocity_format import UnitVelocityFormat
|
||||
from ...models.unit_velocity_conversion import UnitVelocityConversion
|
||||
from ...models.unit_velocity_format import UnitVelocityFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/velocity/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/velocity/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitVelocityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitVelocityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitVelocityConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitVelocityConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitVelocityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitVelocityConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitVelocityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitVelocityConversion, Error]]:
|
||||
""" Convert a velocity unit value to another velocity unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a velocity unit value to another velocity unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitVelocityConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVelocityFormat,
|
||||
src_format: UnitVelocityFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitVelocityConversion, Error]]:
|
||||
""" Convert a velocity unit value to another velocity unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a velocity unit value to another velocity unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_voltage_conversion import UnitVoltageConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_voltage_format import UnitVoltageFormat
|
||||
from ...models.unit_voltage_conversion import UnitVoltageConversion
|
||||
from ...models.unit_voltage_format import UnitVoltageFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/voltage/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/voltage/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitVoltageConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitVoltageConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitVoltageConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitVoltageConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitVoltageConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitVoltageConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitVoltageConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitVoltageConversion, Error]]:
|
||||
""" Convert a voltage unit value to another voltage unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a voltage unit value to another voltage unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitVoltageConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVoltageFormat,
|
||||
src_format: UnitVoltageFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitVoltageConversion, Error]]:
|
||||
""" Convert a voltage unit value to another voltage unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a voltage unit value to another voltage unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
@ -1,129 +1,140 @@
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ...client import Client
|
||||
from ...models.unit_volume_conversion import UnitVolumeConversion
|
||||
from ...models.error import Error
|
||||
from ...models.unit_volume_format import UnitVolumeFormat
|
||||
from ...models.unit_volume_conversion import UnitVolumeConversion
|
||||
from ...models.unit_volume_format import UnitVolumeFormat
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Dict[str, Any]:
|
||||
url = "{}/unit/conversion/volume/{src_format}/{output_format}?value={value}".format(client.base_url, output_format=output_format, src_format=src_format, value=value)
|
||||
url = "{}/unit/conversion/volume/{src_format}/{output_format}".format(
|
||||
client.base_url, output_format=output_format, src_format=src_format
|
||||
) # noqa: E501
|
||||
if value is not None:
|
||||
if "?" in url:
|
||||
url = url + "&value=" + str(value)
|
||||
else:
|
||||
url = url + "?value=" + str(value)
|
||||
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
headers: Dict[str, Any] = client.get_headers()
|
||||
cookies: Dict[str, Any] = client.get_cookies()
|
||||
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
return {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"cookies": cookies,
|
||||
"timeout": client.get_timeout(),
|
||||
}
|
||||
|
||||
|
||||
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, UnitVolumeConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitVolumeConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
def _parse_response(
|
||||
*, response: httpx.Response
|
||||
) -> Optional[Union[Any, UnitVolumeConversion, Error]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = UnitVolumeConversion.from_dict(response.json())
|
||||
return response_200
|
||||
if response.status_code == 400:
|
||||
response_4XX = Error.from_dict(response.json())
|
||||
return response_4XX
|
||||
if response.status_code == 500:
|
||||
response_5XX = Error.from_dict(response.json())
|
||||
return response_5XX
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, response: httpx.Response) -> Response[Union[Any, UnitVolumeConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
def _build_response(
|
||||
*, response: httpx.Response
|
||||
) -> Response[Union[Any, UnitVolumeConversion, Error]]:
|
||||
return Response(
|
||||
status_code=response.status_code,
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitVolumeConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
response = httpx.get(
|
||||
verify=client.verify_ssl,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitVolumeConversion, Error]]:
|
||||
""" Convert a volume unit value to another volume unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a volume unit value to another volume unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
return sync_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Response[Union[Any, UnitVolumeConversion, Error]]:
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
kwargs = _get_kwargs(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
||||
response = await _client.get(**kwargs)
|
||||
|
||||
return _build_response(response=response)
|
||||
return _build_response(response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
output_format: UnitVolumeFormat,
|
||||
src_format: UnitVolumeFormat,
|
||||
value: float,
|
||||
*,
|
||||
client: Client,
|
||||
) -> Optional[Union[Any, UnitVolumeConversion, Error]]:
|
||||
""" Convert a volume unit value to another volume unit value. This is a nice endpoint to use for helper functions. """
|
||||
"""Convert a volume unit value to another volume unit value. This is a nice endpoint to use for helper functions.""" # noqa: E501
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
output_format=output_format,
|
||||
src_format=src_format,
|
||||
value=value,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
|
Reference in New Issue
Block a user