push

package
v0.0.0-...-db0aad3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	PushSingleByCid(ctx context.Context, request *SingleReq, token string) (map[string]map[string]string, error)
	PushSingleByAlias(ctx context.Context, request *SingleReq, token string) (map[string]map[string]string, error)
	PushBatchByCid(ctx context.Context, request *BatchReq, token string) (map[string]map[string]string, error)
	PushBatchByAlias(ctx context.Context, request *BatchReq, token string) (map[string]map[string]string, error)
	CreateMsg(ctx context.Context, request *CreateReq, token string) (string, error)
	PushListByCid(ctx context.Context, request *ListReq, token string) (map[string]map[string]string, error)
	PushListByAlias(ctx context.Context, request *ListReq, token string) (map[string]map[string]string, error)
	PushAll(ctx context.Context, request *AllReq, token string) (string, error)
	PushByTag(ctx context.Context, request *ByTagReq, token string) (string, error)
	PushByFastCustomTag(ctx context.Context, request *ByTagReq, token string) (string, error)
	StopPush(ctx context.Context, taskId, token string) (bool, error)
	DeleteScheduleTask(ctx context.Context, taskId, token string) (bool, error)
	QueryScheduleTask(ctx context.Context, taskId, token string) (map[string]string, error)
	QueryDetail(ctx context.Context, taskId, cId, token string) ([][2]string, error)
	Close()
}

type AgentMgr

type AgentMgr struct {
	// contains filtered or unexported fields
}

func NewAgentMgr

func NewAgentMgr() (*AgentMgr, error)

func (*AgentMgr) Close

func (m *AgentMgr) Close()

func (*AgentMgr) CreateMsg

func (m *AgentMgr) CreateMsg(ctx context.Context, uniqueId core.UniqueId, request *CreateReq, token string) (string, error)

func (*AgentMgr) DeleteScheduleTask

func (m *AgentMgr) DeleteScheduleTask(ctx context.Context, uniqueId core.UniqueId, taskId, token string) (bool, error)

func (*AgentMgr) PushAll

func (m *AgentMgr) PushAll(ctx context.Context, uniqueId core.UniqueId, request *AllReq, token string) (string, error)

func (*AgentMgr) PushBatch

func (m *AgentMgr) PushBatch(ctx context.Context, uniqueId core.UniqueId, request *BatchReq, token string) (map[string]map[string]string, error)

func (*AgentMgr) PushByTag

func (m *AgentMgr) PushByTag(ctx context.Context, uniqueId core.UniqueId, request *ByTagReq, token string) (string, error)

func (*AgentMgr) PushList

func (m *AgentMgr) PushList(ctx context.Context, uniqueId core.UniqueId, request *ListReq, token string) (map[string]map[string]string, error)

func (*AgentMgr) PushSingle

func (m *AgentMgr) PushSingle(ctx context.Context, uniqueId core.UniqueId, request *SingleReq, token string) (map[string]map[string]string, error)

func (*AgentMgr) QueryDetail

func (m *AgentMgr) QueryDetail(ctx context.Context, uniqueId core.UniqueId, taskId, cId, token string) ([][2]string, error)

func (*AgentMgr) QueryScheduleTask

func (m *AgentMgr) QueryScheduleTask(ctx context.Context, uniqueId core.UniqueId, taskId, token string) (map[string]string, error)

func (*AgentMgr) RegisterAgent

func (m *AgentMgr) RegisterAgent(uniqueId core.UniqueId, agent Agent) error

func (*AgentMgr) StopPush

func (m *AgentMgr) StopPush(ctx context.Context, uniqueId core.UniqueId, taskId, token string) (bool, error)

type AllReq

