notify

package
v0.5.1 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

View Source
const (
	SegmentSubscribedUsers Segment = "Subscribed Users" // 所有已订阅的用户
	SegmentActiveUsers     Segment = "Active Users"     // 最近一周活跃的用户
	SegmentEngagedUsers    Segment = "Engaged Users"    // 最近一周重度依赖的用户
	SegmentInactiveUsers   Segment = "Inactive Users"   // 超过一周没有活跃的用户

	NotificationClickEventNone                  NotificationClickEvent = "none"                    // 空事件,点击通知什么都不会发送
	NotificationClickEventLoginAbnormal         NotificationClickEvent = "login_abnormal"          // 新的系统通知事件
	NotificationClickEventNewSystemNotification NotificationClickEvent = "new_system_notification" // 新的系统通知事件
)

Variables

View Source
var Notify = getInstance(NewNotifierOneSignal())

Functions

This section is empty.

Types

type Content

type Content struct {
	EN string `json:"en"`
}

type Event added in v0.5.0

type Event string
const (
	EventSendNotifyToAllUser             Event = "EventSendNotifyToAllUser"             // 推送给所有用户
	EventSendNotifyToCustomUser          Event = "EventSendNotifyToCustomUser"          // 推送给指定用户
	EventSendNotifyCheckUserLoginStatus  Event = "EventSendNotifyCheckUserLoginStatus"  // 推送检查用户登录状态
	EventSendNotifyToUserNewNotification Event = "EventSendNotifyToUserNewNotification" // 推送新的系统通知
)

type Headings

type Headings struct {
	EN string `json:"en"`
}

type NotificationBody added in v0.5.0

type NotificationBody struct {
	Event   NotificationClickEvent `json:"event"`   // 事件名
	Payload interface{}            `json:"payload"` // 数据体
}

发送推送附带的数据体结构 event 给 APP 识别 payload 是附带的数据

type NotificationClickEvent added in v0.5.0

type NotificationClickEvent string // 推送的点击事件

type Notifier

type Notifier interface {
	SendNotifyToAllUser(headings string, content string, data map[string]interface{}) error                      // 向所有用户推送
	SendNotifyToCustomUser(userIds []string, headings string, content string, data map[string]interface{}) error // 推送自定义通知
	SendNotifySystemNotificationToUser(notificationId string) error                                              // 推送系统通知
	//SendNotifyUserMessageToUser(userIds []string, title string, content string) error   // 推送用户消息
	SendNotifyToUserForLoginStatus(userID string) error // 推送用户登录异常
}

type NotifierOneSignal

type NotifierOneSignal struct {
}

func NewNotifierOneSignal

func NewNotifierOneSignal() *NotifierOneSignal

func (*NotifierOneSignal) SendNotifySystemNotificationToUser added in v0.5.0

func (n *NotifierOneSignal) SendNotifySystemNotificationToUser(notificationId string) error

func (*NotifierOneSignal) SendNotifyToAllUser

func (n *NotifierOneSignal) SendNotifyToAllUser(headings string, content string, data map[string]interface{}) error

func (*NotifierOneSignal) SendNotifyToCustomUser

func (n *NotifierOneSignal) SendNotifyToCustomUser(userId []string, headings string, content string, data map[string]interface{}) error

func (*NotifierOneSignal) SendNotifyToUserForLoginStatus added in v0.5.0

func (n *NotifierOneSignal) SendNotifyToUserForLoginStatus(userID string) error

type Segment added in v0.5.0

type Segment string // 用户细分群体

Jump to

Keyboard shortcuts

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