Initial upload: DevDash CLI with TUI dashboard
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
29
src/api/gitlab.py
Normal file
29
src/api/gitlab.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from typing import Any, Dict, List
|
||||||
|
import httpx
|
||||||
|
from src.api.base import APIClient
|
||||||
|
|
||||||
|
|
||||||
|
class GitLabClient(APIClient):
|
||||||
|
def __init__(self, token: str = None, base_url: str = "https://gitlab.com/api/v4"):
|
||||||
|
super().__init__(base_url, token or "")
|
||||||
|
|
||||||
|
async def get_pull_requests(self, owner: str, repo: str) -> List[Dict[str, Any]]:
|
||||||
|
url = f"{self.base_url}/projects/{owner}%2F{repo}/merge_requests?state=opened&per_page=10"
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
response = await client.get(url, headers=self.headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
async def get_issues(self, owner: str, repo: str) -> List[Dict[str, Any]]:
|
||||||
|
url = f"{self.base_url}/projects/{owner}%2F{repo}/issues?state=opened&per_page=10"
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
response = await client.get(url, headers=self.headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
async def get_workflows(self, owner: str, repo: str) -> List[Dict[str, Any]]:
|
||||||
|
url = f"{self.base_url}/projects/{owner}%2F{repo}/pipelines?per_page=5"
|
||||||
|
async with httpx.AsyncClient() as client:
|
||||||
|
response = await client.get(url, headers=self.headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
Reference in New Issue
Block a user