github ¶
GitHub API Service Wrapper for Tux Bot.
This module provides integration with the GitHub API using GitHub Apps authentication, enabling the bot to interact with GitHub repositories, issues, pull requests, and more.
Classes:
-
GithubService–GitHub API service wrapper for repository and issue management.
Classes¶
GithubService ¶
GithubService()
GitHub API service wrapper for repository and issue management.
Initialize the GitHub service with app credentials.
Raises:
-
ValueError–If any required GitHub configuration is missing or invalid.
Methods:
-
get_repo–Get the repository.
-
create_issue–Create an issue.
-
create_issue_comment–Create an issue comment.
-
close_issue–Close an issue.
-
get_issue–Get an issue.
-
get_open_issues–Get all open issues.
-
get_closed_issues–Get all closed issues.
-
get_open_pulls–Get all open pulls.
-
get_closed_pulls–Get all closed pulls.
-
get_pull–Get a pull request.
Functions¶
get_repo async ¶
get_repo() -> FullRepository
Get the repository.
Returns:
-
FullRepository–The repository.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIPermissionError–If insufficient permissions to access the repository.
-
TuxAPIRequestError–If the API request fails for other reasons.
-
TuxAPIResourceNotFoundError–If the repository is not found.
create_issue async ¶
Create an issue.
Parameters:
Returns:
-
Issue–The created issue.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIPermissionError–If insufficient permissions.
-
TuxAPIRequestError–If the API request fails.
create_issue_comment async ¶
Create an issue comment.
Parameters:
Returns:
-
IssueComment–The created issue comment.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIPermissionError–If insufficient permissions.
-
TuxAPIRequestError–If the API request fails.
-
TuxAPIResourceNotFoundError–If the issue is not found.
close_issue async ¶
close_issue(issue_number: int) -> Issue
Close an issue.
Parameters:
-
issue_number(int) –The number of the issue.
Returns:
-
Issue–The closed issue.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIPermissionError–If insufficient permissions.
-
TuxAPIRequestError–If the API request fails.
-
TuxAPIResourceNotFoundError–If the issue is not found.
get_issue async ¶
get_issue(issue_number: int) -> Issue
Get an issue.
Parameters:
-
issue_number(int) –The number of the issue.
Returns:
-
Issue–The issue.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIRequestError–If the API request fails.
-
TuxAPIResourceNotFoundError–If the issue is not found.
get_open_issues async ¶
get_open_issues() -> list[Issue]
Get all open issues.
Returns:
-
list[Issue]–The list of open issues.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIRequestError–If the API request fails.
get_closed_issues async ¶
get_closed_issues() -> list[Issue]
Get all closed issues.
Returns:
-
list[Issue]–The list of closed issues.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIRequestError–If the API request fails.
get_open_pulls async ¶
get_open_pulls() -> list[PullRequestSimple]
Get all open pulls.
Returns:
-
list[PullRequestSimple]–The list of open pulls.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIRequestError–If the API request fails.
get_closed_pulls async ¶
get_closed_pulls() -> list[PullRequestSimple]
Get all closed pulls.
Returns:
-
list[PullRequestSimple]–The list of closed pulls.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIRequestError–If the API request fails.
get_pull async ¶
get_pull(pr_number: int) -> PullRequest
Get a pull request.
Parameters:
-
pr_number(int) –The number of the pull request.
Returns:
-
PullRequest–The pull request.
Raises:
-
TuxAPIConnectionError–If connection to GitHub API fails.
-
TuxAPIRequestError–If the API request fails.
-
TuxAPIResourceNotFoundError–If the pull request is not found.