| 1 |
package putio |
| 2 |
|
| 3 |
import "fmt" |
| 4 |
|
| 5 |
|
| 6 |
type File struct { |
| 7 |
ID int64 `json:"id"` |
| 8 |
Name string `json:"name"` |
| 9 |
Size int64 `json:"size"` |
| 10 |
ContentType string `json:"content_type"` |
| 11 |
CreatedAt *Time `json:"created_at"` |
| 12 |
UpdatedAt *Time `json:"updated_at"` |
| 13 |
FirstAccessedAt *Time `json:"first_accessed_at"` |
| 14 |
ParentID int64 `json:"parent_id"` |
| 15 |
Screenshot string `json:"screenshot"` |
| 16 |
OpensubtitlesHash string `json:"opensubtitles_hash"` |
| 17 |
IsMP4Available bool `json:"is_mp4_available"` |
| 18 |
Icon string `json:"icon"` |
| 19 |
CRC32 string `json:"crc32"` |
| 20 |
IsShared bool `json:"is_shared"` |
| 21 |
} |
| 22 |
|
| 23 |
func (f *File) String() string { |
| 24 |
return fmt.Sprintf("<ID: %v Name: %q Size: %v>", f.ID, f.Name, f.Size) |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
func (f *File) IsDir() bool { |
| 29 |
return f.ContentType == "application/x-directory" |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
type Upload struct { |
| 35 |
File *File `json:"file"` |
| 36 |
Transfer *Transfer `json:"transfer"` |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
type Search struct { |
| 41 |
Files []File `json:"files"` |
| 42 |
Next string `json:"next"` |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
type Transfer struct { |
| 47 |
Availability int `json:"availability"` |
| 48 |
CallbackURL string `json:"callback_url"` |
| 49 |
CreatedAt *Time `json:"created_at"` |
| 50 |
CreatedTorrent bool `json:"created_torrent"` |
| 51 |
ClientIP string `json:"client_ip"` |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
DownloadSpeed int `json:"down_speed"` |
| 57 |
Downloaded int64 `json:"downloaded"` |
| 58 |
DownloadID int64 `json:"download_id"` |
| 59 |
ErrorMessage string `json:"error_message"` |
| 60 |
EstimatedTime int64 `json:"estimated_time"` |
| 61 |
Extract bool `json:"extract"` |
| 62 |
FileID int64 `json:"file_id"` |
| 63 |
FinishedAt *Time `json:"finished_at"` |
| 64 |
ID int64 `json:"id"` |
| 65 |
IsPrivate bool `json:"is_private"` |
| 66 |
MagnetURI string `json:"magneturi"` |
| 67 |
Name string `json:"name"` |
| 68 |
PeersConnected int `json:"peers_connected"` |
| 69 |
PeersGettingFromUs int `json:"peers_getting_from_us"` |
| 70 |
PeersSendingToUs int `json:"peers_sending_to_us"` |
| 71 |
PercentDone int `json:"percent_done"` |
| 72 |
SaveParentID int64 `json:"save_parent_id"` |
| 73 |
SecondsSeeding int `json:"seconds_seeding"` |
| 74 |
Size int `json:"size"` |
| 75 |
Source string `json:"source"` |
| 76 |
Status string `json:"status"` |
| 77 |
StatusMessage string `json:"status_message"` |
| 78 |
SubscriptionID int `json:"subscription_id"` |
| 79 |
TorrentLink string `json:"torrent_link"` |
| 80 |
TrackerMessage string `json:"tracker_message"` |
| 81 |
Trackers string `json:"tracker"` |
| 82 |
Type string `json:"type"` |
| 83 |
UploadSpeed int `json:"up_speed"` |
| 84 |
Uploaded int64 `json:"uploaded"` |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
type AccountInfo struct { |
| 89 |
AccountActive bool `json:"account_active"` |
| 90 |
AvatarURL string `json:"avatar_url"` |
| 91 |
DaysUntilFilesDeletion int `json:"days_until_files_deletion"` |
| 92 |
DefaultSubtitleLanguage string `json:"default_subtitle_language"` |
| 93 |
Disk struct { |
| 94 |
Avail int64 `json:"avail"` |
| 95 |
Size int64 `json:"size"` |
| 96 |
Used int64 `json:"used"` |
| 97 |
} `json:"disk"` |
| 98 |
HasVoucher bool `json:"has_voucher"` |
| 99 |
Mail string `json:"mail"` |
| 100 |
PlanExpirationDate string `json:"plan_expiration_date"` |
| 101 |
Settings Settings `json:"settings"` |
| 102 |
SimultaneousDownloadLimit int `json:"simultaneous_download_limit"` |
| 103 |
SubtitleLanguages []string `json:"subtitle_languages"` |
| 104 |
UserID int64 `json:"user_id"` |
| 105 |
Username string `json:"username"` |
| 106 |
} |
| 107 |
|
| 108 |
|
| 109 |
type Settings struct { |
| 110 |
CallbackURL string `json:"callback_url"` |
| 111 |
DefaultDownloadFolder int64 `json:"default_download_folder"` |
| 112 |
DefaultSubtitleLanguage string `json:"default_subtitle_language"` |
| 113 |
DownloadFolderUnset bool `json:"download_folder_unset"` |
| 114 |
IsInvisible bool `json:"is_invisible"` |
| 115 |
Nextepisode bool `json:"nextepisode"` |
| 116 |
PrivateDownloadHostIP interface{} `json:"private_download_host_ip"` |
| 117 |
PushoverToken string `json:"pushover_token"` |
| 118 |
Routing string `json:"routing"` |
| 119 |
Sorting string `json:"sorting"` |
| 120 |
SSLEnabled bool `json:"ssl_enabled"` |
| 121 |
StartFrom bool `json:"start_from"` |
| 122 |
SubtitleLanguages []string `json:"subtitle_languages"` |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
type Friend struct { |
| 127 |
ID int64 `json:"id"` |
| 128 |
Name string `json:"name"` |
| 129 |
AvatarURL string `json:"avatar_url"` |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
type Zip struct { |
| 134 |
ID int64 `json:"id"` |
| 135 |
CreatedAt *Time `json:"created_at"` |
| 136 |
|
| 137 |
Size int64 `json:"size"` |
| 138 |
Status string `json:"status"` |
| 139 |
URL string `json:"url"` |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
type Subtitle struct { |
| 144 |
Key string |
| 145 |
Language string |
| 146 |
Name string |
| 147 |
Source string |
| 148 |
} |
| 149 |
|
| 150 |
|
| 151 |
type Event struct { |
| 152 |
ID int64 `json:"id"` |
| 153 |
FileID int64 `json:"file_id"` |
| 154 |
Source string `json:"source"` |
| 155 |
Type string `json:"type"` |
| 156 |
TransferName string `json:"transfer_name"` |
| 157 |
TransferSize int64 `json:"transfer_size"` |
| 158 |
CreatedAt *Time `json:"created_at"` |
| 159 |
} |
| 160 |
|
| 161 |
type share struct { |
| 162 |
FileID int64 `json:"file_id"` |
| 163 |
Filename string `json:"file_name"` |
| 164 |
|
| 165 |
SharedWith int64 `json:"shared_with"` |
| 166 |
} |