bark

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Scheme = "bark"
)

Scheme is the identifying part of this service's configuration URL

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	standard.EnumlessConfig
	Title     string `key:"title"    default:""      desc:"Notification title, optionally set by the sender"`
	Host      string `url:"host"                     desc:"Server hostname and port"`
	Path      string `url:"path"     default:"/"     desc:"Server path"`
	DeviceKey string `url:"password"                 desc:"The key for each device"`
	Scheme    string `key:"scheme"   default:"https" desc:"Server protocol, http or https"`
	Sound     string `key:"sound"    default:""      desc:"Value from https://github.com/Finb/Bark/tree/master/Sounds"`
	Badge     int64  `key:"badge"    default:"0"     desc:"The number displayed next to App icon"`
	Icon      string `key:"icon"     default:""      desc:"An url to the icon, available only on iOS 15 or later"`
	Group     string `key:"group"    default:""      desc:"The group of the notification"`
	URL       string `key:"url"      default:""      desc:"Url that will jump when click notification"`
	Category  string `key:"category" default:""      desc:"Reserved field, no use yet"`
	Copy      string `key:"copy"     default:""      desc:"The value to be copied"`
}

Config for use within the bark service

func (*Config) GetAPIURL

func (config *Config) GetAPIURL(endpoint string) string

GetAPIURL returns the API URL corresponding to the passed endpoint based on the configuration

func (*Config) GetURL

func (config *Config) GetURL() *url.URL

GetURL returns a URL representation of it's current field values

func (*Config) SetURL

func (config *Config) SetURL(url *url.URL) error

SetURL updates a ServiceConfig from a URL representation of it's field values

type PushPayload

type PushPayload struct {
	Body      string `json:"body"`
	DeviceKey string `json:"device_key"`
	Title     string `json:"title"`
	Sound     string `json:"sound,omitempty"`
	Badge     *int64 `json:"badge,omitempty"`
	Icon      string `json:"icon,omitempty"`
	Group     string `json:"group,omitempty"`
	URL       string `json:"url,omitempty"`
	Category  string `json:"category,omitempty"`
	Copy      string `json:"copy,omitempty"`
}

PushPayload is the notification payload for the bark notification service

type Service

type Service struct {
	standard.Standard
	// contains filtered or unexported fields
}

Service sends notifications Bark

func (*Service) Initialize

func (service *Service) Initialize(configURL *url.URL, logger types.StdLogger) error

Initialize loads ServiceConfig from configURL and sets logger for this Service

func (*Service) Send

func (service *Service) Send(message string, params *types.Params) error

Send a notification message to Bark

Jump to

Keyboard shortcuts

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