API Reference for api-service¶
api_service ¶
FastAPI orchestrator service for the Rune platform.
Modules¶
dependencies ¶
Dependency injection for FastAPI endpoints.
Functions¶
get_db ¶
get_db() -> Generator[Session, None, None]
Provide a database session for dependency injection.
Yields:
| Type | Description |
|---|---|
Session
|
Database session that automatically commits or rolls back. |
Source code in services/api-service/src/api_service/dependencies.py
10 11 12 13 14 15 16 17 | |
main ¶
FastAPI application entry point for the API service.
Functions¶
lifespan
async
¶
lifespan(app: FastAPI)
Manage the lifecycle of the FastAPI application.
Source code in services/api-service/src/api_service/main.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
health_check
async
¶
health_check()
Liveness probe - is the service running?
Source code in services/api-service/src/api_service/main.py
62 63 64 65 | |
readiness_check
async
¶
readiness_check(db: Session = Depends(get_db))
Readiness probe - can the service handle requests?
Source code in services/api-service/src/api_service/main.py
68 69 70 71 72 73 74 75 76 77 78 79 80 | |
root
async
¶
root()
Returns a welcome message for the API.
Source code in services/api-service/src/api_service/main.py
83 84 85 86 | |
routers ¶
API router modules for adapters and sessions.
Modules¶
adapters ¶
Adapter management router stubs.
async
¶list_adapters() -> JSONResponse
List all stored adapters.
Returns:
| Type | Description |
|---|---|
JSONResponse
|
JSONResponse with list of adapter records. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
501 while not yet implemented. |
Example
response = client.get("/adapters") response.status_code 200 isinstance(response.json(), list) True 'adapter_id' in response.json()[0] True
Source code in services/api-service/src/api_service/routers/adapters.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
async
¶get_adapter(adapter_id: str) -> JSONResponse
Get adapter by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter_id
|
str
|
Unique identifier for the adapter. |
required |
Returns:
| Type | Description |
|---|---|
JSONResponse
|
JSONResponse with a single adapter record dict. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
404 if adapter not found. |
HTTPException
|
501 while not yet implemented. |
Example
response = client.get("/adapters/test-adapter-123") response.status_code 200 'adapter_id' in response.json() True
Source code in services/api-service/src/api_service/routers/adapters.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
async
¶create_adapter() -> JSONResponse
Store a new adapter.
Returns:
| Type | Description |
|---|---|
JSONResponse
|
JSONResponse with the created adapter record. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
422 if request body is invalid. |
HTTPException
|
501 while not yet implemented. |
Example
body = {"adapter_id": "new-adapter-001", "task_type": "bug-fix"} response = client.post("/adapters", json=body) response.status_code 201 'adapter_id' in response.json() True
Source code in services/api-service/src/api_service/routers/adapters.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
sessions ¶
Coding session router stubs.
async
¶list_sessions() -> JSONResponse
List coding sessions.
Returns:
| Type | Description |
|---|---|
JSONResponse
|
JSONResponse with list of coding session records. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
501 while not yet implemented. |
Example
response = client.get("/sessions") response.status_code 200 isinstance(response.json(), list) True 'session_id' in response.json()[0] True
Source code in services/api-service/src/api_service/routers/sessions.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
async
¶get_session(session_id: str) -> JSONResponse
Get coding session by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_id
|
str
|
Unique identifier for the coding session. |
required |
Returns:
| Type | Description |
|---|---|
JSONResponse
|
JSONResponse with a single coding session record dict. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
404 if session not found. |
HTTPException
|
501 while not yet implemented. |
Example
response = client.get("/sessions/test-session-456") response.status_code 200 'session_id' in response.json() True
Source code in services/api-service/src/api_service/routers/sessions.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
async
¶create_session() -> JSONResponse
Create a new coding session.
Returns:
| Type | Description |
|---|---|
JSONResponse
|
JSONResponse with the created coding session record. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
422 if request body is invalid. |
HTTPException
|
501 while not yet implemented. |
Example
body = {"session_id": "new-session-001", "task_type": "bug-fix"} response = client.post("/sessions", json=body) response.status_code 201 'session_id' in response.json() True
Source code in services/api-service/src/api_service/routers/sessions.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
storage ¶
Database storage configuration.