Skip to content

gitea.notification

notification

Gitea Notification resource.

Classes

gitea.notification.AsyncNotification

AsyncNotification(client: AsyncClientProtocol)

Bases: BaseNotification, AsyncResource

Asynchronous Gitea Notification resource.

Source code in src/gitea/resource/async_resource.py
def __init__(self, client: AsyncClientProtocol) -> None:
    """Initialize the Resource with a AsyncGitea client.

    Args:
        client: An instance of the AsyncGitea client.

    """
    self.client = client
Methods:
gitea.notification.AsyncNotification.list_notifications async
list_notifications(
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List the authenticated user's notifications.

Parameters:

Name Type Description Default
all_notifications bool | None

If true, show notifications marked as read.

None
status_types list[str] | None

Show notifications with the provided status types.

None
subject_type list[str] | None

Filter notifications by subject type.

None
since datetime | None

Only show notifications updated after the given time.

None
before datetime | None

Only show notifications updated before the given time.

None
page int | None

The page number for pagination.

None
limit int | None

The number of notifications per page.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def list_notifications(
    self,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List the authenticated user's notifications.

    Args:
        all_notifications: If true, show notifications marked as read.
        status_types: Show notifications with the provided status types.
        subject_type: Filter notifications by subject type.
        since: Only show notifications updated after the given time.
        before: Only show notifications updated before the given time.
        page: The page number for pagination.
        limit: The number of notifications per page.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

    """
    response = await self._list_notifications(
        all_notifications=all_notifications,
        status_types=status_types,
        subject_type=subject_type,
        since=since,
        before=before,
        page=page,
        limit=limit,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.AsyncNotification.list_repo_notifications async
list_repo_notifications(
    owner: str,
    repository: str,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List a repository's notifications.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
all_notifications bool | None

If true, show notifications marked as read.

None
status_types list[str] | None

Show notifications with the provided status types.

None
subject_type list[str] | None

Filter notifications by subject type.

None
since datetime | None

Only show notifications updated after the given time.

None
before datetime | None

Only show notifications updated before the given time.

None
page int | None

The page number for pagination.

None
limit int | None

The number of notifications per page.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def list_repo_notifications(
    self,
    owner: str,
    repository: str,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List a repository's notifications.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        all_notifications: If true, show notifications marked as read.
        status_types: Show notifications with the provided status types.
        subject_type: Filter notifications by subject type.
        since: Only show notifications updated after the given time.
        before: Only show notifications updated before the given time.
        page: The page number for pagination.
        limit: The number of notifications per page.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

    """
    response = await self._list_repo_notifications(
        owner=owner,
        repository=repository,
        all_notifications=all_notifications,
        status_types=status_types,
        subject_type=subject_type,
        since=since,
        before=before,
        page=page,
        limit=limit,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.AsyncNotification.read_notifications async
read_notifications(
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

Mark notifications as read.

Parameters:

Name Type Description Default
last_read_at datetime | None

Describes the last point that notifications were checked.

None
all_notifications bool | None

If true, mark all notifications on this repo.

None
status_types list[str] | None

Mark notifications with the provided status types as read.

None
to_status str | None

Status to mark notifications as.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def read_notifications(
    self,
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """Mark notifications as read.

    Args:
        last_read_at: Describes the last point that notifications were checked.
        all_notifications: If true, mark all notifications on this repo.
        status_types: Mark notifications with the provided status types as read.
        to_status: Status to mark notifications as.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

    """
    response = await self._read_notifications(
        last_read_at=last_read_at,
        all_notifications=all_notifications,
        status_types=status_types,
        to_status=to_status,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.AsyncNotification.read_repo_notifications async
read_repo_notifications(
    owner: str,
    repository: str,
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

Mark a repository's notifications as read.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
last_read_at datetime | None

Describes the last point that notifications were checked.

None
all_notifications bool | None

If true, mark all notifications on this repo.

None
status_types list[str] | None

Mark notifications with the provided status types as read.

None
to_status str | None

Status to mark notifications as.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def read_repo_notifications(
    self,
    owner: str,
    repository: str,
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """Mark a repository's notifications as read.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        last_read_at: Describes the last point that notifications were checked.
        all_notifications: If true, mark all notifications on this repo.
        status_types: Mark notifications with the provided status types as read.
        to_status: Status to mark notifications as.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

    """
    response = await self._read_repo_notifications(
        owner=owner,
        repository=repository,
        last_read_at=last_read_at,
        all_notifications=all_notifications,
        status_types=status_types,
        to_status=to_status,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.AsyncNotification.get_notification_thread async
get_notification_thread(
    thread_id: int, **kwargs: Any
) -> tuple[dict[str, Any], dict[str, Any]]

Get a notification thread.

Parameters:

Name Type Description Default
thread_id int

The ID of the notification thread.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing the notification thread as a dictionary and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def get_notification_thread(
    self,
    thread_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Get a notification thread.

    Args:
        thread_id: The ID of the notification thread.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the notification thread as a dictionary and a dictionary with metadata.

    """
    response = await self._get_notification_thread(thread_id=thread_id, **kwargs)
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.notification.AsyncNotification.read_notification_thread async
read_notification_thread(
    thread_id: int,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Mark a notification thread.

Parameters:

Name Type Description Default
thread_id int

The ID of the notification thread.

required
to_status str | None

Status to mark notifications as.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing the notification thread as a dictionary and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def read_notification_thread(
    self,
    thread_id: int,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Mark a notification thread.

    Args:
        thread_id: The ID of the notification thread.
        to_status: Status to mark notifications as.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the notification thread as a dictionary and a dictionary with metadata.

    """
    response = await self._read_notification_thread(
        thread_id=thread_id,
        to_status=to_status,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.notification.AsyncNotification.new_notifications async
new_notifications(
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Count new notifications.

Parameters:

Name Type Description Default
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing the new notification count as a dictionary and a dictionary with metadata.

Source code in src/gitea/notification/async_notification.py
async def new_notifications(
    self,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Count new notifications.

    Args:
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the new notification count as a dictionary and a dictionary with metadata.

    """
    response = await self._new_notifications(**kwargs)
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}

gitea.notification.Notification

Notification(client: ClientProtocol)

Bases: BaseNotification, Resource

Gitea Notification resource.

Source code in src/gitea/resource/resource.py
def __init__(self, client: ClientProtocol) -> None:
    """Initialize the Resource with a Gitea client.

    Args:
        client: An instance of the Gitea client.

    """
    self.client = client
Methods:
gitea.notification.Notification.list_notifications
list_notifications(
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List the authenticated user's notifications.

Parameters:

Name Type Description Default
all_notifications bool | None

If true, show notifications marked as read.

None
status_types list[str] | None

Show notifications with the provided status types.

None
subject_type list[str] | None

Filter notifications by subject type.

None
since datetime | None

Only show notifications updated after the given time.

None
before datetime | None

Only show notifications updated before the given time.

None
page int | None

The page number for pagination.

None
limit int | None

The number of notifications per page.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def list_notifications(
    self,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List the authenticated user's notifications.

    Args:
        all_notifications: If true, show notifications marked as read.
        status_types: Show notifications with the provided status types.
        subject_type: Filter notifications by subject type.
        since: Only show notifications updated after the given time.
        before: Only show notifications updated before the given time.
        page: The page number for pagination.
        limit: The number of notifications per page.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

    """
    response = self._list_notifications(
        all_notifications=all_notifications,
        status_types=status_types,
        subject_type=subject_type,
        since=since,
        before=before,
        page=page,
        limit=limit,
        **kwargs,
    )
    data, status_code = process_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.Notification.list_repo_notifications
list_repo_notifications(
    owner: str,
    repository: str,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List a repository's notifications.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
all_notifications bool | None

If true, show notifications marked as read.

None
status_types list[str] | None

Show notifications with the provided status types.

None
subject_type list[str] | None

Filter notifications by subject type.

None
since datetime | None

Only show notifications updated after the given time.

None
before datetime | None

Only show notifications updated before the given time.

None
page int | None

The page number for pagination.

None
limit int | None

The number of notifications per page.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def list_repo_notifications(
    self,
    owner: str,
    repository: str,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    subject_type: list[str] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List a repository's notifications.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        all_notifications: If true, show notifications marked as read.
        status_types: Show notifications with the provided status types.
        subject_type: Filter notifications by subject type.
        since: Only show notifications updated after the given time.
        before: Only show notifications updated before the given time.
        page: The page number for pagination.
        limit: The number of notifications per page.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing a list of notifications as dictionaries and a dictionary with metadata.

    """
    response = self._list_repo_notifications(
        owner=owner,
        repository=repository,
        all_notifications=all_notifications,
        status_types=status_types,
        subject_type=subject_type,
        since=since,
        before=before,
        page=page,
        limit=limit,
        **kwargs,
    )
    data, status_code = process_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.Notification.read_notifications
read_notifications(
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

Mark notifications as read.

Parameters:

Name Type Description Default
last_read_at datetime | None

Describes the last point that notifications were checked.

None
all_notifications bool | None

If true, mark all notifications on this repo.

None
status_types list[str] | None

Mark notifications with the provided status types as read.

None
to_status str | None

Status to mark notifications as.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def read_notifications(
    self,
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """Mark notifications as read.

    Args:
        last_read_at: Describes the last point that notifications were checked.
        all_notifications: If true, mark all notifications on this repo.
        status_types: Mark notifications with the provided status types as read.
        to_status: Status to mark notifications as.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

    """
    response = self._read_notifications(
        last_read_at=last_read_at,
        all_notifications=all_notifications,
        status_types=status_types,
        to_status=to_status,
        **kwargs,
    )
    data, status_code = process_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.Notification.read_repo_notifications
read_repo_notifications(
    owner: str,
    repository: str,
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

Mark a repository's notifications as read.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
last_read_at datetime | None

Describes the last point that notifications were checked.

None
all_notifications bool | None

If true, mark all notifications on this repo.

None
status_types list[str] | None

Mark notifications with the provided status types as read.

None
to_status str | None

Status to mark notifications as.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[list[dict[str, Any]], dict[str, Any]]

A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def read_repo_notifications(
    self,
    owner: str,
    repository: str,
    last_read_at: datetime | None = None,
    all_notifications: bool | None = None,
    status_types: list[str] | None = None,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """Mark a repository's notifications as read.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        last_read_at: Describes the last point that notifications were checked.
        all_notifications: If true, mark all notifications on this repo.
        status_types: Mark notifications with the provided status types as read.
        to_status: Status to mark notifications as.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the changed notification threads as a list of dictionaries and a dictionary with metadata.

    """
    response = self._read_repo_notifications(
        owner=owner,
        repository=repository,
        last_read_at=last_read_at,
        all_notifications=all_notifications,
        status_types=status_types,
        to_status=to_status,
        **kwargs,
    )
    data, status_code = process_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.notification.Notification.get_notification_thread
get_notification_thread(
    thread_id: int, **kwargs: Any
) -> tuple[dict[str, Any], dict[str, Any]]

Get a notification thread.

Parameters:

Name Type Description Default
thread_id int

The ID of the notification thread.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing the notification thread as a dictionary and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def get_notification_thread(
    self,
    thread_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Get a notification thread.

    Args:
        thread_id: The ID of the notification thread.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the notification thread as a dictionary and a dictionary with metadata.

    """
    response = self._get_notification_thread(thread_id=thread_id, **kwargs)
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.notification.Notification.read_notification_thread
read_notification_thread(
    thread_id: int,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Mark a notification thread.

Parameters:

Name Type Description Default
thread_id int

The ID of the notification thread.

required
to_status str | None

Status to mark notifications as.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing the notification thread as a dictionary and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def read_notification_thread(
    self,
    thread_id: int,
    to_status: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Mark a notification thread.

    Args:
        thread_id: The ID of the notification thread.
        to_status: Status to mark notifications as.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the notification thread as a dictionary and a dictionary with metadata.

    """
    response = self._read_notification_thread(
        thread_id=thread_id,
        to_status=to_status,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.notification.Notification.new_notifications
new_notifications(
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Count new notifications.

Parameters:

Name Type Description Default
**kwargs Any

Additional arguments for the request.

{}

Returns:

Type Description
tuple[dict[str, Any], dict[str, Any]]

A tuple containing the new notification count as a dictionary and a dictionary with metadata.

Source code in src/gitea/notification/notification.py
def new_notifications(
    self,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Count new notifications.

    Args:
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the new notification count as a dictionary and a dictionary with metadata.

    """
    response = self._new_notifications(**kwargs)
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}

Functions:

Modules