@hoshinorei/bark-sdk
v0.6.0
Published
An SDK for Bark written in TypeScript
Downloads
6
Readme
Typescript Bark SDK
Introduction
An SDK for Bark written in TypeScript.
Features
- Using Bark V2 API
- Encrypted push
- Working in the browser and Node.js
- Check if the Bark server is healthy
- Check if the Bark server is running
- Get Bark server information
Getting started
Install
pnpm
pnpm add @hoshinorei/bark-sdk
Yarn
yarn add @hoshinorei/bark-sdk
npm
npm i @hoshinorei/bark-sdk
Push a simple message
import { BarkClient, BarkMessageBuilder } from "@hoshinorei/bark-sdk"
const barkClient = new BarkClient("<your_bark_server_url>")
barkClient.push(
new BarkMessageBuilder()
.body("<your_body>")
.deviceKey("<your_device_key>")
.title("<your_title>")
.build(),
)
Push an encrypted message
import {
BarkClient,
BarkEncryptedPushAlgorithm,
BarkMessageBuilder,
} from "@hoshinorei/bark-sdk"
const barkClient = new BarkClient("<your_bark_server_url>")
barkClient.pushEncrypted(
"<your_device_key>",
new BarkMessageBuilder().body("<your_body>").title("<your_title>").build(),
BarkEncryptedPushAlgorithm.AES_128_CBC, // You can view the supported algorithms via the link below
"<your_key>",
"<your_iv>",
)
For More usage, please read wiki.