API Reference¶
ToDo
¶
Bases: ToDoCreate
Schema for a to-do item, including a unique identifier.
Source code in backend/example.py
24 25 26 27 28 | |
ToDoCreate
¶
Bases: BaseModel
Schema for creating a new to-do item.
Source code in backend/example.py
16 17 18 19 20 21 22 | |
create_todo(todo)
¶
Create a new to-do item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
todo
|
ToDoCreate
|
The to-do item to be created. |
required |
Returns:
| Type | Description |
|---|---|
|
The newly created to-do item with a unique UUID. |
Source code in backend/example.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
delete_todo(todo_id)
¶
Delete a to-do item by its UUID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
todo_id
|
UUID
|
The unique identifier of the to-do item to delete. |
required |
Returns:
| Type | Description |
|---|---|
|
No content if deletion is successful. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If the to-do item does not exist. |
Source code in backend/example.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
get_all_todos()
¶
Retrieve all to-do items.
Returns:
| Type | Description |
|---|---|
|
A list of all to-do tasks currently stored in memory. |
Source code in backend/example.py
49 50 51 52 53 54 55 56 57 | |
get_todo(todo_id)
¶
Retrieve a single to-do item by its UUID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
todo_id
|
UUID
|
The unique identifier of the to-do item. |
required |
Returns:
| Type | Description |
|---|---|
|
The to-do item matching the given UUID. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If no item with the given UUID is found. |
Source code in backend/example.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
read_root()
¶
Root endpoint for health check or welcome message.
Returns a simple JSON message indicating the API is working.
Source code in backend/example.py
40 41 42 43 44 45 46 47 | |
update_todo(todo_id, updated_todo)
¶
Update an existing to-do item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
todo_id
|
UUID
|
The UUID of the to-do item to update. |
required |
updated_todo
|
ToDoCreate
|
The updated task data. |
required |
Returns:
| Type | Description |
|---|---|
|
The updated to-do item. |
Raises:
| Type | Description |
|---|---|
HTTPException
|
If the to-do item does not exist. |
Source code in backend/example.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |