Skip to content

Instantly share code, notes, and snippets.

@sgur

sgur/codic_test.vim

Last active Aug 29, 2015
Embed
What would you like to do?
Codic Ver.3 の API (Ver.1) のサンプル
let s:access_token = 'so0RiFwQJIfvHFBdVDJa2fUyxtAwpAgTS'
let s:host = 'https://api.codic.jp'
let s:resourece = '/v1/user_projects.json'
unlet! s:resp
let s:resp = eval(webapi#http#get(s:host . s:resourece,
\ {},
\ {
\ 'Authorization' : 'Bearer ' . s:access_token
\ }).content)
if type(s:resp) != type([]) || type(s:resp[0]) != type({})
echoerr 'Error'
finish
endif
let s:project_id = s:resp[0].id
echo eval(webapi#http#get(s:host . printf('/v1/user_projects/%s.json', s:project_id)
\ , {}
\ , {
\ 'Authorization' : 'Bearer ' . s:access_token
\ }).content)
echo eval(webapi#http#get(s:host . '/v1/ced/lookup.json'
\ , {
\ 'query' : 'term'
\ , 'count' : 5
\ }
\ , {
\ 'Authorization' : 'Bearer ' . s:access_token
\ }).content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.