type AllReq struct {
	RequestId   string             `json:"request_id"`             // 必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
	GroupName   string             `json:"group_name,omitempty"`   // 非必须,任务组名
	Audience    string             `json:"audience"`               // 必须字段,必须为all
	Settings    *proto.Settings    `json:"settings,omitempty"`     // 非必须,推送条件设置
	PushMessage *proto.PushMessage `json:"push_message"`           // 必须字段,个推推送消息参数
	PushChannel *proto.PushChannel `json:"push_channel,omitempty"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数
}

type ApnsPush

type ApnsPush struct {
	// contains filtered or unexported fields
}

func NewApnsPush

func NewApnsPush(env, topic string, hc *http.Client) (*ApnsPush, error)

func (*ApnsPush) Close

func (a *ApnsPush) Close()

func (*ApnsPush) CreateMsg

func (a *ApnsPush) CreateMsg(ctx context.Context, request *CreateReq, token string) (string, error)

func (*ApnsPush) DeleteScheduleTask

func (a *ApnsPush) DeleteScheduleTask(ctx context.Context, taskId, token string) (bool, error)

func (*ApnsPush) PushAll

func (a *ApnsPush) PushAll(ctx context.Context, request *AllReq, token string) (string, error)

func (*ApnsPush) PushBatchByAlias

func (a *ApnsPush) PushBatchByAlias(ctx context.Context, request *BatchReq, token string) (map[string]map[string]string, error)

func (*ApnsPush) PushBatchByCid

func (a *ApnsPush) PushBatchByCid(ctx context.Context, request *BatchReq, token string) (map[string]map[string]string, error)

func (*ApnsPush) PushByFastCustomTag

func (a *ApnsPush) PushByFastCustomTag(ctx context.Context, request *ByTagReq, token string) (string, error)

func (*ApnsPush) PushByTag

func (a *ApnsPush) PushByTag(ctx context.Context, request *ByTagReq, token string) (string, error)

func (*ApnsPush) PushListByAlias

func (a *ApnsPush) PushListByAlias(ctx context.Context, request *ListReq, token string) (map[string]map[string]string, error)

func (*ApnsPush) PushListByCid

func (a *ApnsPush) PushListByCid(ctx context.Context, request *ListReq, token string) (map[string]map[string]string, error)

func (*ApnsPush) PushSingleByAlias

func (a *ApnsPush) PushSingleByAlias(ctx context.Context, request *SingleReq, token string) (map[string]map[string]string, error)

func (*ApnsPush) PushSingleByCid

func (a *ApnsPush) PushSingleByCid(ctx context.Context, request *SingleReq, token string) (map[string]map[string]string, error)

func (*ApnsPush) QueryDetail

func (a *ApnsPush) QueryDetail(ctx context.Context, taskId, cId, token string) ([][2]string, error)

func (*ApnsPush) QueryScheduleTask

func (a *ApnsPush) QueryScheduleTask(ctx context.Context, taskId, token string) (map[string]string, error)

func (*ApnsPush) StopPush

func (a *ApnsPush) StopPush(ctx context.Context, taskId, token string) (bool, error)

type BatchReq

type BatchReq struct {
	IsAsync bool         `json:"is_async,omitempty"` // 非必须,默认值:false,是否异步推送,异步推送不会返回data,is_async为false时返回data
	MsgList []*SingleReq `json:"msg_list"`           // 必须,默认值:无,消息内容,数组长度不大于 200
}

type ByTagReq

type ByTagReq struct {
	RequestId   string             `json:"request_id"`             // 必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
	GroupName   string             `json:"group_name,omitempty"`   // 非必须,任务组名
	Settings    *proto.Settings    `json:"settings,omitempty"`     // 非必须,推送条件设置
	Audience    *proto.Audience    `json:"audience"`               // 必须字段,tag数组
	PushMessage *proto.PushMessage `json:"push_message"`           // 必须字段,个推推送消息参数
	PushChannel *proto.PushChannel `json:"push_channel,omitempty"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数
}

type CreateReq

type CreateReq struct {
	RequestId   string             `json:"request_id,omitempty"`   // 非必须,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
	GroupName   string             `json:"group_name,omitempty"`   // 非必须,任务组名
	Settings    *proto.Settings    `json:"settings,omitempty"`     // 非必须,推送条件设置
	PushMessage *proto.PushMessage `json:"push_message"`           // 必须字段,个推推送消息参数
	PushChannel *proto.PushChannel `json:"push_channel,omitempty"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数
}

type GeTuiPush

type GeTuiPush struct {
	// contains filtered or unexported fields
}

func NewGeTuiPush

func NewGeTuiPush(apiUrl, appId string, hc *http.Client) (*GeTuiPush, error)

func (*GeTuiPush) Close

func (g *GeTuiPush) Close()

func (*GeTuiPush) CreateMsg

func (g *GeTuiPush) CreateMsg(ctx context.Context, request *CreateReq, token string) (string, error)

func (*GeTuiPush) DeleteScheduleTask

func (g *GeTuiPush) DeleteScheduleTask(ctx context.Context, taskId, token string) (bool, error)

func (*GeTuiPush) PushAll

func (g *GeTuiPush) PushAll(ctx context.Context, request *AllReq, token string) (string, error)

func (*GeTuiPush) PushBatchByAlias

func (g *GeTuiPush) PushBatchByAlias(ctx context.Context, request *BatchReq, token string) (map[string]map[string]string, error)

func (*GeTuiPush) PushBatchByCid

func (g *GeTuiPush) PushBatchByCid(ctx context.Context, request *BatchReq, token string) (map[string]map[string]string, error)

func (*GeTuiPush) PushByFastCustomTag

func (g *GeTuiPush) PushByFastCustomTag(ctx context.Context, request *ByTagReq, token string) (string, error)

func (*GeTuiPush) PushByTag

func (g *GeTuiPush) PushByTag(ctx context.Context, request *ByTagReq, token string) (string, error)

func (*GeTuiPush) PushListByAlias

func (g *GeTuiPush) PushListByAlias(ctx context.Context, request *ListReq, token string) (map[string]map[string]string, error)

func (*GeTuiPush) PushListByCid

func (g *GeTuiPush) PushListByCid(ctx context.Context, request *ListReq, token string) (map[string]map[string]string, error)

func (*GeTuiPush) PushSingleByAlias

func (g *GeTuiPush) PushSingleByAlias(ctx context.Context, request *SingleReq, token string) (map[string]map[string]string, error)

func (*GeTuiPush) PushSingleByCid

func (g *GeTuiPush) PushSingleByCid(ctx context.Context, request *SingleReq, token string) (map[string]map[string]string, error)

func (*GeTuiPush) QueryDetail

func (g *GeTuiPush) QueryDetail(ctx context.Context, taskId, cId, token string) ([][2]string, error)

func (*GeTuiPush) QueryScheduleTask

func (g *GeTuiPush) QueryScheduleTask(ctx context.Context, taskId, token string) (map[string]string, error)

func (*GeTuiPush) StopPush

func (g *GeTuiPush) StopPush(ctx context.Context, taskId, token string) (bool, error)

type ListReq

type ListReq struct {
	Audience *proto.Audience `json:"audience"`           // 必须字段,用cid数组,多个cid,注意这里!!数组长度不大于200
	IsAsync  bool            `json:"is_async,omitempty"` // 非必须,默认值:false,是否异步推送,异步推送不会返回data,is_async为false时返回data
	TaskId   string          `json:"taskid"`             // 必须字段,默认值:无,使用创建消息接口返回的taskId,可以多次使用
}

type Server

type Server struct {
	*proto.UnimplementedPushServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conf *core.PushConfig) (*Server, error)

func (*Server) CheckTask

func (s *Server) CheckTask(ctx context.Context, in *proto.CheckTaskReq) (*proto.CheckTaskResp, error)

func (*Server) Close

func (s *Server) Close()

func (*Server) CreateTask

func (s *Server) CreateTask(ctx context.Context, in *proto.CreateTaskReq) (*proto.CreateTaskResp, error)

func (*Server) PushToApp

func (s *Server) PushToApp(ctx context.Context, in *proto.PushToAppReq) (*proto.PushToAppResp, error)

func (*Server) PushToList

func (s *Server) PushToList(ctx context.Context, in *proto.PushToListReq) (*proto.PushToListResp, error)

func (*Server) PushToSingle

func (s *Server) PushToSingle(ctx context.Context, in *proto.PushToSingleReq) (*proto.PushToSingleResp, error)

func (*Server) RemoveTask

func (s *Server) RemoveTask(ctx context.Context, in *proto.RemoveTaskReq) (*proto.RemoveTaskResp, error)

func (*Server) StopTask

func (s *Server) StopTask(ctx context.Context, in *proto.StopTaskReq) (*proto.StopTaskResp, error)

func (*Server) ViewDetail

func (s *Server) ViewDetail(ctx context.Context, in *proto.ViewDetailReq) (*proto.ViewDetailResp, error)

type SingleReq

type SingleReq struct {
	RequestId   string             `json:"request_id"`             // 必须字段,请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
	Audience    *proto.Audience    `json:"audience"`               // 必须字段,cid数组,只能填一个cid
	Settings    *proto.Settings    `json:"settings,omitempty"`     // 非必须,推送条件设置
	PushMessage *proto.PushMessage `json:"push_message"`           // 必须字段,个推推送消息参数
	PushChannel *proto.PushChannel `json:"push_channel,omitempty"` // 非必须,厂商推送消息参数,包含ios消息参数,android厂商消息参数
}

Jump to

Keyboard shortcuts

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