pushgateway

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPushRejected error = &RespPush{}

Functions

This section is empty.

Types

type BaseDevice

type BaseDevice struct {
	AppID     PusherAppID `json:"app_id"`
	PushKey   string      `json:"pushkey"`
	PushKeyTS int64       `json:"pushkey_ts,omitempty"`
	Data      PusherData  `json:"data,omitempty"`
}

type Device

type Device struct {
	BaseDevice
	Tweaks map[pushrules.PushActionTweak]any `json:"tweaks,omitempty"`
}

type NotificationCounts

type NotificationCounts struct {
	MissedCalls int `json:"missed_calls,omitempty"`
	Unread      int `json:"unread,omitempty"`

	BeeperServerType string `json:"com.beeper.server_type,omitempty"`
	BeeperAsOfToken  string `json:"com.beeper.as_of_token,omitempty"`
}

type PushFormat added in v0.12.2

type PushFormat string
const (
	PushFormatDefault     PushFormat = ""
	PushFormatEventIDOnly PushFormat = "event_id_only"
)

type PushKey

type PushKey struct {
	BaseDevice
	URL string `json:"url"`
}

func (*PushKey) Push

func (pk *PushKey) Push(ctx context.Context, data *PushNotification) error

type PushNotification

type PushNotification struct {
	Devices []Device `json:"devices"`

	Counts *NotificationCounts `json:"counts,omitempty"`

	EventID           id.EventID      `json:"event_id,omitempty"`
	Priority          PushPriority    `json:"prio,omitempty"`
	RoomAlias         id.RoomAlias    `json:"room_alias,omitempty"`
	RoomID            id.RoomID       `json:"room_id,omitempty"`
	RoomName          string          `json:"room_name,omitempty"`
	Sender            id.UserID       `json:"sender,omitempty"`
	SenderDisplayName string          `json:"sender_display_name,omitempty"`
	Type              string          `json:"type,omitempty"`
	Content           json.RawMessage `json:"content,omitempty"`
	UserIsTarget      bool            `json:"user_is_target,omitempty"`

	BeeperTTL    *int      `json:"com.beeper.ttl,omitempty"`
	BeeperUserID id.UserID `json:"com.beeper.user_id,omitempty"`
}

func (*PushNotification) Push

func (pn *PushNotification) Push(ctx context.Context, url string) error

type PushPriority

type PushPriority string
const (
	PushPriorityHigh PushPriority = "high"
	PushPriorityLow  PushPriority = "low"
)

type Pusher added in v0.12.2

type Pusher struct {
	AppDisplayName    string      `json:"app_display_name"`
	AppID             PusherAppID `json:"app_id"`
	Data              PusherData  `json:"data"`
	DeviceDisplayName string      `json:"device_display_name"`
	Kind              *PusherKind `json:"kind"`
	Language          string      `json:"lang"`
	ProfileTag        string      `json:"profile_tag,omitempty"`
	PushKey           string      `json:"pushkey"`
}

type PusherAppID added in v0.12.2

type PusherAppID string
const (
	PusherAppEmail PusherAppID = "m.email"
)

type PusherData added in v0.12.2

type PusherData map[string]any

func (PusherData) ConvertToNotificationData added in v0.12.2

func (pd PusherData) ConvertToNotificationData() PusherData

ConvertToNotificationData returns a copy of the map with the url and format fields removed.

func (PusherData) Format added in v0.12.2

func (pd PusherData) Format() PushFormat

func (PusherData) URL added in v0.12.2

func (pd PusherData) URL() string

type PusherKind added in v0.12.2

type PusherKind string
const (
	PusherKindHTTP  PusherKind = "http"
	PusherKindEmail PusherKind = "email"
)

type ReqPush

type ReqPush struct {
	Notification *PushNotification `json:"notification"`
}

type RespPush

type RespPush struct {
	Rejected []string `json:"rejected"`
}

func (*RespPush) Error

func (rp *RespPush) Error() string

func (*RespPush) Is

func (rp *RespPush) Is(other error) bool

type RespPushers added in v0.12.2

type RespPushers struct {
	Pushers []Pusher `json:"pushers"`
}

Jump to

Keyboard shortcuts

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