forked from vieter-v/vieter
feat(server): moved api routes under /v1 namespace
This commit is contained in:
parent
3a5ac5d32b
commit
6b79f7b5ed
5 changed files with 41 additions and 37 deletions
|
|
@ -7,7 +7,7 @@ import response { Response }
|
|||
// get_git_repos returns a list of GitRepo's, given a filter object.
|
||||
pub fn (c &Client) get_git_repos(filter GitRepoFilter) ?[]GitRepo {
|
||||
params := models.params_from(filter)
|
||||
data := c.send_request<[]GitRepo>(Method.get, '/api/repos', params)?
|
||||
data := c.send_request<[]GitRepo>(Method.get, '/api/v1/repos', params)?
|
||||
|
||||
return data.data
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ pub fn (c &Client) get_all_git_repos() ?[]GitRepo {
|
|||
|
||||
// get_git_repo returns the repo for a specific ID.
|
||||
pub fn (c &Client) get_git_repo(id int) ?GitRepo {
|
||||
data := c.send_request<GitRepo>(Method.get, '/api/repos/$id', {})?
|
||||
data := c.send_request<GitRepo>(Method.get, '/api/v1/repos/$id', {})?
|
||||
|
||||
return data.data
|
||||
}
|
||||
|
|
@ -52,14 +52,14 @@ pub fn (c &Client) add_git_repo(url string, branch string, repo string, arch []s
|
|||
params['arch'] = arch.join(',')
|
||||
}
|
||||
|
||||
data := c.send_request<string>(Method.post, '/api/repos', params)?
|
||||
data := c.send_request<string>(Method.post, '/api/v1/repos', params)?
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
// remove_git_repo removes the repo with the given ID from the server.
|
||||
pub fn (c &Client) remove_git_repo(id int) ?Response<string> {
|
||||
data := c.send_request<string>(Method.delete, '/api/repos/$id', {})?
|
||||
data := c.send_request<string>(Method.delete, '/api/v1/repos/$id', {})?
|
||||
|
||||
return data
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ pub fn (c &Client) remove_git_repo(id int) ?Response<string> {
|
|||
// patch_git_repo sends a PATCH request to the given repo with the params as
|
||||
// payload.
|
||||
pub fn (c &Client) patch_git_repo(id int, params map[string]string) ?Response<string> {
|
||||
data := c.send_request<string>(Method.patch, '/api/repos/$id', params)?
|
||||
data := c.send_request<string>(Method.patch, '/api/v1/repos/$id', params)?
|
||||
|
||||
return data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import time
|
|||
// get_build_logs returns all build logs.
|
||||
pub fn (c &Client) get_build_logs(filter BuildLogFilter) ?Response<[]BuildLog> {
|
||||
params := models.params_from(filter)
|
||||
data := c.send_request<[]BuildLog>(Method.get, '/api/logs', params)?
|
||||
data := c.send_request<[]BuildLog>(Method.get, '/api/v1/logs', params)?
|
||||
|
||||
return data
|
||||
}
|
||||
|
|
@ -19,21 +19,21 @@ pub fn (c &Client) get_build_logs_for_repo(repo_id int) ?Response<[]BuildLog> {
|
|||
'repo': repo_id.str()
|
||||
}
|
||||
|
||||
data := c.send_request<[]BuildLog>(Method.get, '/api/logs', params)?
|
||||
data := c.send_request<[]BuildLog>(Method.get, '/api/v1/logs', params)?
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
// get_build_log returns a specific build log.
|
||||
pub fn (c &Client) get_build_log(id int) ?Response<BuildLog> {
|
||||
data := c.send_request<BuildLog>(Method.get, '/api/logs/$id', {})?
|
||||
data := c.send_request<BuildLog>(Method.get, '/api/v1/logs/$id', {})?
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
// get_build_log_content returns the contents of the build log file.
|
||||
pub fn (c &Client) get_build_log_content(id int) ?string {
|
||||
data := c.send_request_raw_response(Method.get, '/api/logs/$id/content', {}, '')?
|
||||
data := c.send_request_raw_response(Method.get, '/api/v1/logs/$id/content', {}, '')?
|
||||
|
||||
return data
|
||||
}
|
||||
|
|
@ -48,7 +48,7 @@ pub fn (c &Client) add_build_log(repo_id int, start_time time.Time, end_time tim
|
|||
'exitCode': exit_code.str()
|
||||
}
|
||||
|
||||
data := c.send_request_with_body<string>(Method.post, '/api/logs', params, content)?
|
||||
data := c.send_request_with_body<string>(Method.post, '/api/v1/logs', params, content)?
|
||||
|
||||
return data
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue