forked from vieter-v/vieter
docs(slate): add Git Repositories API docs
This commit is contained in:
parent
a02b70e9a5
commit
4870edde51
8 changed files with 195 additions and 119 deletions
|
|
@ -1,22 +0,0 @@
|
|||
# Errors
|
||||
|
||||
<aside class="notice">
|
||||
This error section is stored in a separate file in <code>includes/_errors.md</code>. Slate allows you to optionally separate out your docs into many files...just save them to the <code>includes</code> folder and add them to the top of your <code>index.md</code>'s frontmatter. Files are included in the order listed.
|
||||
</aside>
|
||||
|
||||
The Kittn API uses the following error codes:
|
||||
|
||||
|
||||
Error Code | Meaning
|
||||
---------- | -------
|
||||
400 | Bad Request -- Your request is invalid.
|
||||
401 | Unauthorized -- Your API key is wrong.
|
||||
403 | Forbidden -- The kitten requested is hidden for administrators only.
|
||||
404 | Not Found -- The specified kitten could not be found.
|
||||
405 | Method Not Allowed -- You tried to access a kitten with an invalid method.
|
||||
406 | Not Acceptable -- You requested a format that isn't json.
|
||||
410 | Gone -- The kitten requested has been removed from our servers.
|
||||
418 | I'm a teapot.
|
||||
429 | Too Many Requests -- You're requesting too many kittens! Slow down!
|
||||
500 | Internal Server Error -- We had a problem with our server. Try again later.
|
||||
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later.
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
# Git Repositories
|
||||
|
||||
<aside class="notice">
|
||||
|
||||
All routes in this section require authentication.
|
||||
|
||||
</aside>
|
||||
|
||||
Endpoints for interacting with the list of Git repositories stored on the
|
||||
server.
|
||||
|
||||
## List repos
|
||||
|
||||
```shell
|
||||
curl \
|
||||
-H 'X-Api-Key: secret' \
|
||||
https://example.com/api/repos?offset=10&limit=20
|
||||
```
|
||||
|
||||
> JSON Output format
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "",
|
||||
"data": [
|
||||
{
|
||||
"id": 1,
|
||||
"url": "https://aur.archlinux.org/discord-ptb.git",
|
||||
"branch": "master",
|
||||
"repo": "bur",
|
||||
"schedule": "",
|
||||
"arch": [
|
||||
{
|
||||
"id": 1,
|
||||
"repo_id": 1,
|
||||
"value": "x86_64"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Retrieve a list of Git repositories.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET /api/repos`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
limit | Maximum amount of results to return.
|
||||
offset | Offset of results.
|
||||
repo | Limit results to repositories that publish to the given repo.
|
||||
|
||||
## Get a repo
|
||||
|
||||
```shell
|
||||
curl \
|
||||
-H 'X-Api-Key: secret' \
|
||||
https://example.com/api/repos/15
|
||||
```
|
||||
|
||||
> JSON Output format
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "",
|
||||
"data": {
|
||||
"id": 1,
|
||||
"url": "https://aur.archlinux.org/discord-ptb.git",
|
||||
"branch": "master",
|
||||
"repo": "bur",
|
||||
"schedule": " 0 3",
|
||||
"arch": [
|
||||
{
|
||||
"id": 1,
|
||||
"repo_id": 1,
|
||||
"value": "x86_64"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Get info about a specific Git repository.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET /api/repos/:id`
|
||||
|
||||
### URL Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
repo | ID of requested repo
|
||||
|
||||
## Create a new repo
|
||||
|
||||
Create a new Git repository with the given data.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`POST /api/repos`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
url | URL of the Git repository.
|
||||
branch | Branch of the Git repository.
|
||||
repo | Vieter repository to publish built packages to.
|
||||
schedule | Cron build schedule
|
||||
arch | Comma-separated list of architectures to build package on.
|
||||
|
||||
## Modify a repo
|
||||
|
||||
Modify the data of an existing Git repository.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`PATCH /api/repos`
|
||||
|
||||
### Query Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
url | URL of the Git repository.
|
||||
branch | Branch of the Git repository.
|
||||
repo | Vieter repository to publish built packages to.
|
||||
schedule | Cron build schedule
|
||||
arch | Comma-separated list of architectures to build package on.
|
||||
|
||||
## Remove a repo
|
||||
|
||||
Remove a Git repository from the server.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`DELETE /api/repos/:id`
|
||||
|
||||
### URL Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
repo | ID of repo to remove
|
||||
|
|
@ -7,7 +7,7 @@ possible.
|
|||
## Get a package archive or database file
|
||||
|
||||
```shell
|
||||
curl -OL https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
|
||||
curl -L https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
|
||||
```
|
||||
|
||||
This endpoint is really the entire repository. It serves both the package
|
||||
|
|
@ -43,7 +43,7 @@ filename | actual filename to request
|
|||
## Check whether file exists
|
||||
|
||||
```shell
|
||||
curl -IL https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
|
||||
curl -L https://example.com/bur/x86_64/tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst
|
||||
```
|
||||
|
||||
The above request can also be performed as a HEAD request. The behavior is the
|
||||
|
|
@ -73,7 +73,7 @@ This endpoint requests authentication.
|
|||
```shell
|
||||
curl \
|
||||
-H 'X-Api-Key: secret' \
|
||||
-XPOST
|
||||
-XPOST \
|
||||
-T tuxedo-keyboard-3.0.10-1-x86_64.pkg.tar.zst \
|
||||
https://example.com/some-repo/publish
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue