Aria2 API lib for Nim using local JSON-RPC over HTTP GET for any backend.
Example:
import src/aria import std/[json, osproc] ## json.$, startProcess ## "aria" template activates an Aria process daemon. ## "aria" template does NOT work in JavaScript, because browser cant run processes, ## but you can use the Aria API from the browser on a running Aria process daemon. let client: Aria = newAria(ip = "127.0.0.1", port = 6800.uint16) aria: ## These are just Aria API calls, same naming as from Aria Documentation. echo client.getVersion() echo client.listNotifications() echo client.getSessionInfo() echo client.getGlobalStat() echo client.getGlobalOption() echo client.tellActive() ## echo client.addUrl("http://nim-lang.org") ## See also addTorrent() and addMetalink()
Example: cmd: -r:off -b:js -d:nimExperimentalJsfetch -d:nimExperimentalAsyncjsThen
import src/aria import std/jsfetch ## fetch() let client: Aria = newAria(ip = "127.0.0.1", port = 6800.uint16) echo client.getVersion().repr
Procs
func newAria(ip = "127.0.0.1"; port = 6800.uint16): Aria {....raises: [ValueError], tags: [].}
proc getVersion(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc tellActive(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc listNotifications(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc pauseAll(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc forcePauseAll(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc unpauseAll(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getGlobalOption(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getGlobalStat(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc purgeDownloadResult(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getSessionInfo(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc shutdown(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc forceShutdown(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc saveSession(self: Aria): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc remove(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc forceRemove(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc pause(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc forcePause(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc unpause(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc tellStatus(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getUris(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getFiles(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getPeers(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getServers(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc getOption(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc removeDownloadResult(self: Aria; gid: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc addUrl(self: Aria; url: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc addTorrent(self: Aria; torrent: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}
proc addMetalink(self: Aria; metalink: string): JsonNode {....raises: [IOError, OSError, JsonParsingError, ValueError, Exception, HttpRequestError, LibraryError, SslError, TimeoutError, ProtocolError, KeyError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, TimeEffect].}