diff --git a/docs/api/repositories.md b/docs/api/repositories.md index c3d7925..1080c35 100644 --- a/docs/api/repositories.md +++ b/docs/api/repositories.md @@ -8,6 +8,73 @@ All endpoints require authentication (session cookie). --- +## GET /repositories + +**Description:** List all repositories owned by the user, including external repositories not tied to any project. + +### Response + +#### Success (200 OK) + +```json +[ + { + "id": "uuid", + "name": "my-external-repo", + "remote_url": "https://github.com/user/repo.git", + "is_mirror": false, + "project_id": null, + "owner_id": "uuid", + "created_at": "2024-01-01T00:00:00Z" + } +] +``` + +--- + +## POST /repositories + +**Description:** Create a new external repository (not tied to any project). External repositories can be used across all projects for config profile git mounts. + +### Request + +#### Request Body + +```json +{ + "name": "my-external-repo", + "remote_url": "https://github.com/user/repo.git", + "ssh_key_id": "uuid" +} +``` + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `name` | `string` | Yes | Repository name (unique per user for external repos) | +| `remote_url` | `string` | No | Remote URL to clone from | +| `ssh_key_id` | `string` | No | SSH key ID for authentication | +| `force_original_url` | `boolean` | No | Skip URL parsing (default: false) | + +### Response + +#### Success (201 Created) + +```json +{ + "id": "uuid", + "name": "my-external-repo", + "path": "/data/repos/external/{user_id}/{repo_id}", + "remote_url": "https://github.com/user/repo.git", + "is_mirror": false, + "project_id": null, + "owner_id": "uuid", + "ssh_key_id": "uuid", + "created_at": "2024-01-01T00:00:00Z" +} +``` + +--- + ## GET /projects/{project_id}/repositories **Description:** List repositories in a project.