|
| 1 | +import 'dart:convert'; |
| 2 | + |
| 3 | + |
| 4 | +class RegionResp { |
| 5 | + |
| 6 | + int code; |
| 7 | + int ttl; |
| 8 | + String message; |
| 9 | + Data data; |
| 10 | + |
| 11 | + |
| 12 | + RegionResp(jsonStr) { |
| 13 | + var jsonRes = JSON.decode(jsonStr); |
| 14 | + |
| 15 | + code = jsonRes['code']; |
| 16 | + ttl = jsonRes['ttl']; |
| 17 | + message = jsonRes['message']; |
| 18 | + data = new Data(jsonRes['data']); |
| 19 | + } |
| 20 | + |
| 21 | + @override |
| 22 | + String toString() { |
| 23 | + return '{"code": $code,"ttl": $ttl,"message": ${message != null ? '${JSON |
| 24 | + .encode(message)}' : 'null'},"data": $data}'; |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | + |
| 29 | +class Data { |
| 30 | + |
| 31 | + List<Arch> archives; |
| 32 | + Page page; |
| 33 | + |
| 34 | + |
| 35 | + Data(jsonRes) { |
| 36 | + archives = []; |
| 37 | + |
| 38 | + for (var archivesItem in jsonRes['archives']) { |
| 39 | + archives.add(new Arch(archivesItem)); |
| 40 | + } |
| 41 | + |
| 42 | + page = new Page(jsonRes['page']); |
| 43 | + } |
| 44 | + |
| 45 | + @override |
| 46 | + String toString() { |
| 47 | + return '{"archives": $archives,"page": $page}'; |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | + |
| 52 | +class Page { |
| 53 | + |
| 54 | + int count; |
| 55 | + int num; |
| 56 | + int size; |
| 57 | + |
| 58 | + |
| 59 | + Page(jsonRes) { |
| 60 | + count = jsonRes['count']; |
| 61 | + num = jsonRes['num']; |
| 62 | + size = jsonRes['size']; |
| 63 | + } |
| 64 | + |
| 65 | + @override |
| 66 | + String toString() { |
| 67 | + return '{"count": $count,"num": $num,"size": $size}'; |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | + |
| 72 | +class Arch { |
| 73 | + |
| 74 | + int aid; |
| 75 | + int attribute; |
| 76 | + int copyright; |
| 77 | + int ctime; |
| 78 | + int duration; |
| 79 | + int pubdate; |
| 80 | + int state; |
| 81 | + int tid; |
| 82 | + int videos; |
| 83 | + String desc; |
| 84 | + String dynamic; |
| 85 | + String pic; |
| 86 | + String title; |
| 87 | + String tname; |
| 88 | + Owner owner; |
| 89 | + Rights rights; |
| 90 | + Stat stat; |
| 91 | + |
| 92 | + |
| 93 | + Arch(jsonRes) { |
| 94 | + aid = jsonRes['aid']; |
| 95 | + attribute = jsonRes['attribute']; |
| 96 | + copyright = jsonRes['copyright']; |
| 97 | + ctime = jsonRes['ctime']; |
| 98 | + duration = jsonRes['duration']; |
| 99 | + pubdate = jsonRes['pubdate']; |
| 100 | + state = jsonRes['state']; |
| 101 | + tid = jsonRes['tid']; |
| 102 | + videos = jsonRes['videos']; |
| 103 | + desc = jsonRes['desc']; |
| 104 | + dynamic = jsonRes['dynamic']; |
| 105 | + pic = jsonRes['pic']; |
| 106 | + title = jsonRes['title']; |
| 107 | + tname = jsonRes['tname']; |
| 108 | + owner = new Owner(jsonRes['owner']); |
| 109 | + rights = new Rights(jsonRes['rights']); |
| 110 | + stat = new Stat(jsonRes['stat']); |
| 111 | + } |
| 112 | + |
| 113 | + @override |
| 114 | + String toString() { |
| 115 | + return '{"aid": $aid,"attribute": $attribute,"copyright": $copyright,"ctime": $ctime,"duration": $duration,"pubdate": $pubdate,"state": $state,"tid": $tid,"videos": $videos,"desc": ${desc != |
| 116 | + null ? '${JSON.encode(desc)}' : 'null'},"dynamic": ${dynamic != null |
| 117 | + ? '${JSON.encode(dynamic)}' |
| 118 | + : 'null'},"pic": ${pic != null |
| 119 | + ? '${JSON.encode(pic)}' |
| 120 | + : 'null'},"title": ${title != null |
| 121 | + ? '${JSON.encode(title)}' |
| 122 | + : 'null'},"tname": ${tname != null |
| 123 | + ? '${JSON.encode(tname)}' |
| 124 | + : 'null'},"owner": $owner,"rights": $rights,"stat": $stat}'; |
| 125 | + } |
| 126 | +} |
| 127 | + |
| 128 | + |
| 129 | +class Stat { |
| 130 | + |
| 131 | + int aid; |
| 132 | + int coin; |
| 133 | + int danmaku; |
| 134 | + int favorite; |
| 135 | + int his_rank; |
| 136 | + int like; |
| 137 | + int now_rank; |
| 138 | + int reply; |
| 139 | + int share; |
| 140 | + int view; |
| 141 | + |
| 142 | + |
| 143 | + Stat(jsonRes) { |
| 144 | + aid = jsonRes['aid']; |
| 145 | + coin = jsonRes['coin']; |
| 146 | + danmaku = jsonRes['danmaku']; |
| 147 | + favorite = jsonRes['favorite']; |
| 148 | + his_rank = jsonRes['his_rank']; |
| 149 | + like = jsonRes['like']; |
| 150 | + now_rank = jsonRes['now_rank']; |
| 151 | + reply = jsonRes['reply']; |
| 152 | + share = jsonRes['share']; |
| 153 | + view = jsonRes['view']; |
| 154 | + } |
| 155 | + |
| 156 | + @override |
| 157 | + String toString() { |
| 158 | + return '{"aid": $aid,"coin": $coin,"danmaku": $danmaku,"favorite": $favorite,"his_rank": $his_rank,"like": $like,"now_rank": $now_rank,"reply": $reply,"share": $share,"view": $view}'; |
| 159 | + } |
| 160 | +} |
| 161 | + |
| 162 | + |
| 163 | +class Rights { |
| 164 | + |
| 165 | + int bp; |
| 166 | + int download; |
| 167 | + int elec; |
| 168 | + int hd5; |
| 169 | + int movie; |
| 170 | + int no_reprint; |
| 171 | + int pay; |
| 172 | + |
| 173 | + |
| 174 | + Rights(jsonRes) { |
| 175 | + bp = jsonRes['bp']; |
| 176 | + download = jsonRes['download']; |
| 177 | + elec = jsonRes['elec']; |
| 178 | + hd5 = jsonRes['hd5']; |
| 179 | + movie = jsonRes['movie']; |
| 180 | + no_reprint = jsonRes['no_reprint']; |
| 181 | + pay = jsonRes['pay']; |
| 182 | + } |
| 183 | + |
| 184 | + @override |
| 185 | + String toString() { |
| 186 | + return '{"bp": $bp,"download": $download,"elec": $elec,"hd5": $hd5,"movie": $movie,"no_reprint": $no_reprint,"pay": $pay}'; |
| 187 | + } |
| 188 | +} |
| 189 | + |
| 190 | + |
| 191 | +class Owner { |
| 192 | + |
| 193 | + int mid; |
| 194 | + String face; |
| 195 | + String name; |
| 196 | + |
| 197 | + |
| 198 | + Owner(jsonRes) { |
| 199 | + mid = jsonRes['mid']; |
| 200 | + face = jsonRes['face']; |
| 201 | + name = jsonRes['name']; |
| 202 | + } |
| 203 | + |
| 204 | + @override |
| 205 | + String toString() { |
| 206 | + return '{"mid": $mid,"face": ${face != null |
| 207 | + ? '${JSON.encode(face)}' |
| 208 | + : 'null'},"name": ${name != null ? '${JSON.encode(name)}' : 'null'}}'; |
| 209 | + } |
| 210 | +} |
| 211 | + |
0 commit comments