blob: 1b84e3e3e803491e6bc4bc267991581e20862210 [file] [log] [blame]
// This is a generated file (see the discoveryapis_generator project).
// ignore_for_file: camel_case_types
// ignore_for_file: comment_references
// ignore_for_file: directives_ordering
// ignore_for_file: file_names
// ignore_for_file: library_names
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: prefer_expression_function_bodies
// ignore_for_file: prefer_final_locals
// ignore_for_file: prefer_interpolation_to_compose_strings
// ignore_for_file: unnecessary_brace_in_string_interps
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_lambdas
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: unnecessary_string_interpolations
library discoveryapis_tests.toyApi.client;
import 'dart:core' as core;
import 'dart:async' as async;
import 'dart:convert' as convert;
import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons;
import 'package:http/http.dart' as http;
import 'package:discoveryapis_tests/messages.dart';
export 'package:_discoveryapis_commons/_discoveryapis_commons.dart'
show ApiRequestError, DetailedApiRequestError;
const userAgent = 'dart-api-client toyApi/0.1';
class ToyApi {
final commons.ApiRequester _requester;
ComputeResourceApi get compute => ComputeResourceApi(_requester);
StorageResourceApi get storage => StorageResourceApi(_requester);
ToyApi(http.Client client,
{core.String rootUrl = 'http://localhost:9090/',
core.String servicePath = 'api/toyApi/0.1/'})
: _requester =
commons.ApiRequester(client, rootUrl, servicePath, userAgent);
/// 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 failing({
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_downloadOptions = null;
_url = 'failing';
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => 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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'hello';
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [core.Map<core.String, 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<core.Map<core.String, ToyResponse>> helloListOfClass(
core.List<ToyRequest> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(
request.map((value) => ToyRequestFactory.toJson(value)).toList());
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloListOfClass';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => commons.mapMap<core.Map, ToyResponse>(
data.cast<core.String, core.Map>(),
(core.Map item) => ToyResponseFactory.fromJson(item)));
}
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [core.Map<core.String, 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<core.Map<core.String, ToyResponse>> helloListOfListOfClass(
core.List<core.List<ToyRequest>> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request
.map((value) =>
value.map((value) => ToyRequestFactory.toJson(value)).toList())
.toList());
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloListOfListOfClass';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => commons.mapMap<core.Map, ToyResponse>(
data.cast<core.String, core.Map>(),
(core.Map item) => ToyResponseFactory.fromJson(item)));
}
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [core.Map<core.String, core.int>].
///
/// 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.Map<core.String, core.int>> helloMap(
core.Map<core.String, core.int> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request);
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloMap';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => commons.mapMap<core.int, core.int>(
data.cast<core.String, core.int>(),
(core.int item) => item 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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (name == null) {
throw core.ArgumentError('Parameter name is required.');
}
if (age == null) {
throw core.ArgumentError('Parameter age is required.');
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'hello/' +
commons.Escaper.ecapeVariable('$name') +
'/age/' +
commons.Escaper.ecapeVariable('$age');
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// [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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(ToyAgeRequestFactory.toJson(request));
}
if (name == null) {
throw core.ArgumentError('Parameter name is required.');
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloPost/' + commons.Escaper.ecapeVariable('$name');
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// Request parameters:
///
/// [name] - Path parameter: 'name'.
///
/// [age] - Query parameter: 'age'.
///
/// [foo] - Query parameter: 'foo'.
///
/// [$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 name, {
core.int age,
core.String foo,
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (name == null) {
throw core.ArgumentError('Parameter name is required.');
}
if (age != null) {
_queryParams['age'] = ['${age}'];
}
if (foo != null) {
_queryParams['foo'] = [foo];
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloQuery/' + commons.Escaper.ecapeVariable('$name');
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [core.List<core.List<core.String>>].
///
/// 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.List<core.List<core.String>>> helloNestedListList(
core.List<core.List<core.int>> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request);
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloNestedListList';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => (data as core.List)
.map<core.List<core.String>>((value) => (value as core.List)
.map<core.String>((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 [core.List<core.Map<core.String,
/// core.List<core.String>>>].
///
/// 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.List<core.Map<core.String, core.List<core.String>>>>
helloNestedListMapList(
core.List<core.Map<core.String, core.List<core.int>>> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request);
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloNestedListMapList';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => (data as core.List)
.map<core.Map<core.String, core.List<core.String>>>((value) =>
commons.mapMap<core.List, core.List<core.String>>(
value.cast<core.String, core.List>(),
(core.List item) => (item as core.List)
.map<core.String>((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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloNestedMap';
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyMapResponseFactory.fromJson(data));
}
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [core.Map<core.String, core.List<core.Map<core.String,
/// core.bool>>>].
///
/// 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.Map<core.String, core.List<core.Map<core.String, core.bool>>>>
helloNestedMapListMap(
core.Map<core.String, core.List<core.Map<core.String, core.int>>> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request);
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloNestedMapListMap';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) =>
commons.mapMap<core.List, core.List<core.Map<core.String, core.bool>>>(
data.cast<core.String, core.List>(),
(core.List item) => (item as core.List)
.map<core.Map<core.String, core.bool>>((value) =>
commons.mapMap<core.bool, core.bool>(
value.cast<core.String, core.bool>(),
(core.bool item) => item 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 [core.Map<core.String, core.Map<core.String,
/// core.bool>>].
///
/// 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.Map<core.String, core.Map<core.String, core.bool>>>
helloNestedMapMap(
core.Map<core.String, core.Map<core.String, core.int>> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request);
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloNestedMapMap';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) =>
commons.mapMap<core.Map, core.Map<core.String, core.bool>>(
data.cast<core.String, core.Map>(),
(core.Map item) => commons.mapMap<core.bool, core.bool>(
item.cast<core.String, core.bool>(),
(core.bool item) => item 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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(ToyRequestFactory.toJson(request));
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloPost';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// 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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloReturnNull';
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// 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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'helloVoid';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResponseFactory.fromJson(data));
}
/// 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 noop({
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_downloadOptions = null;
_url = 'noop';
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => null);
}
/// [request] - The metadata request object.
///
/// Request parameters:
///
/// [$fields] - Selector specifying which fields to include in a partial
/// response.
///
/// Completes with a [core.List<core.String>].
///
/// 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.List<core.String>> reverseList(
core.List<core.String> request, {
core.String $fields,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (request != null) {
_body = convert.json.encode(request);
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'reverseList';
final _response = _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => (data as core.List)
.map<core.String>((value) => value as core.String)
.toList());
}
}
class ComputeResourceApi {
final commons.ApiRequester _requester;
ComputeResourceApi(commons.ApiRequester client) : _requester = client;
/// Request parameters:
///
/// [resource] - Path parameter: 'resource'.
///
/// [compute] - Path parameter: 'compute'.
///
/// [$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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (resource == null) {
throw core.ArgumentError('Parameter resource is required.');
}
if (compute == null) {
throw core.ArgumentError('Parameter compute is required.');
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'toyresource/' +
commons.Escaper.ecapeVariable('$resource') +
'/compute/' +
commons.Escaper.ecapeVariable('$compute');
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResourceResponseFactory.fromJson(data));
}
}
class StorageResourceApi {
final commons.ApiRequester _requester;
StorageResourceApi(commons.ApiRequester client) : _requester = client;
/// Request parameters:
///
/// [resource] - Path parameter: 'resource'.
///
/// [storage] - Path parameter: 'storage'.
///
/// [$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,
}) {
core.String _url;
final _queryParams = <core.String, core.List<core.String>>{};
commons.Media _uploadMedia;
commons.UploadOptions _uploadOptions;
var _downloadOptions = commons.DownloadOptions.Metadata;
core.String _body;
if (resource == null) {
throw core.ArgumentError('Parameter resource is required.');
}
if (storage == null) {
throw core.ArgumentError('Parameter storage is required.');
}
if ($fields != null) {
_queryParams['fields'] = [$fields];
}
_url = 'toyresource/' +
commons.Escaper.ecapeVariable('$resource') +
'/storage/' +
commons.Escaper.ecapeVariable('$storage');
final _response = _requester.request(
_url,
'GET',
body: _body,
queryParams: _queryParams,
uploadOptions: _uploadOptions,
uploadMedia: _uploadMedia,
downloadOptions: _downloadOptions,
);
return _response.then((data) => ToyResourceResponseFactory.fromJson(data));
}
}
class NestedResponseFactory {
static NestedResponse fromJson(core.Map _json) {
var message = NestedResponse();
if (_json.containsKey('nestedResult')) {
message.nestedResult = _json['nestedResult'] as core.String;
}
return message;
}
static core.Map toJson(NestedResponse message) {
var _json = {};
if (message.nestedResult != null) {
_json['nestedResult'] = message.nestedResult;
}
return _json;
}
}
class ToyAgeRequestFactory {
static ToyAgeRequest fromJson(core.Map _json) {
var message = ToyAgeRequest();
if (_json.containsKey('age')) {
message.age = _json['age'] as core.int;
}
return message;
}
static core.Map toJson(ToyAgeRequest message) {
var _json = {};
if (message.age != null) {
_json['age'] = message.age;
}
return _json;
}
}
class ToyMapResponseFactory {
static ToyMapResponse fromJson(core.Map _json) {
var message = ToyMapResponse();
if (_json.containsKey('mapResult')) {
message.mapResult = commons.mapMap<core.Map, NestedResponse>(
_json['mapResult'].cast<core.String, core.Map>(),
(core.Map item) => NestedResponseFactory.fromJson(item));
}
if (_json.containsKey('result')) {
message.result = _json['result'] as core.String;
}
return message;
}
static core.Map toJson(ToyMapResponse message) {
var _json = {};
if (message.mapResult != null) {
_json['mapResult'] =
commons.mapMap<NestedResponse, core.Map<core.String, core.Object>>(
message.mapResult,
(NestedResponse item) => NestedResponseFactory.toJson(item));
}
if (message.result != null) {
_json['result'] = message.result;
}
return _json;
}
}
class ToyRequestFactory {
static ToyRequest fromJson(core.Map _json) {
var message = ToyRequest();
if (_json.containsKey('age')) {
message.age = _json['age'] as core.int;
}
if (_json.containsKey('name')) {
message.name = _json['name'] as core.String;
}
return message;
}
static core.Map toJson(ToyRequest message) {
var _json = {};
if (message.age != null) {
_json['age'] = message.age;
}
if (message.name != null) {
_json['name'] = message.name;
}
return _json;
}
}
class ToyResourceResponseFactory {
static ToyResourceResponse fromJson(core.Map _json) {
var message = ToyResourceResponse();
if (_json.containsKey('result')) {
message.result = _json['result'] as core.String;
}
return message;
}
static core.Map toJson(ToyResourceResponse message) {
var _json = {};
if (message.result != null) {
_json['result'] = message.result;
}
return _json;
}
}
class ToyResponseFactory {
static ToyResponse fromJson(core.Map _json) {
var message = ToyResponse();
if (_json.containsKey('result')) {
message.result = _json['result'] as core.String;
}
return message;
}
static core.Map toJson(ToyResponse message) {
var _json = {};
if (message.result != null) {
_json['result'] = message.result;
}
return _json;
}
}