getuigo

package module
v0.0.0-...-bb8398c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2020 License: MIT Imports: 8 Imported by: 0

README

getuigo

简介

项目在github.com/geek-go/getui的基础上封装了个推的go语言SDK。 项目定义了Payload数据结构和接口,并且封装了发送流程接口。

数据结构说明
GetuiConfig
type GetuiConfig struct {
     AppId        string `yaml:"appid"`
     AppKey       string `yaml:"appkey"`
     AppSecret    string `yaml:"appsecret"`
     MasterSecret string `yaml:"mastersecret"`
 }

可以通过YAML或者其他方式填充个推的配置,注意请不要将秘钥包含在版本库中。

GetuiPush

GetuiPush是外部调用的数据结构,封装了发送推送的接口。

BasicPayload
type BasicPayload struct {
    PushTitle    string `json:"push_title"`
    PushBody     string `json:"push_body"`
    IsShowNotify int    `json:"is_show_notify"`
    Ext          string `json:"ext"`
}

可以通过组合BasicPayload并实现Payload接口的方式定义属于业务的Payload。

示例

sample中实现了调用示例。

Documentation

Index

Constants

View Source
const (
	LogNone = iota
	LogStd
	LogFile
)
View Source
const NotifyTypeIntent = "1"
View Source
const NotifyTypePayload = "0"
View Source
const NotifyTypeUrl = "2"

Variables

View Source
var LogType = LogNone

Functions

func IGtTransmissionTemplate

func IGtTransmissionTemplate(payload Payload) (*getui.Transmission, *getui.PushInfo, error)

Types

type BasicPayload

type BasicPayload struct {
	NotifyTitle  string `json:"push_title"`
	NotifyBody   string `json:"push_body"`
	IsShowNotify int    `json:"is_show_notify"`
	Ext          string `json:"ext"`
}

func (*BasicPayload) GetExt

func (p *BasicPayload) GetExt() string

func (*BasicPayload) GetIntent

func (p *BasicPayload) GetIntent() string

func (*BasicPayload) GetIsShowNotify

func (p *BasicPayload) GetIsShowNotify() int

func (*BasicPayload) GetNotifyBody

func (p *BasicPayload) GetNotifyBody() string

func (*BasicPayload) GetNotifyTitle

func (p *BasicPayload) GetNotifyTitle() string

func (*BasicPayload) SetExt

func (p *BasicPayload) SetExt(ext string)

func (*BasicPayload) SetIntent

func (p *BasicPayload) SetIntent(_ string)

func (*BasicPayload) SetIsShowNotify

func (p *BasicPayload) SetIsShowNotify(isshow int)

func (*BasicPayload) SetNotifyBody

func (p *BasicPayload) SetNotifyBody(body string)

func (*BasicPayload) SetNotifyTitle

func (p *BasicPayload) SetNotifyTitle(title string)

func (*BasicPayload) String

func (p *BasicPayload) String() string

type GetuiConfig

type GetuiConfig struct {
	AppId          string `json:"appid" yaml:"appid"`
	AppKey         string `json:"appkey" yaml:"appkey"`
	AppSecret      string `json:"appsecret" yaml:"appsecret"`
	MasterSecret   string `json:"mastersecret" yaml:"mastersecret"`
	IntentTemplate string `json:"intent_template" yaml:"intent_template"`
}

type GetuiPush

type GetuiPush struct {
	Config *GetuiConfig
}

func NewGeTui

func NewGeTui(config *GetuiConfig) (*GetuiPush, error)

func (*GetuiPush) MergeAppConditions

func (g *GetuiPush) MergeAppConditions(filters ...getui.AppCondition) getui.Condition

func (*GetuiPush) PushAppConditions

func (g *GetuiPush) PushAppConditions(filters ...getui.AppCondition) getui.Condition

func (*GetuiPush) RequestId

func (g *GetuiPush) RequestId(useUuid bool) (s string)

func (*GetuiPush) SendTransmissionByCid

func (g *GetuiPush) SendTransmissionByCid(cid string, payload Payload) error

func (*GetuiPush) SendTransmissionByCidList

func (g *GetuiPush) SendTransmissionByCidList(cids []string, payload Payload) error

func (*GetuiPush) SendTransmissionToAll

func (g *GetuiPush) SendTransmissionToAll(payload Payload, filter ...getui.AppCondition) error

type Payload

type Payload interface {
	GetNotifyTitle() string
	SetNotifyTitle(title string)
	GetNotifyBody() string
	SetNotifyBody(body string)
	GetIsShowNotify() int
	SetIsShowNotify(isshow int)
	GetIntent() string
	SetIntent(intent string)
	String() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL