Skip to content

gitea.label.async_label

async_label

Asynchronous Gitea Label resource.

Classes

gitea.label.async_label.AsyncLabel

AsyncLabel(client: AsyncClientProtocol)

Bases: BaseLabel, AsyncResource

Asynchronous Gitea Label 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.label.async_label.AsyncLabel.list_labels async
list_labels(
    owner: str,
    repository: str,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List labels in a repository.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
page int | None

The page number for pagination.

None
limit int | None

The number of labels 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 labels as dictionaries and a dictionary with metadata.

Source code in src/gitea/label/async_label.py
async def list_labels(
    self,
    owner: str,
    repository: str,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List labels in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        page: The page number for pagination.
        limit: The number of labels per page.
        **kwargs: Additional arguments for the request.

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

    """
    response = await self._list_labels(
        owner=owner,
        repository=repository,
        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.label.async_label.AsyncLabel.create_label async
create_label(
    owner: str,
    repository: str,
    name: str,
    color: str,
    description: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Create a label in a repository.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
name str

The name of the label.

required
color str

The color of the label in hexadecimal format (e.g. #00aabb).

required
description str | None

The description of the label.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the created label as a dictionary and a dictionary with metadata.

Source code in src/gitea/label/async_label.py
async def create_label(
    self,
    owner: str,
    repository: str,
    name: str,
    color: str,
    description: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Create a label in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        name: The name of the label.
        color: The color of the label in hexadecimal format (e.g. ``#00aabb``).
        description: The description of the label.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the created label as a dictionary and a dictionary with metadata.

    """
    response = await self._create_label(
        owner=owner,
        repository=repository,
        name=name,
        color=color,
        description=description,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.label.async_label.AsyncLabel.edit_label async
edit_label(
    owner: str,
    repository: str,
    label_id: int,
    name: str | None = None,
    color: str | None = None,
    description: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Edit a label.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
label_id int

The ID of the label.

required
name str | None

The new name of the label.

None
color str | None

The new color of the label in hexadecimal format.

None
description str | None

The new description of the label.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the updated label as a dictionary and a dictionary with metadata.

Source code in src/gitea/label/async_label.py
async def edit_label(
    self,
    owner: str,
    repository: str,
    label_id: int,
    name: str | None = None,
    color: str | None = None,
    description: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Edit a label.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        label_id: The ID of the label.
        name: The new name of the label.
        color: The new color of the label in hexadecimal format.
        description: The new description of the label.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the updated label as a dictionary and a dictionary with metadata.

    """
    response = await self._edit_label(
        owner=owner,
        repository=repository,
        label_id=label_id,
        name=name,
        color=color,
        description=description,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.label.async_label.AsyncLabel.delete_label async
delete_label(
    owner: str,
    repository: str,
    label_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Delete a label.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
label_id int

The ID of the label.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing an empty dictionary and a dictionary with metadata.

Source code in src/gitea/label/async_label.py
async def delete_label(
    self,
    owner: str,
    repository: str,
    label_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Delete a label.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        label_id: The ID of the label.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing an empty dictionary and a dictionary with metadata.

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

Functions: