aboutsummaryrefslogtreecommitdiff
path: root/api_torrent_add.go
diff options
context:
space:
mode:
Diffstat (limited to 'api_torrent_add.go')
-rw-r--r--api_torrent_add.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/api_torrent_add.go b/api_torrent_add.go
new file mode 100644
index 0000000..557a751
--- /dev/null
+++ b/api_torrent_add.go
@@ -0,0 +1,35 @@
+package transmission
+
+type CallTorrentAddArguments struct {
+ Cookies string `json:"cookies"`
+ DownloadDir string `json:"download-dir"`
+ Filename string `json:"filename"`
+ Labels []string `json:"labels"`
+ Metainfo string `json:"metainfo"`
+ Paused bool `json:"paused"`
+ PeerLimit uint `json:"peer-limit"`
+ BandwidthPriority uint `json:"bandwidthPriority"`
+ FilesWanted []uint `json:"files-wanted"`
+ FilesUnwanted []uint `json:"files-unwanted"`
+ PriorityHigh []uint `json:"priority-high"`
+ PriorityLow []uint `json:"priority-low"`
+ PriorityNormal []uint `json:"priority-normal"`
+}
+
+type CallTorrentAddResponse struct {
+ Result string `json:"result"`
+ Arguments CallTorrentAddResponseArguments `json:"arguments"`
+ Tag uint `json:"tag"`
+}
+
+type CallTorrentAddResponseArguments struct {
+ TorrentAdded Torrent `json:"torrent-added"`
+ TorrentDuplicate Torrent `json:"torrent-duplicate"`
+}
+
+func (this *Client) CallTorrentAdd(arguments CallTorrentAddArguments) (CallTorrentAddResponse, error) {
+ var response CallTorrentAddResponse
+
+ err := this.Call("torrent-get", arguments, this.makeTag(), &response)
+ return response, err
+}