sabnzbd-api
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

SABnzbd-API

SABnzbd API client written in TypeScript licensed under the MIT. It supports all of the API calls listed in the version 3.4.0 documentation (https://sabnzbd.org/wiki/advanced/api). It's still under active development and I welcome issue reports and pull requests.

GitHub license npm version CircleCI

Features

  • Written in TypeScript
  • Promise based API
  • Supports adding files via multi-part form data using the FormData library.

Dependencies

Installation

npm install --save sabnzbd-api

Documentation

You can find the API documentation at https://zordtk.github.io/sabnzbd-api/docs/, you should also read SABnzbd's API documentation at https://sabnzbd.org/wiki/advanced/api

Usage

version()

const SABnzbd = require("sabnzbd-api");
let client    = new SABnzbd.Client("http://example.com/sabnzbd", "apikey");
client.version().then(version => {
    console.log(version);
}).catch(error => {
    console.log(error.message);
});

addUrl()

const SABnzbd = require("sabnzbd-api");
let client    = new SABnzbd.Client("http://example.com/sabnzbd", "apikey");
client.addUrl('url-to-nzb').then(results => {
    if( results.status )
        console.log('Added NZB');
    else
        console.log('Failed to add NZB: ' + results.error);
}).catch(error => {
    console.log(error.message);
});

addFile()

const SABnzbd   = require("sabnzbd-api");
const fs        = require("fs");
const FormData  = require("form-data");
let client      = new SABnzbd.Client("http://example.com/sabnzbd", "apikey");
let formData    = new FormData();

formData.append("name", fs.createReadStream("/path/to/file"));
client.addFile(formData).then(results => {
    if( results.status )
        console.log('Added NZB');
    else
        console.log('Failed to add NZB: ' + results.error);
}).catch(error => {
    console.log(error.message);
});

Todo

  • Improve documentation

Readme

Keywords

Package Sidebar

Install

npm i sabnzbd-api

Weekly Downloads

100

Version

1.5.0

License

MIT

Unpacked Size

150 kB

Total Files

16

Last publish

Collaborators

  • zordtk