-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathapi_push_list.go
44 lines (36 loc) · 1.1 KB
/
api_push_list.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
package getui
import (
"encoding/json"
)
//http://docs.getui.com/getui/server/rest/push/#doc-title-1
type PushListParam struct {
Cid []string `json:"cid"` //cid为cid list,与alias list二选一
Alias []string `json:"alias"`
Taskid string `json:"taskid"`
NeedDetail bool `json:"need_detail"`
}
type PushListResult struct {
Result string `json:"result"`
Taskid string `json:"taskid"`
Desc string `json:"desc"`
CidDetails map[string]string `json:"cid_details"`
AliasDetails map[string]string `json:"alias_details"`
}
//群推
func PushList(appId string, authToken string, param *PushListParam) (*PushListResult, error) {
url := API_URL + appId + "/push_list"
bodyByte, err := MakeReqBody(param)
if err != nil {
return nil, err
}
result, err := SendPost(url, authToken, bodyByte)
if err != nil {
return nil, err
}
//fmt.Println("PushList result: " + result)
var pushListResult *PushListResult
if err := json.Unmarshal([]byte(result), &pushListResult); err != nil {
return nil, err
}
return pushListResult, err
}