Skip to content

Todo Operations

Operations for managing todos and todo-related data.

API Reference

TodoOperations

TodoOperations(client: Client)

Bases: BaseOperations

Class to handle all operations related to todos.

Note

This class is already initialized via the client and usable as client.todo.method

Methods:

  • list

    List all todos for a specific user or meeting.

  • create

    Create a new todo.

  • complete

    Mark a todo as complete.

  • update

    Update an existing todo.

  • details

    Retrieve the details of a specific todo item by its ID.

  • create_many

    Create multiple todos in a best-effort manner.

Functions

list
list(user_id: int | None = None, meeting_id: int | None = None) -> list[Todo]

List all todos for a specific user or meeting.

Parameters:

  • user_id (int | None, default: None ) –

    The ID of the user (default is the initialized user ID)

  • meeting_id (int | None, default: None ) –

    The ID of the meeting

Returns:

  • list[Todo]

    A list of Todo model instances

Raises:

  • ValueError

    If both user_id and meeting_id are provided

Example
# Fetch todos for the current user
client.todo.list()
# Returns: [Todo(id=1, name='New Todo', due_date='2024-06-15', ...)]
create
create(title: str, meeting_id: int, due_date: str | None = None, user_id: int | None = None, notes: str | None = None) -> Todo

Create a new todo.

Parameters:

  • title (str) –

    The title of the new todo

  • meeting_id (int) –

    The ID of the meeting associated with the todo

  • due_date (str | None, default: None ) –

    The due date of the todo (optional)

  • user_id (int | None, default: None ) –

    The ID of the user responsible for the todo (default: initialized user ID)

  • notes (str | None, default: None ) –

    Additional notes for the todo (optional)

Returns:

  • Todo

    A Todo model instance representing the newly created todo

Example
client.todo.create(
    title="New Todo", meeting_id=1, due_date="2024-06-15"
)
# Returns: Todo(id=1, name='New Todo', due_date='2024-06-15', ...)
complete
complete(todo_id: int) -> bool

Mark a todo as complete.

Parameters:

  • todo_id (int) –

    The ID of the todo to complete

Returns:

  • bool

    True if the operation was successful

Example
client.todo.complete(1)
# Returns: True
update
update(todo_id: int, title: str | None = None, due_date: str | None = None) -> Todo

Update an existing todo.

Parameters:

  • todo_id (int) –

    The ID of the todo to update

  • title (str | None, default: None ) –

    The new title of the todo (optional)

  • due_date (str | None, default: None ) –

    The new due date of the todo (optional)

Returns:

  • Todo

    A Todo model instance containing the updated todo details

Raises:

  • ValueError

    If no update fields are provided

  • RuntimeError

    If the update request fails

Example
client.todo.update(
    todo_id=1, title="Updated Todo", due_date="2024-11-01"
)
# Returns: Todo(id=1, name='Updated Todo', due_date='2024-11-01', ...)
details
details(todo_id: int) -> Todo

Retrieve the details of a specific todo item by its ID.

Parameters:

  • todo_id (int) –

    The ID of the todo item to retrieve

Returns:

  • Todo

    A Todo model instance containing the todo details

Raises:

  • RuntimeError

    If the request to retrieve the todo details fails

Example
client.todo.details(1)
# Returns: Todo(id=1, name='Updated Todo', due_date='2024-11-01', ...)
create_many
create_many(todos: list[dict[str, Any]]) -> BulkCreateResult[Todo]

Create multiple todos in a best-effort manner.

Processes each todo sequentially to avoid rate limiting. Failed operations are captured and returned alongside successful ones.

Parameters:

  • todos (list[dict[str, Any]]) –

    List of dictionaries containing todo data. Each dict should have: - title (required): Title of the todo - meeting_id (required): ID of the associated meeting - due_date (optional): Due date in string format - user_id (optional): ID of the responsible user (defaults to current user) - notes (optional): Additional notes for the todo

Returns:

  • BulkCreateResult[Todo]

    BulkCreateResult containing: - successful: List of Todo instances for successful creations - failed: List of BulkCreateError instances for failed creations

Raises:

  • ValueError

    When required parameters are missing in todo data

Example
result = client.todo.create_many([
    {"title": "Todo 1", "meeting_id": 123, "due_date": "2024-12-31"},
    {"title": "Todo 2", "meeting_id": 123, "user_id": 456}
])

print(f"Created {len(result.successful)} todos")
for error in result.failed:
    print(f"Failed at index {error.index}: {error.error}")

Async Version

The async version AsyncTodoOperations provides the same methods as above, but with async/await support:

AsyncTodoOperations

AsyncTodoOperations(client: AsyncClient)

Async class to handle all operations related to todos.

Note

This class is already initialized via the client and usable as client.todo.method

Initialize the async todo operations.

Parameters:

  • client (AsyncClient) –

    The async HTTP client to use for API requests.

Async Usage

All methods have the same parameters and return types as their sync counterparts. Simply add await before each method call.

Usage Examples

from bloomy import Client

with Client(api_key="your-api-key") as client:
    # List todos for current user
    todos = client.todo.list()
    for todo in todos:
        print(f"{todo.name} - Due: {todo.due_date}")

    # List todos for a specific meeting
    meeting_todos = client.todo.list(meeting_id=123)

    # Create a new todo
    new_todo = client.todo.create(
        title="Review quarterly report",
        meeting_id=123,
        due_date="2024-12-31"
    )

    # Update a todo
    client.todo.update(
        todo_id=new_todo.id,
        title="Review Q4 report",
        due_date="2024-12-15"
    )

    # Mark a todo as complete
    client.todo.complete(todo_id=new_todo.id)

    # Delete a todo
    client.todo.delete(todo_id=new_todo.id)
import asyncio
from bloomy import AsyncClient

async def main():
    async with AsyncClient(api_key="your-api-key") as client:
        # List todos for current user
        todos = await client.todo.list()
        for todo in todos:
            print(f"{todo.name} - Due: {todo.due_date}")

        # List todos for a specific meeting
        meeting_todos = await client.todo.list(meeting_id=123)

        # Create a new todo
        new_todo = await client.todo.create(
            title="Review quarterly report",
            meeting_id=123,
            due_date="2024-12-31"
        )

        # Update a todo
        await client.todo.update(
            todo_id=new_todo.id,
            title="Review Q4 report",
            due_date="2024-12-15"
        )

        # Mark a todo as complete
        await client.todo.complete(todo_id=new_todo.id)

        # Delete a todo
        await client.todo.delete(todo_id=new_todo.id)

asyncio.run(main())

Available Methods

Method Description Parameters
list() Get todos user_id, meeting_id, include_closed
details() Get detailed todo information todo_id
create() Create a new todo title, meeting_id, user_id, due_date
update() Update an existing todo todo_id, title, meeting_id, user_id, due_date
delete() Delete a todo todo_id
complete() Mark a todo as complete todo_id

Filtering

You can filter todos by either user_id or meeting_id, but not both at the same time.