aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api_torrent_add.go35
-rw-r--r--api_torrent_get.go2
2 files changed, 35 insertions, 2 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
+}
diff --git a/api_torrent_get.go b/api_torrent_get.go
index 9aa8fbd..0b57c2c 100644
--- a/api_torrent_get.go
+++ b/api_torrent_get.go
@@ -24,7 +24,6 @@ func (this *Client) CallTorrentGet(arguments CallTorrentGetArguments) (CallTorre
var response CallTorrentGetResponse
err := this.Call("torrent-get", arguments, this.makeTag(), &response)
-
return response, err
}
@@ -32,6 +31,5 @@ func (this *Client) CallTorrentGetAll(arguments CallTorrentGetAllArguments) (Cal
var response CallTorrentGetResponse
err := this.Call("torrent-get", arguments, this.makeTag(), &response)
-
return response, err
}