diff options
| author | Patrick Spek <p.spek@tyil.nl> | 2024-11-29 12:01:40 +0100 |
|---|---|---|
| committer | Patrick Spek <p.spek@tyil.nl> | 2024-11-29 12:01:40 +0100 |
| commit | 78b2083868a92704deaa192426ebfa10d624c05f (patch) | |
| tree | af7e97e7c1dd86535851e0b7d0ada9cf2c868357 | |
| parent | 50cf4ea66fbd0fa6fc2952945a9f3a410f51253c (diff) | |
| download | transmission-master.tar.gz transmission-master.tar.bz2 | |
| -rw-r--r-- | api_torrent_add.go | 35 | ||||
| -rw-r--r-- | api_torrent_get.go | 2 |
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 } |
