Skip to content

gitea.comment

comment

Gitea Comment resource.

Classes

gitea.comment.AsyncComment

AsyncComment(client: AsyncClientProtocol)

Bases: BaseComment, AsyncResource

Asynchronous Gitea Comment 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.comment.AsyncComment.list_comments async
list_comments(
    owner: str,
    repository: str,
    index: int,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List comments on an issue.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
index int

The index of the issue.

required
page int | None

The page number for pagination.

None
limit int | None

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

Source code in src/gitea/comment/async_comment.py
async def list_comments(
    self,
    owner: str,
    repository: str,
    index: int,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List comments on an issue.

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

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

    """
    response = await self._list_comments(
        owner=owner,
        repository=repository,
        index=index,
        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.comment.AsyncComment.create_comment async
create_comment(
    owner: str,
    repository: str,
    index: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Create a comment on an issue.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
index int

The index of the issue.

required
body str

The body of the comment.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/comment/async_comment.py
async def create_comment(
    self,
    owner: str,
    repository: str,
    index: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Create a comment on an issue.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the issue.
        body: The body of the comment.
        **kwargs: Additional arguments for the request.

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

    """
    response = await self._create_comment(
        owner=owner,
        repository=repository,
        index=index,
        body=body,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.comment.AsyncComment.edit_comment async
edit_comment(
    owner: str,
    repository: str,
    comment_id: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Edit a comment.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
comment_id int

The ID of the comment.

required
body str

The new body of the comment.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/comment/async_comment.py
async def edit_comment(
    self,
    owner: str,
    repository: str,
    comment_id: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Edit a comment.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        comment_id: The ID of the comment.
        body: The new body of the comment.
        **kwargs: Additional arguments for the request.

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

    """
    response = await self._edit_comment(
        owner=owner,
        repository=repository,
        comment_id=comment_id,
        body=body,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.comment.AsyncComment.delete_comment async
delete_comment(
    owner: str,
    repository: str,
    comment_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Delete a comment.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
comment_id int

The ID of the comment.

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/comment/async_comment.py
async def delete_comment(
    self,
    owner: str,
    repository: str,
    comment_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Delete a comment.

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

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

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

gitea.comment.Comment

Comment(client: ClientProtocol)

Bases: BaseComment, Resource

Gitea Comment 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.comment.Comment.list_comments
list_comments(
    owner: str,
    repository: str,
    index: int,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List comments on an issue.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
index int

The index of the issue.

required
page int | None

The page number for pagination.

None
limit int | None

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

Source code in src/gitea/comment/comment.py
def list_comments(
    self,
    owner: str,
    repository: str,
    index: int,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List comments on an issue.

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

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

    """
    response = self._list_comments(
        owner=owner,
        repository=repository,
        index=index,
        page=page,
        limit=limit,
        **kwargs,
    )
    data, status_code = process_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.comment.Comment.create_comment
create_comment(
    owner: str,
    repository: str,
    index: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Create a comment on an issue.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
index int

The index of the issue.

required
body str

The body of the comment.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/comment/comment.py
def create_comment(
    self,
    owner: str,
    repository: str,
    index: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Create a comment on an issue.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the issue.
        body: The body of the comment.
        **kwargs: Additional arguments for the request.

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

    """
    response = self._create_comment(
        owner=owner,
        repository=repository,
        index=index,
        body=body,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.comment.Comment.edit_comment
edit_comment(
    owner: str,
    repository: str,
    comment_id: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Edit a comment.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
comment_id int

The ID of the comment.

required
body str

The new body of the comment.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/comment/comment.py
def edit_comment(
    self,
    owner: str,
    repository: str,
    comment_id: int,
    body: str,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Edit a comment.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        comment_id: The ID of the comment.
        body: The new body of the comment.
        **kwargs: Additional arguments for the request.

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

    """
    response = self._edit_comment(
        owner=owner,
        repository=repository,
        comment_id=comment_id,
        body=body,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.comment.Comment.delete_comment
delete_comment(
    owner: str,
    repository: str,
    comment_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Delete a comment.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
comment_id int

The ID of the comment.

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/comment/comment.py
def delete_comment(
    self,
    owner: str,
    repository: str,
    comment_id: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Delete a comment.

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

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

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

Functions:

Modules