GitPasha MCP Server - Ready for deployment
هذا الالتزام موجود في:
38
api/issues/list.py
Normal file
38
api/issues/list.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
from typing import List, Dict, Any, Optional
|
||||
from helpers import get_headers, build_client
|
||||
|
||||
|
||||
BASE_URL = os.getenv(
|
||||
"GITPASHA_BASE_URL",
|
||||
"https://app.gitpasha.com/api/v1"
|
||||
).rstrip("/")
|
||||
|
||||
|
||||
def api_list_issues(
|
||||
repo: str,
|
||||
state: Optional[str] = None
|
||||
) -> List[Dict[str, Any]]:
|
||||
username = os.getenv("GITPASHA__USERNAME", "")
|
||||
|
||||
if "/" not in repo:
|
||||
if not username:
|
||||
raise ValueError("GITPASHA__USERNAME not set in .env")
|
||||
repo = f"{username}/{repo}"
|
||||
|
||||
params = {}
|
||||
if state:
|
||||
params["state"] = state
|
||||
with build_client() as client:
|
||||
url = f"{BASE_URL}/repos/{repo}/issues"
|
||||
res = client.get(
|
||||
url,
|
||||
headers=get_headers(),
|
||||
params=params
|
||||
)
|
||||
res.raise_for_status()
|
||||
try:
|
||||
data = res.json()
|
||||
except Exception:
|
||||
data = []
|
||||
return data
|
||||
المرجع في مشكلة جديدة
حظر مستخدم