Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

Thrive (codenamed Jupiter) is a life planning tool with a monorepo containing:

| Service | Port | Tech |
|---|---|---|
| **WebAPI** (backend) | 8004 | Python/FastAPI, SQLite |
| **Public API** | 8020 | Python/FastAPI (proxies to WebAPI) |
| **WebUI** (frontend) | 10020 | TypeScript/Remix/React |
| **Docs** | 8000 | Python/MkDocs |
| Service | Tech |
|---|---|
| **WebAPI** (backend) | Python/FastAPI, SQLite |
| **WebUI** (frontend) | TypeScript/Remix/React |
| **API** | Python/FastAPI |
| **MCP** | Python/FastAPI |
| **Docs** | Python/MkDocs |

### Tool versions

Expand All @@ -26,7 +27,7 @@ mise run prepare

### Running services

Start all 4 services (WebAPI, API, WebUI, Docs) via mise:
Start all 5 services (WebAPI, API, MCP, WebUI, Docs) via mise:

```bash
mise run run:srv --instance <instance-name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Contains endpoint functions for accessing the API"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
from http import HTTPStatus
from typing import Any

import httpx

from ... import errors
from ...client import AuthenticatedClient, Client
from ...models.error_response import ErrorResponse
from ...models.get_entity_mutation_history_args import GetEntityMutationHistoryArgs
from ...models.get_entity_mutation_history_result import GetEntityMutationHistoryResult
from ...types import UNSET, Response, Unset


def _get_kwargs(
*,
body: GetEntityMutationHistoryArgs | Unset = UNSET,
) -> dict[str, Any]:
headers: dict[str, Any] = {}

_kwargs: dict[str, Any] = {
"method": "post",
"url": "/get-entity-mutation-history",
}

if not isinstance(body, Unset):
_kwargs["json"] = body.to_dict()

headers["Content-Type"] = "application/json"

_kwargs["headers"] = headers
return _kwargs


def _parse_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> ErrorResponse | GetEntityMutationHistoryResult | None:
if response.status_code == 200:
response_200 = GetEntityMutationHistoryResult.from_dict(response.json())

return response_200

if response.status_code == 400:
response_400 = ErrorResponse.from_dict(response.json())

return response_400

if response.status_code == 401:
response_401 = ErrorResponse.from_dict(response.json())

return response_401

if response.status_code == 404:
response_404 = ErrorResponse.from_dict(response.json())

return response_404

if response.status_code == 406:
response_406 = ErrorResponse.from_dict(response.json())

return response_406

if response.status_code == 409:
response_409 = ErrorResponse.from_dict(response.json())

return response_409

if response.status_code == 410:
response_410 = ErrorResponse.from_dict(response.json())

return response_410

if response.status_code == 422:
response_422 = ErrorResponse.from_dict(response.json())

return response_422

if response.status_code == 426:
response_426 = ErrorResponse.from_dict(response.json())

return response_426

if client.raise_on_unexpected_status:
raise errors.UnexpectedStatus(response.status_code, response.content)
else:
return None


def _build_response(
*, client: AuthenticatedClient | Client, response: httpx.Response
) -> Response[ErrorResponse | GetEntityMutationHistoryResult]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
)


def sync_detailed(
*,
client: AuthenticatedClient,
body: GetEntityMutationHistoryArgs | Unset = UNSET,
) -> Response[ErrorResponse | GetEntityMutationHistoryResult]:
"""Use case for loading the history of mutations for an entity.

Args:
body (GetEntityMutationHistoryArgs | Unset): Arguments for the entity mutation history.

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[ErrorResponse | GetEntityMutationHistoryResult]
"""

kwargs = _get_kwargs(
body=body,
)

response = client.get_httpx_client().request(
**kwargs,
)

return _build_response(client=client, response=response)


def sync(
*,
client: AuthenticatedClient,
body: GetEntityMutationHistoryArgs | Unset = UNSET,
) -> ErrorResponse | GetEntityMutationHistoryResult | None:
"""Use case for loading the history of mutations for an entity.

Args:
body (GetEntityMutationHistoryArgs | Unset): Arguments for the entity mutation history.

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:
ErrorResponse | GetEntityMutationHistoryResult
"""

return sync_detailed(
client=client,
body=body,
).parsed


async def asyncio_detailed(
*,
client: AuthenticatedClient,
body: GetEntityMutationHistoryArgs | Unset = UNSET,
) -> Response[ErrorResponse | GetEntityMutationHistoryResult]:
"""Use case for loading the history of mutations for an entity.

Args:
body (GetEntityMutationHistoryArgs | Unset): Arguments for the entity mutation history.

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[ErrorResponse | GetEntityMutationHistoryResult]
"""

kwargs = _get_kwargs(
body=body,
)

response = await client.get_async_httpx_client().request(**kwargs)

return _build_response(client=client, response=response)


async def asyncio(
*,
client: AuthenticatedClient,
body: GetEntityMutationHistoryArgs | Unset = UNSET,
) -> ErrorResponse | GetEntityMutationHistoryResult | None:
"""Use case for loading the history of mutations for an entity.

Args:
body (GetEntityMutationHistoryArgs | Unset): Arguments for the entity mutation history.

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:
ErrorResponse | GetEntityMutationHistoryResult
"""

return (
await asyncio_detailed(
client=client,
body=body,
)
).parsed
Loading