Bark
通知目标格式
Section titled “通知目标格式”bark://<server>[:<port>]/<device-key>[/<device-key>...]import { send } from 'statocysts'
await send( 'bark://api.day.app/DEVICE_KEY', { title: 'Deployment complete', body: 'Production is healthy.' },)通知提供方会向 <server>/push 发送 HTTPS 请求。增加路径段可以在一个请求中向多个设备密钥投递。
支持以下 Bark 字段:
subtitle、group、url、icon、sound和ciphertext;level:active、timeSensitive、passive或critical;call=1、autoCopy=1和isArchive=1;volume、数字类型的badge、copy和action=none。
bark://api.day.app/DEVICE_KEY?group=operations&level=timeSensitive&sound=alarm查询参数会进入 JSON 请求体。枚举值或标志值非法时,投递会失败。
包含正文时,标题作为 title,正文作为 markdown;只有标题时,标题作为 markdown。
提供方专属选项
Section titled “提供方专属选项”直接调用 bark.send() 可以传入 fetchOptions:
import { bark } from 'statocysts'
await bark.send(target, notification, { fetchOptions: { timeout: 5000 },})