Documentation ¶
Index ¶
- Constants
- func SendGet(url, appKey, masterSecret string) (string, error)
- func SendPostBytes(url string, content []byte, appKey, masterSecret string) (string, error)
- func SendPostBytes2(url string, data []byte, appKey, masterSecret string) (string, error)
- func SendPostString(url string, content, appKey, masterSecret string) (string, error)
- func TimeoutDialer(connectTimeout time.Duration, readWriteTimeout time.Duration) func(net, addr string) (c net.Conn, err error)
- func UnmarshalResponse(resp string) (map[string]interface{}, error)
- type AndroidNotification
- type Audience
- func (a *Audience) All()
- func (a *Audience) Interface() interface{}
- func (a *Audience) SetABTest(abtests []string)
- func (a *Audience) SetAlias(aliases []string)
- func (a *Audience) SetID(ids []string)
- func (a *Audience) SetSegment(segments []string)
- func (a *Audience) SetTag(tags []string)
- func (a *Audience) SetTagAnd(tags []string)
- func (a *Audience) SetTagNot(tags []string)
- type AudienceType
- type CallBack
- type CidRequest
- type CidResponse
- type HttpRequest
- func (h *HttpRequest) Bytes() ([]byte, error)
- func (h *HttpRequest) GetCookie(key string) string
- func (h *HttpRequest) GetHeader() http.Header
- func (h *HttpRequest) GetParam(key string) string
- func (h *HttpRequest) Response() (*http.Response, error)
- func (h *HttpRequest) SetBasicAuth(username, password string) *HttpRequest
- func (h *HttpRequest) SetBody(body interface{}) *HttpRequest
- func (h *HttpRequest) SetCookie(cookie *http.Cookie) *HttpRequest
- func (h *HttpRequest) SetHeader(key, value string) *HttpRequest
- func (h *HttpRequest) SetParam(key, value string) *HttpRequest
- func (h *HttpRequest) SetProtocolVersion(vers string) *HttpRequest
- func (h *HttpRequest) SetProxy(proxy func(*http.Request) (*url.URL, error)) *HttpRequest
- func (h *HttpRequest) SetQueryParam(key, value string) *HttpRequest
- func (h *HttpRequest) SetTLSConfig(config *tls.Config) *HttpRequest
- func (h *HttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *HttpRequest
- func (h *HttpRequest) SetTransport(transport http.RoundTripper) *HttpRequest
- func (h *HttpRequest) SetUserAgent(useragent string) *HttpRequest
- func (h *HttpRequest) Status() int
- func (h *HttpRequest) String() (string, error)
- func (h *HttpRequest) ToFile(file string) error
- func (h *HttpRequest) ToJson(v interface{}) error
- func (h *HttpRequest) ToXml(v interface{}) error
- type InappMessage
- type IosNotification
- type JPushClient
- func (j *JPushClient) CreateSchedule(data []byte) (string, error)
- func (j *JPushClient) DeleteSchedule(id string) (string, error)
- func (j *JPushClient) GetAuthorization() string
- func (j *JPushClient) GetCid(count int, push_type string) ([]byte, error)
- func (j *JPushClient) GetReport(msg_ids string) (string, error)
- func (j *JPushClient) GetSchedule(id string) (string, error)
- func (j *JPushClient) Push(data []byte) (string, error)
- type Message
- type Notification
- func (n *Notification) SetAiOpportunity(use bool)
- func (n *Notification) SetAlert(alert string)
- func (n *Notification) SetAndroid(android *AndroidNotification)
- func (n *Notification) SetIos(ios *IosNotification)
- func (n *Notification) SetQuickApp(quickApp *QuickAppNotification)
- func (n *Notification) SetVoip(value map[string]interface{})
- func (n *Notification) SetWinPhone(winPhone *WinPhoneNotification)
- type Notification3rd
- func (n *Notification3rd) SetBadgeAddNum(badgeAddNum string)
- func (n *Notification3rd) SetBadgeClass(badgeClass string)
- func (n *Notification3rd) SetChannelId(channelId string)
- func (n *Notification3rd) SetContent(content string) error
- func (n *Notification3rd) SetExtras(extras map[string]interface{})
- func (n *Notification3rd) SetSound(sound string)
- func (n *Notification3rd) SetTitle(title string)
- func (n *Notification3rd) SetUriAction(uriAction string)
- func (n *Notification3rd) SetUriActivity(uriActivity string)
- type Options
- func (o *Options) AddThirdPartyChannel(channel ThirdChannelType, value ThirdPartyOptions)
- func (o *Options) SetApnsProduction(apnsProduction bool)
- func (o *Options) SetBigPushDuration(bigPushDuration int)
- func (o *Options) SetOverrideMsgId(overrideMsgId int)
- func (o *Options) SetSendNo(sendNo int)
- func (o *Options) SetTimeToLive(timeToLive int)
- type PayLoad
- type Platform
- type PlatformType
- type QuickAppNotification
- type Schecule
- func (s *Schecule) Bytes() ([]byte, error)
- func (s *Schecule) GetCid() string
- func (s *Schecule) GetEnabled() bool
- func (s *Schecule) GetName() string
- func (s *Schecule) PeriodicalTrigger(start, end, t time.Time, timeUnit string, frequency int, point []string)
- func (s *Schecule) SetCid(cid string)
- func (s *Schecule) SetEnabled(enabled bool)
- func (s *Schecule) SetName(name string)
- func (s *Schecule) SetPayLoad(push *PayLoad)
- func (s *Schecule) SingleTrigger(t time.Time)
- type SmsMessage
- type ThirdChannelType
- type ThirdPartyChannel
- type ThirdPartyOptions
- type WinPhoneNotification
Constants ¶
const ( CHARSET = "UTF-8" CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_FORM = "application/x-www-form-urlencoded" DEFAULT_CONNECT_TIMEOUT = 60 // Connect timeout in seconds DEFAULT_READ_WRITE_TIMEOUT = 60 // Read and write timeout in seconds )
const ( SUCCESS_FLAG = "msg_id" HOST_PUSH = "https://api.jpush.cn/v3/push" HOST_SCHEDULE = "https://api.jpush.cn/v3/schedules" HOST_REPORT = "https://report.jpush.cn/v3/received" HOST_CID = "https://api.jpush.cn/v3/push/cid" )
Variables ¶
This section is empty.
Functions ¶
func SendPostBytes ¶
SendPostBytes sends a post request and returns the response body as bytes
func SendPostBytes2 ¶
SendPostBytes2 sends a post request and returns the response body as bytes
func SendPostString ¶
SendPostString sends a post request and returns the response body as string
func TimeoutDialer ¶
func TimeoutDialer(connectTimeout time.Duration, readWriteTimeout time.Duration) func(net, addr string) (c net.Conn, err error)
TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.
func UnmarshalResponse ¶
UnmarshalResponse unmarshals the response body to the map
Types ¶
type AndroidNotification ¶
type AndroidNotification struct { Alert interface{} `json:"alert"` // 通知内容 Title interface{} `json:"title,omitempty"` // 通知标题 BuilderID int `json:"builder_id,omitempty"` // 通知栏样式 ID ChannelId string `json:"channel_id,omitempty"` // android通知channel_id Priority int `json:"priority,omitempty"` // 通知栏展示优先级, 默认为 0,范围为 -2~2。 Category string `json:"category,omitempty"` // 通知栏条目过滤或排序 Style int `json:"style,omitempty"` // 通知栏样式类型, 默认为 0,还有 1,2,3 可选 AlertType int `json:"alert_type,omitempty"` // 通知提醒方式, 可选范围为 -1~7 BigText string `json:"big_text,omitempty"` // 大文本通知栏样式, 当 style = 1 时可用,内容会被通知栏以大文本的形式展示出来 Inbox interface{} `json:"inbox,omitempty"` // 文本条目通知栏样式, 当 style = 2 时可用, json 的每个 key 对应的 value 会被当作文本条目逐条展示 BigPicPath string `json:"big_pic_path,omitempty"` // 大图片通知栏样式, 当 style = 3 时可用,可以是网络图片 url,或本地图片的 path 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"` // 指定跳转页面, 该字段用于指定开发者想要打开的 activity,值为 activity 节点的 “android:name”属性值; 适配华为、小米、vivo厂商通道跳转; UriAction string `json:"uri_action,omitempty"` // 指定跳转页面, 该字段用于指定开发者想要打开的 activity,值为 "activity"-"intent-filter"-"action" 节点的 "android:name" 属性值; 适配 oppo、fcm跳转; BadgeAddNum int `json:"badge_add_num,omitempty"` // 角标数字,取值范围1-99 BadgeClass string `json:"badge_class,omitempty"` // 桌面图标对应的应用入口Activity类, 配合badge_add_num使用,二者需要共存,缺少其一不可; Sound string `json:"sound,omitempty"` // 填写Android工程中/res/raw/路径下铃声文件名称,无需文件名后缀 ShowBeginTime string `json:"show_begin_time,omitempty"` //定时展示开始时间(yyyy-MM-dd HH:mm:ss) ShowEndTime string `json:"show_end_time,omitempty"` //定时展示结束时间(yyyy-MM-dd HH:mm:ss) DisplayForeground string `json:"display_foreground,omitempty"` //APP在前台,通知是否展示, 值为 "1" 时,APP 在前台会弹出通知栏消息;值为 "0" 时,APP 在前台不会弹出通知栏消息。 }
type Audience ¶
type Audience struct { Object interface{} // contains filtered or unexported fields }
func (*Audience) SetSegment ¶
SetSegment set audiences by segment
type AudienceType ¶
type AudienceType string
const ( TAG AudienceType = "tag" // 标签OR TAG_AND AudienceType = "tag_and" // 标签AND TAG_NOT AudienceType = "tag_not" // 标签NOT ALIAS AudienceType = "alias" // 别名 REGISTRATION_ID AudienceType = "registration_id" // 注册ID SEGMENT AudienceType = "segment" // 用户分群 ID ABTEST AudienceType = "abtest" // A/B Test ID )
func (AudienceType) String ¶
func (a AudienceType) String() string
type CallBack ¶
type CallBack struct { Url string `json:"url,omitempty"` // 数据临时回调地址,指定后以此处指定为准,仅针对这一次推送请求生效;不指定,则以极光后台配置为准 Params map[string]interface{} `json:"params,omitempty"` // 需要回调给用户的自定义参数 Type string `json:"type,omitempty"` // 回调数据类型,1:送达回执, 2:点击回执, 3:送达和点击回执, 8:推送成功回执, 9:成功和送达回执, 10:成功和点击回执, 11:成功和送达以及点击回执 }
type CidRequest ¶
type CidRequest struct { Count int `json:"count,omitempty"` // 数值类型,不传则默认为 1。范围为 [1, 1000] Type string `json:"type,omitempty"` // CID 类型。取值:push(默认),schedule }
func NewCidRequest ¶
func NewCidRequest(count int, push_type string) *CidRequest
NewCidRequest 创建 CidRequest 对象
func (*CidRequest) GetCidList ¶
func (c *CidRequest) GetCidList(key, secret string) (*CidResponse, error)
GetCidList 获取 CID 列表
func (CidRequest) String ¶
func (c CidRequest) String() string
type CidResponse ¶
type CidResponse struct {
CidList []string `json:"cidlist,omitempty"` // CID 列表
}
func (CidResponse) String ¶
func (c CidResponse) String() string
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
func (*HttpRequest) Bytes ¶
func (h *HttpRequest) Bytes() ([]byte, error)
Bytes executes request client gets response body in bytes.
func (*HttpRequest) GetCookie ¶
func (h *HttpRequest) GetCookie(key string) string
GetCookie returns the request cookies.
func (*HttpRequest) GetHeader ¶
func (h *HttpRequest) GetHeader() http.Header
GetHeader returns header data.
func (*HttpRequest) GetParam ¶
func (h *HttpRequest) GetParam(key string) string
GetParam returns the request parameter value according to its key.
func (*HttpRequest) Response ¶
func (h *HttpRequest) Response() (*http.Response, error)
Response executes request client gets response in the return.
func (*HttpRequest) SetBasicAuth ¶
func (h *HttpRequest) SetBasicAuth(username, password string) *HttpRequest
SetBasicAuth sets the basic authentication header
func (*HttpRequest) SetBody ¶
func (h *HttpRequest) SetBody(body interface{}) *HttpRequest
SetBody sets request body. It supports string, []byte, url.Values, map[string]interface{} and io.Reader.
func (*HttpRequest) SetCookie ¶
func (h *HttpRequest) SetCookie(cookie *http.Cookie) *HttpRequest
SetCookie add cookie into request.
func (*HttpRequest) SetHeader ¶
func (h *HttpRequest) SetHeader(key, value string) *HttpRequest
SetHeader sets header field
func (*HttpRequest) SetParam ¶
func (h *HttpRequest) SetParam(key, value string) *HttpRequest
SetParam adds query param in to request.
func (*HttpRequest) SetProtocolVersion ¶
func (h *HttpRequest) SetProtocolVersion(vers string) *HttpRequest
SetProtocolVersion sets the protocol version for the request.
func (*HttpRequest) SetProxy ¶
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 (*HttpRequest) SetQueryParam ¶
func (h *HttpRequest) SetQueryParam(key, value string) *HttpRequest
SetQueryParam replaces the request query values.
func (*HttpRequest) SetTLSConfig ¶
func (h *HttpRequest) SetTLSConfig(config *tls.Config) *HttpRequest
SetTLSConfig sets tls connection configurations if visiting https url.
func (*HttpRequest) SetTimeout ¶
func (h *HttpRequest) SetTimeout(connectTimeout, readWriteTimeout time.Duration) *HttpRequest
SetTimeout sets connect time out and read-write time out for Request.
func (*HttpRequest) SetTransport ¶
func (h *HttpRequest) SetTransport(transport http.RoundTripper) *HttpRequest
SetTransport sets Transport to HttpClient.
func (*HttpRequest) SetUserAgent ¶
func (h *HttpRequest) SetUserAgent(useragent string) *HttpRequest
SetUserAgent sets User-Agent header field
func (*HttpRequest) String ¶
func (h *HttpRequest) String() (string, error)
String returns the body string in response. it calls Response internally.
func (*HttpRequest) ToFile ¶
func (h *HttpRequest) ToFile(file string) error
ToFile saves the body data in response to one file.
func (*HttpRequest) ToJson ¶
func (h *HttpRequest) ToJson(v interface{}) error
ToJson returns the map that converted from response body bytes as json in response .
func (*HttpRequest) ToXml ¶
func (h *HttpRequest) ToXml(v interface{}) error
ToXml returns the map that converted from response body bytes as xml in response .
type InappMessage ¶
type InappMessage struct {
InAppMessage bool `json:"inapp_message"`
}
inapp_message 面向于通知栏消息类型,对于通知权限关闭的用户可设置启用此功能。此功能启用后,当用户前台运行APP时,会通过应用内消息的方式展示通知栏消息内容。
func (*InappMessage) SetInAppMessage ¶
func (i *InappMessage) SetInAppMessage(inAppMessage bool)
SetInAppMessage 设置是否启用应用内消息
type IosNotification ¶
type IosNotification struct { Alert interface{} `json:"alert"` // 通知内容 Sound interface{} `json:"sound,omitempty"` // 通知提示声音或警告通知 Badge interface{} `json:"badge,omitempty"` // 应用角标, 如果不填,表示不改变角标数字,否则把角标数字改为指定的数字;为 0 表示清除。 ContentAvailable bool `json:"content-available,omitempty"` // 推送唤醒 MutableContent bool `json:"mutable-content,omitempty"` // 通知扩展 Category string `json:"category,omitempty"` // 通知类别, IOS 8 才支持。设置 APNs payload 中的 "category" 字段值 Extras map[string]interface{} `json:"extras,omitempty"` // 扩展字段 ThreadId string `json:"thread-id,omitempty"` // 通知分组, ios 的远程通知通过该属性来对通知进行分组,同一个 thread-id 的通知归为一组。 InterruptionLevel string `json:"interruption-level,omitempty"` // 通知优先级和交付时间的中断级别, ios15 的通知级别,取值只能是active,critical,passive,timeSensitive中的一个。 }
type JPushClient ¶
func NewJPushClient ¶
func NewJPushClient(appKey string, masterSecret string) *JPushClient
NewJPushClient returns a new JPushClient
func (*JPushClient) CreateSchedule ¶
func (j *JPushClient) CreateSchedule(data []byte) (string, error)
CreateSchedule 创建推送计划
func (*JPushClient) DeleteSchedule ¶
func (j *JPushClient) DeleteSchedule(id string) (string, error)
DeleteSchedule 删除推送计划
func (*JPushClient) GetAuthorization ¶
func (j *JPushClient) GetAuthorization() string
GetAuthorization returns the authorization string
func (*JPushClient) GetCid ¶
func (j *JPushClient) GetCid(count int, push_type string) ([]byte, error)
GetCid returns the cid list as byte array
func (*JPushClient) GetReport ¶
func (j *JPushClient) GetReport(msg_ids string) (string, error)
GetReport 获取消息推送结果
func (*JPushClient) GetSchedule ¶
func (j *JPushClient) GetSchedule(id string) (string, error)
GetSchedule 获取推送计划
type Message ¶
type Message struct { MsgContent string `json:"msg_content"` // 消息内容本身 Title string `json:"title,omitempty"` // 消息标题 ContentType string `json:"content_type,omitempty"` // 消息内容类型 Extras map[string]interface{} `json:"extras,omitempty"` // JSON 格式的可选参数 }
func (*Message) SetContentType ¶
SetContentType 设置消息内容类型
type Notification ¶
type Notification struct { AiOpportunity bool `json:"ai_opportunity,omitempty"` // 如需采用“智能时机”策略下发通知,必须指定该字段。 Alert string `json:"alert,omitempty"` // 通知的内容在各个平台上,都可能只有这一个最基本的属性 "alert"。 Android *AndroidNotification `json:"android,omitempty"` // Android通知 Ios *IosNotification `json:"ios,omitempty"` // iOS通知 QuickApp *QuickAppNotification `json:"quick_app,omitempty"` // 快应用通知 WinPhone *WinPhoneNotification `json:"winphone,omitempty"` // Windows Phone通知 Voip map[string]interface{} `json:"voip,omitempty"` // iOS VOIP功能。 }
func (*Notification) SetAiOpportunity ¶
func (n *Notification) SetAiOpportunity(use bool)
SetAiOpportunity 设置智能推送是否开启
func (*Notification) SetAndroid ¶
func (n *Notification) SetAndroid(android *AndroidNotification)
SetAndroid 设置 Android 通知
func (*Notification) SetQuickApp ¶
func (n *Notification) SetQuickApp(quickApp *QuickAppNotification)
SetQuickApp 设置 QuickApp 通知
func (*Notification) SetVoip ¶
func (n *Notification) SetVoip(value map[string]interface{})
SetVoip 设置 Voip 通知
func (*Notification) SetWinPhone ¶
func (n *Notification) SetWinPhone(winPhone *WinPhoneNotification)
SetWinPhone 设置 WinPhone 通知
type Notification3rd ¶
type Notification3rd struct { Title string `json:"title,omitempty"` // 补发通知标题,如果为空则默认为应用名称 Content string `json:"content"` // 补发通知的内容,如果存在 notification_3rd 这个key,content 字段不能为空,且值不能为空字符串。 ChannelId string `json:"channel_id,omitempty"` // 不超过1000字节 UriActivity string `json:"uri_activity,omitempty"` // 该字段用于指定开发者想要打开的 activity,值为 activity 节点的 “android:name”属性值;适配华为、小米、vivo厂商通道跳转;针对 VIP 厂商通道用户使用生效。 UriAction string `json:"uri_action,omitempty"` // 指定跳转页面;该字段用于指定开发者想要打开的 activity,值为 "activity"-"intent-filter"-"action" 节点的 "android:name" 属性值;适配 oppo、fcm跳转;针对 VIP 厂商通道用户使用生效。 BadgeAddNum string `json:"badge_add_num,omitempty"` // 角标数字,取值范围1-99 BadgeClass string `json:"badge_class,omitempty"` // 桌面图标对应的应用入口Activity类, 比如“com.test.badge.MainActivity; Sound string `json:"sound,omitempty"` // 填写Android工程中/res/raw/路径下铃声文件名称,无需文件名后缀;注意:针对Android 8.0以上,当传递了channel_id 时,此属性不生效。 Extras map[string]interface{} `json:"extras,omitempty"` // 扩展字段;这里自定义 JSON 格式的 Key / Value 信息,以供业务使用。 }
func (*Notification3rd) SetBadgeAddNum ¶
func (n *Notification3rd) SetBadgeAddNum(badgeAddNum string)
SetBadgeAddNum 设置角标数字
func (*Notification3rd) SetBadgeClass ¶
func (n *Notification3rd) SetBadgeClass(badgeClass string)
SetBadgeClass 设置桌面图标对应的应用入口Activity类
func (*Notification3rd) SetChannelId ¶
func (n *Notification3rd) SetChannelId(channelId string)
SetChannelId 设置通道ID
func (*Notification3rd) SetContent ¶
func (n *Notification3rd) SetContent(content string) error
SetContent 设置内容
func (*Notification3rd) SetExtras ¶
func (n *Notification3rd) SetExtras(extras map[string]interface{})
SetExtras 设置扩展字段
func (*Notification3rd) SetUriAction ¶
func (n *Notification3rd) SetUriAction(uriAction string)
SetUriAction 设置uri_action
func (*Notification3rd) SetUriActivity ¶
func (n *Notification3rd) SetUriActivity(uriActivity string)
SetUriActivity 设置uri_activity
type Options ¶
type Options struct { SendNo int `json:"sendno,omitempty"` //推送序号 TimeToLive int `json:"time_to_live,omitempty"` //离线消息保留时长(秒) OverrideMsgId int `json:"override_msg_id,omitempty"` //要覆盖的消息 ID ApnsProduction bool `json:"apns_production"` //APNs 是否生产环境 ApnsCollapseId string `json:"apns_collapse_id,omitempty"` //更新 iOS 通知的标识符 BigPushDuration int `json:"big_push_duration,omitempty"` //定速推送时长(分钟) ThirdPartyChannel ThirdPartyChannel `json:"third_party_channel,omitempty"` //推送请求下发通道 }
func (*Options) AddThirdPartyChannel ¶
func (o *Options) AddThirdPartyChannel(channel ThirdChannelType, value ThirdPartyOptions)
AddThirdPartyChannel 添加第三方渠道。
func (*Options) SetApnsProduction ¶
SetApnsProduction 设置推送时 APNs 是否生产环境。
func (*Options) SetBigPushDuration ¶
SetBigPushDuration 设置大推送时长,单位为秒。
func (*Options) SetOverrideMsgId ¶
SetOverrideMsgId 设置覆盖推送时由 JPush 生成的消息 ID。
func (*Options) SetTimeToLive ¶
SetTimeToLive 设置消息的有效期,单位为秒。
type PayLoad ¶
type PayLoad struct { Platform *Platform `json:"platform"` // 平台 Audience *Audience `json:"audience"` // 推送目标 Notification *Notification `json:"notification,omitempty"` // 推送内容 Message *Message `json:"message,omitempty"` // 推送内容 Options *Options `json:"options,omitempty"` // 推送选项 Cid string `json:"cid,omitempty"` // 推送唯一标识符 }
func (*PayLoad) SetNotification ¶
func (p *PayLoad) SetNotification(notification *Notification)
SetNotification 设置推送内容
type PlatformType ¶
type PlatformType string
const ( IOS PlatformType = "ios" ANDROID PlatformType = "android" WINPHONE PlatformType = "winphone" )
type QuickAppNotification ¶
type QuickAppNotification struct { Title string `json:"title"` // 通知标题, 必填字段,快应用推送通知的标题 Alert string `json:"alert"` // 通知内容, 这里指定了,则会覆盖上级统一指定的 alert 信息。 Page string `json:"page"` // 通知跳转页面, 必填字段,快应用通知跳转地址。 Extras map[string]interface{} `json:"extras,omitempty"` // 扩展字段, 这里自定义 Key / value 信息,以供业务使用。 }
type Schecule ¶
type Schecule struct { Cid string `json:"cid"` // 定时任务id Name string `json:"name"` // 定时任务名称 Enabled bool `json:"enabled"` // 是否启用 Trigger map[string]interface{} `json:"trigger"` // 定时任务触发条件 Push *PayLoad `json:"push"` // 定时任务推送内容 }
func NewSchedule ¶
NewSchedule 创建定时任务
type SmsMessage ¶
type SmsMessage struct { DelayTime int `json:"delay_time"` // 单位为秒,不能超过24小时。设置为0,表示立即发送短信。该参数仅对 android 和 iOS 平台有效,Winphone 平台则会立即发送短信。 Signid int `json:"signid,omitempty"` // 签名ID,该字段为空则使用应用默认签名。 TempId int64 `json:"temp_id,omitempty"` // 短信补充的内容模板 ID。没有填写该字段即表示不使用短信补充功能。 TempPara interface{} `json:"temp_para,omitempty"` // 短信模板中的参数。 ActiveFilter bool `json:"active_filter"` // active_filter 字段用来控制是否对补发短信的用户进行活跃过滤,默认为 true ,做活跃过滤;为 false,则不做活跃过滤; }
func (*SmsMessage) SetActiveFilter ¶
func (s *SmsMessage) SetActiveFilter(activeFilter bool)
SetActiveFilter 设置是否对补发短信的用户进行活跃过滤
func (*SmsMessage) SetDelayTime ¶
func (s *SmsMessage) SetDelayTime(delayTime int)
SetDelayTime 设置短信发送延时时间
func (*SmsMessage) SetTempPara ¶
func (s *SmsMessage) SetTempPara(tempPara interface{})
SetTempPara 设置短信模板参数
type ThirdChannelType ¶
type ThirdChannelType string
const ( XIAOMI ThirdChannelType = "xiaomi" HUAWEI ThirdChannelType = "huawei" MEIZU ThirdChannelType = "meizu" OPPO ThirdChannelType = "oppo" VIVO ThirdChannelType = "vivo" FCM ThirdChannelType = "fcm" )
func (ThirdChannelType) String ¶
func (t ThirdChannelType) String() string
type ThirdPartyChannel ¶
type ThirdPartyChannel struct {
// contains filtered or unexported fields
}
type ThirdPartyOptions ¶
type ThirdPartyOptions struct { Distribution string `json:"distribution,omitempty"` //通知栏消息下发逻辑 DistributionFcm string `json:"distribution_fcm,omitempty"` //通知栏消息fcm+国内厂商组合类型下发逻辑 DistributionCustomize string `json:"distribution_customize,omitempty"` //自定义消息国内厂商类型下发逻辑 ChannelId string `json:"channel_id,omitempty"` //通知栏消息分类 SkipQuota bool `json:"skip_quota,omitempty"` //配额判断及扣除, 目前仅对小米和oppo有效 Classification string `json:"classification,omitempty"` //通知栏消息分类, 为了适配 vivo 手机厂商通知栏消息分类,“0”代表运营消息,“1”代表系统消息 PushMode int `json:"push_mode,omitempty"` //通知栏消息类型, 对应 vivo 的 pushMode 字段,值分别是:“0”表示正式推送;“1”表示测试推送,不填默认为0 Importance string `json:"importance,omitempty"` //华为通知栏消息智能分类, 为了适配华为手机厂商的通知栏消息智能分类 Urgency string `json:"urgency,omitempty"` //华为厂商自定义消息优先级, 为了适配华为手机厂商自定义消息的优先级 Category string `json:"category,omitempty"` //华为厂商自定义消息场景标识 LargeIcon string `json:"large_icon,omitempty"` //厂商消息大图标样式, 目前支持小米/华为/oppo三个厂商 SmallIconUri string `json:"small_icon_uri,omitempty"` //厂商消息小图标样式, 目前支持小米/华为两个厂商 SmallIconColor string `json:"small_icon_color,omitempty"` //小米厂商小图标样式颜色 Style int `json:"style,omitempty"` //厂商消息大文本/inbox/大图片样式 BigText string `json:"big_text,omitempty"` //厂商消息大文本样式 Inbox interface{} `json:"inbox,omitempty"` //厂商消息inbox样式, 目前支持华为厂商 BigPicPath string `json:"big_pic_path,omitempty"` //厂商big_pic_path, 为了适配厂商的消息大图片样式,目前支持小米/oppo两个厂商 OnlyUseVendorStyle bool `json:"only_use_vendor_style,omitempty"` //是否是否使用自身通道设置样式 }
type WinPhoneNotification ¶
type WinPhoneNotification struct { Alert string `json:"alert"` // 通知内容, 必填字段,会填充到 toast 类型 text2 字段上。这里指定了,将会覆盖上级统一指定的 alert 信息;内容为空则不展示到通知栏。 Title string `json:"title,omitempty"` // 通知标题, 会填充到 toast 类型 text1 字段上。 OpenPage string `json:"_open_page,omitempty"` // 点击打开的页面名称, 点击打开的页面。会填充到推送信息的 param 字段上,表示由哪个 App 页面打开该通知。可不填,则由默认的首页打开。 Extras map[string]interface{} `json:"extras,omitempty"` // 扩展字段, 这里自定义 Key / value 信息,以供业务使用。 }