This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.go
69 lines (65 loc) · 1.53 KB
/
misc.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cmtt
//GetVacancies returns vacancies from VC widget
func (api *Cmtt) GetVacancies() (*[]Vacancy, error) {
res, err := api.execute("vacancies/widget", nil, nil, nil)
if err != nil {
return nil, err
}
result := &[]Vacancy{}
err = castStruct(res, result)
if err != nil {
return nil, err
}
return result, err
}
//GetRates returns currency rates from VC
func (api *Cmtt) GetRates() (*Rates, error) {
res, err := api.execute("rates", nil, nil, nil)
if err != nil {
return nil, err
}
result := &Rates{}
err = castStruct(res, result)
if err != nil {
return nil, err
}
return result, err
}
//GetPaymentsCheck returns... I don't really know. Didn't test it
func (api *Cmtt) GetPaymentsCheck() (*PaymentsCheck, error) {
//TODO: fix description
res, err := api.execute("payments/check", nil, nil, nil)
if err != nil {
return nil, err
}
paymentsCheck := &PaymentsCheck{}
err = castStruct(res, paymentsCheck)
if err != nil {
return nil, err
}
return paymentsCheck, err
}
/*
TODO: Ask Cmtt for regular response format
Dear Cmtt,
Stop using DIFFERENT RESPONSE formats.
I'm expecting {"result": ...} in every method.
Thanks.
func (api *Cmtt) GetTweets(mode string, count, offset int) (*[]Tweet, error) {
res, err := api.execute("tweets/{mode}", map[string]string {
"mode": mode,
}, map[string]string {
"count": strconv.Itoa(count),
"offset": strconv.Itoa(offset),
}, nil)
if err != nil {
return nil, err
}
result := &[]Tweet{}
err = castStruct(res, result)
if err != nil {
return nil, err
}
return result, err
}
*/