forked from mattn/webapi-vim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhatenadiary.vim
More file actions
27 lines (20 loc) · 744 Bytes
/
hatenadiary.vim
File metadata and controls
27 lines (20 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
scriptencoding utf-8
let hatena_id = 'your-hatena-id'
let password = 'your-hatena-password'
" write entry
let entry = atom#newEntry()
call entry.setTitle("title of entry")
call entry.setContentType("text/html")
call entry.setContent("<script>alert(2)</script>")
" post draft
let id = atom#createEntry("http://d.hatena.ne.jp/".hatena_id."/atom/draft", hatena_id, password, entry)
" modify it. publish it.
call entry.setContent("<script>alert(1)</script>")
let id = atom#updateEntry(id, hatena_id, password, entry, {"X-HATENA-PUBLISH": 1})
" get the entry.
let entry = atom#getEntry(id, hatena_id, password)
echo entry.getTitle()
echo entry.getContent()
" delete the entry.
call atom#deleteEntry(id, hatena_id, password)
" vim:set ft=vim: