0 purchases
transmission api
transmission_api #
A Transmission client library for dart.
To know more about transmission visit offical site
Thanks tmdb_api,most of the code comes from it.
Getting started #
Adding as dependencies
Pub.dev's installation guide
Add this to your package's pubspec.yaml file:
dependencies:
transmission_api: latest
copied to clipboard
Import it
Now in your Dart code, you can use:
import 'package:transmission_api/transmission_api.dart';
copied to clipboard
Create Instance
Now you need to create instance for Transmission and AuthKeys with your api keys.
final transmission = Transmission( //Transmission instance
AuthKeys('Username', 'Password'),//AuthKeys instance with your keys,
);
await transmission.v1.waitRpcVersion();// Get real rpc version,default 18.
copied to clipboard
Configuring console logs
There are 3 logconfigs presets avaliable.
ConfigLogger.showAll(): development use.
ConfigLogger.showRecommended(): development use.
ConfigLogger.showNone(): production use.
You can add any off this presets to logConfig named parameter of Transmission instance
Custom Logs
final transmission = Transmission(
AuthKeys('Username', 'Password'),
logConfig: ConfigLogger(
showLogs: true,//must be true than only all other logs will be shown
showErrorLogs: true,
),
);
copied to clipboard
Example #
For getting torrents list
Map result = await transmission.v1.torrent.torrentGet(fields: TorrentFields.basic());
copied to clipboard
Custom Dio instance #
final transmission = Transmission(
AuthKeys('Username', 'Password'),
dio:Dio()// your own dio instance
);
copied to clipboard
Adding Interceptors #
final transmission = Transmission(
AuthKeys('Username', 'Password'),
interceptors:Interceptors()..add(/*your interceptor*/)
);
copied to clipboard
or
final customDio = Dio();
customDio.interceptors.add(/*your interceptor*/)
final transmission = Transmission(
AuthKeys('Username', 'Password'),
dio:dio
);
copied to clipboard
note:Use interceptors only when you are not using a custom Dio instance.
For more API documentation #
visit offical API documentation
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.