OLD | NEW |
1 library googleapis.drive.v2; | 1 library googleapis.drive.v2; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert_1; | 6 import "dart:convert" as convert_1; |
7 | 7 |
8 import "package:crypto/crypto.dart" as crypto; | 8 import "package:crypto/crypto.dart" as crypto; |
9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
10 import '../src/common_internal.dart' as common_internal; | 10 import '../src/common_internal.dart' as common_internal; |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 return _response.then((data) => null); | 1148 return _response.then((data) => null); |
1149 } | 1149 } |
1150 | 1150 |
1151 /** | 1151 /** |
1152 * Gets a file's metadata by ID. | 1152 * Gets a file's metadata by ID. |
1153 * | 1153 * |
1154 * Request parameters: | 1154 * Request parameters: |
1155 * | 1155 * |
1156 * [fileId] - The ID for the file in question. | 1156 * [fileId] - The ID for the file in question. |
1157 * | 1157 * |
| 1158 * [acknowledgeAbuse] - Whether the user is acknowledging the risk of |
| 1159 * downloading known malware or other abusive files. |
| 1160 * |
1158 * [projection] - This parameter is deprecated and has no function. | 1161 * [projection] - This parameter is deprecated and has no function. |
1159 * Possible string values are: | 1162 * Possible string values are: |
1160 * - "BASIC" : Deprecated | 1163 * - "BASIC" : Deprecated |
1161 * - "FULL" : Deprecated | 1164 * - "FULL" : Deprecated |
1162 * | 1165 * |
1163 * [updateViewedDate] - Whether to update the view date after successfully | 1166 * [updateViewedDate] - Whether to update the view date after successfully |
1164 * retrieving the file. | 1167 * retrieving the file. |
1165 * | 1168 * |
1166 * Completes with a [File]. | 1169 * [downloadOptions] - Options for downloading. A download can be either a |
| 1170 * Metadata (default) or Media download. Partial Media downloads are possible |
| 1171 * as well. |
| 1172 * |
| 1173 * Completes with a |
| 1174 * |
| 1175 * - [File] for Metadata downloads (see [downloadOptions]). |
| 1176 * |
| 1177 * - [common.Media] for Media downloads (see [downloadOptions]). |
1167 * | 1178 * |
1168 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 1179 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
1169 * error. | 1180 * error. |
1170 * | 1181 * |
1171 * If the used [http.Client] completes with an error when making a REST call, | 1182 * If the used [http.Client] completes with an error when making a REST call, |
1172 * this method will complete with the same error. | 1183 * this method will complete with the same error. |
1173 */ | 1184 */ |
1174 async.Future<File> get(core.String fileId, {core.String projection, core.bool
updateViewedDate}) { | 1185 async.Future get(core.String fileId, {core.bool acknowledgeAbuse, core.String
projection, core.bool updateViewedDate, common.DownloadOptions downloadOptions:
common.DownloadOptions.Metadata}) { |
1175 var _url = null; | 1186 var _url = null; |
1176 var _queryParams = new core.Map(); | 1187 var _queryParams = new core.Map(); |
1177 var _uploadMedia = null; | 1188 var _uploadMedia = null; |
1178 var _uploadOptions = null; | 1189 var _uploadOptions = null; |
1179 var _downloadOptions = common.DownloadOptions.Metadata; | 1190 var _downloadOptions = common.DownloadOptions.Metadata; |
1180 var _body = null; | 1191 var _body = null; |
1181 | 1192 |
1182 if (fileId == null) { | 1193 if (fileId == null) { |
1183 throw new core.ArgumentError("Parameter fileId is required."); | 1194 throw new core.ArgumentError("Parameter fileId is required."); |
1184 } | 1195 } |
| 1196 if (acknowledgeAbuse != null) { |
| 1197 _queryParams["acknowledgeAbuse"] = ["${acknowledgeAbuse}"]; |
| 1198 } |
1185 if (projection != null) { | 1199 if (projection != null) { |
1186 _queryParams["projection"] = [projection]; | 1200 _queryParams["projection"] = [projection]; |
1187 } | 1201 } |
1188 if (updateViewedDate != null) { | 1202 if (updateViewedDate != null) { |
1189 _queryParams["updateViewedDate"] = ["${updateViewedDate}"]; | 1203 _queryParams["updateViewedDate"] = ["${updateViewedDate}"]; |
1190 } | 1204 } |
1191 | 1205 |
| 1206 _downloadOptions = downloadOptions; |
1192 | 1207 |
1193 _url = 'files/' + common_internal.Escaper.ecapeVariable('$fileId'); | 1208 _url = 'files/' + common_internal.Escaper.ecapeVariable('$fileId'); |
1194 | 1209 |
1195 var _response = _requester.request(_url, | 1210 var _response = _requester.request(_url, |
1196 "GET", | 1211 "GET", |
1197 body: _body, | 1212 body: _body, |
1198 queryParams: _queryParams, | 1213 queryParams: _queryParams, |
1199 uploadOptions: _uploadOptions, | 1214 uploadOptions: _uploadOptions, |
1200 uploadMedia: _uploadMedia, | 1215 uploadMedia: _uploadMedia, |
1201 downloadOptions: _downloadOptions); | 1216 downloadOptions: _downloadOptions); |
1202 return _response.then((data) => new File.fromJson(data)); | 1217 if (_downloadOptions == null || |
| 1218 _downloadOptions == common.DownloadOptions.Metadata) { |
| 1219 return _response.then((data) => new File.fromJson(data)); |
| 1220 } else { |
| 1221 return _response; |
| 1222 } |
1203 } | 1223 } |
1204 | 1224 |
1205 /** | 1225 /** |
1206 * Insert a new file. | 1226 * Insert a new file. |
1207 * | 1227 * |
1208 * [request] - The metadata request object. | 1228 * [request] - The metadata request object. |
1209 * | 1229 * |
1210 * Request parameters: | 1230 * Request parameters: |
1211 * | 1231 * |
1212 * [convert] - Whether to convert this file to the corresponding Google Docs | 1232 * [convert] - Whether to convert this file to the corresponding Google Docs |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 | 1752 |
1733 /** | 1753 /** |
1734 * Subscribe to changes on a file | 1754 * Subscribe to changes on a file |
1735 * | 1755 * |
1736 * [request] - The metadata request object. | 1756 * [request] - The metadata request object. |
1737 * | 1757 * |
1738 * Request parameters: | 1758 * Request parameters: |
1739 * | 1759 * |
1740 * [fileId] - The ID for the file in question. | 1760 * [fileId] - The ID for the file in question. |
1741 * | 1761 * |
| 1762 * [acknowledgeAbuse] - Whether the user is acknowledging the risk of |
| 1763 * downloading known malware or other abusive files. |
| 1764 * |
1742 * [projection] - This parameter is deprecated and has no function. | 1765 * [projection] - This parameter is deprecated and has no function. |
1743 * Possible string values are: | 1766 * Possible string values are: |
1744 * - "BASIC" : Deprecated | 1767 * - "BASIC" : Deprecated |
1745 * - "FULL" : Deprecated | 1768 * - "FULL" : Deprecated |
1746 * | 1769 * |
1747 * [updateViewedDate] - Whether to update the view date after successfully | 1770 * [updateViewedDate] - Whether to update the view date after successfully |
1748 * retrieving the file. | 1771 * retrieving the file. |
1749 * | 1772 * |
1750 * Completes with a [Channel]. | 1773 * [downloadOptions] - Options for downloading. A download can be either a |
| 1774 * Metadata (default) or Media download. Partial Media downloads are possible |
| 1775 * as well. |
| 1776 * |
| 1777 * Completes with a |
| 1778 * |
| 1779 * - [Channel] for Metadata downloads (see [downloadOptions]). |
| 1780 * |
| 1781 * - [common.Media] for Media downloads (see [downloadOptions]). |
1751 * | 1782 * |
1752 * Completes with a [common.ApiRequestError] if the API endpoint returned an | 1783 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
1753 * error. | 1784 * error. |
1754 * | 1785 * |
1755 * If the used [http.Client] completes with an error when making a REST call, | 1786 * If the used [http.Client] completes with an error when making a REST call, |
1756 * this method will complete with the same error. | 1787 * this method will complete with the same error. |
1757 */ | 1788 */ |
1758 async.Future<Channel> watch(Channel request, core.String fileId, {core.String
projection, core.bool updateViewedDate}) { | 1789 async.Future watch(Channel request, core.String fileId, {core.bool acknowledge
Abuse, core.String projection, core.bool updateViewedDate, common.DownloadOption
s downloadOptions: common.DownloadOptions.Metadata}) { |
1759 var _url = null; | 1790 var _url = null; |
1760 var _queryParams = new core.Map(); | 1791 var _queryParams = new core.Map(); |
1761 var _uploadMedia = null; | 1792 var _uploadMedia = null; |
1762 var _uploadOptions = null; | 1793 var _uploadOptions = null; |
1763 var _downloadOptions = common.DownloadOptions.Metadata; | 1794 var _downloadOptions = common.DownloadOptions.Metadata; |
1764 var _body = null; | 1795 var _body = null; |
1765 | 1796 |
1766 if (request != null) { | 1797 if (request != null) { |
1767 _body = convert_1.JSON.encode((request).toJson()); | 1798 _body = convert_1.JSON.encode((request).toJson()); |
1768 } | 1799 } |
1769 if (fileId == null) { | 1800 if (fileId == null) { |
1770 throw new core.ArgumentError("Parameter fileId is required."); | 1801 throw new core.ArgumentError("Parameter fileId is required."); |
1771 } | 1802 } |
| 1803 if (acknowledgeAbuse != null) { |
| 1804 _queryParams["acknowledgeAbuse"] = ["${acknowledgeAbuse}"]; |
| 1805 } |
1772 if (projection != null) { | 1806 if (projection != null) { |
1773 _queryParams["projection"] = [projection]; | 1807 _queryParams["projection"] = [projection]; |
1774 } | 1808 } |
1775 if (updateViewedDate != null) { | 1809 if (updateViewedDate != null) { |
1776 _queryParams["updateViewedDate"] = ["${updateViewedDate}"]; | 1810 _queryParams["updateViewedDate"] = ["${updateViewedDate}"]; |
1777 } | 1811 } |
1778 | 1812 |
| 1813 _downloadOptions = downloadOptions; |
1779 | 1814 |
1780 _url = 'files/' + common_internal.Escaper.ecapeVariable('$fileId') + '/watch
'; | 1815 _url = 'files/' + common_internal.Escaper.ecapeVariable('$fileId') + '/watch
'; |
1781 | 1816 |
1782 var _response = _requester.request(_url, | 1817 var _response = _requester.request(_url, |
1783 "POST", | 1818 "POST", |
1784 body: _body, | 1819 body: _body, |
1785 queryParams: _queryParams, | 1820 queryParams: _queryParams, |
1786 uploadOptions: _uploadOptions, | 1821 uploadOptions: _uploadOptions, |
1787 uploadMedia: _uploadMedia, | 1822 uploadMedia: _uploadMedia, |
1788 downloadOptions: _downloadOptions); | 1823 downloadOptions: _downloadOptions); |
1789 return _response.then((data) => new Channel.fromJson(data)); | 1824 if (_downloadOptions == null || |
| 1825 _downloadOptions == common.DownloadOptions.Metadata) { |
| 1826 return _response.then((data) => new Channel.fromJson(data)); |
| 1827 } else { |
| 1828 return _response; |
| 1829 } |
1790 } | 1830 } |
1791 | 1831 |
1792 } | 1832 } |
1793 | 1833 |
1794 | 1834 |
1795 /** Not documented yet. */ | 1835 /** Not documented yet. */ |
1796 class ParentsResourceApi { | 1836 class ParentsResourceApi { |
1797 final common_internal.ApiRequester _requester; | 1837 final common_internal.ApiRequester _requester; |
1798 | 1838 |
1799 ParentsResourceApi(common_internal.ApiRequester client) : | 1839 ParentsResourceApi(common_internal.ApiRequester client) : |
(...skipping 5067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6867 _json["permissionId"] = permissionId; | 6907 _json["permissionId"] = permissionId; |
6868 } | 6908 } |
6869 if (picture != null) { | 6909 if (picture != null) { |
6870 _json["picture"] = (picture).toJson(); | 6910 _json["picture"] = (picture).toJson(); |
6871 } | 6911 } |
6872 return _json; | 6912 return _json; |
6873 } | 6913 } |
6874 } | 6914 } |
6875 | 6915 |
6876 | 6916 |
OLD | NEW |