Getui

package
v0.0.0-...-ae4999c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseUrl   = "https://restapi.getui.com/v2/"
	IntentStr = "" /* 159-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func NewHttpClient

func NewHttpClient() *ghttp.Client

func Register

func Register(clientID string, user model.User) error

* 一个用户可以登录多个clientID,但每个clientID只能对应一个用户

func SendTo

func SendTo(user model.User, title, content string)

* 向指定用户推送消息

Types

type Android

type Android struct {
	UPS struct {
		Notification *Notification `json:"notification"`
	} `json:"ups"`
}

func NewAndroid

func NewAndroid(title, body, payload string) *Android

type Audience

type Audience struct {
	Cid []string `json:"cid"`
}

type Client

type Client struct {
	AppId        string
	AppKey       string
	AppSecret    string
	MasterSecret string
	BaseUrl      string
}

func NewClient

func NewClient() *Client

func SetAppId

func SetAppId(appId string) *Client

func SetAppKey

func SetAppKey(appKey string) *Client

func SetAppSecret

func SetAppSecret(appSecret string) *Client

func SetMasterSecret

func SetMasterSecret(masterSecret string) *Client

func (*Client) SetAppId

func (client *Client) SetAppId(appId string) *Client

func (*Client) SetAppKey

func (client *Client) SetAppKey(appKey string) *Client

func (*Client) SetAppSecret

func (client *Client) SetAppSecret(appSecret string) *Client

func (*Client) SetMasterSecret

func (client *Client) SetMasterSecret(masterSecret string) *Client

type IOS

type IOS struct {
	Type    string `json:"type"`
	Payload string `json:"payload"`
	APS     struct {
		Alert struct {
			Title string `json:"title"`
			Body  string `json:"body"`
		} `json:"alert"`
		ContentAvailable int `json:"content_available"`
	} `json:"aps"`
}

func NewIOS

func NewIOS(title, body, payload string) *IOS

type Notification

type Notification struct {
	Title     string  `json:"title"`
	Body      string  `json:"body"`
	ClickType string  `json:"click_type"`
	Intent    *string `json:"intent,omitempty"`
	Url       *string `json:"url,omitempty"`
}

type PushChannel

type PushChannel struct {
	Android *Android `json:"android"`
	IOS     *IOS     `json:"ios"`
}

type PushMessage

type PushMessage struct {
	Duration     string        `json:"duration,omitempty"`
	Notification *Notification `json:"notification,omitempty"`
	Transmission *string       `json:"transmission,omitempty"`
}

type PushRequest

type PushRequest struct {
	ID          string                 `json:"request_id"`
	Settings    map[string]interface{} `json:"settings"`
	Audience    *Audience              `json:"audience"`
	PushMessage *PushMessage           `json:"push_message"`
	PushChannel *PushChannel           `json:"push_channel,omitempty"`
}

func NewPushRequest

func NewPushRequest() *PushRequest

func (*PushRequest) AddCid

func (request *PushRequest) AddCid(cid string) *PushRequest

func (*PushRequest) SetNotification

func (request *PushRequest) SetNotification(title, body string) *PushRequest

func (*PushRequest) SetSettings

func (request *PushRequest) SetSettings(name string, settings interface{}) *PushRequest

func (*PushRequest) SetTransmission

func (request *PushRequest) SetTransmission(title, body, payload string) *PushRequest

type Response

type Response struct {
	Code int             `json:"code"`
	Msg  string          `json:"msg"`
	Data json.RawMessage `json:"data"`
}

Jump to

Keyboard shortcuts

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