gobark

package module
v0.0.0-...-98f52a1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 3 Imported by: 0

README

gobark

Quick start

import (
	"fmt"
	bark "github.com/pushyzheng/gobark"
)

func main() {
	// 1. create bark client
	client := bark.BarkClient{Domain: bark.DefaultDomain}
    
	// 2. build options
	options := bark.NewPushOptions("Hello", "To be or not to be")
	options.SetReceiver("your key")
	options.SetLevel(bark.Passive)
	
	// 3. execute push
	failed, err := client.Push(options)
	if err != nil {
		panic(err)
	}
	fmt.Println("failed:", failed)
}

Documentation

Index

Constants

View Source
const (
	DefaultDomain      string    = "api.day.app"
	DefaultSound       SoundType = Alarm
	Alarm              SoundType = "alarm"
	Anticipate         SoundType = "anticipate"
	Bell               SoundType = "bell"
	Birdsong           SoundType = "birdsong"
	Bloom              SoundType = "bloom"
	Calypso            SoundType = "calypso"
	Chime              SoundType = "chime"
	Choo               SoundType = "choo"
	Descent            SoundType = "descent"
	Electronic         SoundType = "electronic"
	Fanfare            SoundType = "fanfare"
	Glass              SoundType = "glass"
	GotoSleep          SoundType = "gotosleep"
	HealthNotification SoundType = "healthnotification"
	Horn               SoundType = "horn"
	Ladder             SoundType = "ladder"
	MailSend           SoundType = "mailsend"
	Minuet             SoundType = "minuet"
	MultiwayInvitation SoundType = "multiwayinvitation"
	NewMail            SoundType = "newmail"
	NewsFlash          SoundType = "newsflash"
	Noir               SoundType = "noir"
	PaymentSuccess     SoundType = "paymentsuccess"
	Shake              SoundType = "shake"
	SherwoodForest     SoundType = "sherwoodforest"
	Spell              SoundType = "spell"
	Suspense           SoundType = "suspense"
	Telegraph          SoundType = "telegraph"
	Tiptoes            SoundType = "tiptoes"
	Typewriters        SoundType = "typewriters"
	Update             SoundType = "update"
	Active             LevelType = "active"
	TimeSensitive      LevelType = "timeSensitive"
	Passive            LevelType = "passive"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BarkClient

type BarkClient struct {
	Domain string
}

func (BarkClient) Push

func (client BarkClient) Push(options *PushOptions) ([]string, error)

func (BarkClient) PushSimple

func (client BarkClient) PushSimple(title string, content string, receivers []string) ([]string, error)

type LevelType

type LevelType string

type OnFailed

type OnFailed func(receiver string)

type OnSuccess

type OnSuccess func(receiver string)

type PushOptions

type PushOptions struct {
	Title             string
	Content           string
	Url               string
	Receivers         []string
	CopyText          string
	Sound             SoundType
	Group             string
	Level             LevelType
	IconUrl           string // above iOS15
	AutomaticallyCopy bool
	IsArchive         bool
	OnSuccess         OnSuccess // The listener of successful event
	OnFailed          OnFailed  // The listener of failed event
}

func NewPushOptions

func NewPushOptions(title string, content string) *PushOptions

func (*PushOptions) SetArchived

func (options *PushOptions) SetArchived() *PushOptions

func (*PushOptions) SetAutomaticallyCopy

func (options *PushOptions) SetAutomaticallyCopy() *PushOptions

func (*PushOptions) SetCopyText

func (options *PushOptions) SetCopyText(copyText string) *PushOptions

func (*PushOptions) SetGroup

func (options *PushOptions) SetGroup(group string) *PushOptions

func (*PushOptions) SetIconUrl

func (options *PushOptions) SetIconUrl(iconUrl string) *PushOptions

func (*PushOptions) SetLevel

func (options *PushOptions) SetLevel(level LevelType) *PushOptions

func (*PushOptions) SetOnFailed

func (options *PushOptions) SetOnFailed(OnFailedFunc OnFailed) *PushOptions

func (*PushOptions) SetOnSuccess

func (options *PushOptions) SetOnSuccess(OnSuccessFunc OnSuccess) *PushOptions

func (*PushOptions) SetReceiver

func (options *PushOptions) SetReceiver(receiver string) *PushOptions

func (*PushOptions) SetReceivers

func (options *PushOptions) SetReceivers(receivers []string) *PushOptions

func (*PushOptions) SetSound

func (options *PushOptions) SetSound(sound SoundType) *PushOptions

func (*PushOptions) SetTitle

func (options *PushOptions) SetTitle(title string) *PushOptions

func (*PushOptions) SetUrl

func (options *PushOptions) SetUrl(url string) *PushOptions

type SoundType

type SoundType string

Jump to

Keyboard shortcuts

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