importApi method
Imports an API.
May throw NotFoundException. May throw TooManyRequestsException. May throw BadRequestException. May throw ConflictException.
Parameter body
:
The OpenAPI definition. Supported only for HTTP APIs.
Parameter basepath
:
Specifies how to interpret the base path of the API during import. Valid
values are ignore, prepend, and split. The default value is ignore. To
learn more, see Set
the OpenAPI basePath Property. Supported only for HTTP APIs.
Parameter failOnWarnings
:
Specifies whether to rollback the API creation when a warning is
encountered. By default, API creation continues if a warning is
encountered.
Implementation
Future<ImportApiResponse> importApi({
required String body,
String? basepath,
bool? failOnWarnings,
}) async {
ArgumentError.checkNotNull(body, 'body');
final $query = <String, List<String>>{
if (basepath != null) 'basepath': [basepath],
if (failOnWarnings != null) 'failOnWarnings': [failOnWarnings.toString()],
};
final $payload = <String, dynamic>{
'body': body,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/v2/apis',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ImportApiResponse.fromJson(response);
}