push

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFcmTokens

func GetFcmTokens() map[string]string

GetFcmTokens returns the current in-memory FCM tokens

func NewFromCmdlineOptions

func NewFromCmdlineOptions() plugin.Plugin

Types

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse represents a generic error response.

type Notification

type Notification struct {
	Tokens   []string `json:"tokens"`
	Platform int      `json:"platform"`
	Message  string   `json:"message"`
}

type PushOptionFunc

type PushOptionFunc func(*PushOutput)

func WithAccessTokenUrl

func WithAccessTokenUrl(url string) PushOptionFunc

func WithServiceAccountFilePath

func WithServiceAccountFilePath(serviceAccountFilePath string) PushOptionFunc

type PushOutput

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

func New

func New(options ...PushOptionFunc) *PushOutput

func (*PushOutput) AddNewFcmTokens

func (p *PushOutput) AddNewFcmTokens()

AddNewFcmTokens adds only the new FCM tokens to the fcmTokens slice

func (*PushOutput) ErrorChan

func (p *PushOutput) ErrorChan() chan error

ErrorChan returns the input error channel

func (*PushOutput) GetAccessToken

func (p *PushOutput) GetAccessToken() error

func (*PushOutput) GetProjectId

func (p *PushOutput) GetProjectId() error

Get project ID from file

func (*PushOutput) InputChan

func (p *PushOutput) InputChan() chan<- event.Event

InputChan returns the input event channel

func (*PushOutput) OutputChan

func (p *PushOutput) OutputChan() <-chan event.Event

OutputChan always returns nil

func (*PushOutput) RegisterRoutes

func (p *PushOutput) RegisterRoutes()

func (*PushOutput) Start

func (p *PushOutput) Start() error

func (*PushOutput) Stop

func (p *PushOutput) Stop() error

Stop the embedded output

type PushPayload

type PushPayload struct {
	Notifications []Notification `json:"notifications"`
}

type TokenRequest

type TokenRequest struct {
	FCMToken string `json:"fcmToken" binding:"required"`
}

TokenRequest represents a request containing an FCM token.

type TokenResponse

type TokenResponse struct {
	FCMToken string `json:"fcmToken"`
}

Token represents an FCM token object.

@Produce	json
@Success	200	{object}	TokenResponse

type TokenStore

type TokenStore struct {
	FCMTokens map[string]string
}

Jump to

Keyboard shortcuts

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