Skip to content

Todo Operations

Operations for managing todos and todo-related data.

API Reference

TodoOperations

TodoOperations(client: Client)

Bases: BaseOperations, TodoOperationsMixin

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 | None = None, 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 | None, default: None ) –

    The ID of the meeting associated with the todo (optional)

  • 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
# Create a user todo
client.todo.create(
    title="New Todo", due_date="2024-06-15"
)

# Create a meeting todo
client.todo.create(
    title="Meeting Action", meeting_id=1, due_date="2024-06-15"
)
complete
complete(todo_id: int) -> Todo

Mark a todo as complete.

Parameters:

  • todo_id (int) –

    The ID of the todo to complete

Returns:

  • Todo

    A Todo model instance containing the completed todo details

Example
client.todo.complete(1)
# Returns: Todo(id=1, name='Todo', complete=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

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

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

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

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 (returns the completed Todo)
    completed_todo = client.todo.complete(todo_id=new_todo.id)
    print(f"Completed: {completed_todo.name} at {completed_todo.complete_date}")

    # Create multiple todos in bulk
    result = client.todo.create_many([
        {"title": "Todo 1", "meeting_id": 123, "due_date": "2024-12-31"},
        {"title": "Todo 2", "meeting_id": 123, "notes": "Important task"}
    ])
    print(f"Created {len(result.successful)} todos")
    for error in result.failed:
        print(f"Failed at index {error.index}: {error.error}")
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 (returns the completed Todo)
        completed_todo = await client.todo.complete(todo_id=new_todo.id)
        print(f"Completed: {completed_todo.name} at {completed_todo.complete_date}")

        # Create multiple todos concurrently
        result = await client.todo.create_many(
            todos=[
                {"title": "Todo 1", "meeting_id": 123, "due_date": "2024-12-31"},
                {"title": "Todo 2", "meeting_id": 123, "notes": "Important task"}
            ],
            max_concurrent=5  # Control concurrency level
        )
        print(f"Created {len(result.successful)} todos")
        for error in result.failed:
            print(f"Failed at index {error.index}: {error.error}")

asyncio.run(main())

Available Methods

Method Description Parameters
list() Get todos user_id, meeting_id
details() Get detailed todo information todo_id
create() Create a new todo title, meeting_id, user_id, due_date, notes
update() Update an existing todo todo_id, title, due_date
complete() Mark a todo as complete todo_id
create_many() Create multiple todos in bulk todos (sync), todos, max_concurrent (async)

Filtering

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

Bulk Operations

Use create_many() for creating multiple todos efficiently. The sync version processes sequentially to avoid rate limiting, while the async version processes concurrently with configurable concurrency limits.