getExport method
Exports a deployed version of a RestApi in a specified format.
May throw BadRequestException.
May throw ConflictException.
May throw LimitExceededException.
May throw NotFoundException.
May throw TooManyRequestsException.
May throw UnauthorizedException.
Parameter exportType :
The type of export. Acceptable values are 'oas30' for OpenAPI 3.0.x and
'swagger' for Swagger/OpenAPI 2.0.
Parameter restApiId :
The string identifier of the associated RestApi.
Parameter stageName :
The name of the Stage that will be exported.
Parameter accepts :
The content-type of the export, for example application/json.
Currently application/json and application/yaml
are supported for exportType ofoas30 and
swagger. This should be specified in the Accept
header for direct API requests.
Parameter parameters :
A key-value map of query string parameters that specify properties of the
export, depending on the requested exportType. For
exportType oas30 and swagger, any
combination of the following parameters are supported:
extensions='integrations' or
extensions='apigateway' will export the API with
x-amazon-apigateway-integration extensions.
extensions='authorizers' will export the API with
x-amazon-apigateway-authorizer extensions. postman will
export the API with Postman extensions, allowing for import to the Postman
tool
Implementation
Future<ExportResponse> getExport({
required String exportType,
required String restApiId,
required String stageName,
String? accepts,
Map<String, String>? parameters,
}) async {
final headers = <String, String>{
if (accepts != null) 'Accept': accepts.toString(),
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri:
'/restapis/${Uri.encodeComponent(restApiId)}/stages/${Uri.encodeComponent(stageName)}/exports/${Uri.encodeComponent(exportType)}',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return ExportResponse(
body: await response.stream.toBytes(),
contentDisposition:
_s.extractHeaderStringValue(response.headers, 'Content-Disposition'),
contentType:
_s.extractHeaderStringValue(response.headers, 'Content-Type'),
);
}