Add Gitea commit lookup tools
This commit is contained in:
@@ -142,6 +142,34 @@ class GiteaClient:
|
||||
)
|
||||
return result if isinstance(result, list) else []
|
||||
|
||||
def list_commits(
|
||||
self,
|
||||
owner: str,
|
||||
repo: str,
|
||||
sha: str | None = None,
|
||||
path: str | None = None,
|
||||
limit: int = 20,
|
||||
page: int = 1,
|
||||
) -> list[dict[str, Any]]:
|
||||
query = {"limit": str(limit), "page": str(page)}
|
||||
if sha:
|
||||
query["sha"] = sha
|
||||
if path:
|
||||
query["path"] = path
|
||||
result = self._request(
|
||||
"GET",
|
||||
f"/repos/{_quote(owner)}/{_quote(repo)}/commits",
|
||||
query=query,
|
||||
)
|
||||
return result if isinstance(result, list) else []
|
||||
|
||||
def get_commit(self, owner: str, repo: str, sha: str) -> dict[str, Any]:
|
||||
result = self._request(
|
||||
"GET",
|
||||
f"/repos/{_quote(owner)}/{_quote(repo)}/git/commits/{_quote(sha)}",
|
||||
)
|
||||
return result if isinstance(result, dict) else {}
|
||||
|
||||
def _request(
|
||||
self,
|
||||
method: str,
|
||||
|
||||
Reference in New Issue
Block a user