mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-03-14 08:55:25 +00:00
feat: Initial commit of FitTrack_GarminSync project
This commit is contained in:
23
backend/src/central_db_client/.gitignore
vendored
Normal file
23
backend/src/central_db_client/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
__pycache__/
|
||||
build/
|
||||
dist/
|
||||
*.egg-info/
|
||||
.pytest_cache/
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# JetBrains
|
||||
.idea/
|
||||
|
||||
/coverage.xml
|
||||
/.coverage
|
||||
124
backend/src/central_db_client/README.md
Normal file
124
backend/src/central_db_client/README.md
Normal file
@@ -0,0 +1,124 @@
|
||||
# fit-track-central-db-api-client
|
||||
A client library for accessing FitTrack CentralDB API
|
||||
|
||||
## Usage
|
||||
First, create a client:
|
||||
|
||||
```python
|
||||
from fit_track_central_db_api_client import Client
|
||||
|
||||
client = Client(base_url="https://api.example.com")
|
||||
```
|
||||
|
||||
If the endpoints you're going to hit require authentication, use `AuthenticatedClient` instead:
|
||||
|
||||
```python
|
||||
from fit_track_central_db_api_client import AuthenticatedClient
|
||||
|
||||
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken")
|
||||
```
|
||||
|
||||
Now call your endpoint and use your models:
|
||||
|
||||
```python
|
||||
from fit_track_central_db_api_client.models import MyDataModel
|
||||
from fit_track_central_db_api_client.api.my_tag import get_my_data_model
|
||||
from fit_track_central_db_api_client.types import Response
|
||||
|
||||
with client as client:
|
||||
my_data: MyDataModel = get_my_data_model.sync(client=client)
|
||||
# or if you need more info (e.g. status_code)
|
||||
response: Response[MyDataModel] = get_my_data_model.sync_detailed(client=client)
|
||||
```
|
||||
|
||||
Or do the same thing with an async version:
|
||||
|
||||
```python
|
||||
from fit_track_central_db_api_client.models import MyDataModel
|
||||
from fit_track_central_db_api_client.api.my_tag import get_my_data_model
|
||||
from fit_track_central_db_api_client.types import Response
|
||||
|
||||
async with client as client:
|
||||
my_data: MyDataModel = await get_my_data_model.asyncio(client=client)
|
||||
response: Response[MyDataModel] = await get_my_data_model.asyncio_detailed(client=client)
|
||||
```
|
||||
|
||||
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
|
||||
|
||||
```python
|
||||
client = AuthenticatedClient(
|
||||
base_url="https://internal_api.example.com",
|
||||
token="SuperSecretToken",
|
||||
verify_ssl="/path/to/certificate_bundle.pem",
|
||||
)
|
||||
```
|
||||
|
||||
You can also disable certificate validation altogether, but beware that **this is a security risk**.
|
||||
|
||||
```python
|
||||
client = AuthenticatedClient(
|
||||
base_url="https://internal_api.example.com",
|
||||
token="SuperSecretToken",
|
||||
verify_ssl=False
|
||||
)
|
||||
```
|
||||
|
||||
Things to know:
|
||||
1. Every path/method combo becomes a Python module with four functions:
|
||||
1. `sync`: Blocking request that returns parsed data (if successful) or `None`
|
||||
1. `sync_detailed`: Blocking request that always returns a `Request`, optionally with `parsed` set if the request was successful.
|
||||
1. `asyncio`: Like `sync` but async instead of blocking
|
||||
1. `asyncio_detailed`: Like `sync_detailed` but async instead of blocking
|
||||
|
||||
1. All path/query params, and bodies become method arguments.
|
||||
1. If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
|
||||
1. Any endpoint which did not have a tag will be in `fit_track_central_db_api_client.api.default`
|
||||
|
||||
## Advanced customizations
|
||||
|
||||
There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case):
|
||||
|
||||
```python
|
||||
from fit_track_central_db_api_client import Client
|
||||
|
||||
def log_request(request):
|
||||
print(f"Request event hook: {request.method} {request.url} - Waiting for response")
|
||||
|
||||
def log_response(response):
|
||||
request = response.request
|
||||
print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")
|
||||
|
||||
client = Client(
|
||||
base_url="https://api.example.com",
|
||||
httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
|
||||
)
|
||||
|
||||
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()
|
||||
```
|
||||
|
||||
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
|
||||
|
||||
```python
|
||||
import httpx
|
||||
from fit_track_central_db_api_client import Client
|
||||
|
||||
client = Client(
|
||||
base_url="https://api.example.com",
|
||||
)
|
||||
# Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
|
||||
client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030"))
|
||||
```
|
||||
|
||||
## Building / publishing this package
|
||||
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
|
||||
1. Update the metadata in pyproject.toml (e.g. authors, version)
|
||||
1. If you're using a private repository, configure it with Poetry
|
||||
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
|
||||
1. `poetry config http-basic.<your-repository-name> <username> <password>`
|
||||
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
|
||||
|
||||
If you want to install this client into another project without publishing it (e.g. for development) then:
|
||||
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
|
||||
1. If that project is not using Poetry:
|
||||
1. Build a wheel with `poetry build -f wheel`
|
||||
1. Install that wheel from the other project `pip install <path-to-wheel>`
|
||||
@@ -0,0 +1,8 @@
|
||||
"""A client library for accessing FitTrack CentralDB API"""
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
"""Contains methods for accessing the API"""
|
||||
@@ -0,0 +1 @@
|
||||
"""Contains endpoint functions for accessing the API"""
|
||||
@@ -0,0 +1,179 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.analysis_artifact import AnalysisArtifact
|
||||
from ...models.analysis_artifact_create import AnalysisArtifactCreate
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
activity_id: int,
|
||||
*,
|
||||
body: AnalysisArtifactCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": f"/activities/{activity_id}/analysis",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[AnalysisArtifact, HTTPValidationError]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = AnalysisArtifact.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[AnalysisArtifact, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: AnalysisArtifactCreate,
|
||||
) -> Response[Union[AnalysisArtifact, HTTPValidationError]]:
|
||||
"""Create Analysis Artifact
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
body (AnalysisArtifactCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AnalysisArtifact, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
activity_id=activity_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: AnalysisArtifactCreate,
|
||||
) -> Optional[Union[AnalysisArtifact, HTTPValidationError]]:
|
||||
"""Create Analysis Artifact
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
body (AnalysisArtifactCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[AnalysisArtifact, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
activity_id=activity_id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: AnalysisArtifactCreate,
|
||||
) -> Response[Union[AnalysisArtifact, HTTPValidationError]]:
|
||||
"""Create Analysis Artifact
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
body (AnalysisArtifactCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[AnalysisArtifact, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
activity_id=activity_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: AnalysisArtifactCreate,
|
||||
) -> Optional[Union[AnalysisArtifact, HTTPValidationError]]:
|
||||
"""Create Analysis Artifact
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
body (AnalysisArtifactCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[AnalysisArtifact, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
activity_id=activity_id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,166 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.coaching_session import CoachingSession
|
||||
from ...models.coaching_session_create import CoachingSessionCreate
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: CoachingSessionCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/coaching/sessions",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[CoachingSession, HTTPValidationError]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = CoachingSession.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[CoachingSession, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: CoachingSessionCreate,
|
||||
) -> Response[Union[CoachingSession, HTTPValidationError]]:
|
||||
"""Create Coaching Session
|
||||
|
||||
Args:
|
||||
body (CoachingSessionCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[CoachingSession, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: CoachingSessionCreate,
|
||||
) -> Optional[Union[CoachingSession, HTTPValidationError]]:
|
||||
"""Create Coaching Session
|
||||
|
||||
Args:
|
||||
body (CoachingSessionCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[CoachingSession, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: CoachingSessionCreate,
|
||||
) -> Response[Union[CoachingSession, HTTPValidationError]]:
|
||||
"""Create Coaching Session
|
||||
|
||||
Args:
|
||||
body (CoachingSessionCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[CoachingSession, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: CoachingSessionCreate,
|
||||
) -> Optional[Union[CoachingSession, HTTPValidationError]]:
|
||||
"""Create Coaching Session
|
||||
|
||||
Args:
|
||||
body (CoachingSessionCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[CoachingSession, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,166 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.health_metric import HealthMetric
|
||||
from ...models.health_metric_create import HealthMetricCreate
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: HealthMetricCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/health_metrics",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = HealthMetric.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricCreate,
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Create Health Metric
|
||||
|
||||
Args:
|
||||
body (HealthMetricCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, HealthMetric]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricCreate,
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Create Health Metric
|
||||
|
||||
Args:
|
||||
body (HealthMetricCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, HealthMetric]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricCreate,
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Create Health Metric
|
||||
|
||||
Args:
|
||||
body (HealthMetricCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, HealthMetric]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricCreate,
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Create Health Metric
|
||||
|
||||
Args:
|
||||
body (HealthMetricCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, HealthMetric]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,166 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.user import User
|
||||
from ...models.user_create import UserCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: UserCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/users",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = User.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserCreate,
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
"""Create User
|
||||
|
||||
Args:
|
||||
body (UserCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, User]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserCreate,
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
"""Create User
|
||||
|
||||
Args:
|
||||
body (UserCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, User]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserCreate,
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
"""Create User
|
||||
|
||||
Args:
|
||||
body (UserCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, User]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserCreate,
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
"""Create User
|
||||
|
||||
Args:
|
||||
body (UserCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, User]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,166 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.workout_plan import WorkoutPlan
|
||||
from ...models.workout_plan_create import WorkoutPlanCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: WorkoutPlanCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/workout_plans",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = WorkoutPlan.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanCreate,
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Create Workout Plan
|
||||
|
||||
Args:
|
||||
body (WorkoutPlanCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, WorkoutPlan]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanCreate,
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Create Workout Plan
|
||||
|
||||
Args:
|
||||
body (WorkoutPlanCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, WorkoutPlan]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanCreate,
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Create Workout Plan
|
||||
|
||||
Args:
|
||||
body (WorkoutPlanCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, WorkoutPlan]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanCreate,
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Create Workout Plan
|
||||
|
||||
Args:
|
||||
body (WorkoutPlanCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, WorkoutPlan]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,155 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
metric_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/health_metrics/{metric_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
metric_id=metric_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
metric_id=metric_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
metric_id=metric_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
metric_id=metric_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,155 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/users/{user_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,155 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
plan_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/workout_plans/{plan_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
plan_id=plan_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
plan_id=plan_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
plan_id=plan_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
plan_id=plan_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,155 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
activity_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/activities/{activity_id}/file",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = response.json()
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Download Activity File
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
activity_id=activity_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Download Activity File
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
activity_id=activity_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Download Activity File
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
activity_id=activity_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Download Activity File
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
activity_id=activity_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,157 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.activity import Activity
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
activity_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/activities/{activity_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Activity, HTTPValidationError]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Activity.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Activity, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Activity, HTTPValidationError]]:
|
||||
"""Get Activity By Id
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Activity, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
activity_id=activity_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Activity, HTTPValidationError]]:
|
||||
"""Get Activity By Id
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Activity, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
activity_id=activity_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Activity, HTTPValidationError]]:
|
||||
"""Get Activity By Id
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Activity, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
activity_id=activity_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
activity_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Activity, HTTPValidationError]]:
|
||||
"""Get Activity By Id
|
||||
|
||||
Args:
|
||||
activity_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Activity, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
activity_id=activity_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,132 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.activity import Activity
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/activities",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[list["Activity"]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = Activity.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[list["Activity"]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[list["Activity"]]:
|
||||
"""Get All Activities
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[list['Activity']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[list["Activity"]]:
|
||||
"""Get All Activities
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['Activity']
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[list["Activity"]]:
|
||||
"""Get All Activities
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[list['Activity']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[list["Activity"]]:
|
||||
"""Get All Activities
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['Activity']
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,132 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.coaching_session import CoachingSession
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/coaching/sessions",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[list["CoachingSession"]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = CoachingSession.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[list["CoachingSession"]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[list["CoachingSession"]]:
|
||||
"""Get All Coaching Sessions
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[list['CoachingSession']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[list["CoachingSession"]]:
|
||||
"""Get All Coaching Sessions
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['CoachingSession']
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[list["CoachingSession"]]:
|
||||
"""Get All Coaching Sessions
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[list['CoachingSession']]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[list["CoachingSession"]]:
|
||||
"""Get All Coaching Sessions
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
list['CoachingSession']
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,157 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.health_metric import HealthMetric
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
metric_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/health_metrics/{metric_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = HealthMetric.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Read Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, HealthMetric]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
metric_id=metric_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Read Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, HealthMetric]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
metric_id=metric_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Read Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, HealthMetric]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
metric_id=metric_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Read Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, HealthMetric]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
metric_id=metric_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,162 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.health_metric import HealthMetric
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/users/{user_id}/health_metrics",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, list["HealthMetric"]]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = HealthMetric.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, list["HealthMetric"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, list["HealthMetric"]]]:
|
||||
"""Read Health Metrics By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, list['HealthMetric']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, list["HealthMetric"]]]:
|
||||
"""Read Health Metrics By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, list['HealthMetric']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, list["HealthMetric"]]]:
|
||||
"""Read Health Metrics By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, list['HealthMetric']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, list["HealthMetric"]]]:
|
||||
"""Read Health Metrics By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, list['HealthMetric']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,157 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.user import User
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/users/{user_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = User.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
"""Read User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, User]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
"""Read User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, User]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
"""Read User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, User]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
"""Read User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, User]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,185 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.user import User
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
skip: Union[Unset, int] = 0,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {}
|
||||
|
||||
params["skip"] = skip
|
||||
|
||||
params["limit"] = limit
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/users",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, list["User"]]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = User.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, list["User"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
skip: Union[Unset, int] = 0,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Response[Union[HTTPValidationError, list["User"]]]:
|
||||
"""Read Users
|
||||
|
||||
Args:
|
||||
skip (Union[Unset, int]): Default: 0.
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, list['User']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
skip=skip,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
skip: Union[Unset, int] = 0,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[HTTPValidationError, list["User"]]]:
|
||||
"""Read Users
|
||||
|
||||
Args:
|
||||
skip (Union[Unset, int]): Default: 0.
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, list['User']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
skip=skip,
|
||||
limit=limit,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
skip: Union[Unset, int] = 0,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Response[Union[HTTPValidationError, list["User"]]]:
|
||||
"""Read Users
|
||||
|
||||
Args:
|
||||
skip (Union[Unset, int]): Default: 0.
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, list['User']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
skip=skip,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
skip: Union[Unset, int] = 0,
|
||||
limit: Union[Unset, int] = 100,
|
||||
) -> Optional[Union[HTTPValidationError, list["User"]]]:
|
||||
"""Read Users
|
||||
|
||||
Args:
|
||||
skip (Union[Unset, int]): Default: 0.
|
||||
limit (Union[Unset, int]): Default: 100.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, list['User']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
skip=skip,
|
||||
limit=limit,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,157 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.workout_plan import WorkoutPlan
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
plan_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/workout_plans/{plan_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = WorkoutPlan.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Read Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, WorkoutPlan]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
plan_id=plan_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Read Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, WorkoutPlan]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
plan_id=plan_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Read Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, WorkoutPlan]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
plan_id=plan_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Read Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, WorkoutPlan]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
plan_id=plan_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,162 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.workout_plan import WorkoutPlan
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: int,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/users/{user_id}/workout_plans",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, list["WorkoutPlan"]]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = []
|
||||
_response_200 = response.json()
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = WorkoutPlan.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, list["WorkoutPlan"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, list["WorkoutPlan"]]]:
|
||||
"""Read Workout Plans By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, list['WorkoutPlan']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, list["WorkoutPlan"]]]:
|
||||
"""Read Workout Plans By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, list['WorkoutPlan']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, list["WorkoutPlan"]]]:
|
||||
"""Read Workout Plans By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, list['WorkoutPlan']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, list["WorkoutPlan"]]]:
|
||||
"""Read Workout Plans By User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, list['WorkoutPlan']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,179 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.health_metric import HealthMetric
|
||||
from ...models.health_metric_update import HealthMetricUpdate
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
metric_id: int,
|
||||
*,
|
||||
body: HealthMetricUpdate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/health_metrics/{metric_id}",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = HealthMetric.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricUpdate,
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Update Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
body (HealthMetricUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, HealthMetric]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
metric_id=metric_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Update Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
body (HealthMetricUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, HealthMetric]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
metric_id=metric_id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricUpdate,
|
||||
) -> Response[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Update Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
body (HealthMetricUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, HealthMetric]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
metric_id=metric_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
metric_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: HealthMetricUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, HealthMetric]]:
|
||||
"""Update Health Metric
|
||||
|
||||
Args:
|
||||
metric_id (int):
|
||||
body (HealthMetricUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, HealthMetric]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
metric_id=metric_id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,179 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.user import User
|
||||
from ...models.user_update import UserUpdate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: int,
|
||||
*,
|
||||
body: UserUpdate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/users/{user_id}",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = User.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserUpdate,
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
"""Update User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
body (UserUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, User]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
"""Update User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
body (UserUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, User]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserUpdate,
|
||||
) -> Response[Union[HTTPValidationError, User]]:
|
||||
"""Update User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
body (UserUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, User]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: UserUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, User]]:
|
||||
"""Update User
|
||||
|
||||
Args:
|
||||
user_id (int):
|
||||
body (UserUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, User]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,179 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.workout_plan import WorkoutPlan
|
||||
from ...models.workout_plan_update import WorkoutPlanUpdate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
plan_id: int,
|
||||
*,
|
||||
body: WorkoutPlanUpdate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/workout_plans/{plan_id}",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = WorkoutPlan.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanUpdate,
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Update Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
body (WorkoutPlanUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, WorkoutPlan]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
plan_id=plan_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Update Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
body (WorkoutPlanUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, WorkoutPlan]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
plan_id=plan_id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanUpdate,
|
||||
) -> Response[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Update Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
body (WorkoutPlanUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, WorkoutPlan]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
plan_id=plan_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
plan_id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: WorkoutPlanUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, WorkoutPlan]]:
|
||||
"""Update Workout Plan
|
||||
|
||||
Args:
|
||||
plan_id (int):
|
||||
body (WorkoutPlanUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, WorkoutPlan]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
plan_id=plan_id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,164 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.activity import Activity
|
||||
from ...models.body_upload_activity_activities_post import BodyUploadActivityActivitiesPost
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: BodyUploadActivityActivitiesPost,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/activities",
|
||||
}
|
||||
|
||||
_kwargs["files"] = body.to_multipart()
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Activity, HTTPValidationError]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Activity.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Activity, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUploadActivityActivitiesPost,
|
||||
) -> Response[Union[Activity, HTTPValidationError]]:
|
||||
"""Upload Activity
|
||||
|
||||
Args:
|
||||
body (BodyUploadActivityActivitiesPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Activity, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUploadActivityActivitiesPost,
|
||||
) -> Optional[Union[Activity, HTTPValidationError]]:
|
||||
"""Upload Activity
|
||||
|
||||
Args:
|
||||
body (BodyUploadActivityActivitiesPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Activity, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUploadActivityActivitiesPost,
|
||||
) -> Response[Union[Activity, HTTPValidationError]]:
|
||||
"""Upload Activity
|
||||
|
||||
Args:
|
||||
body (BodyUploadActivityActivitiesPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Activity, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: BodyUploadActivityActivitiesPost,
|
||||
) -> Optional[Union[Activity, HTTPValidationError]]:
|
||||
"""Upload Activity
|
||||
|
||||
Args:
|
||||
body (BodyUploadActivityActivitiesPost):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Activity, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1 @@
|
||||
"""Contains endpoint functions for accessing the API"""
|
||||
@@ -0,0 +1,80 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == 200:
|
||||
return None
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Any]:
|
||||
"""Read Root
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Any]:
|
||||
"""Read Root
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
@@ -0,0 +1 @@
|
||||
"""Contains endpoint functions for accessing the API"""
|
||||
@@ -0,0 +1,166 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.token import Token
|
||||
from ...models.token_create import TokenCreate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
body: TokenCreate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/tokens/",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
if response.status_code == 201:
|
||||
response_201 = Token.from_dict(response.json())
|
||||
|
||||
return response_201
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenCreate,
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
"""Create Token Api
|
||||
|
||||
Args:
|
||||
body (TokenCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenCreate,
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
"""Create Token Api
|
||||
|
||||
Args:
|
||||
body (TokenCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenCreate,
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
"""Create Token Api
|
||||
|
||||
Args:
|
||||
body (TokenCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenCreate,
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
"""Create Token Api
|
||||
|
||||
Args:
|
||||
body (TokenCreate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,155 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "delete",
|
||||
"url": f"/tokens/{user_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
if response.status_code == 204:
|
||||
response_204 = cast(Any, None)
|
||||
return response_204
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, HTTPValidationError]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, HTTPValidationError]]:
|
||||
"""Delete Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, HTTPValidationError]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,157 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.token import Token
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: str,
|
||||
) -> dict[str, Any]:
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/tokens/{user_id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Token.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
"""Get Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
"""Get Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
"""Get Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
"""Get Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,179 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.http_validation_error import HTTPValidationError
|
||||
from ...models.token import Token
|
||||
from ...models.token_update import TokenUpdate
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
user_id: str,
|
||||
*,
|
||||
body: TokenUpdate,
|
||||
) -> dict[str, Any]:
|
||||
headers: dict[str, Any] = {}
|
||||
|
||||
_kwargs: dict[str, Any] = {
|
||||
"method": "put",
|
||||
"url": f"/tokens/{user_id}",
|
||||
}
|
||||
|
||||
_kwargs["json"] = body.to_dict()
|
||||
|
||||
headers["Content-Type"] = "application/json"
|
||||
|
||||
_kwargs["headers"] = headers
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
if response.status_code == 200:
|
||||
response_200 = Token.from_dict(response.json())
|
||||
|
||||
return response_200
|
||||
|
||||
if response.status_code == 422:
|
||||
response_422 = HTTPValidationError.from_dict(response.json())
|
||||
|
||||
return response_422
|
||||
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenUpdate,
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
"""Update Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
body (TokenUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
"""Update Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
body (TokenUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
body=body,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenUpdate,
|
||||
) -> Response[Union[HTTPValidationError, Token]]:
|
||||
"""Update Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
body (TokenUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[HTTPValidationError, Token]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
user_id=user_id,
|
||||
body=body,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
user_id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
body: TokenUpdate,
|
||||
) -> Optional[Union[HTTPValidationError, Token]]:
|
||||
"""Update Token Api
|
||||
|
||||
Args:
|
||||
user_id (str):
|
||||
body (TokenUpdate):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[HTTPValidationError, Token]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
user_id=user_id,
|
||||
client=client,
|
||||
body=body,
|
||||
)
|
||||
).parsed
|
||||
@@ -0,0 +1,268 @@
|
||||
import ssl
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import httpx
|
||||
from attrs import define, evolve, field
|
||||
|
||||
|
||||
@define
|
||||
class Client:
|
||||
"""A class for keeping track of data related to the API
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
|
||||
def with_headers(self, headers: dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
self._client.headers.update(headers)
|
||||
if self._async_client is not None:
|
||||
self._async_client.headers.update(headers)
|
||||
return evolve(self, headers={**self._headers, **headers})
|
||||
|
||||
def with_cookies(self, cookies: dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
if self._client is not None:
|
||||
self._client.cookies.update(cookies)
|
||||
if self._async_client is not None:
|
||||
self._async_client.cookies.update(cookies)
|
||||
return evolve(self, cookies={**self._cookies, **cookies})
|
||||
|
||||
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
if self._client is not None:
|
||||
self._client.timeout = timeout
|
||||
if self._async_client is not None:
|
||||
self._async_client.timeout = timeout
|
||||
return evolve(self, timeout=timeout)
|
||||
|
||||
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
||||
"""Manually set the underlying httpx.Client
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._client = client
|
||||
return self
|
||||
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._client
|
||||
|
||||
def __enter__(self) -> "Client":
|
||||
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||
self.get_httpx_client().__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._async_client = async_client
|
||||
return self
|
||||
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._async_client
|
||||
|
||||
async def __aenter__(self) -> "Client":
|
||||
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||
|
||||
|
||||
@define
|
||||
class AuthenticatedClient:
|
||||
"""A Client which has been authenticated for use on secured endpoints
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
token: The token to use for authentication
|
||||
prefix: The prefix to use for the Authorization header
|
||||
auth_header_name: The name of the Authorization header
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
|
||||
token: str
|
||||
prefix: str = "Bearer"
|
||||
auth_header_name: str = "Authorization"
|
||||
|
||||
def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
self._client.headers.update(headers)
|
||||
if self._async_client is not None:
|
||||
self._async_client.headers.update(headers)
|
||||
return evolve(self, headers={**self._headers, **headers})
|
||||
|
||||
def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
if self._client is not None:
|
||||
self._client.cookies.update(cookies)
|
||||
if self._async_client is not None:
|
||||
self._async_client.cookies.update(cookies)
|
||||
return evolve(self, cookies={**self._cookies, **cookies})
|
||||
|
||||
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
if self._client is not None:
|
||||
self._client.timeout = timeout
|
||||
if self._async_client is not None:
|
||||
self._async_client.timeout = timeout
|
||||
return evolve(self, timeout=timeout)
|
||||
|
||||
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
||||
"""Manually set the underlying httpx.Client
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._client = client
|
||||
return self
|
||||
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._client
|
||||
|
||||
def __enter__(self) -> "AuthenticatedClient":
|
||||
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||
self.get_httpx_client().__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._async_client = async_client
|
||||
return self
|
||||
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._async_client
|
||||
|
||||
async def __aenter__(self) -> "AuthenticatedClient":
|
||||
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||
@@ -0,0 +1,16 @@
|
||||
"""Contains shared errors types that can be raised from API functions"""
|
||||
|
||||
|
||||
class UnexpectedStatus(Exception):
|
||||
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
||||
|
||||
def __init__(self, status_code: int, content: bytes):
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
|
||||
super().__init__(
|
||||
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["UnexpectedStatus"]
|
||||
@@ -0,0 +1,67 @@
|
||||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .activity import Activity
|
||||
from .activity_activity_metadata_type_0 import ActivityActivityMetadataType0
|
||||
from .analysis_artifact import AnalysisArtifact
|
||||
from .analysis_artifact_create import AnalysisArtifactCreate
|
||||
from .analysis_artifact_create_data import AnalysisArtifactCreateData
|
||||
from .analysis_artifact_data import AnalysisArtifactData
|
||||
from .body_upload_activity_activities_post import BodyUploadActivityActivitiesPost
|
||||
from .coaching_session import CoachingSession
|
||||
from .coaching_session_conversation import CoachingSessionConversation
|
||||
from .coaching_session_create import CoachingSessionCreate
|
||||
from .coaching_session_create_conversation import CoachingSessionCreateConversation
|
||||
from .health_metric import HealthMetric
|
||||
from .health_metric_create import HealthMetricCreate
|
||||
from .health_metric_update import HealthMetricUpdate
|
||||
from .http_validation_error import HTTPValidationError
|
||||
from .token import Token
|
||||
from .token_create import TokenCreate
|
||||
from .token_update import TokenUpdate
|
||||
from .user import User
|
||||
from .user_create import UserCreate
|
||||
from .user_create_preferences_type_0 import UserCreatePreferencesType0
|
||||
from .user_preferences_type_0 import UserPreferencesType0
|
||||
from .user_update import UserUpdate
|
||||
from .user_update_preferences_type_0 import UserUpdatePreferencesType0
|
||||
from .validation_error import ValidationError
|
||||
from .workout_plan import WorkoutPlan
|
||||
from .workout_plan_create import WorkoutPlanCreate
|
||||
from .workout_plan_create_plan_details import WorkoutPlanCreatePlanDetails
|
||||
from .workout_plan_plan_details import WorkoutPlanPlanDetails
|
||||
from .workout_plan_update import WorkoutPlanUpdate
|
||||
from .workout_plan_update_plan_details_type_0 import WorkoutPlanUpdatePlanDetailsType0
|
||||
|
||||
__all__ = (
|
||||
"Activity",
|
||||
"ActivityActivityMetadataType0",
|
||||
"AnalysisArtifact",
|
||||
"AnalysisArtifactCreate",
|
||||
"AnalysisArtifactCreateData",
|
||||
"AnalysisArtifactData",
|
||||
"BodyUploadActivityActivitiesPost",
|
||||
"CoachingSession",
|
||||
"CoachingSessionConversation",
|
||||
"CoachingSessionCreate",
|
||||
"CoachingSessionCreateConversation",
|
||||
"HealthMetric",
|
||||
"HealthMetricCreate",
|
||||
"HealthMetricUpdate",
|
||||
"HTTPValidationError",
|
||||
"Token",
|
||||
"TokenCreate",
|
||||
"TokenUpdate",
|
||||
"User",
|
||||
"UserCreate",
|
||||
"UserCreatePreferencesType0",
|
||||
"UserPreferencesType0",
|
||||
"UserUpdate",
|
||||
"UserUpdatePreferencesType0",
|
||||
"ValidationError",
|
||||
"WorkoutPlan",
|
||||
"WorkoutPlanCreate",
|
||||
"WorkoutPlanCreatePlanDetails",
|
||||
"WorkoutPlanPlanDetails",
|
||||
"WorkoutPlanUpdate",
|
||||
"WorkoutPlanUpdatePlanDetailsType0",
|
||||
)
|
||||
@@ -0,0 +1,125 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.activity_activity_metadata_type_0 import ActivityActivityMetadataType0
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Activity")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Activity:
|
||||
"""
|
||||
Attributes:
|
||||
user_id (int):
|
||||
file_path (str):
|
||||
id (int):
|
||||
created_at (datetime.datetime):
|
||||
activity_metadata (Union['ActivityActivityMetadataType0', None, Unset]):
|
||||
"""
|
||||
|
||||
user_id: int
|
||||
file_path: str
|
||||
id: int
|
||||
created_at: datetime.datetime
|
||||
activity_metadata: Union["ActivityActivityMetadataType0", None, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.activity_activity_metadata_type_0 import ActivityActivityMetadataType0
|
||||
|
||||
user_id = self.user_id
|
||||
|
||||
file_path = self.file_path
|
||||
|
||||
id = self.id
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
activity_metadata: Union[None, Unset, dict[str, Any]]
|
||||
if isinstance(self.activity_metadata, Unset):
|
||||
activity_metadata = UNSET
|
||||
elif isinstance(self.activity_metadata, ActivityActivityMetadataType0):
|
||||
activity_metadata = self.activity_metadata.to_dict()
|
||||
else:
|
||||
activity_metadata = self.activity_metadata
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user_id": user_id,
|
||||
"file_path": file_path,
|
||||
"id": id,
|
||||
"created_at": created_at,
|
||||
}
|
||||
)
|
||||
if activity_metadata is not UNSET:
|
||||
field_dict["activity_metadata"] = activity_metadata
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.activity_activity_metadata_type_0 import ActivityActivityMetadataType0
|
||||
|
||||
d = dict(src_dict)
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
file_path = d.pop("file_path")
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
def _parse_activity_metadata(data: object) -> Union["ActivityActivityMetadataType0", None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
activity_metadata_type_0 = ActivityActivityMetadataType0.from_dict(data)
|
||||
|
||||
return activity_metadata_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["ActivityActivityMetadataType0", None, Unset], data)
|
||||
|
||||
activity_metadata = _parse_activity_metadata(d.pop("activity_metadata", UNSET))
|
||||
|
||||
activity = cls(
|
||||
user_id=user_id,
|
||||
file_path=file_path,
|
||||
id=id,
|
||||
created_at=created_at,
|
||||
activity_metadata=activity_metadata,
|
||||
)
|
||||
|
||||
activity.additional_properties = d
|
||||
return activity
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ActivityActivityMetadataType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ActivityActivityMetadataType0:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
activity_activity_metadata_type_0 = cls()
|
||||
|
||||
activity_activity_metadata_type_0.additional_properties = d
|
||||
return activity_activity_metadata_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,91 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.analysis_artifact_data import AnalysisArtifactData
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AnalysisArtifact")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AnalysisArtifact:
|
||||
"""
|
||||
Attributes:
|
||||
activity_id (int):
|
||||
data (AnalysisArtifactData):
|
||||
id (int):
|
||||
created_at (datetime.datetime):
|
||||
"""
|
||||
|
||||
activity_id: int
|
||||
data: "AnalysisArtifactData"
|
||||
id: int
|
||||
created_at: datetime.datetime
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
activity_id = self.activity_id
|
||||
|
||||
data = self.data.to_dict()
|
||||
|
||||
id = self.id
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"activity_id": activity_id,
|
||||
"data": data,
|
||||
"id": id,
|
||||
"created_at": created_at,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.analysis_artifact_data import AnalysisArtifactData
|
||||
|
||||
d = dict(src_dict)
|
||||
activity_id = d.pop("activity_id")
|
||||
|
||||
data = AnalysisArtifactData.from_dict(d.pop("data"))
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
analysis_artifact = cls(
|
||||
activity_id=activity_id,
|
||||
data=data,
|
||||
id=id,
|
||||
created_at=created_at,
|
||||
)
|
||||
|
||||
analysis_artifact.additional_properties = d
|
||||
return analysis_artifact
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,65 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.analysis_artifact_create_data import AnalysisArtifactCreateData
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AnalysisArtifactCreate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AnalysisArtifactCreate:
|
||||
"""
|
||||
Attributes:
|
||||
data (AnalysisArtifactCreateData):
|
||||
"""
|
||||
|
||||
data: "AnalysisArtifactCreateData"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
data = self.data.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"data": data,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.analysis_artifact_create_data import AnalysisArtifactCreateData
|
||||
|
||||
d = dict(src_dict)
|
||||
data = AnalysisArtifactCreateData.from_dict(d.pop("data"))
|
||||
|
||||
analysis_artifact_create = cls(
|
||||
data=data,
|
||||
)
|
||||
|
||||
analysis_artifact_create.additional_properties = d
|
||||
return analysis_artifact_create
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AnalysisArtifactCreateData")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AnalysisArtifactCreateData:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
analysis_artifact_create_data = cls()
|
||||
|
||||
analysis_artifact_create_data.additional_properties = d
|
||||
return analysis_artifact_create_data
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="AnalysisArtifactData")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AnalysisArtifactData:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
analysis_artifact_data = cls()
|
||||
|
||||
analysis_artifact_data.additional_properties = d
|
||||
return analysis_artifact_data
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,73 @@
|
||||
from collections.abc import Mapping
|
||||
from io import BytesIO
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from .. import types
|
||||
from ..types import File
|
||||
|
||||
T = TypeVar("T", bound="BodyUploadActivityActivitiesPost")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class BodyUploadActivityActivitiesPost:
|
||||
"""
|
||||
Attributes:
|
||||
file (File):
|
||||
"""
|
||||
|
||||
file: File
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
file = self.file.to_tuple()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"file": file,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
def to_multipart(self) -> types.RequestFiles:
|
||||
files: types.RequestFiles = []
|
||||
|
||||
files.append(("file", self.file.to_tuple()))
|
||||
|
||||
for prop_name, prop in self.additional_properties.items():
|
||||
files.append((prop_name, (None, str(prop).encode(), "text/plain")))
|
||||
|
||||
return files
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
file = File(payload=BytesIO(d.pop("file")))
|
||||
|
||||
body_upload_activity_activities_post = cls(
|
||||
file=file,
|
||||
)
|
||||
|
||||
body_upload_activity_activities_post.additional_properties = d
|
||||
return body_upload_activity_activities_post
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,83 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.coaching_session_conversation import CoachingSessionConversation
|
||||
|
||||
|
||||
T = TypeVar("T", bound="CoachingSession")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CoachingSession:
|
||||
"""
|
||||
Attributes:
|
||||
conversation (CoachingSessionConversation):
|
||||
id (int):
|
||||
created_at (datetime.datetime):
|
||||
"""
|
||||
|
||||
conversation: "CoachingSessionConversation"
|
||||
id: int
|
||||
created_at: datetime.datetime
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
conversation = self.conversation.to_dict()
|
||||
|
||||
id = self.id
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"conversation": conversation,
|
||||
"id": id,
|
||||
"created_at": created_at,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.coaching_session_conversation import CoachingSessionConversation
|
||||
|
||||
d = dict(src_dict)
|
||||
conversation = CoachingSessionConversation.from_dict(d.pop("conversation"))
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
coaching_session = cls(
|
||||
conversation=conversation,
|
||||
id=id,
|
||||
created_at=created_at,
|
||||
)
|
||||
|
||||
coaching_session.additional_properties = d
|
||||
return coaching_session
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="CoachingSessionConversation")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CoachingSessionConversation:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
coaching_session_conversation = cls()
|
||||
|
||||
coaching_session_conversation.additional_properties = d
|
||||
return coaching_session_conversation
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,65 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.coaching_session_create_conversation import CoachingSessionCreateConversation
|
||||
|
||||
|
||||
T = TypeVar("T", bound="CoachingSessionCreate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CoachingSessionCreate:
|
||||
"""
|
||||
Attributes:
|
||||
conversation (CoachingSessionCreateConversation):
|
||||
"""
|
||||
|
||||
conversation: "CoachingSessionCreateConversation"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
conversation = self.conversation.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"conversation": conversation,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.coaching_session_create_conversation import CoachingSessionCreateConversation
|
||||
|
||||
d = dict(src_dict)
|
||||
conversation = CoachingSessionCreateConversation.from_dict(d.pop("conversation"))
|
||||
|
||||
coaching_session_create = cls(
|
||||
conversation=conversation,
|
||||
)
|
||||
|
||||
coaching_session_create.additional_properties = d
|
||||
return coaching_session_create
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="CoachingSessionCreateConversation")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CoachingSessionCreateConversation:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
coaching_session_create_conversation = cls()
|
||||
|
||||
coaching_session_create_conversation.additional_properties = d
|
||||
return coaching_session_create_conversation
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,117 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="HealthMetric")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class HealthMetric:
|
||||
"""
|
||||
Attributes:
|
||||
user_id (int):
|
||||
metric_type (str):
|
||||
value (float):
|
||||
id (int):
|
||||
timestamp (Union[None, Unset, datetime.datetime]):
|
||||
"""
|
||||
|
||||
user_id: int
|
||||
metric_type: str
|
||||
value: float
|
||||
id: int
|
||||
timestamp: Union[None, Unset, datetime.datetime] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
user_id = self.user_id
|
||||
|
||||
metric_type = self.metric_type
|
||||
|
||||
value = self.value
|
||||
|
||||
id = self.id
|
||||
|
||||
timestamp: Union[None, Unset, str]
|
||||
if isinstance(self.timestamp, Unset):
|
||||
timestamp = UNSET
|
||||
elif isinstance(self.timestamp, datetime.datetime):
|
||||
timestamp = self.timestamp.isoformat()
|
||||
else:
|
||||
timestamp = self.timestamp
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user_id": user_id,
|
||||
"metric_type": metric_type,
|
||||
"value": value,
|
||||
"id": id,
|
||||
}
|
||||
)
|
||||
if timestamp is not UNSET:
|
||||
field_dict["timestamp"] = timestamp
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
metric_type = d.pop("metric_type")
|
||||
|
||||
value = d.pop("value")
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
def _parse_timestamp(data: object) -> Union[None, Unset, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
timestamp_type_0 = isoparse(data)
|
||||
|
||||
return timestamp_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, Unset, datetime.datetime], data)
|
||||
|
||||
timestamp = _parse_timestamp(d.pop("timestamp", UNSET))
|
||||
|
||||
health_metric = cls(
|
||||
user_id=user_id,
|
||||
metric_type=metric_type,
|
||||
value=value,
|
||||
id=id,
|
||||
timestamp=timestamp,
|
||||
)
|
||||
|
||||
health_metric.additional_properties = d
|
||||
return health_metric
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,109 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="HealthMetricCreate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class HealthMetricCreate:
|
||||
"""
|
||||
Attributes:
|
||||
user_id (int):
|
||||
metric_type (str):
|
||||
value (float):
|
||||
timestamp (Union[None, Unset, datetime.datetime]):
|
||||
"""
|
||||
|
||||
user_id: int
|
||||
metric_type: str
|
||||
value: float
|
||||
timestamp: Union[None, Unset, datetime.datetime] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
user_id = self.user_id
|
||||
|
||||
metric_type = self.metric_type
|
||||
|
||||
value = self.value
|
||||
|
||||
timestamp: Union[None, Unset, str]
|
||||
if isinstance(self.timestamp, Unset):
|
||||
timestamp = UNSET
|
||||
elif isinstance(self.timestamp, datetime.datetime):
|
||||
timestamp = self.timestamp.isoformat()
|
||||
else:
|
||||
timestamp = self.timestamp
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user_id": user_id,
|
||||
"metric_type": metric_type,
|
||||
"value": value,
|
||||
}
|
||||
)
|
||||
if timestamp is not UNSET:
|
||||
field_dict["timestamp"] = timestamp
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
metric_type = d.pop("metric_type")
|
||||
|
||||
value = d.pop("value")
|
||||
|
||||
def _parse_timestamp(data: object) -> Union[None, Unset, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
timestamp_type_0 = isoparse(data)
|
||||
|
||||
return timestamp_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, Unset, datetime.datetime], data)
|
||||
|
||||
timestamp = _parse_timestamp(d.pop("timestamp", UNSET))
|
||||
|
||||
health_metric_create = cls(
|
||||
user_id=user_id,
|
||||
metric_type=metric_type,
|
||||
value=value,
|
||||
timestamp=timestamp,
|
||||
)
|
||||
|
||||
health_metric_create.additional_properties = d
|
||||
return health_metric_create
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,123 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="HealthMetricUpdate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class HealthMetricUpdate:
|
||||
"""
|
||||
Attributes:
|
||||
metric_type (Union[None, Unset, str]):
|
||||
value (Union[None, Unset, float]):
|
||||
timestamp (Union[None, Unset, datetime.datetime]):
|
||||
"""
|
||||
|
||||
metric_type: Union[None, Unset, str] = UNSET
|
||||
value: Union[None, Unset, float] = UNSET
|
||||
timestamp: Union[None, Unset, datetime.datetime] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
metric_type: Union[None, Unset, str]
|
||||
if isinstance(self.metric_type, Unset):
|
||||
metric_type = UNSET
|
||||
else:
|
||||
metric_type = self.metric_type
|
||||
|
||||
value: Union[None, Unset, float]
|
||||
if isinstance(self.value, Unset):
|
||||
value = UNSET
|
||||
else:
|
||||
value = self.value
|
||||
|
||||
timestamp: Union[None, Unset, str]
|
||||
if isinstance(self.timestamp, Unset):
|
||||
timestamp = UNSET
|
||||
elif isinstance(self.timestamp, datetime.datetime):
|
||||
timestamp = self.timestamp.isoformat()
|
||||
else:
|
||||
timestamp = self.timestamp
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if metric_type is not UNSET:
|
||||
field_dict["metric_type"] = metric_type
|
||||
if value is not UNSET:
|
||||
field_dict["value"] = value
|
||||
if timestamp is not UNSET:
|
||||
field_dict["timestamp"] = timestamp
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_metric_type(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
metric_type = _parse_metric_type(d.pop("metric_type", UNSET))
|
||||
|
||||
def _parse_value(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
value = _parse_value(d.pop("value", UNSET))
|
||||
|
||||
def _parse_timestamp(data: object) -> Union[None, Unset, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
timestamp_type_0 = isoparse(data)
|
||||
|
||||
return timestamp_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, Unset, datetime.datetime], data)
|
||||
|
||||
timestamp = _parse_timestamp(d.pop("timestamp", UNSET))
|
||||
|
||||
health_metric_update = cls(
|
||||
metric_type=metric_type,
|
||||
value=value,
|
||||
timestamp=timestamp,
|
||||
)
|
||||
|
||||
health_metric_update.additional_properties = d
|
||||
return health_metric_update
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,75 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.validation_error import ValidationError
|
||||
|
||||
|
||||
T = TypeVar("T", bound="HTTPValidationError")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class HTTPValidationError:
|
||||
"""
|
||||
Attributes:
|
||||
detail (Union[Unset, list['ValidationError']]):
|
||||
"""
|
||||
|
||||
detail: Union[Unset, list["ValidationError"]] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
detail: Union[Unset, list[dict[str, Any]]] = UNSET
|
||||
if not isinstance(self.detail, Unset):
|
||||
detail = []
|
||||
for detail_item_data in self.detail:
|
||||
detail_item = detail_item_data.to_dict()
|
||||
detail.append(detail_item)
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if detail is not UNSET:
|
||||
field_dict["detail"] = detail
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.validation_error import ValidationError
|
||||
|
||||
d = dict(src_dict)
|
||||
detail = []
|
||||
_detail = d.pop("detail", UNSET)
|
||||
for detail_item_data in _detail or []:
|
||||
detail_item = ValidationError.from_dict(detail_item_data)
|
||||
|
||||
detail.append(detail_item)
|
||||
|
||||
http_validation_error = cls(
|
||||
detail=detail,
|
||||
)
|
||||
|
||||
http_validation_error.additional_properties = d
|
||||
return http_validation_error
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,125 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Token")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Token:
|
||||
"""
|
||||
Attributes:
|
||||
access_token (str):
|
||||
refresh_token (str):
|
||||
expires_at (datetime.datetime):
|
||||
user_id (str):
|
||||
created_at (datetime.datetime):
|
||||
updated_at (Union[None, Unset, datetime.datetime]):
|
||||
"""
|
||||
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
expires_at: datetime.datetime
|
||||
user_id: str
|
||||
created_at: datetime.datetime
|
||||
updated_at: Union[None, Unset, datetime.datetime] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
access_token = self.access_token
|
||||
|
||||
refresh_token = self.refresh_token
|
||||
|
||||
expires_at = self.expires_at.isoformat()
|
||||
|
||||
user_id = self.user_id
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
updated_at: Union[None, Unset, str]
|
||||
if isinstance(self.updated_at, Unset):
|
||||
updated_at = UNSET
|
||||
elif isinstance(self.updated_at, datetime.datetime):
|
||||
updated_at = self.updated_at.isoformat()
|
||||
else:
|
||||
updated_at = self.updated_at
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"access_token": access_token,
|
||||
"refresh_token": refresh_token,
|
||||
"expires_at": expires_at,
|
||||
"user_id": user_id,
|
||||
"created_at": created_at,
|
||||
}
|
||||
)
|
||||
if updated_at is not UNSET:
|
||||
field_dict["updated_at"] = updated_at
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
access_token = d.pop("access_token")
|
||||
|
||||
refresh_token = d.pop("refresh_token")
|
||||
|
||||
expires_at = isoparse(d.pop("expires_at"))
|
||||
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
def _parse_updated_at(data: object) -> Union[None, Unset, datetime.datetime]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, str):
|
||||
raise TypeError()
|
||||
updated_at_type_0 = isoparse(data)
|
||||
|
||||
return updated_at_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[None, Unset, datetime.datetime], data)
|
||||
|
||||
updated_at = _parse_updated_at(d.pop("updated_at", UNSET))
|
||||
|
||||
token = cls(
|
||||
access_token=access_token,
|
||||
refresh_token=refresh_token,
|
||||
expires_at=expires_at,
|
||||
user_id=user_id,
|
||||
created_at=created_at,
|
||||
updated_at=updated_at,
|
||||
)
|
||||
|
||||
token.additional_properties = d
|
||||
return token
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,85 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
T = TypeVar("T", bound="TokenCreate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class TokenCreate:
|
||||
"""
|
||||
Attributes:
|
||||
access_token (str):
|
||||
refresh_token (str):
|
||||
expires_at (datetime.datetime):
|
||||
user_id (str):
|
||||
"""
|
||||
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
expires_at: datetime.datetime
|
||||
user_id: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
access_token = self.access_token
|
||||
|
||||
refresh_token = self.refresh_token
|
||||
|
||||
expires_at = self.expires_at.isoformat()
|
||||
|
||||
user_id = self.user_id
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"access_token": access_token,
|
||||
"refresh_token": refresh_token,
|
||||
"expires_at": expires_at,
|
||||
"user_id": user_id,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
access_token = d.pop("access_token")
|
||||
|
||||
refresh_token = d.pop("refresh_token")
|
||||
|
||||
expires_at = isoparse(d.pop("expires_at"))
|
||||
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
token_create = cls(
|
||||
access_token=access_token,
|
||||
refresh_token=refresh_token,
|
||||
expires_at=expires_at,
|
||||
user_id=user_id,
|
||||
)
|
||||
|
||||
token_create.additional_properties = d
|
||||
return token_create
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,77 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
T = TypeVar("T", bound="TokenUpdate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class TokenUpdate:
|
||||
"""
|
||||
Attributes:
|
||||
access_token (str):
|
||||
refresh_token (str):
|
||||
expires_at (datetime.datetime):
|
||||
"""
|
||||
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
expires_at: datetime.datetime
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
access_token = self.access_token
|
||||
|
||||
refresh_token = self.refresh_token
|
||||
|
||||
expires_at = self.expires_at.isoformat()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"access_token": access_token,
|
||||
"refresh_token": refresh_token,
|
||||
"expires_at": expires_at,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
access_token = d.pop("access_token")
|
||||
|
||||
refresh_token = d.pop("refresh_token")
|
||||
|
||||
expires_at = isoparse(d.pop("expires_at"))
|
||||
|
||||
token_update = cls(
|
||||
access_token=access_token,
|
||||
refresh_token=refresh_token,
|
||||
expires_at=expires_at,
|
||||
)
|
||||
|
||||
token_update.additional_properties = d
|
||||
return token_update
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,115 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.user_preferences_type_0 import UserPreferencesType0
|
||||
|
||||
|
||||
T = TypeVar("T", bound="User")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class User:
|
||||
"""
|
||||
Attributes:
|
||||
name (str):
|
||||
email (str):
|
||||
id (int):
|
||||
preferences (Union['UserPreferencesType0', None, Unset]):
|
||||
"""
|
||||
|
||||
name: str
|
||||
email: str
|
||||
id: int
|
||||
preferences: Union["UserPreferencesType0", None, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.user_preferences_type_0 import UserPreferencesType0
|
||||
|
||||
name = self.name
|
||||
|
||||
email = self.email
|
||||
|
||||
id = self.id
|
||||
|
||||
preferences: Union[None, Unset, dict[str, Any]]
|
||||
if isinstance(self.preferences, Unset):
|
||||
preferences = UNSET
|
||||
elif isinstance(self.preferences, UserPreferencesType0):
|
||||
preferences = self.preferences.to_dict()
|
||||
else:
|
||||
preferences = self.preferences
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"name": name,
|
||||
"email": email,
|
||||
"id": id,
|
||||
}
|
||||
)
|
||||
if preferences is not UNSET:
|
||||
field_dict["preferences"] = preferences
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.user_preferences_type_0 import UserPreferencesType0
|
||||
|
||||
d = dict(src_dict)
|
||||
name = d.pop("name")
|
||||
|
||||
email = d.pop("email")
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
def _parse_preferences(data: object) -> Union["UserPreferencesType0", None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
preferences_type_0 = UserPreferencesType0.from_dict(data)
|
||||
|
||||
return preferences_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["UserPreferencesType0", None, Unset], data)
|
||||
|
||||
preferences = _parse_preferences(d.pop("preferences", UNSET))
|
||||
|
||||
user = cls(
|
||||
name=name,
|
||||
email=email,
|
||||
id=id,
|
||||
preferences=preferences,
|
||||
)
|
||||
|
||||
user.additional_properties = d
|
||||
return user
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,107 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.user_create_preferences_type_0 import UserCreatePreferencesType0
|
||||
|
||||
|
||||
T = TypeVar("T", bound="UserCreate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class UserCreate:
|
||||
"""
|
||||
Attributes:
|
||||
name (str):
|
||||
email (str):
|
||||
preferences (Union['UserCreatePreferencesType0', None, Unset]):
|
||||
"""
|
||||
|
||||
name: str
|
||||
email: str
|
||||
preferences: Union["UserCreatePreferencesType0", None, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.user_create_preferences_type_0 import UserCreatePreferencesType0
|
||||
|
||||
name = self.name
|
||||
|
||||
email = self.email
|
||||
|
||||
preferences: Union[None, Unset, dict[str, Any]]
|
||||
if isinstance(self.preferences, Unset):
|
||||
preferences = UNSET
|
||||
elif isinstance(self.preferences, UserCreatePreferencesType0):
|
||||
preferences = self.preferences.to_dict()
|
||||
else:
|
||||
preferences = self.preferences
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"name": name,
|
||||
"email": email,
|
||||
}
|
||||
)
|
||||
if preferences is not UNSET:
|
||||
field_dict["preferences"] = preferences
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.user_create_preferences_type_0 import UserCreatePreferencesType0
|
||||
|
||||
d = dict(src_dict)
|
||||
name = d.pop("name")
|
||||
|
||||
email = d.pop("email")
|
||||
|
||||
def _parse_preferences(data: object) -> Union["UserCreatePreferencesType0", None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
preferences_type_0 = UserCreatePreferencesType0.from_dict(data)
|
||||
|
||||
return preferences_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["UserCreatePreferencesType0", None, Unset], data)
|
||||
|
||||
preferences = _parse_preferences(d.pop("preferences", UNSET))
|
||||
|
||||
user_create = cls(
|
||||
name=name,
|
||||
email=email,
|
||||
preferences=preferences,
|
||||
)
|
||||
|
||||
user_create.additional_properties = d
|
||||
return user_create
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="UserCreatePreferencesType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class UserCreatePreferencesType0:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
user_create_preferences_type_0 = cls()
|
||||
|
||||
user_create_preferences_type_0.additional_properties = d
|
||||
return user_create_preferences_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="UserPreferencesType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class UserPreferencesType0:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
user_preferences_type_0 = cls()
|
||||
|
||||
user_preferences_type_0.additional_properties = d
|
||||
return user_preferences_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,129 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.user_update_preferences_type_0 import UserUpdatePreferencesType0
|
||||
|
||||
|
||||
T = TypeVar("T", bound="UserUpdate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class UserUpdate:
|
||||
"""
|
||||
Attributes:
|
||||
name (Union[None, Unset, str]):
|
||||
email (Union[None, Unset, str]):
|
||||
preferences (Union['UserUpdatePreferencesType0', None, Unset]):
|
||||
"""
|
||||
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
email: Union[None, Unset, str] = UNSET
|
||||
preferences: Union["UserUpdatePreferencesType0", None, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.user_update_preferences_type_0 import UserUpdatePreferencesType0
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
email: Union[None, Unset, str]
|
||||
if isinstance(self.email, Unset):
|
||||
email = UNSET
|
||||
else:
|
||||
email = self.email
|
||||
|
||||
preferences: Union[None, Unset, dict[str, Any]]
|
||||
if isinstance(self.preferences, Unset):
|
||||
preferences = UNSET
|
||||
elif isinstance(self.preferences, UserUpdatePreferencesType0):
|
||||
preferences = self.preferences.to_dict()
|
||||
else:
|
||||
preferences = self.preferences
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if email is not UNSET:
|
||||
field_dict["email"] = email
|
||||
if preferences is not UNSET:
|
||||
field_dict["preferences"] = preferences
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.user_update_preferences_type_0 import UserUpdatePreferencesType0
|
||||
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_email(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
email = _parse_email(d.pop("email", UNSET))
|
||||
|
||||
def _parse_preferences(data: object) -> Union["UserUpdatePreferencesType0", None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
preferences_type_0 = UserUpdatePreferencesType0.from_dict(data)
|
||||
|
||||
return preferences_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["UserUpdatePreferencesType0", None, Unset], data)
|
||||
|
||||
preferences = _parse_preferences(d.pop("preferences", UNSET))
|
||||
|
||||
user_update = cls(
|
||||
name=name,
|
||||
email=email,
|
||||
preferences=preferences,
|
||||
)
|
||||
|
||||
user_update.additional_properties = d
|
||||
return user_update
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="UserUpdatePreferencesType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class UserUpdatePreferencesType0:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
user_update_preferences_type_0 = cls()
|
||||
|
||||
user_update_preferences_type_0.additional_properties = d
|
||||
return user_update_preferences_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,88 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="ValidationError")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ValidationError:
|
||||
"""
|
||||
Attributes:
|
||||
loc (list[Union[int, str]]):
|
||||
msg (str):
|
||||
type_ (str):
|
||||
"""
|
||||
|
||||
loc: list[Union[int, str]]
|
||||
msg: str
|
||||
type_: str
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
loc = []
|
||||
for loc_item_data in self.loc:
|
||||
loc_item: Union[int, str]
|
||||
loc_item = loc_item_data
|
||||
loc.append(loc_item)
|
||||
|
||||
msg = self.msg
|
||||
|
||||
type_ = self.type_
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"loc": loc,
|
||||
"msg": msg,
|
||||
"type": type_,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
loc = []
|
||||
_loc = d.pop("loc")
|
||||
for loc_item_data in _loc:
|
||||
|
||||
def _parse_loc_item(data: object) -> Union[int, str]:
|
||||
return cast(Union[int, str], data)
|
||||
|
||||
loc_item = _parse_loc_item(loc_item_data)
|
||||
|
||||
loc.append(loc_item)
|
||||
|
||||
msg = d.pop("msg")
|
||||
|
||||
type_ = d.pop("type")
|
||||
|
||||
validation_error = cls(
|
||||
loc=loc,
|
||||
msg=msg,
|
||||
type_=type_,
|
||||
)
|
||||
|
||||
validation_error.additional_properties = d
|
||||
return validation_error
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,91 @@
|
||||
import datetime
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
from dateutil.parser import isoparse
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.workout_plan_plan_details import WorkoutPlanPlanDetails
|
||||
|
||||
|
||||
T = TypeVar("T", bound="WorkoutPlan")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class WorkoutPlan:
|
||||
"""
|
||||
Attributes:
|
||||
user_id (int):
|
||||
plan_details (WorkoutPlanPlanDetails):
|
||||
id (int):
|
||||
created_at (datetime.datetime):
|
||||
"""
|
||||
|
||||
user_id: int
|
||||
plan_details: "WorkoutPlanPlanDetails"
|
||||
id: int
|
||||
created_at: datetime.datetime
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
user_id = self.user_id
|
||||
|
||||
plan_details = self.plan_details.to_dict()
|
||||
|
||||
id = self.id
|
||||
|
||||
created_at = self.created_at.isoformat()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user_id": user_id,
|
||||
"plan_details": plan_details,
|
||||
"id": id,
|
||||
"created_at": created_at,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.workout_plan_plan_details import WorkoutPlanPlanDetails
|
||||
|
||||
d = dict(src_dict)
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
plan_details = WorkoutPlanPlanDetails.from_dict(d.pop("plan_details"))
|
||||
|
||||
id = d.pop("id")
|
||||
|
||||
created_at = isoparse(d.pop("created_at"))
|
||||
|
||||
workout_plan = cls(
|
||||
user_id=user_id,
|
||||
plan_details=plan_details,
|
||||
id=id,
|
||||
created_at=created_at,
|
||||
)
|
||||
|
||||
workout_plan.additional_properties = d
|
||||
return workout_plan
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,73 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.workout_plan_create_plan_details import WorkoutPlanCreatePlanDetails
|
||||
|
||||
|
||||
T = TypeVar("T", bound="WorkoutPlanCreate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class WorkoutPlanCreate:
|
||||
"""
|
||||
Attributes:
|
||||
user_id (int):
|
||||
plan_details (WorkoutPlanCreatePlanDetails):
|
||||
"""
|
||||
|
||||
user_id: int
|
||||
plan_details: "WorkoutPlanCreatePlanDetails"
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
user_id = self.user_id
|
||||
|
||||
plan_details = self.plan_details.to_dict()
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update(
|
||||
{
|
||||
"user_id": user_id,
|
||||
"plan_details": plan_details,
|
||||
}
|
||||
)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.workout_plan_create_plan_details import WorkoutPlanCreatePlanDetails
|
||||
|
||||
d = dict(src_dict)
|
||||
user_id = d.pop("user_id")
|
||||
|
||||
plan_details = WorkoutPlanCreatePlanDetails.from_dict(d.pop("plan_details"))
|
||||
|
||||
workout_plan_create = cls(
|
||||
user_id=user_id,
|
||||
plan_details=plan_details,
|
||||
)
|
||||
|
||||
workout_plan_create.additional_properties = d
|
||||
return workout_plan_create
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="WorkoutPlanCreatePlanDetails")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class WorkoutPlanCreatePlanDetails:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
workout_plan_create_plan_details = cls()
|
||||
|
||||
workout_plan_create_plan_details.additional_properties = d
|
||||
return workout_plan_create_plan_details
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="WorkoutPlanPlanDetails")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class WorkoutPlanPlanDetails:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
workout_plan_plan_details = cls()
|
||||
|
||||
workout_plan_plan_details.additional_properties = d
|
||||
return workout_plan_plan_details
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,89 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.workout_plan_update_plan_details_type_0 import WorkoutPlanUpdatePlanDetailsType0
|
||||
|
||||
|
||||
T = TypeVar("T", bound="WorkoutPlanUpdate")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class WorkoutPlanUpdate:
|
||||
"""
|
||||
Attributes:
|
||||
plan_details (Union['WorkoutPlanUpdatePlanDetailsType0', None, Unset]):
|
||||
"""
|
||||
|
||||
plan_details: Union["WorkoutPlanUpdatePlanDetailsType0", None, Unset] = UNSET
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
from ..models.workout_plan_update_plan_details_type_0 import WorkoutPlanUpdatePlanDetailsType0
|
||||
|
||||
plan_details: Union[None, Unset, dict[str, Any]]
|
||||
if isinstance(self.plan_details, Unset):
|
||||
plan_details = UNSET
|
||||
elif isinstance(self.plan_details, WorkoutPlanUpdatePlanDetailsType0):
|
||||
plan_details = self.plan_details.to_dict()
|
||||
else:
|
||||
plan_details = self.plan_details
|
||||
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
field_dict.update({})
|
||||
if plan_details is not UNSET:
|
||||
field_dict["plan_details"] = plan_details
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
from ..models.workout_plan_update_plan_details_type_0 import WorkoutPlanUpdatePlanDetailsType0
|
||||
|
||||
d = dict(src_dict)
|
||||
|
||||
def _parse_plan_details(data: object) -> Union["WorkoutPlanUpdatePlanDetailsType0", None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, dict):
|
||||
raise TypeError()
|
||||
plan_details_type_0 = WorkoutPlanUpdatePlanDetailsType0.from_dict(data)
|
||||
|
||||
return plan_details_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union["WorkoutPlanUpdatePlanDetailsType0", None, Unset], data)
|
||||
|
||||
plan_details = _parse_plan_details(d.pop("plan_details", UNSET))
|
||||
|
||||
workout_plan_update = cls(
|
||||
plan_details=plan_details,
|
||||
)
|
||||
|
||||
workout_plan_update.additional_properties = d
|
||||
return workout_plan_update
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1,44 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import Any, TypeVar
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
from attrs import field as _attrs_field
|
||||
|
||||
T = TypeVar("T", bound="WorkoutPlanUpdatePlanDetailsType0")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class WorkoutPlanUpdatePlanDetailsType0:
|
||||
""" """
|
||||
|
||||
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
field_dict: dict[str, Any] = {}
|
||||
field_dict.update(self.additional_properties)
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
||||
d = dict(src_dict)
|
||||
workout_plan_update_plan_details_type_0 = cls()
|
||||
|
||||
workout_plan_update_plan_details_type_0.additional_properties = d
|
||||
return workout_plan_update_plan_details_type_0
|
||||
|
||||
@property
|
||||
def additional_keys(self) -> list[str]:
|
||||
return list(self.additional_properties.keys())
|
||||
|
||||
def __getitem__(self, key: str) -> Any:
|
||||
return self.additional_properties[key]
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
self.additional_properties[key] = value
|
||||
|
||||
def __delitem__(self, key: str) -> None:
|
||||
del self.additional_properties[key]
|
||||
|
||||
def __contains__(self, key: str) -> bool:
|
||||
return key in self.additional_properties
|
||||
@@ -0,0 +1 @@
|
||||
# Marker file for PEP 561
|
||||
@@ -0,0 +1,54 @@
|
||||
"""Contains some shared types for properties"""
|
||||
|
||||
from collections.abc import Mapping, MutableMapping
|
||||
from http import HTTPStatus
|
||||
from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union
|
||||
|
||||
from attrs import define
|
||||
|
||||
|
||||
class Unset:
|
||||
def __bool__(self) -> Literal[False]:
|
||||
return False
|
||||
|
||||
|
||||
UNSET: Unset = Unset()
|
||||
|
||||
# The types that `httpx.Client(files=)` can accept, copied from that library.
|
||||
FileContent = Union[IO[bytes], bytes, str]
|
||||
FileTypes = Union[
|
||||
# (filename, file (or bytes), content_type)
|
||||
tuple[Optional[str], FileContent, Optional[str]],
|
||||
# (filename, file (or bytes), content_type, headers)
|
||||
tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]],
|
||||
]
|
||||
RequestFiles = list[tuple[str, FileTypes]]
|
||||
|
||||
|
||||
@define
|
||||
class File:
|
||||
"""Contains information for file uploads"""
|
||||
|
||||
payload: BinaryIO
|
||||
file_name: Optional[str] = None
|
||||
mime_type: Optional[str] = None
|
||||
|
||||
def to_tuple(self) -> FileTypes:
|
||||
"""Return a tuple representation that httpx will accept for multipart/form-data"""
|
||||
return self.file_name, self.payload, self.mime_type
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@define
|
||||
class Response(Generic[T]):
|
||||
"""A response from an endpoint"""
|
||||
|
||||
status_code: HTTPStatus
|
||||
content: bytes
|
||||
headers: MutableMapping[str, str]
|
||||
parsed: Optional[T]
|
||||
|
||||
|
||||
__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]
|
||||
26
backend/src/central_db_client/pyproject.toml
Normal file
26
backend/src/central_db_client/pyproject.toml
Normal file
@@ -0,0 +1,26 @@
|
||||
[tool.poetry]
|
||||
name = "fit-track-central-db-api-client"
|
||||
version = "1.0.0"
|
||||
description = "A client library for accessing FitTrack CentralDB API"
|
||||
authors = []
|
||||
readme = "README.md"
|
||||
packages = [
|
||||
{ include = "fit_track_central_db_api_client" },
|
||||
]
|
||||
include = ["CHANGELOG.md", "fit_track_central_db_api_client/py.typed"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
httpx = ">=0.23.0,<0.29.0"
|
||||
attrs = ">=22.2.0"
|
||||
python-dateutil = "^2.8.0"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 120
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["F", "I", "UP"]
|
||||
Reference in New Issue
Block a user