-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreport.go
More file actions
22 lines (18 loc) · 741 Bytes
/
report.go
File metadata and controls
22 lines (18 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package jpush_golang
import "time"
// GetReport 获取消息推送结果
func (j *JPushClient) GetReport(msg_ids string) (string, error) {
return j.sendGetReportRequest(msg_ids)
}
// SendGetReportRequest sends a get report request and returns the response body as string
func (j *JPushClient) sendGetReportRequest(msg_ids string) (string, error) {
req := Get(HOST_REPORT)
req.SetTimeout(DEFAULT_CONNECT_TIMEOUT*time.Second, DEFAULT_READ_WRITE_TIMEOUT*time.Second)
req.SetHeader("Connection", "Keep-Alive")
req.SetHeader("Charset", CHARSET)
req.SetBasicAuth(j.AppKey, j.MasterSecret)
req.SetHeader("Content-Type", CONTENT_TYPE_JSON)
req.SetProtocolVersion("HTTP/1.1")
req.SetQueryParam("msg_ids", msg_ids)
return req.String()
}