OLD | NEW |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
1 library googleapis.urlshortener.v1; | 3 library googleapis.urlshortener.v1; |
2 | 4 |
3 import "dart:core" as core; | 5 import 'dart:core' as core; |
4 import "dart:collection" as collection; | 6 import 'dart:collection' as collection; |
5 import "dart:async" as async; | 7 import 'dart:async' as async; |
6 import "dart:convert" as convert; | 8 import 'dart:convert' as convert; |
7 | 9 |
8 import "package:crypto/crypto.dart" as crypto; | 10 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| 11 import 'package:crypto/crypto.dart' as crypto; |
9 import 'package:http/http.dart' as http; | 12 import 'package:http/http.dart' as http; |
10 import '../src/common_internal.dart' as common_internal; | |
11 import '../common/common.dart' as common; | |
12 | 13 |
13 export '../common/common.dart' show ApiRequestError; | 14 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
14 export '../common/common.dart' show DetailedApiRequestError; | 15 ApiRequestError, DetailedApiRequestError; |
| 16 |
| 17 const core.String USER_AGENT = 'dart-api-client urlshortener/v1'; |
15 | 18 |
16 /** Lets you create, inspect, and manage goo.gl short URLs */ | 19 /** Lets you create, inspect, and manage goo.gl short URLs */ |
17 class UrlshortenerApi { | 20 class UrlshortenerApi { |
18 /** Manage your goo.gl short URLs */ | 21 /** Manage your goo.gl short URLs */ |
19 static const UrlshortenerScope = "https://www.googleapis.com/auth/urlshortener
"; | 22 static const UrlshortenerScope = "https://www.googleapis.com/auth/urlshortener
"; |
20 | 23 |
21 | 24 |
22 final common_internal.ApiRequester _requester; | 25 final commons.ApiRequester _requester; |
23 | 26 |
24 UrlResourceApi get url => new UrlResourceApi(_requester); | 27 UrlResourceApi get url => new UrlResourceApi(_requester); |
25 | 28 |
26 UrlshortenerApi(http.Client client, {core.String rootUrl: "https://www.googlea
pis.com/", core.String servicePath: "urlshortener/v1/"}) : | 29 UrlshortenerApi(http.Client client, {core.String rootUrl: "https://www.googlea
pis.com/", core.String servicePath: "urlshortener/v1/"}) : |
27 _requester = new common_internal.ApiRequester(client, rootUrl, servicePath
); | 30 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
28 } | 31 } |
29 | 32 |
30 | 33 |
31 /** Not documented yet. */ | |
32 class UrlResourceApi { | 34 class UrlResourceApi { |
33 final common_internal.ApiRequester _requester; | 35 final commons.ApiRequester _requester; |
34 | 36 |
35 UrlResourceApi(common_internal.ApiRequester client) : | 37 UrlResourceApi(commons.ApiRequester client) : |
36 _requester = client; | 38 _requester = client; |
37 | 39 |
38 /** | 40 /** |
39 * Expands a short URL or gets creation time and analytics. | 41 * Expands a short URL or gets creation time and analytics. |
40 * | 42 * |
41 * Request parameters: | 43 * Request parameters: |
42 * | 44 * |
43 * [shortUrl] - The short URL, including the protocol. | 45 * [shortUrl] - The short URL, including the protocol. |
44 * | 46 * |
45 * [projection] - Additional information to return. | 47 * [projection] - Additional information to return. |
46 * Possible string values are: | 48 * Possible string values are: |
47 * - "ANALYTICS_CLICKS" : Returns only click counts. | 49 * - "ANALYTICS_CLICKS" : Returns only click counts. |
48 * - "ANALYTICS_TOP_STRINGS" : Returns only top string counts. | 50 * - "ANALYTICS_TOP_STRINGS" : Returns only top string counts. |
49 * - "FULL" : Returns the creation timestamp and all available analytics. | 51 * - "FULL" : Returns the creation timestamp and all available analytics. |
50 * | 52 * |
51 * Completes with a [Url]. | 53 * Completes with a [Url]. |
52 * | 54 * |
53 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 55 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
54 * error. | 56 * error. |
55 * | 57 * |
56 * If the used [http.Client] completes with an error when making a REST call, | 58 * If the used [http.Client] completes with an error when making a REST call, |
57 * this method will complete with the same error. | 59 * this method will complete with the same error. |
58 */ | 60 */ |
59 async.Future<Url> get(core.String shortUrl, {core.String projection}) { | 61 async.Future<Url> get(core.String shortUrl, {core.String projection}) { |
60 var _url = null; | 62 var _url = null; |
61 var _queryParams = new core.Map(); | 63 var _queryParams = new core.Map(); |
62 var _uploadMedia = null; | 64 var _uploadMedia = null; |
63 var _uploadOptions = null; | 65 var _uploadOptions = null; |
64 var _downloadOptions = common.DownloadOptions.Metadata; | 66 var _downloadOptions = commons.DownloadOptions.Metadata; |
65 var _body = null; | 67 var _body = null; |
66 | 68 |
67 if (shortUrl == null) { | 69 if (shortUrl == null) { |
68 throw new core.ArgumentError("Parameter shortUrl is required."); | 70 throw new core.ArgumentError("Parameter shortUrl is required."); |
69 } | 71 } |
70 _queryParams["shortUrl"] = [shortUrl]; | 72 _queryParams["shortUrl"] = [shortUrl]; |
71 if (projection != null) { | 73 if (projection != null) { |
72 _queryParams["projection"] = [projection]; | 74 _queryParams["projection"] = [projection]; |
73 } | 75 } |
74 | 76 |
(...skipping 12 matching lines...) Expand all Loading... |
87 | 89 |
88 /** | 90 /** |
89 * Creates a new short URL. | 91 * Creates a new short URL. |
90 * | 92 * |
91 * [request] - The metadata request object. | 93 * [request] - The metadata request object. |
92 * | 94 * |
93 * Request parameters: | 95 * Request parameters: |
94 * | 96 * |
95 * Completes with a [Url]. | 97 * Completes with a [Url]. |
96 * | 98 * |
97 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 99 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
98 * error. | 100 * error. |
99 * | 101 * |
100 * If the used [http.Client] completes with an error when making a REST call, | 102 * If the used [http.Client] completes with an error when making a REST call, |
101 * this method will complete with the same error. | 103 * this method will complete with the same error. |
102 */ | 104 */ |
103 async.Future<Url> insert(Url request) { | 105 async.Future<Url> insert(Url request) { |
104 var _url = null; | 106 var _url = null; |
105 var _queryParams = new core.Map(); | 107 var _queryParams = new core.Map(); |
106 var _uploadMedia = null; | 108 var _uploadMedia = null; |
107 var _uploadOptions = null; | 109 var _uploadOptions = null; |
108 var _downloadOptions = common.DownloadOptions.Metadata; | 110 var _downloadOptions = commons.DownloadOptions.Metadata; |
109 var _body = null; | 111 var _body = null; |
110 | 112 |
111 if (request != null) { | 113 if (request != null) { |
112 _body = convert.JSON.encode((request).toJson()); | 114 _body = convert.JSON.encode((request).toJson()); |
113 } | 115 } |
114 | 116 |
115 | 117 |
116 _url = 'url'; | 118 _url = 'url'; |
117 | 119 |
118 var _response = _requester.request(_url, | 120 var _response = _requester.request(_url, |
(...skipping 13 matching lines...) Expand all Loading... |
132 * | 134 * |
133 * [projection] - Additional information to return. | 135 * [projection] - Additional information to return. |
134 * Possible string values are: | 136 * Possible string values are: |
135 * - "ANALYTICS_CLICKS" : Returns short URL click counts. | 137 * - "ANALYTICS_CLICKS" : Returns short URL click counts. |
136 * - "FULL" : Returns short URL click counts. | 138 * - "FULL" : Returns short URL click counts. |
137 * | 139 * |
138 * [start_token] - Token for requesting successive pages of results. | 140 * [start_token] - Token for requesting successive pages of results. |
139 * | 141 * |
140 * Completes with a [UrlHistory]. | 142 * Completes with a [UrlHistory]. |
141 * | 143 * |
142 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 144 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
143 * error. | 145 * error. |
144 * | 146 * |
145 * If the used [http.Client] completes with an error when making a REST call, | 147 * If the used [http.Client] completes with an error when making a REST call, |
146 * this method will complete with the same error. | 148 * this method will complete with the same error. |
147 */ | 149 */ |
148 async.Future<UrlHistory> list({core.String projection, core.String start_token
}) { | 150 async.Future<UrlHistory> list({core.String projection, core.String start_token
}) { |
149 var _url = null; | 151 var _url = null; |
150 var _queryParams = new core.Map(); | 152 var _queryParams = new core.Map(); |
151 var _uploadMedia = null; | 153 var _uploadMedia = null; |
152 var _uploadOptions = null; | 154 var _uploadOptions = null; |
153 var _downloadOptions = common.DownloadOptions.Metadata; | 155 var _downloadOptions = commons.DownloadOptions.Metadata; |
154 var _body = null; | 156 var _body = null; |
155 | 157 |
156 if (projection != null) { | 158 if (projection != null) { |
157 _queryParams["projection"] = [projection]; | 159 _queryParams["projection"] = [projection]; |
158 } | 160 } |
159 if (start_token != null) { | 161 if (start_token != null) { |
160 _queryParams["start-token"] = [start_token]; | 162 _queryParams["start-token"] = [start_token]; |
161 } | 163 } |
162 | 164 |
163 | 165 |
164 _url = 'url/history'; | 166 _url = 'url/history'; |
165 | 167 |
166 var _response = _requester.request(_url, | 168 var _response = _requester.request(_url, |
167 "GET", | 169 "GET", |
168 body: _body, | 170 body: _body, |
169 queryParams: _queryParams, | 171 queryParams: _queryParams, |
170 uploadOptions: _uploadOptions, | 172 uploadOptions: _uploadOptions, |
171 uploadMedia: _uploadMedia, | 173 uploadMedia: _uploadMedia, |
172 downloadOptions: _downloadOptions); | 174 downloadOptions: _downloadOptions); |
173 return _response.then((data) => new UrlHistory.fromJson(data)); | 175 return _response.then((data) => new UrlHistory.fromJson(data)); |
174 } | 176 } |
175 | 177 |
176 } | 178 } |
177 | 179 |
178 | 180 |
179 | 181 |
180 /** Not documented yet. */ | |
181 class AnalyticsSnapshot { | 182 class AnalyticsSnapshot { |
182 /** | 183 /** |
183 * Top browsers, e.g. "Chrome"; sorted by (descending) click counts. Only | 184 * Top browsers, e.g. "Chrome"; sorted by (descending) click counts. Only |
184 * present if this data is available. | 185 * present if this data is available. |
185 */ | 186 */ |
186 core.List<StringCount> browsers; | 187 core.List<StringCount> browsers; |
187 | 188 |
188 /** | 189 /** |
189 * Top countries (expressed as country codes), e.g. "US" or "DE"; sorted by | 190 * Top countries (expressed as country codes), e.g. "US" or "DE"; sorted by |
190 * (descending) click counts. Only present if this data is available. | 191 * (descending) click counts. Only present if this data is available. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 _json["referrers"] = referrers.map((value) => (value).toJson()).toList(); | 252 _json["referrers"] = referrers.map((value) => (value).toJson()).toList(); |
252 } | 253 } |
253 if (shortUrlClicks != null) { | 254 if (shortUrlClicks != null) { |
254 _json["shortUrlClicks"] = shortUrlClicks; | 255 _json["shortUrlClicks"] = shortUrlClicks; |
255 } | 256 } |
256 return _json; | 257 return _json; |
257 } | 258 } |
258 } | 259 } |
259 | 260 |
260 | 261 |
261 /** Not documented yet. */ | |
262 class AnalyticsSummary { | 262 class AnalyticsSummary { |
263 /** Click analytics over all time. */ | 263 /** Click analytics over all time. */ |
264 AnalyticsSnapshot allTime; | 264 AnalyticsSnapshot allTime; |
265 | 265 |
266 /** Click analytics over the last day. */ | 266 /** Click analytics over the last day. */ |
267 AnalyticsSnapshot day; | 267 AnalyticsSnapshot day; |
268 | 268 |
269 /** Click analytics over the last month. */ | 269 /** Click analytics over the last month. */ |
270 AnalyticsSnapshot month; | 270 AnalyticsSnapshot month; |
271 | 271 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 _json["twoHours"] = (twoHours).toJson(); | 311 _json["twoHours"] = (twoHours).toJson(); |
312 } | 312 } |
313 if (week != null) { | 313 if (week != null) { |
314 _json["week"] = (week).toJson(); | 314 _json["week"] = (week).toJson(); |
315 } | 315 } |
316 return _json; | 316 return _json; |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 | 320 |
321 /** Not documented yet. */ | |
322 class StringCount { | 321 class StringCount { |
323 /** | 322 /** |
324 * Number of clicks for this top entry, e.g. for this particular country or | 323 * Number of clicks for this top entry, e.g. for this particular country or |
325 * browser. | 324 * browser. |
326 */ | 325 */ |
327 core.String count; | 326 core.String count; |
328 | 327 |
329 /** Label assigned to this top entry, e.g. "US" or "Chrome". */ | 328 /** Label assigned to this top entry, e.g. "US" or "Chrome". */ |
330 core.String id; | 329 core.String id; |
331 | 330 |
(...skipping 15 matching lines...) Expand all Loading... |
347 _json["count"] = count; | 346 _json["count"] = count; |
348 } | 347 } |
349 if (id != null) { | 348 if (id != null) { |
350 _json["id"] = id; | 349 _json["id"] = id; |
351 } | 350 } |
352 return _json; | 351 return _json; |
353 } | 352 } |
354 } | 353 } |
355 | 354 |
356 | 355 |
357 /** Not documented yet. */ | |
358 class Url { | 356 class Url { |
359 /** | 357 /** |
360 * A summary of the click analytics for the short and long URL. Might not be | 358 * A summary of the click analytics for the short and long URL. Might not be |
361 * present if not requested or currently unavailable. | 359 * present if not requested or currently unavailable. |
362 */ | 360 */ |
363 AnalyticsSummary analytics; | 361 AnalyticsSummary analytics; |
364 | 362 |
365 /** | 363 /** |
366 * Time the short URL was created; ISO 8601 representation using the | 364 * Time the short URL was created; ISO 8601 representation using the |
367 * yyyy-MM-dd'T'HH:mm:ss.SSSZZ format, e.g. "2010-10-14T19:01:24.944+00:00". | 365 * yyyy-MM-dd'T'HH:mm:ss.SSSZZ format, e.g. "2010-10-14T19:01:24.944+00:00". |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 _json["longUrl"] = longUrl; | 427 _json["longUrl"] = longUrl; |
430 } | 428 } |
431 if (status != null) { | 429 if (status != null) { |
432 _json["status"] = status; | 430 _json["status"] = status; |
433 } | 431 } |
434 return _json; | 432 return _json; |
435 } | 433 } |
436 } | 434 } |
437 | 435 |
438 | 436 |
439 /** Not documented yet. */ | |
440 class UrlHistory { | 437 class UrlHistory { |
441 /** A list of URL resources. */ | 438 /** A list of URL resources. */ |
442 core.List<Url> items; | 439 core.List<Url> items; |
443 | 440 |
444 /** | 441 /** |
445 * Number of items returned with each full "page" of results. Note that the | 442 * Number of items returned with each full "page" of results. Note that the |
446 * last page could have fewer items than the "itemsPerPage" value. | 443 * last page could have fewer items than the "itemsPerPage" value. |
447 */ | 444 */ |
448 core.int itemsPerPage; | 445 core.int itemsPerPage; |
449 | 446 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 } | 489 } |
493 if (nextPageToken != null) { | 490 if (nextPageToken != null) { |
494 _json["nextPageToken"] = nextPageToken; | 491 _json["nextPageToken"] = nextPageToken; |
495 } | 492 } |
496 if (totalItems != null) { | 493 if (totalItems != null) { |
497 _json["totalItems"] = totalItems; | 494 _json["totalItems"] = totalItems; |
498 } | 495 } |
499 return _json; | 496 return _json; |
500 } | 497 } |
501 } | 498 } |
502 | |
503 | |
OLD | NEW |