OLD | NEW |
1 // This is a generated file (see the discoveryapis_generator project). | 1 // This is a generated file (see the discoveryapis_generator project). |
2 | 2 |
3 library googleapis.urlshortener.v1; | 3 library googleapis.urlshortener.v1; |
4 | 4 |
5 import 'dart:core' as core; | 5 import 'dart:core' as core; |
6 import 'dart:async' as async; | 6 import 'dart:async' as async; |
7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
8 | 8 |
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | 9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
11 | 11 |
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' |
13 ApiRequestError, DetailedApiRequestError; | 13 show ApiRequestError, DetailedApiRequestError; |
14 | 14 |
15 const core.String USER_AGENT = 'dart-api-client urlshortener/v1'; | 15 const core.String USER_AGENT = 'dart-api-client urlshortener/v1'; |
16 | 16 |
17 /** Lets you create, inspect, and manage goo.gl short URLs */ | 17 /// Lets you create, inspect, and manage goo.gl short URLs |
18 class UrlshortenerApi { | 18 class UrlshortenerApi { |
19 /** Manage your goo.gl short URLs */ | 19 /// Manage your goo.gl short URLs |
20 static const UrlshortenerScope = "https://www.googleapis.com/auth/urlshortener
"; | 20 static const UrlshortenerScope = |
21 | 21 "https://www.googleapis.com/auth/urlshortener"; |
22 | 22 |
23 final commons.ApiRequester _requester; | 23 final commons.ApiRequester _requester; |
24 | 24 |
25 UrlResourceApi get url => new UrlResourceApi(_requester); | 25 UrlResourceApi get url => new UrlResourceApi(_requester); |
26 | 26 |
27 UrlshortenerApi(http.Client client, {core.String rootUrl: "https://www.googlea
pis.com/", core.String servicePath: "urlshortener/v1/"}) : | 27 UrlshortenerApi(http.Client client, |
28 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | 28 {core.String rootUrl: "https://www.googleapis.com/", |
| 29 core.String servicePath: "urlshortener/v1/"}) |
| 30 : _requester = |
| 31 new commons.ApiRequester(client, rootUrl, servicePath, USER_AGENT); |
29 } | 32 } |
30 | 33 |
31 | |
32 class UrlResourceApi { | 34 class UrlResourceApi { |
33 final commons.ApiRequester _requester; | 35 final commons.ApiRequester _requester; |
34 | 36 |
35 UrlResourceApi(commons.ApiRequester client) : | 37 UrlResourceApi(commons.ApiRequester client) : _requester = client; |
36 _requester = client; | |
37 | 38 |
38 /** | 39 /// Expands a short URL or gets creation time and analytics. |
39 * Expands a short URL or gets creation time and analytics. | 40 /// |
40 * | 41 /// Request parameters: |
41 * Request parameters: | 42 /// |
42 * | 43 /// [shortUrl] - The short URL, including the protocol. |
43 * [shortUrl] - The short URL, including the protocol. | 44 /// |
44 * | 45 /// [projection] - Additional information to return. |
45 * [projection] - Additional information to return. | 46 /// Possible string values are: |
46 * Possible string values are: | 47 /// - "ANALYTICS_CLICKS" : Returns only click counts. |
47 * - "ANALYTICS_CLICKS" : Returns only click counts. | 48 /// - "ANALYTICS_TOP_STRINGS" : Returns only top string counts. |
48 * - "ANALYTICS_TOP_STRINGS" : Returns only top string counts. | 49 /// - "FULL" : Returns the creation timestamp and all available analytics. |
49 * - "FULL" : Returns the creation timestamp and all available analytics. | 50 /// |
50 * | 51 /// Completes with a [Url]. |
51 * Completes with a [Url]. | 52 /// |
52 * | 53 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
53 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 54 /// an error. |
54 * error. | 55 /// |
55 * | 56 /// If the used [http.Client] completes with an error when making a REST |
56 * If the used [http.Client] completes with an error when making a REST call, | 57 /// call, this method will complete with the same error. |
57 * this method will complete with the same error. | |
58 */ | |
59 async.Future<Url> get(core.String shortUrl, {core.String projection}) { | 58 async.Future<Url> get(core.String shortUrl, {core.String projection}) { |
60 var _url = null; | 59 var _url = null; |
61 var _queryParams = new core.Map(); | 60 var _queryParams = new core.Map(); |
62 var _uploadMedia = null; | 61 var _uploadMedia = null; |
63 var _uploadOptions = null; | 62 var _uploadOptions = null; |
64 var _downloadOptions = commons.DownloadOptions.Metadata; | 63 var _downloadOptions = commons.DownloadOptions.Metadata; |
65 var _body = null; | 64 var _body = null; |
66 | 65 |
67 if (shortUrl == null) { | 66 if (shortUrl == null) { |
68 throw new core.ArgumentError("Parameter shortUrl is required."); | 67 throw new core.ArgumentError("Parameter shortUrl is required."); |
69 } | 68 } |
70 _queryParams["shortUrl"] = [shortUrl]; | 69 _queryParams["shortUrl"] = [shortUrl]; |
71 if (projection != null) { | 70 if (projection != null) { |
72 _queryParams["projection"] = [projection]; | 71 _queryParams["projection"] = [projection]; |
73 } | 72 } |
74 | 73 |
75 _url = 'url'; | 74 _url = 'url'; |
76 | 75 |
77 var _response = _requester.request(_url, | 76 var _response = _requester.request(_url, "GET", |
78 "GET", | 77 body: _body, |
79 body: _body, | 78 queryParams: _queryParams, |
80 queryParams: _queryParams, | 79 uploadOptions: _uploadOptions, |
81 uploadOptions: _uploadOptions, | 80 uploadMedia: _uploadMedia, |
82 uploadMedia: _uploadMedia, | 81 downloadOptions: _downloadOptions); |
83 downloadOptions: _downloadOptions); | |
84 return _response.then((data) => new Url.fromJson(data)); | 82 return _response.then((data) => new Url.fromJson(data)); |
85 } | 83 } |
86 | 84 |
87 /** | 85 /// Creates a new short URL. |
88 * Creates a new short URL. | 86 /// |
89 * | 87 /// [request] - The metadata request object. |
90 * [request] - The metadata request object. | 88 /// |
91 * | 89 /// Request parameters: |
92 * Request parameters: | 90 /// |
93 * | 91 /// Completes with a [Url]. |
94 * Completes with a [Url]. | 92 /// |
95 * | 93 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
96 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 94 /// an error. |
97 * error. | 95 /// |
98 * | 96 /// If the used [http.Client] completes with an error when making a REST |
99 * If the used [http.Client] completes with an error when making a REST call, | 97 /// call, this method will complete with the same error. |
100 * this method will complete with the same error. | |
101 */ | |
102 async.Future<Url> insert(Url request) { | 98 async.Future<Url> insert(Url request) { |
103 var _url = null; | 99 var _url = null; |
104 var _queryParams = new core.Map(); | 100 var _queryParams = new core.Map(); |
105 var _uploadMedia = null; | 101 var _uploadMedia = null; |
106 var _uploadOptions = null; | 102 var _uploadOptions = null; |
107 var _downloadOptions = commons.DownloadOptions.Metadata; | 103 var _downloadOptions = commons.DownloadOptions.Metadata; |
108 var _body = null; | 104 var _body = null; |
109 | 105 |
110 if (request != null) { | 106 if (request != null) { |
111 _body = convert.JSON.encode((request).toJson()); | 107 _body = convert.JSON.encode((request).toJson()); |
112 } | 108 } |
113 | 109 |
114 _url = 'url'; | 110 _url = 'url'; |
115 | 111 |
116 var _response = _requester.request(_url, | 112 var _response = _requester.request(_url, "POST", |
117 "POST", | 113 body: _body, |
118 body: _body, | 114 queryParams: _queryParams, |
119 queryParams: _queryParams, | 115 uploadOptions: _uploadOptions, |
120 uploadOptions: _uploadOptions, | 116 uploadMedia: _uploadMedia, |
121 uploadMedia: _uploadMedia, | 117 downloadOptions: _downloadOptions); |
122 downloadOptions: _downloadOptions); | |
123 return _response.then((data) => new Url.fromJson(data)); | 118 return _response.then((data) => new Url.fromJson(data)); |
124 } | 119 } |
125 | 120 |
126 /** | 121 /// Retrieves a list of URLs shortened by a user. |
127 * Retrieves a list of URLs shortened by a user. | 122 /// |
128 * | 123 /// Request parameters: |
129 * Request parameters: | 124 /// |
130 * | 125 /// [projection] - Additional information to return. |
131 * [projection] - Additional information to return. | 126 /// Possible string values are: |
132 * Possible string values are: | 127 /// - "ANALYTICS_CLICKS" : Returns short URL click counts. |
133 * - "ANALYTICS_CLICKS" : Returns short URL click counts. | 128 /// - "FULL" : Returns short URL click counts. |
134 * - "FULL" : Returns short URL click counts. | 129 /// |
135 * | 130 /// [start_token] - Token for requesting successive pages of results. |
136 * [start_token] - Token for requesting successive pages of results. | 131 /// |
137 * | 132 /// Completes with a [UrlHistory]. |
138 * Completes with a [UrlHistory]. | 133 /// |
139 * | 134 /// Completes with a [commons.ApiRequestError] if the API endpoint returned |
140 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 135 /// an error. |
141 * error. | 136 /// |
142 * | 137 /// If the used [http.Client] completes with an error when making a REST |
143 * If the used [http.Client] completes with an error when making a REST call, | 138 /// call, this method will complete with the same error. |
144 * this method will complete with the same error. | 139 async.Future<UrlHistory> list( |
145 */ | 140 {core.String projection, core.String start_token}) { |
146 async.Future<UrlHistory> list({core.String projection, core.String start_token
}) { | |
147 var _url = null; | 141 var _url = null; |
148 var _queryParams = new core.Map(); | 142 var _queryParams = new core.Map(); |
149 var _uploadMedia = null; | 143 var _uploadMedia = null; |
150 var _uploadOptions = null; | 144 var _uploadOptions = null; |
151 var _downloadOptions = commons.DownloadOptions.Metadata; | 145 var _downloadOptions = commons.DownloadOptions.Metadata; |
152 var _body = null; | 146 var _body = null; |
153 | 147 |
154 if (projection != null) { | 148 if (projection != null) { |
155 _queryParams["projection"] = [projection]; | 149 _queryParams["projection"] = [projection]; |
156 } | 150 } |
157 if (start_token != null) { | 151 if (start_token != null) { |
158 _queryParams["start-token"] = [start_token]; | 152 _queryParams["start-token"] = [start_token]; |
159 } | 153 } |
160 | 154 |
161 _url = 'url/history'; | 155 _url = 'url/history'; |
162 | 156 |
163 var _response = _requester.request(_url, | 157 var _response = _requester.request(_url, "GET", |
164 "GET", | 158 body: _body, |
165 body: _body, | 159 queryParams: _queryParams, |
166 queryParams: _queryParams, | 160 uploadOptions: _uploadOptions, |
167 uploadOptions: _uploadOptions, | 161 uploadMedia: _uploadMedia, |
168 uploadMedia: _uploadMedia, | 162 downloadOptions: _downloadOptions); |
169 downloadOptions: _downloadOptions); | |
170 return _response.then((data) => new UrlHistory.fromJson(data)); | 163 return _response.then((data) => new UrlHistory.fromJson(data)); |
171 } | 164 } |
172 | |
173 } | 165 } |
174 | 166 |
| 167 class AnalyticsSnapshot { |
| 168 /// Top browsers, e.g. "Chrome"; sorted by (descending) click counts. Only |
| 169 /// present if this data is available. |
| 170 core.List<StringCount> browsers; |
175 | 171 |
| 172 /// Top countries (expressed as country codes), e.g. "US" or "DE"; sorted by |
| 173 /// (descending) click counts. Only present if this data is available. |
| 174 core.List<StringCount> countries; |
176 | 175 |
177 class AnalyticsSnapshot { | 176 /// Number of clicks on all goo.gl short URLs pointing to this long URL. |
178 /** | |
179 * Top browsers, e.g. "Chrome"; sorted by (descending) click counts. Only | |
180 * present if this data is available. | |
181 */ | |
182 core.List<StringCount> browsers; | |
183 /** | |
184 * Top countries (expressed as country codes), e.g. "US" or "DE"; sorted by | |
185 * (descending) click counts. Only present if this data is available. | |
186 */ | |
187 core.List<StringCount> countries; | |
188 /** Number of clicks on all goo.gl short URLs pointing to this long URL. */ | |
189 core.String longUrlClicks; | 177 core.String longUrlClicks; |
190 /** | 178 |
191 * Top platforms or OSes, e.g. "Windows"; sorted by (descending) click counts. | 179 /// Top platforms or OSes, e.g. "Windows"; sorted by (descending) click |
192 * Only present if this data is available. | 180 /// counts. Only present if this data is available. |
193 */ | |
194 core.List<StringCount> platforms; | 181 core.List<StringCount> platforms; |
195 /** | 182 |
196 * Top referring hosts, e.g. "www.google.com"; sorted by (descending) click | 183 /// Top referring hosts, e.g. "www.google.com"; sorted by (descending) click |
197 * counts. Only present if this data is available. | 184 /// counts. Only present if this data is available. |
198 */ | |
199 core.List<StringCount> referrers; | 185 core.List<StringCount> referrers; |
200 /** Number of clicks on this short URL. */ | 186 |
| 187 /// Number of clicks on this short URL. |
201 core.String shortUrlClicks; | 188 core.String shortUrlClicks; |
202 | 189 |
203 AnalyticsSnapshot(); | 190 AnalyticsSnapshot(); |
204 | 191 |
205 AnalyticsSnapshot.fromJson(core.Map _json) { | 192 AnalyticsSnapshot.fromJson(core.Map _json) { |
206 if (_json.containsKey("browsers")) { | 193 if (_json.containsKey("browsers")) { |
207 browsers = _json["browsers"].map((value) => new StringCount.fromJson(value
)).toList(); | 194 browsers = _json["browsers"] |
| 195 .map((value) => new StringCount.fromJson(value)) |
| 196 .toList(); |
208 } | 197 } |
209 if (_json.containsKey("countries")) { | 198 if (_json.containsKey("countries")) { |
210 countries = _json["countries"].map((value) => new StringCount.fromJson(val
ue)).toList(); | 199 countries = _json["countries"] |
| 200 .map((value) => new StringCount.fromJson(value)) |
| 201 .toList(); |
211 } | 202 } |
212 if (_json.containsKey("longUrlClicks")) { | 203 if (_json.containsKey("longUrlClicks")) { |
213 longUrlClicks = _json["longUrlClicks"]; | 204 longUrlClicks = _json["longUrlClicks"]; |
214 } | 205 } |
215 if (_json.containsKey("platforms")) { | 206 if (_json.containsKey("platforms")) { |
216 platforms = _json["platforms"].map((value) => new StringCount.fromJson(val
ue)).toList(); | 207 platforms = _json["platforms"] |
| 208 .map((value) => new StringCount.fromJson(value)) |
| 209 .toList(); |
217 } | 210 } |
218 if (_json.containsKey("referrers")) { | 211 if (_json.containsKey("referrers")) { |
219 referrers = _json["referrers"].map((value) => new StringCount.fromJson(val
ue)).toList(); | 212 referrers = _json["referrers"] |
| 213 .map((value) => new StringCount.fromJson(value)) |
| 214 .toList(); |
220 } | 215 } |
221 if (_json.containsKey("shortUrlClicks")) { | 216 if (_json.containsKey("shortUrlClicks")) { |
222 shortUrlClicks = _json["shortUrlClicks"]; | 217 shortUrlClicks = _json["shortUrlClicks"]; |
223 } | 218 } |
224 } | 219 } |
225 | 220 |
226 core.Map<core.String, core.Object> toJson() { | 221 core.Map<core.String, core.Object> toJson() { |
227 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 222 final core.Map<core.String, core.Object> _json = |
| 223 new core.Map<core.String, core.Object>(); |
228 if (browsers != null) { | 224 if (browsers != null) { |
229 _json["browsers"] = browsers.map((value) => (value).toJson()).toList(); | 225 _json["browsers"] = browsers.map((value) => (value).toJson()).toList(); |
230 } | 226 } |
231 if (countries != null) { | 227 if (countries != null) { |
232 _json["countries"] = countries.map((value) => (value).toJson()).toList(); | 228 _json["countries"] = countries.map((value) => (value).toJson()).toList(); |
233 } | 229 } |
234 if (longUrlClicks != null) { | 230 if (longUrlClicks != null) { |
235 _json["longUrlClicks"] = longUrlClicks; | 231 _json["longUrlClicks"] = longUrlClicks; |
236 } | 232 } |
237 if (platforms != null) { | 233 if (platforms != null) { |
238 _json["platforms"] = platforms.map((value) => (value).toJson()).toList(); | 234 _json["platforms"] = platforms.map((value) => (value).toJson()).toList(); |
239 } | 235 } |
240 if (referrers != null) { | 236 if (referrers != null) { |
241 _json["referrers"] = referrers.map((value) => (value).toJson()).toList(); | 237 _json["referrers"] = referrers.map((value) => (value).toJson()).toList(); |
242 } | 238 } |
243 if (shortUrlClicks != null) { | 239 if (shortUrlClicks != null) { |
244 _json["shortUrlClicks"] = shortUrlClicks; | 240 _json["shortUrlClicks"] = shortUrlClicks; |
245 } | 241 } |
246 return _json; | 242 return _json; |
247 } | 243 } |
248 } | 244 } |
249 | 245 |
250 class AnalyticsSummary { | 246 class AnalyticsSummary { |
251 /** Click analytics over all time. */ | 247 /// Click analytics over all time. |
252 AnalyticsSnapshot allTime; | 248 AnalyticsSnapshot allTime; |
253 /** Click analytics over the last day. */ | 249 |
| 250 /// Click analytics over the last day. |
254 AnalyticsSnapshot day; | 251 AnalyticsSnapshot day; |
255 /** Click analytics over the last month. */ | 252 |
| 253 /// Click analytics over the last month. |
256 AnalyticsSnapshot month; | 254 AnalyticsSnapshot month; |
257 /** Click analytics over the last two hours. */ | 255 |
| 256 /// Click analytics over the last two hours. |
258 AnalyticsSnapshot twoHours; | 257 AnalyticsSnapshot twoHours; |
259 /** Click analytics over the last week. */ | 258 |
| 259 /// Click analytics over the last week. |
260 AnalyticsSnapshot week; | 260 AnalyticsSnapshot week; |
261 | 261 |
262 AnalyticsSummary(); | 262 AnalyticsSummary(); |
263 | 263 |
264 AnalyticsSummary.fromJson(core.Map _json) { | 264 AnalyticsSummary.fromJson(core.Map _json) { |
265 if (_json.containsKey("allTime")) { | 265 if (_json.containsKey("allTime")) { |
266 allTime = new AnalyticsSnapshot.fromJson(_json["allTime"]); | 266 allTime = new AnalyticsSnapshot.fromJson(_json["allTime"]); |
267 } | 267 } |
268 if (_json.containsKey("day")) { | 268 if (_json.containsKey("day")) { |
269 day = new AnalyticsSnapshot.fromJson(_json["day"]); | 269 day = new AnalyticsSnapshot.fromJson(_json["day"]); |
270 } | 270 } |
271 if (_json.containsKey("month")) { | 271 if (_json.containsKey("month")) { |
272 month = new AnalyticsSnapshot.fromJson(_json["month"]); | 272 month = new AnalyticsSnapshot.fromJson(_json["month"]); |
273 } | 273 } |
274 if (_json.containsKey("twoHours")) { | 274 if (_json.containsKey("twoHours")) { |
275 twoHours = new AnalyticsSnapshot.fromJson(_json["twoHours"]); | 275 twoHours = new AnalyticsSnapshot.fromJson(_json["twoHours"]); |
276 } | 276 } |
277 if (_json.containsKey("week")) { | 277 if (_json.containsKey("week")) { |
278 week = new AnalyticsSnapshot.fromJson(_json["week"]); | 278 week = new AnalyticsSnapshot.fromJson(_json["week"]); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 core.Map<core.String, core.Object> toJson() { | 282 core.Map<core.String, core.Object> toJson() { |
283 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 283 final core.Map<core.String, core.Object> _json = |
| 284 new core.Map<core.String, core.Object>(); |
284 if (allTime != null) { | 285 if (allTime != null) { |
285 _json["allTime"] = (allTime).toJson(); | 286 _json["allTime"] = (allTime).toJson(); |
286 } | 287 } |
287 if (day != null) { | 288 if (day != null) { |
288 _json["day"] = (day).toJson(); | 289 _json["day"] = (day).toJson(); |
289 } | 290 } |
290 if (month != null) { | 291 if (month != null) { |
291 _json["month"] = (month).toJson(); | 292 _json["month"] = (month).toJson(); |
292 } | 293 } |
293 if (twoHours != null) { | 294 if (twoHours != null) { |
294 _json["twoHours"] = (twoHours).toJson(); | 295 _json["twoHours"] = (twoHours).toJson(); |
295 } | 296 } |
296 if (week != null) { | 297 if (week != null) { |
297 _json["week"] = (week).toJson(); | 298 _json["week"] = (week).toJson(); |
298 } | 299 } |
299 return _json; | 300 return _json; |
300 } | 301 } |
301 } | 302 } |
302 | 303 |
303 class StringCount { | 304 class StringCount { |
304 /** | 305 /// Number of clicks for this top entry, e.g. for this particular country or |
305 * Number of clicks for this top entry, e.g. for this particular country or | 306 /// browser. |
306 * browser. | |
307 */ | |
308 core.String count; | 307 core.String count; |
309 /** Label assigned to this top entry, e.g. "US" or "Chrome". */ | 308 |
| 309 /// Label assigned to this top entry, e.g. "US" or "Chrome". |
310 core.String id; | 310 core.String id; |
311 | 311 |
312 StringCount(); | 312 StringCount(); |
313 | 313 |
314 StringCount.fromJson(core.Map _json) { | 314 StringCount.fromJson(core.Map _json) { |
315 if (_json.containsKey("count")) { | 315 if (_json.containsKey("count")) { |
316 count = _json["count"]; | 316 count = _json["count"]; |
317 } | 317 } |
318 if (_json.containsKey("id")) { | 318 if (_json.containsKey("id")) { |
319 id = _json["id"]; | 319 id = _json["id"]; |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 core.Map<core.String, core.Object> toJson() { | 323 core.Map<core.String, core.Object> toJson() { |
324 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 324 final core.Map<core.String, core.Object> _json = |
| 325 new core.Map<core.String, core.Object>(); |
325 if (count != null) { | 326 if (count != null) { |
326 _json["count"] = count; | 327 _json["count"] = count; |
327 } | 328 } |
328 if (id != null) { | 329 if (id != null) { |
329 _json["id"] = id; | 330 _json["id"] = id; |
330 } | 331 } |
331 return _json; | 332 return _json; |
332 } | 333 } |
333 } | 334 } |
334 | 335 |
335 class Url { | 336 class Url { |
336 /** | 337 /// A summary of the click analytics for the short and long URL. Might not be |
337 * A summary of the click analytics for the short and long URL. Might not be | 338 /// present if not requested or currently unavailable. |
338 * present if not requested or currently unavailable. | |
339 */ | |
340 AnalyticsSummary analytics; | 339 AnalyticsSummary analytics; |
341 /** | 340 |
342 * Time the short URL was created; ISO 8601 representation using the | 341 /// Time the short URL was created; ISO 8601 representation using the |
343 * yyyy-MM-dd'T'HH:mm:ss.SSSZZ format, e.g. "2010-10-14T19:01:24.944+00:00". | 342 /// yyyy-MM-dd'T'HH:mm:ss.SSSZZ format, e.g. "2010-10-14T19:01:24.944+00:00". |
344 */ | |
345 core.String created; | 343 core.String created; |
346 /** Short URL, e.g. "http://goo.gl/l6MS". */ | 344 |
| 345 /// Short URL, e.g. "http://goo.gl/l6MS". |
347 core.String id; | 346 core.String id; |
348 /** The fixed string "urlshortener#url". */ | 347 |
| 348 /// The fixed string "urlshortener#url". |
349 core.String kind; | 349 core.String kind; |
350 /** | 350 |
351 * Long URL, e.g. "http://www.google.com/". Might not be present if the status | 351 /// Long URL, e.g. "http://www.google.com/". Might not be present if the |
352 * is "REMOVED". | 352 /// status is "REMOVED". |
353 */ | |
354 core.String longUrl; | 353 core.String longUrl; |
355 /** | 354 |
356 * Status of the target URL. Possible values: "OK", "MALWARE", "PHISHING", or | 355 /// Status of the target URL. Possible values: "OK", "MALWARE", "PHISHING", |
357 * "REMOVED". A URL might be marked "REMOVED" if it was flagged as spam, for | 356 /// or "REMOVED". A URL might be marked "REMOVED" if it was flagged as spam, |
358 * example. | 357 /// for example. |
359 */ | |
360 core.String status; | 358 core.String status; |
361 | 359 |
362 Url(); | 360 Url(); |
363 | 361 |
364 Url.fromJson(core.Map _json) { | 362 Url.fromJson(core.Map _json) { |
365 if (_json.containsKey("analytics")) { | 363 if (_json.containsKey("analytics")) { |
366 analytics = new AnalyticsSummary.fromJson(_json["analytics"]); | 364 analytics = new AnalyticsSummary.fromJson(_json["analytics"]); |
367 } | 365 } |
368 if (_json.containsKey("created")) { | 366 if (_json.containsKey("created")) { |
369 created = _json["created"]; | 367 created = _json["created"]; |
370 } | 368 } |
371 if (_json.containsKey("id")) { | 369 if (_json.containsKey("id")) { |
372 id = _json["id"]; | 370 id = _json["id"]; |
373 } | 371 } |
374 if (_json.containsKey("kind")) { | 372 if (_json.containsKey("kind")) { |
375 kind = _json["kind"]; | 373 kind = _json["kind"]; |
376 } | 374 } |
377 if (_json.containsKey("longUrl")) { | 375 if (_json.containsKey("longUrl")) { |
378 longUrl = _json["longUrl"]; | 376 longUrl = _json["longUrl"]; |
379 } | 377 } |
380 if (_json.containsKey("status")) { | 378 if (_json.containsKey("status")) { |
381 status = _json["status"]; | 379 status = _json["status"]; |
382 } | 380 } |
383 } | 381 } |
384 | 382 |
385 core.Map<core.String, core.Object> toJson() { | 383 core.Map<core.String, core.Object> toJson() { |
386 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 384 final core.Map<core.String, core.Object> _json = |
| 385 new core.Map<core.String, core.Object>(); |
387 if (analytics != null) { | 386 if (analytics != null) { |
388 _json["analytics"] = (analytics).toJson(); | 387 _json["analytics"] = (analytics).toJson(); |
389 } | 388 } |
390 if (created != null) { | 389 if (created != null) { |
391 _json["created"] = created; | 390 _json["created"] = created; |
392 } | 391 } |
393 if (id != null) { | 392 if (id != null) { |
394 _json["id"] = id; | 393 _json["id"] = id; |
395 } | 394 } |
396 if (kind != null) { | 395 if (kind != null) { |
397 _json["kind"] = kind; | 396 _json["kind"] = kind; |
398 } | 397 } |
399 if (longUrl != null) { | 398 if (longUrl != null) { |
400 _json["longUrl"] = longUrl; | 399 _json["longUrl"] = longUrl; |
401 } | 400 } |
402 if (status != null) { | 401 if (status != null) { |
403 _json["status"] = status; | 402 _json["status"] = status; |
404 } | 403 } |
405 return _json; | 404 return _json; |
406 } | 405 } |
407 } | 406 } |
408 | 407 |
409 class UrlHistory { | 408 class UrlHistory { |
410 /** A list of URL resources. */ | 409 /// A list of URL resources. |
411 core.List<Url> items; | 410 core.List<Url> items; |
412 /** | 411 |
413 * Number of items returned with each full "page" of results. Note that the | 412 /// Number of items returned with each full "page" of results. Note that the |
414 * last page could have fewer items than the "itemsPerPage" value. | 413 /// last page could have fewer items than the "itemsPerPage" value. |
415 */ | |
416 core.int itemsPerPage; | 414 core.int itemsPerPage; |
417 /** The fixed string "urlshortener#urlHistory". */ | 415 |
| 416 /// The fixed string "urlshortener#urlHistory". |
418 core.String kind; | 417 core.String kind; |
419 /** A token to provide to get the next page of results. */ | 418 |
| 419 /// A token to provide to get the next page of results. |
420 core.String nextPageToken; | 420 core.String nextPageToken; |
421 /** | 421 |
422 * Total number of short URLs associated with this user (may be approximate). | 422 /// Total number of short URLs associated with this user (may be |
423 */ | 423 /// approximate). |
424 core.int totalItems; | 424 core.int totalItems; |
425 | 425 |
426 UrlHistory(); | 426 UrlHistory(); |
427 | 427 |
428 UrlHistory.fromJson(core.Map _json) { | 428 UrlHistory.fromJson(core.Map _json) { |
429 if (_json.containsKey("items")) { | 429 if (_json.containsKey("items")) { |
430 items = _json["items"].map((value) => new Url.fromJson(value)).toList(); | 430 items = _json["items"].map((value) => new Url.fromJson(value)).toList(); |
431 } | 431 } |
432 if (_json.containsKey("itemsPerPage")) { | 432 if (_json.containsKey("itemsPerPage")) { |
433 itemsPerPage = _json["itemsPerPage"]; | 433 itemsPerPage = _json["itemsPerPage"]; |
434 } | 434 } |
435 if (_json.containsKey("kind")) { | 435 if (_json.containsKey("kind")) { |
436 kind = _json["kind"]; | 436 kind = _json["kind"]; |
437 } | 437 } |
438 if (_json.containsKey("nextPageToken")) { | 438 if (_json.containsKey("nextPageToken")) { |
439 nextPageToken = _json["nextPageToken"]; | 439 nextPageToken = _json["nextPageToken"]; |
440 } | 440 } |
441 if (_json.containsKey("totalItems")) { | 441 if (_json.containsKey("totalItems")) { |
442 totalItems = _json["totalItems"]; | 442 totalItems = _json["totalItems"]; |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 core.Map<core.String, core.Object> toJson() { | 446 core.Map<core.String, core.Object> toJson() { |
447 final core.Map<core.String, core.Object> _json = new core.Map<core.String, c
ore.Object>(); | 447 final core.Map<core.String, core.Object> _json = |
| 448 new core.Map<core.String, core.Object>(); |
448 if (items != null) { | 449 if (items != null) { |
449 _json["items"] = items.map((value) => (value).toJson()).toList(); | 450 _json["items"] = items.map((value) => (value).toJson()).toList(); |
450 } | 451 } |
451 if (itemsPerPage != null) { | 452 if (itemsPerPage != null) { |
452 _json["itemsPerPage"] = itemsPerPage; | 453 _json["itemsPerPage"] = itemsPerPage; |
453 } | 454 } |
454 if (kind != null) { | 455 if (kind != null) { |
455 _json["kind"] = kind; | 456 _json["kind"] = kind; |
456 } | 457 } |
457 if (nextPageToken != null) { | 458 if (nextPageToken != null) { |
458 _json["nextPageToken"] = nextPageToken; | 459 _json["nextPageToken"] = nextPageToken; |
459 } | 460 } |
460 if (totalItems != null) { | 461 if (totalItems != null) { |
461 _json["totalItems"] = totalItems; | 462 _json["totalItems"] = totalItems; |
462 } | 463 } |
463 return _json; | 464 return _json; |
464 } | 465 } |
465 } | 466 } |
OLD | NEW |