| // This is a generated file (see the discoveryapis_generator project). |
| |
| // ignore_for_file: camel_case_types |
| // ignore_for_file: comment_references |
| // ignore_for_file: deprecated_member_use_from_same_package |
| // ignore_for_file: doc_directive_unknown |
| // ignore_for_file: lines_longer_than_80_chars |
| // ignore_for_file: non_constant_identifier_names |
| // ignore_for_file: prefer_interpolation_to_compose_strings |
| // ignore_for_file: unintended_html_in_doc_comment |
| // ignore_for_file: unnecessary_brace_in_string_interps |
| // ignore_for_file: unnecessary_lambdas |
| // ignore_for_file: unnecessary_string_interpolations |
| |
| /// Toy API - 1.0 |
| /// |
| /// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| /// tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, |
| /// quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo |
| /// consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse |
| /// cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat |
| /// non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
| /// |
| /// For more information, see <https://developers.google.com/discovery/> |
| /// |
| /// Create an instance of [ToyApi] to access these resources: |
| /// |
| /// - [ComputeResource] |
| /// - [StorageResource] |
| library; |
| |
| import 'dart:async' as async; |
| import 'dart:convert' as convert; |
| import 'dart:core' as core; |
| |
| import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; |
| import 'package:http/http.dart' as http; |
| |
| export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' |
| show |
| ApiRequestError, |
| ByteRange, |
| DetailedApiRequestError, |
| DownloadOptions, |
| Media, |
| PartialDownloadOptions, |
| ResumableUploadOptions, |
| UploadOptions; |
| |
| /// Request headers used by all libraries in this package |
| final requestHeaders = { |
| 'user-agent': 'google-api-dart-client/1.0', |
| 'x-goog-api-client': 'gl-dart/${commons.dartVersion} gdcl/1.0', |
| }; |
| |
| /// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| /// tempor incididunt ut labore et dolore magna aliqua. |
| /// |
| /// Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut |
| /// aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in |
| /// voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint |
| /// occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit |
| /// anim id est laborum. |
| class ToyApi { |
| final commons.ApiRequester _requester; |
| |
| ComputeResource get compute => ComputeResource(_requester); |
| StorageResource get storage => StorageResource(_requester); |
| |
| ToyApi( |
| http.Client client, { |
| core.String rootUrl = 'http://localhost:9090/', |
| core.String servicePath = 'api/toyApi/0.1/', |
| }) : _requester = commons.ApiRequester( |
| client, |
| rootUrl, |
| servicePath, |
| requestHeaders, |
| ); |
| |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<void> failing({core.String? $fields}) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'failing'; |
| |
| await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| downloadOptions: null, |
| ); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> hello({core.String? $fields}) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'hello'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [MapOfToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<MapOfToyResponse> helloListOfClass( |
| ListOfToyRequest request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloListOfClass'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry( |
| key, |
| ToyResponse.fromJson(value as core.Map<core.String, core.dynamic>), |
| ), |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [MapOfToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<MapOfToyResponse> helloListOfListOfClass( |
| ListOfListOfToyRequest request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloListOfListOfClass'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry( |
| key, |
| ToyResponse.fromJson(value as core.Map<core.String, core.dynamic>), |
| ), |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [MapOfint]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<MapOfint> helloMap( |
| MapOfint request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloMap'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry(key, value as core.int), |
| ); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [name] - Path parameter: 'name'. |
| /// |
| /// [age] - Path parameter: 'age'. |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> helloNameAge( |
| core.String name, |
| core.int age, { |
| core.String? $fields, |
| }) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = |
| 'hello/' + |
| commons.escapeVariable('$name') + |
| '/age/' + |
| commons.escapeVariable('$age'); |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [name] - Path parameter: 'name'. |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> helloNamePostAge( |
| ToyAgeRequest request, |
| core.String name, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = 'helloPost/' + commons.escapeVariable('$name'); |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [foo] - Query parameter: 'foo'. |
| /// |
| /// [name] - Path parameter: 'name'. |
| /// |
| /// [age] - Query parameter: 'age'. |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> helloNameQueryAgeFoo( |
| core.String foo, |
| core.String name, { |
| core.int? age, |
| core.String? $fields, |
| }) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| 'foo': [foo], |
| if (age != null) 'age': ['${age}'], |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = 'helloQuery/' + commons.escapeVariable('$name'); |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ListOfListOfString]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ListOfListOfString> helloNestedListList( |
| ListOfListOfint request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloNestedListList'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.List) |
| .map( |
| (value) => |
| (value as core.List) |
| .map((value) => value as core.String) |
| .toList(), |
| ) |
| .toList(); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ListOfMapOfListOfString]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ListOfMapOfListOfString> helloNestedListMapList( |
| ListOfMapOfListOfint request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloNestedListMapList'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.List) |
| .map( |
| (value) => (value as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry( |
| key, |
| (value as core.List) |
| .map((value) => value as core.String) |
| .toList(), |
| ), |
| ), |
| ) |
| .toList(); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyMapResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyMapResponse> helloNestedMap({core.String? $fields}) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloNestedMap'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyMapResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [MapOfListOfMapOfbool]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<MapOfListOfMapOfbool> helloNestedMapListMap( |
| MapOfListOfMapOfint request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloNestedMapListMap'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry( |
| key, |
| (value as core.List) |
| .map( |
| (value) => (value as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry(key, value as core.bool), |
| ), |
| ) |
| .toList(), |
| ), |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [MapOfMapOfbool]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<MapOfMapOfbool> helloNestedMapMap( |
| MapOfMapOfint request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloNestedMapMap'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry( |
| key, |
| (value as core.Map<core.String, core.dynamic>).map( |
| (key, value) => core.MapEntry(key, value as core.bool), |
| ), |
| ), |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> helloPost( |
| ToyRequest request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloPost'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> helloReturnNull({core.String? $fields}) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloReturnNull'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResponse> helloVoid({core.String? $fields}) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'helloVoid'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| queryParams: queryParams_, |
| ); |
| return ToyResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<void> noop({core.String? $fields}) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'noop'; |
| |
| await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| downloadOptions: null, |
| ); |
| } |
| |
| /// [request] - The metadata request object. |
| /// |
| /// Request parameters: |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ListOfString]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ListOfString> reverseList( |
| ListOfString request, { |
| core.String? $fields, |
| }) async { |
| final body_ = convert.json.encode(request); |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| const url_ = 'reverseList'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'POST', |
| body: body_, |
| queryParams: queryParams_, |
| ); |
| return (response_ as core.List) |
| .map((value) => value as core.String) |
| .toList(); |
| } |
| } |
| |
| class ComputeResource { |
| final commons.ApiRequester _requester; |
| |
| ComputeResource(commons.ApiRequester client) : _requester = client; |
| |
| /// Downloads media. |
| /// |
| /// Download is supported on the URI `/v1/media/{+name}?alt=media`. |
| /// |
| /// Request parameters: |
| /// |
| /// [resourceName] - Name of the media that is being downloaded. See |
| /// ReadRequest.resource_name. |
| /// Value must have pattern `^.*$`. |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// [downloadOptions] - Options for downloading. A download can be either a |
| /// Metadata (default) or Media download. Partial Media downloads are possible |
| /// as well. |
| /// |
| /// Completes with a |
| /// |
| /// - [ToyResourceResponse] for Metadata downloads (see [downloadOptions]). |
| /// |
| /// - [commons.Media] for Media downloads (see [downloadOptions]). |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<core.Object> download( |
| core.String resourceName, { |
| core.String? $fields, |
| commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata, |
| }) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = 'v1/media/' + core.Uri.encodeFull('$resourceName'); |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| downloadOptions: downloadOptions, |
| ); |
| if (downloadOptions.isMetadataDownload) { |
| return ToyResourceResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } else { |
| return response_ as commons.Media; |
| } |
| } |
| |
| /// Exports a Google Doc to the requested MIME type and returns the exported |
| /// content. |
| /// |
| /// Please note that the exported content is limited to 10MB. |
| /// |
| /// Request parameters: |
| /// |
| /// [fileId] - The ID of the file. |
| /// |
| /// [mimeType] - The MIME type of the format requested for this export. |
| /// |
| /// [dimensions] - Dimensions to base the report on. |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// [downloadOptions] - Options for downloading. A download can be either a |
| /// Metadata (default) or Media download. Partial Media downloads are possible |
| /// as well. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<commons.Media?> export( |
| core.String fileId, |
| core.String mimeType, { |
| core.List<core.String>? dimensions, |
| core.String? $fields, |
| commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata, |
| }) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| 'mimeType': [mimeType], |
| if (dimensions != null) 'dimensions': dimensions, |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = 'files/' + commons.escapeVariable('$fileId') + '/export'; |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| downloadOptions: downloadOptions, |
| ); |
| if (downloadOptions.isMetadataDownload) { |
| return null; |
| } else { |
| return response_ as commons.Media; |
| } |
| } |
| |
| /// Request parameters: |
| /// |
| /// [resource] - Path parameter: 'resource'. Should not be empty. |
| /// |
| /// [compute] - Path parameter: 'compute'. Must be at least three characters |
| /// long. |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResourceResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResourceResponse> get( |
| core.String resource, |
| core.String compute, { |
| core.String? $fields, |
| }) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = |
| 'toyresource/' + |
| commons.escapeVariable('$resource') + |
| '/compute/' + |
| commons.escapeVariable('$compute'); |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyResourceResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| } |
| |
| class StorageResource { |
| final commons.ApiRequester _requester; |
| |
| StorageResource(commons.ApiRequester client) : _requester = client; |
| |
| /// Request parameters: |
| /// |
| /// [resource] - Path parameter: 'resource'. Can be used in a url like |
| /// https://example.com/\[resource\]/something |
| /// |
| /// [storage] - Path parameter: 'storage'. Learn more at |
| /// [the web site](https://example.com). |
| /// |
| /// [$fields] - Selector specifying which fields to include in a partial |
| /// response. |
| /// |
| /// Completes with a [ToyResourceResponse]. |
| /// |
| /// Completes with a [commons.ApiRequestError] if the API endpoint returned an |
| /// error. |
| /// |
| /// If the used [http.Client] completes with an error when making a REST call, |
| /// this method will complete with the same error. |
| async.Future<ToyResourceResponse> get( |
| core.String resource, |
| core.String storage, { |
| core.String? $fields, |
| }) async { |
| final queryParams_ = <core.String, core.List<core.String>>{ |
| if ($fields != null) 'fields': [$fields], |
| }; |
| |
| final url_ = |
| 'toyresource/' + |
| commons.escapeVariable('$resource') + |
| '/storage/' + |
| commons.escapeVariable('$storage'); |
| |
| final response_ = await _requester.request( |
| url_, |
| 'GET', |
| queryParams: queryParams_, |
| ); |
| return ToyResourceResponse.fromJson( |
| response_ as core.Map<core.String, core.dynamic>, |
| ); |
| } |
| } |
| |
| typedef ListOfListOfString = core.List<core.List<core.String>>; |
| |
| typedef ListOfListOfToyRequest = core.List<core.List<ToyRequest>>; |
| |
| typedef ListOfListOfint = core.List<core.List<core.int>>; |
| |
| typedef ListOfMapOfListOfString = |
| core.List<core.Map<core.String, core.List<core.String>>>; |
| |
| typedef ListOfMapOfListOfint = |
| core.List<core.Map<core.String, core.List<core.int>>>; |
| |
| typedef ListOfString = core.List<core.String>; |
| |
| typedef ListOfToyRequest = core.List<ToyRequest>; |
| |
| typedef MapOfListOfMapOfbool = |
| core.Map<core.String, core.List<core.Map<core.String, core.bool>>>; |
| |
| typedef MapOfListOfMapOfint = |
| core.Map<core.String, core.List<core.Map<core.String, core.int>>>; |
| |
| typedef MapOfMapOfbool = |
| core.Map<core.String, core.Map<core.String, core.bool>>; |
| |
| typedef MapOfMapOfint = core.Map<core.String, core.Map<core.String, core.int>>; |
| |
| typedef MapOfToyResponse = core.Map<core.String, ToyResponse>; |
| |
| typedef MapOfint = core.Map<core.String, core.int>; |
| |
| class NestedResponse { |
| core.String? nestedResult; |
| |
| NestedResponse({this.nestedResult}); |
| |
| NestedResponse.fromJson(core.Map json_) |
| : this(nestedResult: json_['nestedResult'] as core.String?); |
| |
| core.Map<core.String, core.dynamic> toJson() => { |
| if (nestedResult != null) 'nestedResult': nestedResult!, |
| }; |
| } |
| |
| class ToyAgeRequest { |
| core.int? age; |
| |
| ToyAgeRequest({this.age}); |
| |
| ToyAgeRequest.fromJson(core.Map json_) : this(age: json_['age'] as core.int?); |
| |
| core.Map<core.String, core.dynamic> toJson() => { |
| if (age != null) 'age': age!, |
| }; |
| } |
| |
| class ToyMapResponse { |
| core.Map<core.String, NestedResponse>? mapResult; |
| |
| /// Nested message value of the parameter. |
| /// |
| /// Output only. |
| /// |
| /// The values for Object must be JSON objects. It can consist of `num`, |
| /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| core.List<core.Map<core.String, core.Object?>>? msgValue; |
| |
| /// A null value. |
| /// Possible string values are: |
| /// - "NULL_VALUE" : Null value. |
| core.String? nullValue; |
| |
| /// A collection of arbitrary key-value pairs which are visible to all apps. |
| /// Entries with null values are cleared in update and copy requests. |
| core.Map<core.String, core.String?>? properties; |
| core.String? result; |
| |
| /// |
| /// |
| /// The values for Object must be JSON objects. It can consist of `num`, |
| /// `String`, `bool` and `null` as well as `Map` and `List` values. |
| core.Object? v; |
| |
| ToyMapResponse({ |
| this.mapResult, |
| this.msgValue, |
| this.nullValue, |
| this.properties, |
| this.result, |
| this.v, |
| }); |
| |
| ToyMapResponse.fromJson(core.Map json_) |
| : this( |
| mapResult: (json_['mapResult'] as core.Map<core.String, core.dynamic>?) |
| ?.map( |
| (key, value) => core.MapEntry( |
| key, |
| NestedResponse.fromJson( |
| value as core.Map<core.String, core.dynamic>, |
| ), |
| ), |
| ), |
| msgValue: |
| (json_['msgValue'] as core.List?) |
| ?.map((value) => value as core.Map<core.String, core.dynamic>) |
| .toList(), |
| nullValue: json_.containsKey('nullValue') ? 'NULL_VALUE' : null, |
| properties: (json_['properties'] |
| as core.Map<core.String, core.dynamic>?) |
| ?.map((key, value) => core.MapEntry(key, value as core.String?)), |
| result: json_['result'] as core.String?, |
| v: json_['v'], |
| ); |
| |
| core.Map<core.String, core.dynamic> toJson() => { |
| if (mapResult != null) 'mapResult': mapResult!, |
| if (msgValue != null) 'msgValue': msgValue!, |
| if (nullValue != null) 'nullValue': nullValue!, |
| if (properties != null) 'properties': properties!, |
| if (result != null) 'result': result!, |
| if (v != null) 'v': v!, |
| }; |
| } |
| |
| class ToyRequest { |
| core.int? age; |
| core.String? name; |
| |
| ToyRequest({this.age, this.name}); |
| |
| ToyRequest.fromJson(core.Map json_) |
| : this(age: json_['age'] as core.int?, name: json_['name'] as core.String?); |
| |
| core.Map<core.String, core.dynamic> toJson() => { |
| if (age != null) 'age': age!, |
| if (name != null) 'name': name!, |
| }; |
| } |
| |
| class ToyResourceResponse { |
| core.String? result; |
| |
| ToyResourceResponse({this.result}); |
| |
| ToyResourceResponse.fromJson(core.Map json_) |
| : this(result: json_['result'] as core.String?); |
| |
| core.Map<core.String, core.dynamic> toJson() => { |
| if (result != null) 'result': result!, |
| }; |
| } |
| |
| class ToyResponse { |
| core.String? result; |
| |
| ToyResponse({this.result}); |
| |
| ToyResponse.fromJson(core.Map json_) |
| : this(result: json_['result'] as core.String?); |
| |
| core.Map<core.String, core.dynamic> toJson() => { |
| if (result != null) 'result': result!, |
| }; |
| } |