diff options
| author | Patrick Spek <p.spek@tyil.nl> | 2024-11-29 11:54:20 +0100 |
|---|---|---|
| committer | Patrick Spek <p.spek@tyil.nl> | 2024-11-29 11:54:20 +0100 |
| commit | 50cf4ea66fbd0fa6fc2952945a9f3a410f51253c (patch) | |
| tree | 0e0539236e7f4746a993d99f65bf61e87eea6b3f | |
| parent | 69a29e20673eba9afcfeb75474f561e2e64b120d (diff) | |
| download | transmission-50cf4ea66fbd0fa6fc2952945a9f3a410f51253c.tar.gz transmission-50cf4ea66fbd0fa6fc2952945a9f3a410f51253c.tar.bz2 | |
Add structs to cover the full possible output of torrent-get
| -rw-r--r-- | api.go | 168 | ||||
| -rw-r--r-- | api_torrent_get.go | 1 |
2 files changed, 162 insertions, 7 deletions
@@ -10,13 +10,6 @@ var TorrentStatus = map[int]string{ 6: "seeding", } -type Torrent struct { - Status int `json:"status"` - Id int `json:"id"` - Name string `json:"name"` - HashString string `json:"hashString"` -} - type StatsObject struct { UploadedBytes uint `json:"uploadedBytes"` DownloadedBytes uint `json:"downloadedBytes"` @@ -24,3 +17,164 @@ type StatsObject struct { SessionCount uint `json:"sessionCount"` SecondsActive uint `json:"secondsActive"` } + +type Torrent struct { + ActivityDate uint `json:"activityDate"` + AddedDate uint `json:"addedDate"` + Availability []uint `json:"availability"` + BandwidthPriority int `json:"bandwidthPriority"` + Comment string `json:"comment"` + CorruptEver uint `json:"corruptEver"` + Creator string `json:"creator"` + DateCreated uint `json:"dateCreated"` + DesiredAvailable int `json:"desiredAvailable"` + DoneDate uint `json:"doneDate"` + DownloadDir string `json:"downloadDir"` + DownloadLimit uint `json:"downloadLimit"` + DownloadLimited bool `json:"downloadLimited"` + DownloadedEver bool `json:"downloadedEver"` + EditDate uint `json:"editDate"` + Error int `json:"error"` + ErrorString string `json:"errorString"` + Eta uint `json:"eta"` + EtaIdle uint `json:"etaIdle"` + FileCount int `json:"file-count"` + FileStats TorrentFileStats `json:"fileStats"` + Files []TorrentFile `json:"files"` + Group string `json:"group"` + HashString string `json:"hashString"` + HaveUnchecked uint `json:"haveUnchecked"` + HaveValid uint `json:"haveValid"` + HonorsSessionLimits bool `json:"honorsSessionLimits"` + Id uint `json:"id"` + IsFinished bool `json:"isFinished"` + IsPrivate bool `json:"isPrivate"` + IsStalled bool `json:"isStalled"` + Labels []string `json:"labels"` + LeftUntilDone uint `json:"leftUntilDone"` + MagnetLink string `json:"magnetLink"` + ManualAnnounceTime uint `json:"manualAnnounceTime"` + MaxConnectedPeers uint `json:"maxConnectedPeers"` + MetadataPercentComplete float64 `json:"metadataPercentComplete"` + Name string `json:"name"` + PeerLimit uint `json:"peer-limit"` + Peers []TorrentPeer `json:"peers"` + PeersConnected uint `json:"peersConnected"` + PeersFrom TorrentPeersFrom `json:"peersFrom"` + PeersGettingFromUs uint `json:"peersGettingFromUs"` + PeersSendingToUs uint `json:"peersSendingToUs"` + PercentComplete float64 `json:"percentComplete"` + PercentDone float64 `json:"percentDone"` + PieceCount uint `json:"pieceCount"` + PieceSize uint `json:"pieceSize"` + Pieces string `json:"pieces"` + PrimaryMimeType string `json:"primary-mime-type"` + Priorities []uint `json:"priorities"` + QueuePosition uint `json:"queuePosition"` + RateDownload uint `json:"rateDownload"` + RateUpload uint `json:"rateUpload"` + RecheckProgress float64 `json:"recheckProgress"` + SecondsDownloading uint `json:"secondsDownloading"` + SecondsSeeding uint `json:"secondsSeeding"` + SeedIdleLimit uint `json:"seedIdleLimit"` + SeedIdleMode uint `json:"seedIdleMode"` + SeedRatioLimit float64 `json:"seedRatioLimit"` + SeedRatioMode uint `json:"seedRatioMode"` + SequentialDownload bool `json:"sequentialDownload"` + SizeWhenDone uint `json:"sizeWhenDone"` + StartDate uint `json:"startDate"` + Status uint `json:"status"` + TorrentFile string `json:"torrentFile"` + TotalSize uint `json:"totalSize"` + TrackerList string `json:"trackerList"` + TrackerStats []TorrentTrackerStats `json:"trackerStats"` + Trackers []TorrentTracker `json:"trackers"` + UploadLimit uint `json:"uploadLimit"` + UploadLimited bool `json:"uploadLimited"` + UploadRatio float64 `json:"uploadRatio"` + UploadedEver uint `json:"uploadedEver"` + Wanted []bool `json:"wanted"` + Webseeds []string `json:"webseeds"` + WebseedsSendingToUs uint `json:"webseedsSendingToUs"` +} + +type TorrentFile struct { + BytesCompleted uint `json:"bytesCompleted"` + Length uint `json:"length"` + Name string `json:"name"` + BeginPiece uint `json:"beginPiece"` + EndPiece uint `json:"endPiece"` +} + +type TorrentFileStats struct { + BytesCompleted uint `json:"bytesCompleted"` + Wanted bool `json:"wanted"` + Priority uint `json:"priority"` +} + +type TorrentPeer struct { + Address string `json:"address"` + ClientName string `json:"clientName"` + ClientIsChoked bool `json:"clientIsChoked"` + ClientIsInterested bool `json:"clientIsInterested"` + FlagStr string `json:"flagStr"` + IsDownloadingFrom bool `json:"isDownloadingFrom"` + IsEncrypted bool `json:"isEncrypted"` + IsIncoming bool `json:"isIncoming"` + IsUploadingTo bool `json:"isUploadingTo"` + IsUTP bool `json:"isUTP"` + PeerIsChocked bool `json:"peerIsChoked"` + PeerIsInterested bool `json:"peerIsInterested"` + Port uint `json:"port"` + Progress float64 `json:"progress"` + RateToClient uint `json:"rateToClient"` + RateToPeer uint `json:"rateToPeer"` +} + +type TorrentPeersFrom struct { + FromCache uint `json:"fromCache"` + FromDht uint `json:"fromDht"` + FromIncoming uint `json:"fromIncoming"` + FromLpd uint `json:"fromLpd"` + FromLtep uint `json:"fromLtep"` + FromPex uint `json:"fromPex"` + FromTracker uint `json:"fromTracker"` +} + +type TorrentTracker struct { + Announce string `json:"announce"` + Id uint `json:"id"` + Scrape string `json:"scrape"` + Sitename string `json:"sitename"` + Tier uint `json:"tier"` +} + +type TorrentTrackerStats struct { + Announce string `json:"announce"` + AnnounceState uint `json:"announceState"` + DownloadCount uint `json:"downloadCount"` + HasAnnounced bool `json:"hasAnnounced"` + HasScraped bool `json:"hasScraped"` + Host string `json:"host"` + Id uint `json:"id"` + IsBackup bool `json:"isBackup"` + LastAnnouncePeerCount uint `json:"lastAnnouncePeerCount"` + LastAnnounceResult string `json:"lastAnnounceResult"` + LastAnnounceStartTime uint `json:"lastAnnounceStartTime"` + LastAnnounceSucceeded bool `json:"lastAnnounceSucceeded"` + LastAnnounceTime uint `json:"lastAnnounceTime"` + LastAnnounceTimedOut bool `json:"lastAnnounceTimedOut"` + LastScrapeResult string `json:"lastScrapeResult"` + LastScrapeStartTime uint `json:"lastScrapeStartTime"` + LastScrapeSucceeded bool `json:"lastScrapeSucceeded"` + LastScrapeTime uint `json:"lastScrapeTime"` + LastScrapeTimedOut bool `json:"lastScrapeTimedOut"` + LeecherCount uint `json:"leecherCount"` + NextAnnounceTime uint `json:"nextAnnounceTime"` + NextScrapeTime uint `json:"nextScrapeTime"` + Scrape string `json:"scrape"` + ScrapeState uint `json:"scrapeState"` + SeederCount uint `json:"seederCount"` + Sitename string `json:"sitename"` + Tier uint `json:"tier"` +} diff --git a/api_torrent_get.go b/api_torrent_get.go index 7c4859a..9aa8fbd 100644 --- a/api_torrent_get.go +++ b/api_torrent_get.go @@ -17,6 +17,7 @@ type CallTorrentGetResponse struct { type CallTorrentGetResponseArguments struct { Torrents []Torrent `json:"torrents"` + Removed []Torrent `json:"removed"` } func (this *Client) CallTorrentGet(arguments CallTorrentGetArguments) (CallTorrentGetResponse, error) { |
