| 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.drive.v2; | 3 library googleapis.drive.v2; |
| 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_1; | 7 import 'dart:convert' as convert_1; |
| 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:crypto/crypto.dart' as crypto; | |
| 11 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
| 12 | 11 |
| 13 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | 12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show |
| 14 ApiRequestError, DetailedApiRequestError, Media, UploadOptions, | 13 ApiRequestError, DetailedApiRequestError, Media, UploadOptions, |
| 15 ResumableUploadOptions, DownloadOptions, PartialDownloadOptions, | 14 ResumableUploadOptions, DownloadOptions, PartialDownloadOptions, |
| 16 ByteRange; | 15 ByteRange; |
| 17 | 16 |
| 18 const core.String USER_AGENT = 'dart-api-client drive/v2'; | 17 const core.String USER_AGENT = 'dart-api-client drive/v2'; |
| 19 | 18 |
| 20 /** | 19 /** |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2427 * Updates a permission using patch semantics. | 2426 * Updates a permission using patch semantics. |
| 2428 * | 2427 * |
| 2429 * [request] - The metadata request object. | 2428 * [request] - The metadata request object. |
| 2430 * | 2429 * |
| 2431 * Request parameters: | 2430 * Request parameters: |
| 2432 * | 2431 * |
| 2433 * [fileId] - The ID for the file. | 2432 * [fileId] - The ID for the file. |
| 2434 * | 2433 * |
| 2435 * [permissionId] - The ID for the permission. | 2434 * [permissionId] - The ID for the permission. |
| 2436 * | 2435 * |
| 2436 * [removeExpiration] - Whether to remove the expiration date. |
| 2437 * |
| 2437 * [transferOwnership] - Whether changing a role to 'owner' downgrades the | 2438 * [transferOwnership] - Whether changing a role to 'owner' downgrades the |
| 2438 * current owners to writers. Does nothing if the specified role is not | 2439 * current owners to writers. Does nothing if the specified role is not |
| 2439 * 'owner'. | 2440 * 'owner'. |
| 2440 * | 2441 * |
| 2441 * Completes with a [Permission]. | 2442 * Completes with a [Permission]. |
| 2442 * | 2443 * |
| 2443 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 2444 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 2444 * error. | 2445 * error. |
| 2445 * | 2446 * |
| 2446 * If the used [http.Client] completes with an error when making a REST call, | 2447 * If the used [http.Client] completes with an error when making a REST call, |
| 2447 * this method will complete with the same error. | 2448 * this method will complete with the same error. |
| 2448 */ | 2449 */ |
| 2449 async.Future<Permission> patch(Permission request, core.String fileId, core.St
ring permissionId, {core.bool transferOwnership}) { | 2450 async.Future<Permission> patch(Permission request, core.String fileId, core.St
ring permissionId, {core.bool removeExpiration, core.bool transferOwnership}) { |
| 2450 var _url = null; | 2451 var _url = null; |
| 2451 var _queryParams = new core.Map(); | 2452 var _queryParams = new core.Map(); |
| 2452 var _uploadMedia = null; | 2453 var _uploadMedia = null; |
| 2453 var _uploadOptions = null; | 2454 var _uploadOptions = null; |
| 2454 var _downloadOptions = commons.DownloadOptions.Metadata; | 2455 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 2455 var _body = null; | 2456 var _body = null; |
| 2456 | 2457 |
| 2457 if (request != null) { | 2458 if (request != null) { |
| 2458 _body = convert_1.JSON.encode((request).toJson()); | 2459 _body = convert_1.JSON.encode((request).toJson()); |
| 2459 } | 2460 } |
| 2460 if (fileId == null) { | 2461 if (fileId == null) { |
| 2461 throw new core.ArgumentError("Parameter fileId is required."); | 2462 throw new core.ArgumentError("Parameter fileId is required."); |
| 2462 } | 2463 } |
| 2463 if (permissionId == null) { | 2464 if (permissionId == null) { |
| 2464 throw new core.ArgumentError("Parameter permissionId is required."); | 2465 throw new core.ArgumentError("Parameter permissionId is required."); |
| 2465 } | 2466 } |
| 2467 if (removeExpiration != null) { |
| 2468 _queryParams["removeExpiration"] = ["${removeExpiration}"]; |
| 2469 } |
| 2466 if (transferOwnership != null) { | 2470 if (transferOwnership != null) { |
| 2467 _queryParams["transferOwnership"] = ["${transferOwnership}"]; | 2471 _queryParams["transferOwnership"] = ["${transferOwnership}"]; |
| 2468 } | 2472 } |
| 2469 | 2473 |
| 2470 _url = 'files/' + commons.Escaper.ecapeVariable('$fileId') + '/permissions/'
+ commons.Escaper.ecapeVariable('$permissionId'); | 2474 _url = 'files/' + commons.Escaper.ecapeVariable('$fileId') + '/permissions/'
+ commons.Escaper.ecapeVariable('$permissionId'); |
| 2471 | 2475 |
| 2472 var _response = _requester.request(_url, | 2476 var _response = _requester.request(_url, |
| 2473 "PATCH", | 2477 "PATCH", |
| 2474 body: _body, | 2478 body: _body, |
| 2475 queryParams: _queryParams, | 2479 queryParams: _queryParams, |
| 2476 uploadOptions: _uploadOptions, | 2480 uploadOptions: _uploadOptions, |
| 2477 uploadMedia: _uploadMedia, | 2481 uploadMedia: _uploadMedia, |
| 2478 downloadOptions: _downloadOptions); | 2482 downloadOptions: _downloadOptions); |
| 2479 return _response.then((data) => new Permission.fromJson(data)); | 2483 return _response.then((data) => new Permission.fromJson(data)); |
| 2480 } | 2484 } |
| 2481 | 2485 |
| 2482 /** | 2486 /** |
| 2483 * Updates a permission. | 2487 * Updates a permission. |
| 2484 * | 2488 * |
| 2485 * [request] - The metadata request object. | 2489 * [request] - The metadata request object. |
| 2486 * | 2490 * |
| 2487 * Request parameters: | 2491 * Request parameters: |
| 2488 * | 2492 * |
| 2489 * [fileId] - The ID for the file. | 2493 * [fileId] - The ID for the file. |
| 2490 * | 2494 * |
| 2491 * [permissionId] - The ID for the permission. | 2495 * [permissionId] - The ID for the permission. |
| 2492 * | 2496 * |
| 2497 * [removeExpiration] - Whether to remove the expiration date. |
| 2498 * |
| 2493 * [transferOwnership] - Whether changing a role to 'owner' downgrades the | 2499 * [transferOwnership] - Whether changing a role to 'owner' downgrades the |
| 2494 * current owners to writers. Does nothing if the specified role is not | 2500 * current owners to writers. Does nothing if the specified role is not |
| 2495 * 'owner'. | 2501 * 'owner'. |
| 2496 * | 2502 * |
| 2497 * Completes with a [Permission]. | 2503 * Completes with a [Permission]. |
| 2498 * | 2504 * |
| 2499 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | 2505 * Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| 2500 * error. | 2506 * error. |
| 2501 * | 2507 * |
| 2502 * If the used [http.Client] completes with an error when making a REST call, | 2508 * If the used [http.Client] completes with an error when making a REST call, |
| 2503 * this method will complete with the same error. | 2509 * this method will complete with the same error. |
| 2504 */ | 2510 */ |
| 2505 async.Future<Permission> update(Permission request, core.String fileId, core.S
tring permissionId, {core.bool transferOwnership}) { | 2511 async.Future<Permission> update(Permission request, core.String fileId, core.S
tring permissionId, {core.bool removeExpiration, core.bool transferOwnership}) { |
| 2506 var _url = null; | 2512 var _url = null; |
| 2507 var _queryParams = new core.Map(); | 2513 var _queryParams = new core.Map(); |
| 2508 var _uploadMedia = null; | 2514 var _uploadMedia = null; |
| 2509 var _uploadOptions = null; | 2515 var _uploadOptions = null; |
| 2510 var _downloadOptions = commons.DownloadOptions.Metadata; | 2516 var _downloadOptions = commons.DownloadOptions.Metadata; |
| 2511 var _body = null; | 2517 var _body = null; |
| 2512 | 2518 |
| 2513 if (request != null) { | 2519 if (request != null) { |
| 2514 _body = convert_1.JSON.encode((request).toJson()); | 2520 _body = convert_1.JSON.encode((request).toJson()); |
| 2515 } | 2521 } |
| 2516 if (fileId == null) { | 2522 if (fileId == null) { |
| 2517 throw new core.ArgumentError("Parameter fileId is required."); | 2523 throw new core.ArgumentError("Parameter fileId is required."); |
| 2518 } | 2524 } |
| 2519 if (permissionId == null) { | 2525 if (permissionId == null) { |
| 2520 throw new core.ArgumentError("Parameter permissionId is required."); | 2526 throw new core.ArgumentError("Parameter permissionId is required."); |
| 2521 } | 2527 } |
| 2528 if (removeExpiration != null) { |
| 2529 _queryParams["removeExpiration"] = ["${removeExpiration}"]; |
| 2530 } |
| 2522 if (transferOwnership != null) { | 2531 if (transferOwnership != null) { |
| 2523 _queryParams["transferOwnership"] = ["${transferOwnership}"]; | 2532 _queryParams["transferOwnership"] = ["${transferOwnership}"]; |
| 2524 } | 2533 } |
| 2525 | 2534 |
| 2526 _url = 'files/' + commons.Escaper.ecapeVariable('$fileId') + '/permissions/'
+ commons.Escaper.ecapeVariable('$permissionId'); | 2535 _url = 'files/' + commons.Escaper.ecapeVariable('$fileId') + '/permissions/'
+ commons.Escaper.ecapeVariable('$permissionId'); |
| 2527 | 2536 |
| 2528 var _response = _requester.request(_url, | 2537 var _response = _requester.request(_url, |
| 2529 "PUT", | 2538 "PUT", |
| 2530 body: _body, | 2539 body: _body, |
| 2531 queryParams: _queryParams, | 2540 queryParams: _queryParams, |
| (...skipping 2832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5364 * Thumbnail for the file. Only accepted on upload and for files that are not | 5373 * Thumbnail for the file. Only accepted on upload and for files that are not |
| 5365 * already thumbnailed by Google. | 5374 * already thumbnailed by Google. |
| 5366 */ | 5375 */ |
| 5367 class FileThumbnail { | 5376 class FileThumbnail { |
| 5368 /** | 5377 /** |
| 5369 * The URL-safe Base64 encoded bytes of the thumbnail image. It should conform | 5378 * The URL-safe Base64 encoded bytes of the thumbnail image. It should conform |
| 5370 * to RFC 4648 section 5. | 5379 * to RFC 4648 section 5. |
| 5371 */ | 5380 */ |
| 5372 core.String image; | 5381 core.String image; |
| 5373 core.List<core.int> get imageAsBytes { | 5382 core.List<core.int> get imageAsBytes { |
| 5374 return crypto.CryptoUtils.base64StringToBytes(image); | 5383 return convert_1.BASE64.decode(image); |
| 5375 } | 5384 } |
| 5376 | 5385 |
| 5377 void set imageAsBytes(core.List<core.int> _bytes) { | 5386 void set imageAsBytes(core.List<core.int> _bytes) { |
| 5378 image = crypto.CryptoUtils.bytesToBase64(_bytes, urlSafe: true); | 5387 image = convert_1.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+",
"-"); |
| 5379 } | 5388 } |
| 5380 /** The MIME type of the thumbnail. */ | 5389 /** The MIME type of the thumbnail. */ |
| 5381 core.String mimeType; | 5390 core.String mimeType; |
| 5382 | 5391 |
| 5383 FileThumbnail(); | 5392 FileThumbnail(); |
| 5384 | 5393 |
| 5385 FileThumbnail.fromJson(core.Map _json) { | 5394 FileThumbnail.fromJson(core.Map _json) { |
| 5386 if (_json.containsKey("image")) { | 5395 if (_json.containsKey("image")) { |
| 5387 image = _json["image"]; | 5396 image = _json["image"]; |
| 5388 } | 5397 } |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6222 */ | 6231 */ |
| 6223 core.String domain; | 6232 core.String domain; |
| 6224 /** | 6233 /** |
| 6225 * The email address of the user or group this permission refers to. This is | 6234 * The email address of the user or group this permission refers to. This is |
| 6226 * an output-only field which is present when the permission type is user or | 6235 * an output-only field which is present when the permission type is user or |
| 6227 * group. | 6236 * group. |
| 6228 */ | 6237 */ |
| 6229 core.String emailAddress; | 6238 core.String emailAddress; |
| 6230 /** The ETag of the permission. */ | 6239 /** The ETag of the permission. */ |
| 6231 core.String etag; | 6240 core.String etag; |
| 6241 /** The time at which this permission will expire (RFC 3339 date-time). */ |
| 6242 core.DateTime expirationDate; |
| 6232 /** | 6243 /** |
| 6233 * The ID of the user this permission refers to, and identical to the | 6244 * The ID of the user this permission refers to, and identical to the |
| 6234 * permissionId in the About and Files resources. When making a | 6245 * permissionId in the About and Files resources. When making a |
| 6235 * drive.permissions.insert request, exactly one of the id or value fields | 6246 * drive.permissions.insert request, exactly one of the id or value fields |
| 6236 * must be specified. | 6247 * must be specified. |
| 6237 */ | 6248 */ |
| 6238 core.String id; | 6249 core.String id; |
| 6239 /** This is always drive#permission. */ | 6250 /** This is always drive#permission. */ |
| 6240 core.String kind; | 6251 core.String kind; |
| 6241 /** The name for this permission. */ | 6252 /** The name for this permission. */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6280 } | 6291 } |
| 6281 if (_json.containsKey("domain")) { | 6292 if (_json.containsKey("domain")) { |
| 6282 domain = _json["domain"]; | 6293 domain = _json["domain"]; |
| 6283 } | 6294 } |
| 6284 if (_json.containsKey("emailAddress")) { | 6295 if (_json.containsKey("emailAddress")) { |
| 6285 emailAddress = _json["emailAddress"]; | 6296 emailAddress = _json["emailAddress"]; |
| 6286 } | 6297 } |
| 6287 if (_json.containsKey("etag")) { | 6298 if (_json.containsKey("etag")) { |
| 6288 etag = _json["etag"]; | 6299 etag = _json["etag"]; |
| 6289 } | 6300 } |
| 6301 if (_json.containsKey("expirationDate")) { |
| 6302 expirationDate = core.DateTime.parse(_json["expirationDate"]); |
| 6303 } |
| 6290 if (_json.containsKey("id")) { | 6304 if (_json.containsKey("id")) { |
| 6291 id = _json["id"]; | 6305 id = _json["id"]; |
| 6292 } | 6306 } |
| 6293 if (_json.containsKey("kind")) { | 6307 if (_json.containsKey("kind")) { |
| 6294 kind = _json["kind"]; | 6308 kind = _json["kind"]; |
| 6295 } | 6309 } |
| 6296 if (_json.containsKey("name")) { | 6310 if (_json.containsKey("name")) { |
| 6297 name = _json["name"]; | 6311 name = _json["name"]; |
| 6298 } | 6312 } |
| 6299 if (_json.containsKey("photoLink")) { | 6313 if (_json.containsKey("photoLink")) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6326 } | 6340 } |
| 6327 if (domain != null) { | 6341 if (domain != null) { |
| 6328 _json["domain"] = domain; | 6342 _json["domain"] = domain; |
| 6329 } | 6343 } |
| 6330 if (emailAddress != null) { | 6344 if (emailAddress != null) { |
| 6331 _json["emailAddress"] = emailAddress; | 6345 _json["emailAddress"] = emailAddress; |
| 6332 } | 6346 } |
| 6333 if (etag != null) { | 6347 if (etag != null) { |
| 6334 _json["etag"] = etag; | 6348 _json["etag"] = etag; |
| 6335 } | 6349 } |
| 6350 if (expirationDate != null) { |
| 6351 _json["expirationDate"] = (expirationDate).toIso8601String(); |
| 6352 } |
| 6336 if (id != null) { | 6353 if (id != null) { |
| 6337 _json["id"] = id; | 6354 _json["id"] = id; |
| 6338 } | 6355 } |
| 6339 if (kind != null) { | 6356 if (kind != null) { |
| 6340 _json["kind"] = kind; | 6357 _json["kind"] = kind; |
| 6341 } | 6358 } |
| 6342 if (name != null) { | 6359 if (name != null) { |
| 6343 _json["name"] = name; | 6360 _json["name"] = name; |
| 6344 } | 6361 } |
| 6345 if (photoLink != null) { | 6362 if (photoLink != null) { |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6870 } | 6887 } |
| 6871 if (permissionId != null) { | 6888 if (permissionId != null) { |
| 6872 _json["permissionId"] = permissionId; | 6889 _json["permissionId"] = permissionId; |
| 6873 } | 6890 } |
| 6874 if (picture != null) { | 6891 if (picture != null) { |
| 6875 _json["picture"] = (picture).toJson(); | 6892 _json["picture"] = (picture).toJson(); |
| 6876 } | 6893 } |
| 6877 return _json; | 6894 return _json; |
| 6878 } | 6895 } |
| 6879 } | 6896 } |
| OLD | NEW |