@hoshinorei/bark-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

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>",
)

Supported algorithm

For More usage, please read wiki.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @hoshinorei/bark-sdk

Weekly Downloads

3

Version

0.6.0

License

MIT

Unpacked Size

1.42 MB

Total Files

8

Last publish

Collaborators

  • hoshinorei