Documentation
¶
Overview ¶
Package bark provides a simple SDK for Bark service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllSounds = []SoundName{ SoundSilence, SoundAlarm, SoundAnticipate, SoundBell, SoundBirdsong, SoundBloom, SoundCalypso, SoundChime, SoundChoo, SoundDescent, SoundElectronic, SoundFanfare, SoundGlass, SoundGoToSleep, SoundHealthNotification, SoundHorn, SoundLadder, SoundMailSent, SoundMinuet, SoundMultiwayInvitation, SoundNewMail, SoundNewsFlash, SoundNoir, SoundPaymentSuccess, SoundShake, SoundSherwoodForest, SoundSpell, SoundSuspense, SoundTelegraph, SoundTiptoes, SoundTypewriters, SoundUpdate, }
AllSounds contains all available built-in ringtone sounds.
Functions ¶
This section is empty.
Types ¶
type ArchiveType ¶
type ArchiveType uint8
ArchiveType indicates whether the notification should be archived, overriding the user's settings on the device.
const ( // ArchiveNo indicates that the notification should not be archived. ArchiveNo ArchiveType = 0 // ArchiveYes indicates that the notification should be archived. ArchiveYes ArchiveType = 1 )
type AutomaticallyCopyType ¶
type AutomaticallyCopyType uint8
AutomaticallyCopyType indicates whether the notification should be automatically copied to the clipboard.
const ( // AutomaticallyCopyNo indicates that the notification should not be automatically copied to the clipboard. AutomaticallyCopyNo AutomaticallyCopyType = 0 // AutomaticallyCopyYes indicates that the notification should be automatically copied to the clipboard. AutomaticallyCopyYes AutomaticallyCopyType = 1 )
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Bark client.
func NewClient ¶
NewClient returns a new Bark client. The baseURL should be the URL of your Bark service, e.g. https://api.day.app
func (*Client) Push ¶
func (c *Client) Push(pushRequest *PushRequest) (*PushResponse, error)
Push sends a push request to the Bark service.
type InterruptionLevel ¶
type InterruptionLevel string
InterruptionLevel indicates the importance and delivery timing of a notification.
const ( // InterruptionLevelActive indicates that iOS presents the notification immediately, lights up the screen, and can play a sound. InterruptionLevelActive InterruptionLevel = "active" // InterruptionLevelTimeSensitive indicates that iOS presents the notification immediately, lights up the screen, can play a sound, and breaks through system notification controls. InterruptionLevelTimeSensitive InterruptionLevel = "timeSensitive" // InterruptionLevelPassive indicates that iOS adds the notification to the notification list without lighting up the screen or playing a sound. InterruptionLevelPassive InterruptionLevel = "passive" )
type PushRequest ¶
type PushRequest struct { Key string `json:"device_key"` Title string `json:"title"` Body string `json:"body"` Category string `json:"category,omitempty"` Interruption InterruptionLevel `json:"level,omitempty"` Sound SoundName `json:"sound,omitempty"` AutomaticallyCopy AutomaticallyCopyType `json:"autoCopy,omitempty"` CopyContent string `json:"copy,omitempty"` ShouldArchive ArchiveType `json:"isArchive,omitempty"` BadgeNumber int `json:"badge,omitempty"` IconURL string `json:"icon,omitempty"` ClickURL string `json:"url,omitempty"` Group string `json:"group,omitempty"` }
PushRequest represents a push request.
func NewPushRequest ¶
func NewPushRequest(key, title, body string) *PushRequest
NewPushRequest returns a new PushRequest with the given key, title and body, and other fields are not set.
type PushResponse ¶
type PushResponse struct { Code int `json:"code"` Timestamp int64 `json:"timestamp"` Message string `json:"message,omitempty"` }
PushResponse represents a push response.
type SoundName ¶
type SoundName string
SoundName represents name of built-in ringtone sounds of Bark app.
const ( SoundDefault SoundName = "" SoundSilence SoundName = "silence" SoundAlarm SoundName = "alarm" SoundAnticipate SoundName = "anticipate" SoundBell SoundName = "bell" SoundBirdsong SoundName = "birdsong" SoundBloom SoundName = "bloom" SoundCalypso SoundName = "calypso" SoundChime SoundName = "chime" SoundChoo SoundName = "choo" SoundDescent SoundName = "descent" SoundElectronic SoundName = "electronic" SoundFanfare SoundName = "fanfare" SoundGlass SoundName = "glass" SoundGoToSleep SoundName = "gotosleep" SoundHealthNotification SoundName = "healthnotification" SoundHorn SoundName = "horn" SoundLadder SoundName = "ladder" SoundMailSent SoundName = "mailsent" SoundMinuet SoundName = "minuet" SoundMultiwayInvitation SoundName = "multiwayinvitation" SoundNewMail SoundName = "newmail" SoundNewsFlash SoundName = "newsflash" SoundNoir SoundName = "noir" SoundPaymentSuccess SoundName = "paymentsuccess" SoundShake SoundName = "shake" SoundSherwoodForest SoundName = "sherwoodforest" SoundSpell SoundName = "spell" SoundSuspense SoundName = "suspense" SoundTelegraph SoundName = "telegraph" SoundTiptoes SoundName = "tiptoes" SoundTypewriters SoundName = "typewriters" SoundUpdate SoundName = "update" )
Name of available built-in ringtone sounds of Bark app