-
Notifications
You must be signed in to change notification settings - Fork 246
/
blocks.go
54 lines (45 loc) · 1.59 KB
/
blocks.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package anaconda
import (
"net/url"
"strconv"
)
func (a TwitterApi) GetBlocksList(v url.Values) (c UserCursor, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/blocks/list.json", v, &c, _GET, response_ch}
return c, (<-response_ch).err
}
func (a TwitterApi) GetBlocksIds(v url.Values) (c Cursor, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/blocks/ids.json", v, &c, _GET, response_ch}
return c, (<-response_ch).err
}
func (a TwitterApi) BlockUser(screenName string, v url.Values) (user User, err error) {
v = cleanValues(v)
v.Set("screen_name", screenName)
return a.Block(v)
}
func (a TwitterApi) BlockUserId(id int64, v url.Values) (user User, err error) {
v = cleanValues(v)
v.Set("user_id", strconv.FormatInt(id, 10))
return a.Block(v)
}
func (a TwitterApi) Block(v url.Values) (user User, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/blocks/create.json", v, &user, _POST, response_ch}
return user, (<-response_ch).err
}
func (a TwitterApi) UnblockUser(screenName string, v url.Values) (user User, err error) {
v = cleanValues(v)
v.Set("screen_name", screenName)
return a.Unblock(v)
}
func (a TwitterApi) UnblockUserId(id int64, v url.Values) (user User, err error) {
v = cleanValues(v)
v.Set("user_id", strconv.FormatInt(id, 10))
return a.Unblock(v)
}
func (a TwitterApi) Unblock(v url.Values) (user User, err error) {
response_ch := make(chan response)
a.queryQueue <- query{a.baseUrl + "/blocks/destroy.json", v, &user, _POST, response_ch}
return user, (<-response_ch).err
}