sabnzbd_api 0.0.1-pre.6
Dart abstraction for SABnzbd's public API (https://sabnzbd.org)
SABnzbd API
Dart library package providing an abstraction for SABnzbd's public API.
This package is intended to supply a 1:1 mapping of the public API documentation and does not make assumptions on orchestration to execute different workflows.
Preparing SABnzbd
To connect to your instance of SABnzbd, you will need:
- The host IPv4 address of the machine running SABnzbd
- The API key of the SABnzbd instance (which can be found in the web GUI under Config → General)
Please note that in order to access SABnzbd from another machine on the network you must ensure that both the SABnzbd executable and the running port are allowed in any running firewalls on the host machine.
Connecting to the API
All classes, models, and types are exported in the main package file:
import 'package:sabnzbd_api/sabnzbd_api.dart';
Now you can instantiate an instance of SABnzbdConfig that is used to instantiate an instance of SABnzbdAPI:
final config = SABnzbdConfig(
host: '192.168.1.100:8080',
apiKey: 'asdf123',
);
final api = SABnzbdAPI(config);
You can optionally pass in a Dio
BaseOptionsinstance to the configuration to customize the HTTP client. Note that thebaseUrlproperty will be overwritten with the givenhostproperty in the configuration.
And you are ready to make API calls!
final resume = await api.resumeQueue(); // Resume the global queue
final history = await api.getHistory(); // Get items in the history
...
Additional Notes
- All available API methods can be viewed in the generated Dart documentation
- All models are immutable freezed-generated classes that can be modified using the
<model>.copyWith(...)method - All models are JSON serializable using the
<model>.toJson()method