Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: generated/googleapis/lib/webfonts/v1.dart

Issue 559053002: Generate 0.1.0 version of googleapis/googleapis_beta (Closed) Base URL: git@github.com:dart-lang/googleapis.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library googleapis.webfonts.v1;
2
3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async;
6 import "dart:convert" as convert;
7
8 import "package:crypto/crypto.dart" as crypto;
9 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 export '../common/common.dart' show ApiRequestError;
14 export '../common/common.dart' show DetailedApiRequestError;
15
16 /** The Google Fonts Developer API. */
17 class WebfontsApi {
18
19 final common_internal.ApiRequester _requester;
20
21 WebfontsResourceApi get webfonts => new WebfontsResourceApi(_requester);
22
23 WebfontsApi(http.Client client) :
24 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "/webfonts/v1/");
25 }
26
27
28 /** Not documented yet. */
29 class WebfontsResourceApi {
30 final common_internal.ApiRequester _requester;
31
32 WebfontsResourceApi(common_internal.ApiRequester client) :
33 _requester = client;
34
35 /**
36 * Retrieves the list of fonts currently served by the Google Fonts Developer
37 * API
38 *
39 * Request parameters:
40 *
41 * [sort] - Enables sorting of the list
42 * Possible string values are:
43 * - "alpha" : Sort alphabetically
44 * - "date" : Sort by date added
45 * - "popularity" : Sort by popularity
46 * - "style" : Sort by number of styles
47 * - "trending" : Sort by trending
48 *
49 * Completes with a [WebfontList].
50 *
51 * Completes with a [common.ApiRequestError] if the API endpoint returned an
52 * error.
53 *
54 * If the used [http.Client] completes with an error when making a REST call,
55 * this method will complete with the same error.
56 */
57 async.Future<WebfontList> list({core.String sort}) {
58 var _url = null;
59 var _queryParams = new core.Map();
60 var _uploadMedia = null;
61 var _uploadOptions = null;
62 var _downloadOptions = common.DownloadOptions.Metadata;
63 var _body = null;
64
65 if (sort != null) {
66 _queryParams["sort"] = [sort];
67 }
68
69
70 _url = 'webfonts';
71
72 var _response = _requester.request(_url,
73 "GET",
74 body: _body,
75 queryParams: _queryParams,
76 uploadOptions: _uploadOptions,
77 uploadMedia: _uploadMedia,
78 downloadOptions: _downloadOptions);
79 return _response.then((data) => new WebfontList.fromJson(data));
80 }
81
82 }
83
84
85
86 /** Not documented yet. */
87 class Webfont {
88 /** The category of the font. */
89 core.String category;
90
91 /** The name of the font. */
92 core.String family;
93
94 /**
95 * The font files (with all supported scripts) for each one of the available
96 * variants, as a key : value map.
97 */
98 core.Map<core.String, core.String> files;
99
100 /** This kind represents a webfont object in the webfonts service. */
101 core.String kind;
102
103 /**
104 * The date (format "yyyy-MM-dd") the font was modified for the last time.
105 */
106 core.DateTime lastModified;
107
108 /** The scripts supported by the font. */
109 core.List<core.String> subsets;
110
111 /** The available variants for the font. */
112 core.List<core.String> variants;
113
114 /** The font version. */
115 core.String version;
116
117
118 Webfont();
119
120 Webfont.fromJson(core.Map _json) {
121 if (_json.containsKey("category")) {
122 category = _json["category"];
123 }
124 if (_json.containsKey("family")) {
125 family = _json["family"];
126 }
127 if (_json.containsKey("files")) {
128 files = _json["files"];
129 }
130 if (_json.containsKey("kind")) {
131 kind = _json["kind"];
132 }
133 if (_json.containsKey("lastModified")) {
134 lastModified = core.DateTime.parse(_json["lastModified"]);
135 }
136 if (_json.containsKey("subsets")) {
137 subsets = _json["subsets"];
138 }
139 if (_json.containsKey("variants")) {
140 variants = _json["variants"];
141 }
142 if (_json.containsKey("version")) {
143 version = _json["version"];
144 }
145 }
146
147 core.Map toJson() {
148 var _json = new core.Map();
149 if (category != null) {
150 _json["category"] = category;
151 }
152 if (family != null) {
153 _json["family"] = family;
154 }
155 if (files != null) {
156 _json["files"] = files;
157 }
158 if (kind != null) {
159 _json["kind"] = kind;
160 }
161 if (lastModified != null) {
162 _json["lastModified"] = "${(lastModified).year.toString().padLeft(4, '0')} -${(lastModified).month.toString().padLeft(2, '0')}-${(lastModified).day.toStrin g().padLeft(2, '0')}";
163 }
164 if (subsets != null) {
165 _json["subsets"] = subsets;
166 }
167 if (variants != null) {
168 _json["variants"] = variants;
169 }
170 if (version != null) {
171 _json["version"] = version;
172 }
173 return _json;
174 }
175 }
176
177
178 /** Not documented yet. */
179 class WebfontList {
180 /** The list of fonts currently served by the Google Fonts API. */
181 core.List<Webfont> items;
182
183 /**
184 * This kind represents a list of webfont objects in the webfonts service.
185 */
186 core.String kind;
187
188
189 WebfontList();
190
191 WebfontList.fromJson(core.Map _json) {
192 if (_json.containsKey("items")) {
193 items = _json["items"].map((value) => new Webfont.fromJson(value)).toList( );
194 }
195 if (_json.containsKey("kind")) {
196 kind = _json["kind"];
197 }
198 }
199
200 core.Map toJson() {
201 var _json = new core.Map();
202 if (items != null) {
203 _json["items"] = items.map((value) => (value).toJson()).toList();
204 }
205 if (kind != null) {
206 _json["kind"] = kind;
207 }
208 return _json;
209 }
210 }
211
212
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698