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

Side by Side Diff: generated/googleapis/lib/oauth2/v2.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.oauth2.v2;
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 /** Lets you access OAuth2 protocol related APIs. */
17 class Oauth2Api {
18 /** Know your basic profile info and list of people in your circles. */
19 static const PlusLoginScope = "https://www.googleapis.com/auth/plus.login";
20
21 /** Know who you are on Google */
22 static const PlusMeScope = "https://www.googleapis.com/auth/plus.me";
23
24 /** View your email address */
25 static const UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.em ail";
26
27 /** View your basic profile info */
28 static const UserinfoProfileScope = "https://www.googleapis.com/auth/userinfo. profile";
29
30
31 final common_internal.ApiRequester _requester;
32
33 UserinfoResourceApi get userinfo => new UserinfoResourceApi(_requester);
34
35 Oauth2Api(http.Client client) :
36 _requester = new common_internal.ApiRequester(client, "https://www.googlea pis.com/", "/");
37
38 /**
39 * Not documented yet.
40 *
41 * Request parameters:
42 *
43 * [accessToken] - null
44 *
45 * [idToken] - null
46 *
47 * Completes with a [Tokeninfo].
48 *
49 * Completes with a [common.ApiRequestError] if the API endpoint returned an
50 * error.
51 *
52 * If the used [http.Client] completes with an error when making a REST call,
53 * this method will complete with the same error.
54 */
55 async.Future<Tokeninfo> tokeninfo({core.String accessToken, core.String idToke n}) {
56 var _url = null;
57 var _queryParams = new core.Map();
58 var _uploadMedia = null;
59 var _uploadOptions = null;
60 var _downloadOptions = common.DownloadOptions.Metadata;
61 var _body = null;
62
63 if (accessToken != null) {
64 _queryParams["access_token"] = [accessToken];
65 }
66 if (idToken != null) {
67 _queryParams["id_token"] = [idToken];
68 }
69
70
71 _url = 'oauth2/v2/tokeninfo';
72
73 var _response = _requester.request(_url,
74 "POST",
75 body: _body,
76 queryParams: _queryParams,
77 uploadOptions: _uploadOptions,
78 uploadMedia: _uploadMedia,
79 downloadOptions: _downloadOptions);
80 return _response.then((data) => new Tokeninfo.fromJson(data));
81 }
82
83 }
84
85
86 /** Not documented yet. */
87 class UserinfoResourceApi {
88 final common_internal.ApiRequester _requester;
89
90 UserinfoV2ResourceApi get v2 => new UserinfoV2ResourceApi(_requester);
91
92 UserinfoResourceApi(common_internal.ApiRequester client) :
93 _requester = client;
94
95 /**
96 * Not documented yet.
97 *
98 * Request parameters:
99 *
100 * Completes with a [Userinfoplus].
101 *
102 * Completes with a [common.ApiRequestError] if the API endpoint returned an
103 * error.
104 *
105 * If the used [http.Client] completes with an error when making a REST call,
106 * this method will complete with the same error.
107 */
108 async.Future<Userinfoplus> get() {
109 var _url = null;
110 var _queryParams = new core.Map();
111 var _uploadMedia = null;
112 var _uploadOptions = null;
113 var _downloadOptions = common.DownloadOptions.Metadata;
114 var _body = null;
115
116
117
118 _url = 'oauth2/v2/userinfo';
119
120 var _response = _requester.request(_url,
121 "GET",
122 body: _body,
123 queryParams: _queryParams,
124 uploadOptions: _uploadOptions,
125 uploadMedia: _uploadMedia,
126 downloadOptions: _downloadOptions);
127 return _response.then((data) => new Userinfoplus.fromJson(data));
128 }
129
130 }
131
132
133 /** Not documented yet. */
134 class UserinfoV2ResourceApi {
135 final common_internal.ApiRequester _requester;
136
137 UserinfoV2MeResourceApi get me => new UserinfoV2MeResourceApi(_requester);
138
139 UserinfoV2ResourceApi(common_internal.ApiRequester client) :
140 _requester = client;
141 }
142
143
144 /** Not documented yet. */
145 class UserinfoV2MeResourceApi {
146 final common_internal.ApiRequester _requester;
147
148 UserinfoV2MeResourceApi(common_internal.ApiRequester client) :
149 _requester = client;
150
151 /**
152 * Not documented yet.
153 *
154 * Request parameters:
155 *
156 * Completes with a [Userinfoplus].
157 *
158 * Completes with a [common.ApiRequestError] if the API endpoint returned an
159 * error.
160 *
161 * If the used [http.Client] completes with an error when making a REST call,
162 * this method will complete with the same error.
163 */
164 async.Future<Userinfoplus> get() {
165 var _url = null;
166 var _queryParams = new core.Map();
167 var _uploadMedia = null;
168 var _uploadOptions = null;
169 var _downloadOptions = common.DownloadOptions.Metadata;
170 var _body = null;
171
172
173
174 _url = 'userinfo/v2/me';
175
176 var _response = _requester.request(_url,
177 "GET",
178 body: _body,
179 queryParams: _queryParams,
180 uploadOptions: _uploadOptions,
181 uploadMedia: _uploadMedia,
182 downloadOptions: _downloadOptions);
183 return _response.then((data) => new Userinfoplus.fromJson(data));
184 }
185
186 }
187
188
189
190 /** Not documented yet. */
191 class Tokeninfo {
192 /** The access type granted with this token. It can be offline or online. */
193 core.String accessType;
194
195 /**
196 * Who is the intended audience for this token. In general the same as
197 * issued_to.
198 */
199 core.String audience;
200
201 /**
202 * The email address of the user. Present only if the email scope is present
203 * in the request.
204 */
205 core.String email;
206
207 /** The expiry time of the token, as number of seconds left until expiry. */
208 core.int expiresIn;
209
210 /** To whom was the token issued to. In general the same as audience. */
211 core.String issuedTo;
212
213 /** The space separated list of scopes granted to this token. */
214 core.String scope;
215
216 /** The Gaia obfuscated user id. */
217 core.String userId;
218
219 /**
220 * Boolean flag which is true if the email address is verified. Present only
221 * if the email scope is present in the request.
222 */
223 core.bool verifiedEmail;
224
225
226 Tokeninfo();
227
228 Tokeninfo.fromJson(core.Map _json) {
229 if (_json.containsKey("access_type")) {
230 accessType = _json["access_type"];
231 }
232 if (_json.containsKey("audience")) {
233 audience = _json["audience"];
234 }
235 if (_json.containsKey("email")) {
236 email = _json["email"];
237 }
238 if (_json.containsKey("expires_in")) {
239 expiresIn = _json["expires_in"];
240 }
241 if (_json.containsKey("issued_to")) {
242 issuedTo = _json["issued_to"];
243 }
244 if (_json.containsKey("scope")) {
245 scope = _json["scope"];
246 }
247 if (_json.containsKey("user_id")) {
248 userId = _json["user_id"];
249 }
250 if (_json.containsKey("verified_email")) {
251 verifiedEmail = _json["verified_email"];
252 }
253 }
254
255 core.Map toJson() {
256 var _json = new core.Map();
257 if (accessType != null) {
258 _json["access_type"] = accessType;
259 }
260 if (audience != null) {
261 _json["audience"] = audience;
262 }
263 if (email != null) {
264 _json["email"] = email;
265 }
266 if (expiresIn != null) {
267 _json["expires_in"] = expiresIn;
268 }
269 if (issuedTo != null) {
270 _json["issued_to"] = issuedTo;
271 }
272 if (scope != null) {
273 _json["scope"] = scope;
274 }
275 if (userId != null) {
276 _json["user_id"] = userId;
277 }
278 if (verifiedEmail != null) {
279 _json["verified_email"] = verifiedEmail;
280 }
281 return _json;
282 }
283 }
284
285
286 /** Not documented yet. */
287 class Userinfoplus {
288 /** The user's email address. */
289 core.String email;
290
291 /** The user's last name. */
292 core.String familyName;
293
294 /** The user's gender. */
295 core.String gender;
296
297 /** The user's first name. */
298 core.String givenName;
299
300 /** The hosted domain e.g. example.com if the user is Google apps user. */
301 core.String hd;
302
303 /** The focus obfuscated gaia id of the user. */
304 core.String id;
305
306 /** URL of the profile page. */
307 core.String link;
308
309 /** The user's preferred locale. */
310 core.String locale;
311
312 /** The user's full name. */
313 core.String name;
314
315 /** URL of the user's picture image. */
316 core.String picture;
317
318 /**
319 * Boolean flag which is true if the email address is verified. Always
320 * verified because we only return the user's primary email address.
321 */
322 core.bool verifiedEmail;
323
324
325 Userinfoplus();
326
327 Userinfoplus.fromJson(core.Map _json) {
328 if (_json.containsKey("email")) {
329 email = _json["email"];
330 }
331 if (_json.containsKey("family_name")) {
332 familyName = _json["family_name"];
333 }
334 if (_json.containsKey("gender")) {
335 gender = _json["gender"];
336 }
337 if (_json.containsKey("given_name")) {
338 givenName = _json["given_name"];
339 }
340 if (_json.containsKey("hd")) {
341 hd = _json["hd"];
342 }
343 if (_json.containsKey("id")) {
344 id = _json["id"];
345 }
346 if (_json.containsKey("link")) {
347 link = _json["link"];
348 }
349 if (_json.containsKey("locale")) {
350 locale = _json["locale"];
351 }
352 if (_json.containsKey("name")) {
353 name = _json["name"];
354 }
355 if (_json.containsKey("picture")) {
356 picture = _json["picture"];
357 }
358 if (_json.containsKey("verified_email")) {
359 verifiedEmail = _json["verified_email"];
360 }
361 }
362
363 core.Map toJson() {
364 var _json = new core.Map();
365 if (email != null) {
366 _json["email"] = email;
367 }
368 if (familyName != null) {
369 _json["family_name"] = familyName;
370 }
371 if (gender != null) {
372 _json["gender"] = gender;
373 }
374 if (givenName != null) {
375 _json["given_name"] = givenName;
376 }
377 if (hd != null) {
378 _json["hd"] = hd;
379 }
380 if (id != null) {
381 _json["id"] = id;
382 }
383 if (link != null) {
384 _json["link"] = link;
385 }
386 if (locale != null) {
387 _json["locale"] = locale;
388 }
389 if (name != null) {
390 _json["name"] = name;
391 }
392 if (picture != null) {
393 _json["picture"] = picture;
394 }
395 if (verifiedEmail != null) {
396 _json["verified_email"] = verifiedEmail;
397 }
398 return _json;
399 }
400 }
401
402
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698