forked from vieter-v/vieter
Builder now uses new Git repos API
This commit is contained in:
parent
fc1d4480dc
commit
78310fa1e4
2 changed files with 8 additions and 11 deletions
|
|
@ -4,7 +4,8 @@ import json
|
|||
import response { Response }
|
||||
import net.http
|
||||
|
||||
fn get_repos(address string, api_key string) ?map[string]GitRepo {
|
||||
// get_repos returns the current list of repos.
|
||||
pub fn get_repos(address string, api_key string) ?map[string]GitRepo {
|
||||
mut req := http.new_request(http.Method.get, '$address/api/repos', '') ?
|
||||
req.add_custom_header('X-API-Key', api_key) ?
|
||||
|
||||
|
|
@ -14,7 +15,8 @@ fn get_repos(address string, api_key string) ?map[string]GitRepo {
|
|||
return data.data
|
||||
}
|
||||
|
||||
fn add_repo(address string, api_key string, url string, branch string, arch []string) ?Response<string> {
|
||||
// add_repo adds a new repo to the server.
|
||||
pub fn add_repo(address string, api_key string, url string, branch string, arch []string) ?Response<string> {
|
||||
mut req := http.new_request(http.Method.post, '$address/api/repos?url=$url&branch=$branch&arch=${arch.join(',')}',
|
||||
'') ?
|
||||
req.add_custom_header('X-API-Key', api_key) ?
|
||||
|
|
@ -25,7 +27,8 @@ fn add_repo(address string, api_key string, url string, branch string, arch []st
|
|||
return data
|
||||
}
|
||||
|
||||
fn remove_repo(address string, api_key string, id string) ?Response<string> {
|
||||
// remove_repo removes the repo with the given ID from the server.
|
||||
pub fn remove_repo(address string, api_key string, id string) ?Response<string> {
|
||||
mut req := http.new_request(http.Method.delete, '$address/api/repos/$id', '') ?
|
||||
req.add_custom_header('X-API-Key', api_key) ?
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue