Skip to content

gitea.issue

issue

Gitea Issue resource.

Classes

gitea.issue.AsyncIssue

AsyncIssue(client: AsyncClientProtocol)

Bases: BaseIssue, AsyncResource

Asynchronous Gitea Issue 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.issue.AsyncIssue.list_issues async
list_issues(
    owner: str,
    repository: str,
    state: Literal["closed", "open", "all"] | None = None,
    labels: list[str] | None = None,
    search_string: str | None = None,
    issue_type: Literal["issues", "pulls"] | None = None,
    milestones: list[str] | list[int] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    created_by: str | None = None,
    assigned_by: str | None = None,
    mentioned_by: str | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List issues in a repository.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
state Literal['closed', 'open', 'all'] | None

Filter issues by state.

None
labels list[str] | None

Filter issues by labels.

None
search_string str | None

Filter issues by search string.

None
issue_type Literal['issues', 'pulls'] | None

Filter by issue type.

None
milestones list[str] | list[int] | None

Filter issues by milestones.

None
since datetime | None

Filter issues updated since this time.

None
before datetime | None

Filter issues updated before this time.

None
created_by str | None

Filter issues created by this user.

None
assigned_by str | None

Filter issues assigned to this user.

None
mentioned_by str | None

Filter issues mentioning this user.

None
page int | None

The page number for pagination.

None
limit int | None

The number of issues per page.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the list of issues as a list of dictionaries and the status code.

Source code in src/gitea/issue/async_issue.py
async def list_issues(
    self,
    owner: str,
    repository: str,
    state: Literal["closed", "open", "all"] | None = None,
    labels: list[str] | None = None,
    search_string: str | None = None,
    issue_type: Literal["issues", "pulls"] | None = None,
    milestones: list[str] | list[int] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    created_by: str | None = None,
    assigned_by: str | None = None,
    mentioned_by: str | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List issues in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        state: Filter issues by state.
        labels: Filter issues by labels.
        search_string: Filter issues by search string.
        issue_type: Filter by issue type.
        milestones: Filter issues by milestones.
        since: Filter issues updated since this time.
        before: Filter issues updated before this time.
        created_by: Filter issues created by this user.
        assigned_by: Filter issues assigned to this user.
        mentioned_by: Filter issues mentioning this user.
        page: The page number for pagination.
        limit: The number of issues per page.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the list of issues as a list of dictionaries and the status code.

    """
    response = await self._list_issues(
        owner=owner,
        repository=repository,
        state=state,
        labels=labels,
        search_string=search_string,
        issue_type=issue_type,
        milestones=milestones,
        since=since,
        before=before,
        created_by=created_by,
        assigned_by=assigned_by,
        mentioned_by=mentioned_by,
        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.issue.AsyncIssue.get_issue async
get_issue(
    owner: str, repository: str, index: int, **kwargs: Any
) -> tuple[dict[str, Any], dict[str, Any]]

Get a single issue by its index.

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
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the issue as a dictionary and the status code.

Source code in src/gitea/issue/async_issue.py
async def get_issue(
    self, owner: str, repository: str, index: int, **kwargs: Any
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Get a single issue by its index.

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

    Returns:
        A tuple containing the issue as a dictionary and the status code.

    """
    response = await self._get_issue(owner=owner, repository=repository, index=index, **kwargs)
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.AsyncIssue.edit_issue async
edit_issue(
    owner: str,
    repository: str,
    index: int,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    state: Literal["closed", "open"] | None = None,
    title: str | None = None,
    unset_due_date: bool | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Edit a specific issue in a repository.

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
assignee str | None

The new assignee of the issue.

None
assignees list[str] | None

The new assignees of the issue.

None
body str | None

The new body of the issue.

None
due_date datetime | None

The new due date of the issue.

None
milestone int | None

The new milestone of the issue.

None
ref str | None

The new reference of the issue.

None
state Literal['closed', 'open'] | None

The new state of the issue.

None
title str | None

The new title of the issue.

None
unset_due_date bool | None

Whether to unset the due date of the issue.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the edited issue as a dictionary and the status code.

Source code in src/gitea/issue/async_issue.py
async def edit_issue(
    self,
    owner: str,
    repository: str,
    index: int,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    state: Literal["closed", "open"] | None = None,
    title: str | None = None,
    unset_due_date: bool | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Edit a specific issue in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the issue.
        assignee: The new assignee of the issue.
        assignees: The new assignees of the issue.
        body: The new body of the issue.
        due_date: The new due date of the issue.
        milestone: The new milestone of the issue.
        ref: The new reference of the issue.
        state: The new state of the issue.
        title: The new title of the issue.
        unset_due_date: Whether to unset the due date of the issue.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the edited issue as a dictionary and the status code.

    """
    response = await self._edit_issue(
        owner=owner,
        repository=repository,
        index=index,
        assignee=assignee,
        assignees=assignees,
        body=body,
        due_date=due_date,
        milestone=milestone,
        ref=ref,
        state=state,
        title=title,
        unset_due_date=unset_due_date,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.AsyncIssue.create_issue async
create_issue(
    owner: str,
    repository: str,
    title: str,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    closed: bool | None = None,
    due_date: datetime | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Create an issue in a repository.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
title str

The title of the new issue.

required
assignee str | None

The username to assign the issue to.

None
assignees list[str] | None

The usernames to assign the issue to.

None
body str | None

The body of the new issue.

None
closed bool | None

Whether the issue is created closed.

None
due_date datetime | None

The due date of the new issue.

None
labels list[int] | None

The label IDs to apply to the new issue.

None
milestone int | None

The milestone ID to associate with the new issue.

None
ref str | None

The reference of the new issue.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/issue/async_issue.py
async def create_issue(
    self,
    owner: str,
    repository: str,
    title: str,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    closed: bool | None = None,
    due_date: datetime | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Create an issue in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        title: The title of the new issue.
        assignee: The username to assign the issue to.
        assignees: The usernames to assign the issue to.
        body: The body of the new issue.
        closed: Whether the issue is created closed.
        due_date: The due date of the new issue.
        labels: The label IDs to apply to the new issue.
        milestone: The milestone ID to associate with the new issue.
        ref: The reference of the new issue.
        **kwargs: Additional arguments for the request.

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

    """
    response = await self._create_issue(
        owner=owner,
        repository=repository,
        title=title,
        assignee=assignee,
        assignees=assignees,
        body=body,
        closed=closed,
        due_date=due_date,
        labels=labels,
        milestone=milestone,
        ref=ref,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.AsyncIssue.list_issue_dependencies async
list_issue_dependencies(
    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 an issue's dependencies.

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 dependencies 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 dependency issues as dictionaries and a dictionary with metadata.

Source code in src/gitea/issue/async_issue.py
async def list_issue_dependencies(
    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 an issue's dependencies.

    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 dependencies per page.
        **kwargs: Additional arguments for the request.

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

    """
    response = await self._list_issue_dependencies(
        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.issue.AsyncIssue.create_issue_dependency async
create_issue_dependency(
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Make an issue depend on another 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 target issue.

required
dependency_owner str

The owner of the dependency issue's repository.

required
dependency_repository str

The name of the dependency issue's repository.

required
dependency_index int

The index of the dependency issue.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the target issue as a dictionary and a dictionary with metadata.

Source code in src/gitea/issue/async_issue.py
async def create_issue_dependency(
    self,
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Make an issue depend on another issue.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the target issue.
        dependency_owner: The owner of the dependency issue's repository.
        dependency_repository: The name of the dependency issue's repository.
        dependency_index: The index of the dependency issue.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the target issue as a dictionary and a dictionary with metadata.

    """
    response = await self._create_issue_dependency(
        owner=owner,
        repository=repository,
        index=index,
        dependency_owner=dependency_owner,
        dependency_repository=dependency_repository,
        dependency_index=dependency_index,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.AsyncIssue.remove_issue_dependency async
remove_issue_dependency(
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Remove an issue dependency.

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 target issue.

required
dependency_owner str

The owner of the dependency issue's repository.

required
dependency_repository str

The name of the dependency issue's repository.

required
dependency_index int

The index of the dependency issue.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the target issue as a dictionary and a dictionary with metadata.

Source code in src/gitea/issue/async_issue.py
async def remove_issue_dependency(
    self,
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Remove an issue dependency.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the target issue.
        dependency_owner: The owner of the dependency issue's repository.
        dependency_repository: The name of the dependency issue's repository.
        dependency_index: The index of the dependency issue.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the target issue as a dictionary and a dictionary with metadata.

    """
    response = await self._remove_issue_dependency(
        owner=owner,
        repository=repository,
        index=index,
        dependency_owner=dependency_owner,
        dependency_repository=dependency_repository,
        dependency_index=dependency_index,
        **kwargs,
    )
    data, status_code = await process_async_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}

gitea.issue.Issue

Issue(client: ClientProtocol)

Bases: BaseIssue, Resource

Gitea Issue 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.issue.Issue.list_issues
list_issues(
    owner: str,
    repository: str,
    state: Literal["closed", "open", "all"] | None = None,
    labels: list[str] | None = None,
    search_string: str | None = None,
    issue_type: Literal["issues", "pulls"] | None = None,
    milestones: list[str] | list[int] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    created_by: str | None = None,
    assigned_by: str | None = None,
    mentioned_by: str | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]

List issues in a repository.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
state Literal['closed', 'open', 'all'] | None

Filter issues by state.

None
labels list[str] | None

Filter issues by labels.

None
search_string str | None

Filter issues by search string.

None
issue_type Literal['issues', 'pulls'] | None

Filter by issue type.

None
milestones list[str] | list[int] | None

Filter issues by milestones.

None
since datetime | None

Filter issues updated since this time.

None
before datetime | None

Filter issues updated before this time.

None
created_by str | None

Filter issues created by this user.

None
assigned_by str | None

Filter issues assigned to this user.

None
mentioned_by str | None

Filter issues mentioning this user.

None
page int | None

The page number for pagination.

None
limit int | None

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

Source code in src/gitea/issue/issue.py
def list_issues(
    self,
    owner: str,
    repository: str,
    state: Literal["closed", "open", "all"] | None = None,
    labels: list[str] | None = None,
    search_string: str | None = None,
    issue_type: Literal["issues", "pulls"] | None = None,
    milestones: list[str] | list[int] | None = None,
    since: datetime | None = None,
    before: datetime | None = None,
    created_by: str | None = None,
    assigned_by: str | None = None,
    mentioned_by: str | None = None,
    page: int | None = None,
    limit: int | None = None,
    **kwargs: Any,
) -> tuple[list[dict[str, Any]], dict[str, Any]]:
    """List issues in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        state: Filter issues by state.
        labels: Filter issues by labels.
        search_string: Filter issues by search string.
        issue_type: Filter by issue type.
        milestones: Filter issues by milestones.
        since: Filter issues updated since this time.
        before: Filter issues updated before this time.
        created_by: Filter issues created by this user.
        assigned_by: Filter issues assigned to this user.
        mentioned_by: Filter issues mentioning this user.
        page: The page number for pagination.
        limit: The number of issues per page.
        **kwargs: Additional arguments for the request.

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

    """
    response = self._list_issues(
        owner=owner,
        repository=repository,
        state=state,
        labels=labels,
        search_string=search_string,
        issue_type=issue_type,
        milestones=milestones,
        since=since,
        before=before,
        created_by=created_by,
        assigned_by=assigned_by,
        mentioned_by=mentioned_by,
        page=page,
        limit=limit,
        **kwargs,
    )
    data, status_code = process_response(response, default=[])
    return cast(list[dict[str, Any]], data), {"status_code": status_code}
gitea.issue.Issue.get_issue
get_issue(
    owner: str, repository: str, index: int, **kwargs: Any
) -> tuple[dict[str, Any], dict[str, Any]]

Get a single issue by its index.

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
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the issue as a dictionary and a dictionary with metadata.

Source code in src/gitea/issue/issue.py
def get_issue(
    self, owner: str, repository: str, index: int, **kwargs: Any
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Get a single issue by its index.

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

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

    """
    response = self._get_issue(owner=owner, repository=repository, index=index, **kwargs)
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.Issue.edit_issue
edit_issue(
    owner: str,
    repository: str,
    index: int,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    state: Literal["closed", "open"] | None = None,
    title: str | None = None,
    unset_due_date: bool | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Edit a specific issue in a repository.

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
assignee str | None

The new assignee of the issue.

None
assignees list[str] | None

The new assignees of the issue.

None
body str | None

The new body of the issue.

None
due_date datetime | None

The new due date of the issue.

None
milestone int | None

The new milestone of the issue.

None
ref str | None

The new reference of the issue.

None
state Literal['closed', 'open'] | None

The new state of the issue.

None
title str | None

The new title of the issue.

None
unset_due_date bool | None

Whether to unset the due date of the issue.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/issue/issue.py
def edit_issue(
    self,
    owner: str,
    repository: str,
    index: int,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    due_date: datetime | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    state: Literal["closed", "open"] | None = None,
    title: str | None = None,
    unset_due_date: bool | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Edit a specific issue in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the issue.
        assignee: The new assignee of the issue.
        assignees: The new assignees of the issue.
        body: The new body of the issue.
        due_date: The new due date of the issue.
        milestone: The new milestone of the issue.
        ref: The new reference of the issue.
        state: The new state of the issue.
        title: The new title of the issue.
        unset_due_date: Whether to unset the due date of the issue.
        **kwargs: Additional arguments for the request.

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

    """
    response = self._edit_issue(
        owner=owner,
        repository=repository,
        index=index,
        assignee=assignee,
        assignees=assignees,
        body=body,
        due_date=due_date,
        milestone=milestone,
        ref=ref,
        state=state,
        title=title,
        unset_due_date=unset_due_date,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.Issue.create_issue
create_issue(
    owner: str,
    repository: str,
    title: str,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    closed: bool | None = None,
    due_date: datetime | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Create an issue in a repository.

Parameters:

Name Type Description Default
owner str

The owner of the repository.

required
repository str

The name of the repository.

required
title str

The title of the new issue.

required
assignee str | None

The username to assign the issue to.

None
assignees list[str] | None

The usernames to assign the issue to.

None
body str | None

The body of the new issue.

None
closed bool | None

Whether the issue is created closed.

None
due_date datetime | None

The due date of the new issue.

None
labels list[int] | None

The label IDs to apply to the new issue.

None
milestone int | None

The milestone ID to associate with the new issue.

None
ref str | None

The reference of the new issue.

None
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

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

Source code in src/gitea/issue/issue.py
def create_issue(
    self,
    owner: str,
    repository: str,
    title: str,
    assignee: str | None = None,
    assignees: list[str] | None = None,
    body: str | None = None,
    closed: bool | None = None,
    due_date: datetime | None = None,
    labels: list[int] | None = None,
    milestone: int | None = None,
    ref: str | None = None,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Create an issue in a repository.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        title: The title of the new issue.
        assignee: The username to assign the issue to.
        assignees: The usernames to assign the issue to.
        body: The body of the new issue.
        closed: Whether the issue is created closed.
        due_date: The due date of the new issue.
        labels: The label IDs to apply to the new issue.
        milestone: The milestone ID to associate with the new issue.
        ref: The reference of the new issue.
        **kwargs: Additional arguments for the request.

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

    """
    response = self._create_issue(
        owner=owner,
        repository=repository,
        title=title,
        assignee=assignee,
        assignees=assignees,
        body=body,
        closed=closed,
        due_date=due_date,
        labels=labels,
        milestone=milestone,
        ref=ref,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.Issue.list_issue_dependencies
list_issue_dependencies(
    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 an issue's dependencies.

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 dependencies 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 dependency issues as dictionaries and a dictionary with metadata.

Source code in src/gitea/issue/issue.py
def list_issue_dependencies(
    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 an issue's dependencies.

    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 dependencies per page.
        **kwargs: Additional arguments for the request.

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

    """
    response = self._list_issue_dependencies(
        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.issue.Issue.create_issue_dependency
create_issue_dependency(
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Make an issue depend on another 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 target issue.

required
dependency_owner str

The owner of the dependency issue's repository.

required
dependency_repository str

The name of the dependency issue's repository.

required
dependency_index int

The index of the dependency issue.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the target issue as a dictionary and a dictionary with metadata.

Source code in src/gitea/issue/issue.py
def create_issue_dependency(
    self,
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Make an issue depend on another issue.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the target issue.
        dependency_owner: The owner of the dependency issue's repository.
        dependency_repository: The name of the dependency issue's repository.
        dependency_index: The index of the dependency issue.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the target issue as a dictionary and a dictionary with metadata.

    """
    response = self._create_issue_dependency(
        owner=owner,
        repository=repository,
        index=index,
        dependency_owner=dependency_owner,
        dependency_repository=dependency_repository,
        dependency_index=dependency_index,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}
gitea.issue.Issue.remove_issue_dependency
remove_issue_dependency(
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]

Remove an issue dependency.

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 target issue.

required
dependency_owner str

The owner of the dependency issue's repository.

required
dependency_repository str

The name of the dependency issue's repository.

required
dependency_index int

The index of the dependency issue.

required
**kwargs Any

Additional arguments for the request.

{}

Returns:

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

A tuple containing the target issue as a dictionary and a dictionary with metadata.

Source code in src/gitea/issue/issue.py
def remove_issue_dependency(
    self,
    owner: str,
    repository: str,
    index: int,
    dependency_owner: str,
    dependency_repository: str,
    dependency_index: int,
    **kwargs: Any,
) -> tuple[dict[str, Any], dict[str, Any]]:
    """Remove an issue dependency.

    Args:
        owner: The owner of the repository.
        repository: The name of the repository.
        index: The index of the target issue.
        dependency_owner: The owner of the dependency issue's repository.
        dependency_repository: The name of the dependency issue's repository.
        dependency_index: The index of the dependency issue.
        **kwargs: Additional arguments for the request.

    Returns:
        A tuple containing the target issue as a dictionary and a dictionary with metadata.

    """
    response = self._remove_issue_dependency(
        owner=owner,
        repository=repository,
        index=index,
        dependency_owner=dependency_owner,
        dependency_repository=dependency_repository,
        dependency_index=dependency_index,
        **kwargs,
    )
    data, status_code = process_response(response, default={})
    return cast(dict[str, Any], data), {"status_code": status_code}

Functions:

gitea.issue.async_column_holds_card async

async_column_holds_card(
    *,
    client: AsyncGitea,
    owner: str,
    repository: str | None,
    project_id: int,
    column_id: int,
    issue_id: int,
) -> bool

Report whether one column of a project holds an issue's card.

Parameters:

Name Type Description Default
client AsyncGitea

The asynchronous Gitea client used for the lookup.

required
owner str

The owner of the repository or organization holding the project.

required
repository str | None

The name of the repository holding the project, or None for an organization project.

required
project_id int

The ID of the project.

required
column_id int

The ID of the column.

required
issue_id int

The global ID of the issue.

required

Returns:

Type Description
bool

True when a card for the issue is in that column.

Source code in src/gitea/issue/project_column.py
async def async_column_holds_card(
    *,
    client: AsyncGitea,
    owner: str,
    repository: str | None,
    project_id: int,
    column_id: int,
    issue_id: int,
) -> bool:
    """Report whether one column of a project holds an issue's card.

    Args:
        client: The asynchronous Gitea client used for the lookup.
        owner: The owner of the repository or organization holding the project.
        repository: The name of the repository holding the project, or None for
            an organization project.
        project_id: The ID of the project.
        column_id: The ID of the column.
        issue_id: The global ID of the issue.

    Returns:
        True when a card for the issue is in that column.

    """
    async for issues, _ in iter_async_pages(
        lambda page: client.project.list_project_column_issues(
            owner=owner,
            repository=repository,
            project_id=project_id,
            column_id=column_id,
            page=page,
            limit=PAGE_SIZE,
        )
    ):
        if _holds_issue(issues, issue_id):
            return True
    return False

gitea.issue.column_holds_card

column_holds_card(
    *,
    client: Gitea,
    owner: str,
    repository: str | None,
    project_id: int,
    column_id: int,
    issue_id: int,
) -> bool

Report whether one column of a project holds an issue's card.

The single column the board walk above asks about, asked on its own: a caller that already knows which column it means - one confirming a card arrived where it was sent - pays for that column's listing rather than the board's.

Parameters:

Name Type Description Default
client Gitea

The Gitea client used for the lookup.

required
owner str

The owner of the repository or organization holding the project.

required
repository str | None

The name of the repository holding the project, or None for an organization project.

required
project_id int

The ID of the project.

required
column_id int

The ID of the column.

required
issue_id int

The global ID of the issue.

required

Returns:

Type Description
bool

True when a card for the issue is in that column.

Source code in src/gitea/issue/project_column.py
def column_holds_card(
    *,
    client: Gitea,
    owner: str,
    repository: str | None,
    project_id: int,
    column_id: int,
    issue_id: int,
) -> bool:
    """Report whether one column of a project holds an issue's card.

    The single column the board walk above asks about, asked on its own: a caller
    that already knows which column it means - one confirming a card arrived
    where it was sent - pays for that column's listing rather than the board's.

    Args:
        client: The Gitea client used for the lookup.
        owner: The owner of the repository or organization holding the project.
        repository: The name of the repository holding the project, or None for
            an organization project.
        project_id: The ID of the project.
        column_id: The ID of the column.
        issue_id: The global ID of the issue.

    Returns:
        True when a card for the issue is in that column.

    """
    for issues, _ in iter_pages(
        lambda page: client.project.list_project_column_issues(
            owner=owner,
            repository=repository,
            project_id=project_id,
            column_id=column_id,
            page=page,
            limit=PAGE_SIZE,
        )
    ):
        if _holds_issue(issues, issue_id):
            return True
    return False

gitea.issue.find_async_card_column_id async

find_async_card_column_id(
    *,
    client: AsyncGitea,
    owner: str,
    repository: str | None,
    project_id: int,
    issue_id: int,
) -> int | None

Find the column of a project that lists an issue.

Parameters:

Name Type Description Default
client AsyncGitea

The asynchronous Gitea client used for the lookups.

required
owner str

The owner of the repository or organization holding the project.

required
repository str | None

The name of the repository holding the project, or None for an organization project.

required
project_id int

The ID of the project.

required
issue_id int

The global ID of the issue.

required

Returns:

Type Description
int | None

The ID of the column listing the issue, or None when no column of the

int | None

project lists it.

Source code in src/gitea/issue/project_column.py
async def find_async_card_column_id(
    *,
    client: AsyncGitea,
    owner: str,
    repository: str | None,
    project_id: int,
    issue_id: int,
) -> int | None:
    """Find the column of a project that lists an issue.

    Args:
        client: The asynchronous Gitea client used for the lookups.
        owner: The owner of the repository or organization holding the project.
        repository: The name of the repository holding the project, or None for
            an organization project.
        project_id: The ID of the project.
        issue_id: The global ID of the issue.

    Returns:
        The ID of the column listing the issue, or None when no column of the
        project lists it.

    """
    async for columns, _ in iter_async_pages(
        lambda page: client.project.list_project_columns(
            owner=owner,
            repository=repository,
            project_id=project_id,
            page=page,
            limit=PAGE_SIZE,
        )
    ):
        for column in columns:
            column_id = _identifier(column)
            if column_id is None:
                continue
            if await async_column_holds_card(
                client=client,
                owner=owner,
                repository=repository,
                project_id=project_id,
                column_id=column_id,
                issue_id=issue_id,
            ):
                return column_id
    return None

gitea.issue.find_card_column_id

find_card_column_id(
    *,
    client: Gitea,
    owner: str,
    repository: str | None,
    project_id: int,
    issue_id: int,
) -> int | None

Find the column of a project that lists an issue.

Parameters:

Name Type Description Default
client Gitea

The Gitea client used for the lookups.

required
owner str

The owner of the repository or organization holding the project.

required
repository str | None

The name of the repository holding the project, or None for an organization project.

required
project_id int

The ID of the project.

required
issue_id int

The global ID of the issue.

required

Returns:

Type Description
int | None

The ID of the column listing the issue, or None when no column of the

int | None

project lists it.

Source code in src/gitea/issue/project_column.py
def find_card_column_id(
    *,
    client: Gitea,
    owner: str,
    repository: str | None,
    project_id: int,
    issue_id: int,
) -> int | None:
    """Find the column of a project that lists an issue.

    Args:
        client: The Gitea client used for the lookups.
        owner: The owner of the repository or organization holding the project.
        repository: The name of the repository holding the project, or None for
            an organization project.
        project_id: The ID of the project.
        issue_id: The global ID of the issue.

    Returns:
        The ID of the column listing the issue, or None when no column of the
        project lists it.

    """
    for columns, _ in iter_pages(
        lambda page: client.project.list_project_columns(
            owner=owner,
            repository=repository,
            project_id=project_id,
            page=page,
            limit=PAGE_SIZE,
        )
    ):
        for column in columns:
            column_id = _identifier(column)
            if column_id is None:
                continue
            if column_holds_card(
                client=client,
                owner=owner,
                repository=repository,
                project_id=project_id,
                column_id=column_id,
                issue_id=issue_id,
            ):
                return column_id
    return None

gitea.issue.resolve_async_project_column_ids async

resolve_async_project_column_ids(
    *,
    client: AsyncGitea,
    owner: str,
    repository: str,
    issue: dict[str, Any],
) -> dict[str, Any]

Populate the column_id of every project an issue is on.

Parameters:

Name Type Description Default
client AsyncGitea

The asynchronous Gitea client used for the lookups.

required
owner str

The owner of the repository holding the issue.

required
repository str

The name of the repository holding the issue.

required
issue dict[str, Any]

The issue data returned by the API.

required

Returns:

Type Description
dict[str, Any]

The issue data with a column_id on every project entry, holding the

dict[str, Any]

column the issue's card sits in, or None when it has no card there and

dict[str, Any]

when the lookup could not be made or failed. The issue is returned

dict[str, Any]

unchanged when it lists no projects.

Source code in src/gitea/issue/project_column.py
async def resolve_async_project_column_ids(
    *,
    client: AsyncGitea,
    owner: str,
    repository: str,
    issue: dict[str, Any],
) -> dict[str, Any]:
    """Populate the ``column_id`` of every project an issue is on.

    Args:
        client: The asynchronous Gitea client used for the lookups.
        owner: The owner of the repository holding the issue.
        repository: The name of the repository holding the issue.
        issue: The issue data returned by the API.

    Returns:
        The issue data with a ``column_id`` on every project entry, holding the
        column the issue's card sits in, or None when it has no card there and
        when the lookup could not be made or failed. The issue is returned
        unchanged when it lists no projects.

    """
    if not _lists_projects(issue):
        return issue

    # As above: no global ID means no card can be matched, and the field is
    # attached all the same.
    issue_id = _identifier(issue)
    projects: list[Any] = []
    for project in issue["projects"]:
        if not isinstance(project, dict):
            projects.append(project)
            continue
        column_id = None
        project_id = _identifier(project)
        if project_id is not None and issue_id is not None:
            try:
                column_id = await find_async_card_column_id(
                    client=client,
                    owner=owner,
                    repository=_column_scope_repository(project, repository),
                    project_id=project_id,
                    issue_id=issue_id,
                )
            except _ASYNC_LOOKUP_ERRORS as e:
                # As above: the issue itself was retrieved, so only the column
                # is lost.
                logger.warning(_LOOKUP_FAILED, issue_id, project_id, e)
        projects.append({**project, "column_id": column_id})

    return {**issue, "projects": projects}

gitea.issue.resolve_project_column_ids

resolve_project_column_ids(
    *,
    client: Gitea,
    owner: str,
    repository: str,
    issue: dict[str, Any],
) -> dict[str, Any]

Populate the column_id of every project an issue is on.

Parameters:

Name Type Description Default
client Gitea

The Gitea client used for the lookups.

required
owner str

The owner of the repository holding the issue.

required
repository str

The name of the repository holding the issue.

required
issue dict[str, Any]

The issue data returned by the API.

required

Returns:

Type Description
dict[str, Any]

The issue data with a column_id on every project entry, holding the

dict[str, Any]

column the issue's card sits in, or None when it has no card there and

dict[str, Any]

when the lookup could not be made or failed. The issue is returned

dict[str, Any]

unchanged when it lists no projects.

Source code in src/gitea/issue/project_column.py
def resolve_project_column_ids(
    *,
    client: Gitea,
    owner: str,
    repository: str,
    issue: dict[str, Any],
) -> dict[str, Any]:
    """Populate the ``column_id`` of every project an issue is on.

    Args:
        client: The Gitea client used for the lookups.
        owner: The owner of the repository holding the issue.
        repository: The name of the repository holding the issue.
        issue: The issue data returned by the API.

    Returns:
        The issue data with a ``column_id`` on every project entry, holding the
        column the issue's card sits in, or None when it has no card there and
        when the lookup could not be made or failed. The issue is returned
        unchanged when it lists no projects.

    """
    if not _lists_projects(issue):
        return issue

    # Column listings identify their issues by global ID, so without one on the
    # issue nothing can be matched and every column stays null. The field is
    # still attached, so that consumers see one contract for every issue.
    issue_id = _identifier(issue)
    projects: list[Any] = []
    for project in issue["projects"]:
        if not isinstance(project, dict):
            # An entry that is not a project object has nothing to look a column
            # up by and nothing to attach one to, so it is passed through.
            projects.append(project)
            continue
        column_id = None
        project_id = _identifier(project)
        if project_id is not None and issue_id is not None:
            try:
                column_id = find_card_column_id(
                    client=client,
                    owner=owner,
                    repository=_column_scope_repository(project, repository),
                    project_id=project_id,
                    issue_id=issue_id,
                )
            except RequestException as e:
                # Enriching the issue is not worth failing the issue over: the
                # payload the caller asked for is already in hand.
                logger.warning(_LOOKUP_FAILED, issue_id, project_id, e)
        projects.append({**project, "column_id": column_id})

    return {**issue, "projects": projects}

Modules