feat: added ability to specify kind of target

This commit is contained in:
Jef Roosens 2022-06-17 13:45:21 +02:00
parent 10ad8297fb
commit bb5643bb03
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 58 additions and 25 deletions

View file

@ -40,18 +40,17 @@ pub fn (c &Client) get_target(id int) ?Target {
return data.data
}
pub struct NewTarget {
kind string
url string
branch string
repo string
arch []string
}
// add_target adds a new target to the server.
pub fn (c &Client) add_target(url string, branch string, repo string, arch []string) ?Response<string> {
mut params := {
'url': url
'branch': branch
'repo': repo
}
if arch.len > 0 {
params['arch'] = arch.join(',')
}
pub fn (c &Client) add_target(t NewTarget) ?Response<string> {
params := models.params_from<NewTarget>(t)
data := c.send_request<string>(Method.post, '/api/v1/targets', params)?
return data