forked from vieter-v/vieter
refactor: separated GitRepo types into own module
feat: added more query params for GitRepo API
This commit is contained in:
parent
5e81dadce3
commit
6bd5b7cb48
12 changed files with 114 additions and 122 deletions
|
|
@ -29,7 +29,10 @@ fn (c &Client) send_request_raw(method Method, url string, params map[string]str
|
|||
|
||||
// Escape each query param
|
||||
for k, v in params {
|
||||
params_escaped[k] = urllib.query_escape(v)
|
||||
// An empty parameter should be the same as not providing it at all
|
||||
if v != '' {
|
||||
params_escaped[k] = urllib.query_escape(v)
|
||||
}
|
||||
}
|
||||
|
||||
params_str := params_escaped.keys().map('$it=${params[it]}').join('&')
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
module client
|
||||
|
||||
import db { GitRepo, GitRepoFilter }
|
||||
import models { GitRepo, GitRepoFilter }
|
||||
import net.http { Method }
|
||||
import response { Response }
|
||||
import util
|
||||
|
||||
// get_git_repos returns the current list of repos.
|
||||
pub fn (c &Client) get_git_repos(filter GitRepoFilter) ?[]GitRepo {
|
||||
params := util.struct_to_map(filter)
|
||||
params := models.params_from(filter)
|
||||
data := c.send_request<[]GitRepo>(Method.get, '/api/repos', params)?
|
||||
|
||||
return data.data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue