OLD | NEW |
| 1 // This is a generated file (see the discoveryapis_generator project). |
| 2 |
1 library googleapis.webfonts.v1; | 3 library googleapis.webfonts.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 webfonts/v1'; |
15 | 18 |
16 /** The Google Fonts Developer API. */ | 19 /** The Google Fonts Developer API. */ |
17 class WebfontsApi { | 20 class WebfontsApi { |
18 | 21 |
19 final common_internal.ApiRequester _requester; | 22 final commons.ApiRequester _requester; |
20 | 23 |
21 WebfontsResourceApi get webfonts => new WebfontsResourceApi(_requester); | 24 WebfontsResourceApi get webfonts => new WebfontsResourceApi(_requester); |
22 | 25 |
23 WebfontsApi(http.Client client, {core.String rootUrl: "https://www.googleapis.
com/", core.String servicePath: "webfonts/v1/"}) : | 26 WebfontsApi(http.Client client, {core.String rootUrl: "https://www.googleapis.
com/", core.String servicePath: "webfonts/v1/"}) : |
24 _requester = new common_internal.ApiRequester(client, rootUrl, servicePath
); | 27 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); |
25 } | 28 } |
26 | 29 |
27 | 30 |
28 /** Not documented yet. */ | |
29 class WebfontsResourceApi { | 31 class WebfontsResourceApi { |
30 final common_internal.ApiRequester _requester; | 32 final commons.ApiRequester _requester; |
31 | 33 |
32 WebfontsResourceApi(common_internal.ApiRequester client) : | 34 WebfontsResourceApi(commons.ApiRequester client) : |
33 _requester = client; | 35 _requester = client; |
34 | 36 |
35 /** | 37 /** |
36 * Retrieves the list of fonts currently served by the Google Fonts Developer | 38 * Retrieves the list of fonts currently served by the Google Fonts Developer |
37 * API | 39 * API |
38 * | 40 * |
39 * Request parameters: | 41 * Request parameters: |
40 * | 42 * |
41 * [sort] - Enables sorting of the list | 43 * [sort] - Enables sorting of the list |
42 * Possible string values are: | 44 * Possible string values are: |
43 * - "alpha" : Sort alphabetically | 45 * - "alpha" : Sort alphabetically |
44 * - "date" : Sort by date added | 46 * - "date" : Sort by date added |
45 * - "popularity" : Sort by popularity | 47 * - "popularity" : Sort by popularity |
46 * - "style" : Sort by number of styles | 48 * - "style" : Sort by number of styles |
47 * - "trending" : Sort by trending | 49 * - "trending" : Sort by trending |
48 * | 50 * |
49 * Completes with a [WebfontList]. | 51 * Completes with a [WebfontList]. |
50 * | 52 * |
51 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 53 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
52 * error. | 54 * error. |
53 * | 55 * |
54 * If the used [http.Client] completes with an error when making a REST call, | 56 * If the used [http.Client] completes with an error when making a REST call, |
55 * this method will complete with the same error. | 57 * this method will complete with the same error. |
56 */ | 58 */ |
57 async.Future<WebfontList> list({core.String sort}) { | 59 async.Future<WebfontList> list({core.String sort}) { |
58 var _url = null; | 60 var _url = null; |
59 var _queryParams = new core.Map(); | 61 var _queryParams = new core.Map(); |
60 var _uploadMedia = null; | 62 var _uploadMedia = null; |
61 var _uploadOptions = null; | 63 var _uploadOptions = null; |
62 var _downloadOptions = common.DownloadOptions.Metadata; | 64 var _downloadOptions = commons.DownloadOptions.Metadata; |
63 var _body = null; | 65 var _body = null; |
64 | 66 |
65 if (sort != null) { | 67 if (sort != null) { |
66 _queryParams["sort"] = [sort]; | 68 _queryParams["sort"] = [sort]; |
67 } | 69 } |
68 | 70 |
69 | 71 |
70 _url = 'webfonts'; | 72 _url = 'webfonts'; |
71 | 73 |
72 var _response = _requester.request(_url, | 74 var _response = _requester.request(_url, |
73 "GET", | 75 "GET", |
74 body: _body, | 76 body: _body, |
75 queryParams: _queryParams, | 77 queryParams: _queryParams, |
76 uploadOptions: _uploadOptions, | 78 uploadOptions: _uploadOptions, |
77 uploadMedia: _uploadMedia, | 79 uploadMedia: _uploadMedia, |
78 downloadOptions: _downloadOptions); | 80 downloadOptions: _downloadOptions); |
79 return _response.then((data) => new WebfontList.fromJson(data)); | 81 return _response.then((data) => new WebfontList.fromJson(data)); |
80 } | 82 } |
81 | 83 |
82 } | 84 } |
83 | 85 |
84 | 86 |
85 | 87 |
86 /** Not documented yet. */ | |
87 class Webfont { | 88 class Webfont { |
88 /** The category of the font. */ | 89 /** The category of the font. */ |
89 core.String category; | 90 core.String category; |
90 | 91 |
91 /** The name of the font. */ | 92 /** The name of the font. */ |
92 core.String family; | 93 core.String family; |
93 | 94 |
94 /** | 95 /** |
95 * The font files (with all supported scripts) for each one of the available | 96 * The font files (with all supported scripts) for each one of the available |
96 * variants, as a key : value map. | 97 * variants, as a key : value map. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 _json["variants"] = variants; | 169 _json["variants"] = variants; |
169 } | 170 } |
170 if (version != null) { | 171 if (version != null) { |
171 _json["version"] = version; | 172 _json["version"] = version; |
172 } | 173 } |
173 return _json; | 174 return _json; |
174 } | 175 } |
175 } | 176 } |
176 | 177 |
177 | 178 |
178 /** Not documented yet. */ | |
179 class WebfontList { | 179 class WebfontList { |
180 /** The list of fonts currently served by the Google Fonts API. */ | 180 /** The list of fonts currently served by the Google Fonts API. */ |
181 core.List<Webfont> items; | 181 core.List<Webfont> items; |
182 | 182 |
183 /** | 183 /** |
184 * This kind represents a list of webfont objects in the webfonts service. | 184 * This kind represents a list of webfont objects in the webfonts service. |
185 */ | 185 */ |
186 core.String kind; | 186 core.String kind; |
187 | 187 |
188 | 188 |
(...skipping 12 matching lines...) Expand all Loading... |
201 var _json = new core.Map(); | 201 var _json = new core.Map(); |
202 if (items != null) { | 202 if (items != null) { |
203 _json["items"] = items.map((value) => (value).toJson()).toList(); | 203 _json["items"] = items.map((value) => (value).toJson()).toList(); |
204 } | 204 } |
205 if (kind != null) { | 205 if (kind != null) { |
206 _json["kind"] = kind; | 206 _json["kind"] = kind; |
207 } | 207 } |
208 return _json; | 208 return _json; |
209 } | 209 } |
210 } | 210 } |
211 | |
212 | |
OLD | NEW |