feat: queue one-time builds from CLI

This commit is contained in:
Jef Roosens 2022-12-13 22:03:04 +01:00
parent 6a208dbe6c
commit 2cc3e8404e
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 69 additions and 18 deletions

View file

@ -1,6 +1,7 @@
module client
import build { BuildConfig }
import web.response { Response }
// poll_jobs requests a list of new build jobs from the server.
pub fn (c &Client) poll_jobs(arch string, max int) ![]BuildConfig {
@ -11,3 +12,13 @@ pub fn (c &Client) poll_jobs(arch string, max int) ![]BuildConfig {
return data.data
}
pub fn (c &Client) queue_job(target_id int, arch string, force bool) !Response<string> {
data := c.send_request<string>(.post, '/api/v1/jobs/queue', {
'target': target_id.str()
'arch': arch
'force': force.str()
})!
return data
}