Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions autoload/gitlab/api.vim
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,26 @@ function! s:gitlab_api_key(domain) abort
call gitlab#utils#throw(a:domain . ' is not a key in g:gitlab_api_keys')
endfunction

function! s:gitlab_proxie(domain) abort
if exists('b:gitlab_proxies') && has_key(b:gitlab_proxies, a:domain)
return b:gitlab_proxies[a:domain]
endif

" gitlab_proxies: { "gitlab.com": "myproxy" }
if exists('g:gitlab_proxies')
let key = get(g:gitlab_proxies, a:domain)
if !empty(key)
return key
endif
endif
return ''
endfunction

" Makes a request to the api and returns the resulting text
" :call setreg('+', b:gitlab_last_curl)
function! gitlab#api#request(domain, path, ...) abort
let key = s:gitlab_api_key(a:domain)
let proxy = s:gitlab_proxie(a:domain)
let domains = gitlab#utils#parse_gitlab_domains()
let root = get(domains, a:domain)
if empty(root)
Expand Down Expand Up @@ -107,6 +123,9 @@ function! gitlab#api#request(domain, path, ...) abort
endif

let data = ['-q', '--silent', '-A', 'fugitive-gitlab.vim']
if len(proxy) > 0
call extend(data, ['-x', proxy])
endif
for header in headers
call extend(data, ['-H', header])
endfor
Expand Down