31 أسطر
656 B
Python
31 أسطر
656 B
Python
import os
|
|
from typing import Dict, Any
|
|
import httpx
|
|
from helpers import get_headers, build_client
|
|
|
|
BASE_URL = os.getenv(
|
|
"GITPASHA_BASE_URL",
|
|
"https://app.gitpasha.com/api/v1"
|
|
).rstrip("/")
|
|
|
|
|
|
def api_create_repo(
|
|
name: str,
|
|
description: str,
|
|
private: bool = False
|
|
) -> Dict[str, Any]:
|
|
payload = {
|
|
"name": name,
|
|
"description": description,
|
|
"private": private
|
|
}
|
|
with build_client() as client:
|
|
res = client.post(
|
|
f"{BASE_URL}/user/repos",
|
|
headers=get_headers(),
|
|
json=payload,
|
|
)
|
|
res.raise_for_status()
|
|
data = res.json()
|
|
return data
|