Skip to content

zordtk/sabnzbd-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SABnzbd-API

SABnzbd API client written in TypeScript licensed under the MIT. It supports all of the API calls listed in the version 4.2.1 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/, 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

About

SABnzbd API client written in TypeScript and licensed under the MIT.

Resources

License

Stars

Watchers

Forks

Packages

No packages published