bark

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 10 Imported by: 0

README

Bark

Feature

  • NewBark(token string)
  • UseHost(url string)
  • UseToken(token string)
  • SendText(text string)
  • SendMsg(title, body string)
  • SetDebug(debug bool)
  • SetGet(get bool)
  • SetGroup(group string)
  • SetCopy(text string)
  • SetAutoCopy(copy bool)
  • SetIcon(icon string)
  • SetJumpUrl(url string)
  • SetArchive(archive bool)
  • SetLevel(level int)
  • SetSound(name Sound)
  • SetSilently(silent bool)
  • SetBadge(badge int64)

Parameters

参数 说明
title 推送标题
body 推送内容
level 推送中断级别。
active:默认值,系统会立即亮屏显示通知
timeSensitive:时效性通知,可在专注状态下显示通知。
passive:仅将通知添加到通知列表,不会亮屏提醒。
badge 推送角标,可以是任意数字
autoCopy iOS14.5以下自动复制推送内容,iOS14.5以上需手动长按推送或下拉推送
copy 复制推送时,指定复制的内容,不传此参数将复制整个推送内容。
sound 可以为推送设置不同的铃声
icon 为推送设置自定义图标,设置的图标将替换默认Bark图标。
图标会自动缓存在本机,相同的图标 URL 仅下载一次。
group 对消息进行分组,推送将按group分组显示在通知中心中。
也可在历史消息列表中选择查看不同的群组。
isArchive 传 1 保存推送,传其他的不保存推送,不传按APP内设置来决定是否保存。
url 点击推送时,跳转的URL ,支持URL Scheme 和 Universal Link

Sound list

  • 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
  • SoundSilence
  • SoundSpell
  • SoundSuspense
  • SoundTelegraph
  • SoundTiptoes
  • SoundTypewriters
  • SoundUpdate

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bark added in v0.2.0

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

func NewBark added in v0.2.0

func NewBark(token string) *Bark

NewBark host default is `https://api.day.app`

func (*Bark) SendMsg added in v0.2.0

func (r *Bark) SendMsg(title, body string) error

func (*Bark) SendText added in v0.2.0

func (r *Bark) SendText(text string) error

func (*Bark) SetArchive added in v0.2.0

func (r *Bark) SetArchive(archive bool) *Bark

func (*Bark) SetAutoCopy added in v0.2.0

func (r *Bark) SetAutoCopy(copy bool) *Bark

SetAutoCopy auto copy

func (*Bark) SetBadge added in v0.2.0

func (r *Bark) SetBadge(badge int64) *Bark

func (*Bark) SetCopy added in v0.2.0

func (r *Bark) SetCopy(text string) *Bark

SetCopy Specify what to copy

func (*Bark) SetDebug added in v0.2.0

func (r *Bark) SetDebug(debug bool) *Bark

func (*Bark) SetGet added in v0.2.0

func (r *Bark) SetGet(get bool) *Bark

func (*Bark) SetGroup added in v0.2.0

func (r *Bark) SetGroup(group string) *Bark

func (*Bark) SetIcon added in v0.2.0

func (r *Bark) SetIcon(icon string) *Bark

SetIcon icon url

func (*Bark) SetJumpUrl added in v0.2.0

func (r *Bark) SetJumpUrl(url string) *Bark

SetJumpUrl Jump to the address of URL

func (*Bark) SetLevel added in v0.2.0

func (r *Bark) SetLevel(level int) *Bark

SetLevel 0:active,default; 1:timeSensitive; 2:passive

func (*Bark) SetSilently added in v0.3.0

func (r *Bark) SetSilently(silent bool) *Bark

SetSilently mute the sounds

func (*Bark) SetSound added in v0.2.0

func (r *Bark) SetSound(name Sound) *Bark

func (*Bark) UseHost added in v0.2.0

func (r *Bark) UseHost(url string) notice.Noticer

func (*Bark) UseSecret added in v0.2.0

func (r *Bark) UseSecret(secret string) notice.Noticer

Deprecated

func (*Bark) UseToken added in v0.2.0

func (r *Bark) UseToken(token string) notice.Noticer

type Response

type Response struct {
	Code      int    `json:"code"`
	Message   string `json:"message"`
	Timestamp int64  `json:"timestamp"`
}

type Sound added in v0.2.0

type Sound string
const (
	SoundAlarm              Sound = "alarm.caf"
	SoundAnticipate         Sound = "anticipate.caf"
	SoundBell               Sound = "bell.caf"
	SoundBirdsong           Sound = "birdsong.caf"
	SoundBloom              Sound = "bloom.caf"
	SoundCalypso            Sound = "calypso.caf"
	SoundChime              Sound = "chime.caf"
	SoundChoo               Sound = "choo.caf"
	SoundDescent            Sound = "descent.caf"
	SoundElectronic         Sound = "electronic.caf"
	SoundFanfare            Sound = "fanfare.caf"
	SoundGlass              Sound = "glass.caf"
	SoundGotosleep          Sound = "gotosleep.caf"
	SoundHealthnotification Sound = "healthnotification.caf"
	SoundHorn               Sound = "horn.caf"
	SoundLadder             Sound = "ladder.caf"
	SoundMailsent           Sound = "mailsent.caf"
	SoundMinuet             Sound = "minuet.caf"
	SoundMultiwayinvitation Sound = "multiwayinvitation.caf"
	SoundNewmail            Sound = "newmail.caf"
	SoundNewsflash          Sound = "newsflash.caf"
	SoundNoir               Sound = "noir.caf"
	SoundPaymentsuccess     Sound = "paymentsuccess.caf"
	SoundShake              Sound = "shake.caf"
	SoundSherwoodforest     Sound = "sherwoodforest.caf"
	SoundSilence            Sound = "silence.caf"
	SoundSpell              Sound = "spell.caf"
	SoundSuspense           Sound = "suspense.caf"
	SoundTelegraph          Sound = "telegraph.caf"
	SoundTiptoes            Sound = "tiptoes.caf"
	SoundTypewriters        Sound = "typewriters.caf"
	SoundUpdate             Sound = "update.caf"
)

func (Sound) String added in v0.2.0

func (s Sound) String() string

Jump to

Keyboard shortcuts

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