aboutsummaryrefslogtreecommitdiff
path: root/api_torrent_add.go
blob: 557a751de9a5db3d18949541a197555a4262d982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
}