HOST_IMAGES = "https://api.jpush.cn/v3/images"
func SendPostBytes(url string, content []byte, appKey, masterSecret string) (string, error)
SendPostBytes sends a post request and returns the response body as bytes
func SendPostBytes2(url string, data []byte, appKey, masterSecret string) (string, error)
SendPostBytes2 sends a post request and returns the response body as bytes
func SendPostString(url string, content, appKey, masterSecret string) (string, error)
SendPostString sends a post request and returns the response body as string
func TimeoutDialer(connectTimeout time.Duration, readWriteTimeout time.Duration) func(ctx context.Context, network, addr string) (c net.Conn, err error)
TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.
type AndroidNotification struct {
Alert interface{} `json:"alert"`
Title interface{} `json:"title,omitempty"`
BuilderID int `json:"builder_id,omitempty"`
ChannelId string `json:"channel_id,omitempty"`
Priority int `json:"priority,omitempty"`
Category string `json:"category,omitempty"`
Style int `json:"style,omitempty"`
AlertType int `json:"alert_type,omitempty"`
BigText string `json:"big_text,omitempty"`
Inbox interface{} `json:"inbox,omitempty"`
BigPicPath string `json:"big_pic_path,omitempty"`
Extras map[string]interface{} `json:"extras,omitempty"`
LargeIcon string `json:"large_icon,omitempty"`
SmallIconUri string `json:"small_icon_uri,omitempty"`
Intent interface{} `json:"intent,omitempty"`
UriActivity string `json:"uri_activity,omitempty"`
UriAction string `json:"uri_action,omitempty"`
BadgeAddNum int `json:"badge_add_num,omitempty"`
BadgeClass string `json:"badge_class,omitempty"`
Sound string `json:"sound,omitempty"`
ShowBeginTime string `json:"show_begin_time,omitempty"`
ShowEndTime string `json:"show_end_time,omitempty"`
DisplayForeground string `json:"display_foreground,omitempty"`
TAG AudienceType = "tag"
TAG_AND AudienceType = "tag_and"
TAG_NOT AudienceType = "tag_not"
ALIAS AudienceType = "alias"
REGISTRATION_ID AudienceType = "registration_id"
SEGMENT AudienceType = "segment"
ABTEST AudienceType = "abtest"
LIVEACTIVITYID AudienceType = "live_activity_id"
type CallBack struct {
Url string `json:"url,omitempty"`
Params map[string]interface{} `json:"params,omitempty"`
Type string `json:"type,omitempty"`
type CidRequest struct {
Count int `json:"count,omitempty"`
Type string `json:"type,omitempty"`
func (h *HttpRequest) SetBody(body interface{}) *HttpRequest
SetBody sets request body.
It supports string, []byte, url.Values, map[string]interface{} and io.Reader.
func (h *HttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *HttpRequest
SetProxy sets proxy for HttpClient.
example:
func(req *http.Request) (*url.URL, error) {
u, _ := url.ParseRequestURI("http://127.0.0.1:8118")
return u, nil
func (h *HttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *HttpRequest
SetTimeout sets connect time out and read-write time out for Request.
func (h *HttpRequest) String() (string, error)
String returns the body string in response.
it calls Response internally.
type IosLiveActivity struct {
Event string `json:"event"`
ContentState interface{} `json:"content-state"`
AttributesType string `json:"attributes-type"`
Attributes interface{} `json:"attributes"`
RelevanceScore int `json:"relevance-score,omitempty"`
StaleDate int `json:"stale-date,omitempty"`
Alert *IosLiveActivityAlert `json:"alert,omitempty"`
DismissalDate int `json:"dismissal-date,omitempty"`
type IosLiveActivityAlert struct {
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
Sound string `json:"sound,omitempty"`
type IosNotification struct {
Alert interface{} `json:"alert"`
Sound interface{} `json:"sound,omitempty"`
Badge interface{} `json:"badge,omitempty"`
ContentAvailable bool `json:"content-available,omitempty"`
MutableContent bool `json:"mutable-content,omitempty"`
Category string `json:"category,omitempty"`
ThreadId string `json:"thread-id,omitempty"`
InterruptionLevel string `json:"interruption-level,omitempty"`
type Message struct {
MsgContent string `json:"msg_content"`
Title string `json:"title,omitempty"`
ContentType string `json:"content_type,omitempty"`