35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
"""Gitea REST API v1 client. Phase 2 implementation."""
|
|
|
|
import httpx
|
|
|
|
|
|
class GiteaClient:
|
|
def __init__(self, base_url: str, token: str):
|
|
self.base_url = base_url.rstrip("/")
|
|
self.token = token
|
|
self._client = httpx.AsyncClient(
|
|
base_url=f"{self.base_url}/api/v1",
|
|
headers={"Authorization": f"token {self.token}"},
|
|
)
|
|
|
|
async def create_pull_request(self, owner, repo, title, head, base, body) -> dict:
|
|
raise NotImplementedError("Phase 2")
|
|
|
|
async def merge_pull_request(self, owner, repo, pr_number, merge_type="merge") -> dict:
|
|
raise NotImplementedError("Phase 2")
|
|
|
|
async def create_issue_comment(self, owner, repo, issue_number, body) -> dict:
|
|
raise NotImplementedError("Phase 2")
|
|
|
|
async def get_issue(self, owner, repo, issue_number) -> dict:
|
|
raise NotImplementedError("Phase 2")
|
|
|
|
async def get_issue_comments(self, owner, repo, issue_number) -> list:
|
|
raise NotImplementedError("Phase 2")
|
|
|
|
async def create_branch(self, owner, repo, branch_name, old_branch) -> dict:
|
|
raise NotImplementedError("Phase 2")
|
|
|
|
async def close(self):
|
|
await self._client.aclose()
|