Files

104 lines
2.7 KiB
Markdown

# Repository API reference
Base: `https://git.mpm.to/api/v1`
## List repositories for the authenticated user
```
GET /repos/search?token=...&limit=50&page=1
```
Or list all repos the authenticated user has access to:
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/search?limit=50&page=1"
```
Key response fields per repo: `id`, `full_name`, `description`, `private`, `fork`, `stars_count`, `forks_count`, `open_issues_count`, `default_branch`, `updated_at`, `html_url`.
## List repos for a specific organization
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/orgs/{org}/repos?limit=50"
```
## List repos for a specific user
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/users/{username}/repos?limit=50"
```
## Get a single repository
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}"
```
## Search repositories
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/search?q=SEARCH_TERM&limit=20"
```
## Create a repository (for the authenticated user)
```bash
curl -s -X POST \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
-H "Content-Type: application/json" \
-d '{
"name": "repo-name",
"description": "Description here",
"private": false,
"auto_init": true,
"default_branch": "main"
}' \
"https://git.mpm.to/api/v1/user/repos"
```
## Create a repository under an organization
```bash
curl -s -X POST \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
-H "Content-Type: application/json" \
-d '{"name": "repo-name", "description": "...", "private": false}' \
"https://git.mpm.to/api/v1/orgs/{org}/repos"
```
## Delete a repository
```bash
curl -s -X DELETE \
-H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}"
```
Returns 204 on success. Always confirm with the user before deleting.
## List branches
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/branches"
```
## List topics/tags on a repo
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/topics"
```
## Get repo collaborators
```bash
curl -s -H "Authorization: token e82a7235b948fbbeea60329422fcac89fa5a5ce8" \
"https://git.mpm.to/api/v1/repos/{owner}/{repo}/collaborators"
```