getSdk method
Generates a client SDK for a RestApi and Stage.
May throw UnauthorizedException. May throw NotFoundException. May throw BadRequestException. May throw ConflictException. May throw TooManyRequestsException.
Parameter restApiId
:
Required
The string identifier of the associated RestApi.
Parameter sdkType
:
Required
The language for the generated SDK. Currently
java
, javascript
, android
,
objectivec
(for iOS), swift
(for iOS), and
ruby
are supported.
Parameter stageName
:
Required
The name of the Stage that the SDK will use.
Parameter parameters
:
A string-to-string key-value map of query parameters
sdkType
-dependent properties of the SDK. For
sdkType
of objectivec
or swift
, a
parameter named classPrefix
is required. For
sdkType
of android
, parameters named
groupId
, artifactId
,
artifactVersion
, and invokerPackage
are
required. For sdkType
of java
, parameters named
serviceName
and javaPackageName
are required.
Implementation
Future<SdkResponse> getSdk({
required String restApiId,
required String sdkType,
required String stageName,
Map<String, String>? parameters,
}) async {
ArgumentError.checkNotNull(restApiId, 'restApiId');
ArgumentError.checkNotNull(sdkType, 'sdkType');
ArgumentError.checkNotNull(stageName, 'stageName');
final $query = <String, List<String>>{
if (parameters != null)
for (var e in parameters.entries) e.key: [e.value],
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri:
'/restapis/${Uri.encodeComponent(restApiId)}/stages/${Uri.encodeComponent(stageName)}/sdks/${Uri.encodeComponent(sdkType)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return SdkResponse(
body: await response.stream.toBytes(),
contentDisposition:
_s.extractHeaderStringValue(response.headers, 'Content-Disposition'),
contentType:
_s.extractHeaderStringValue(response.headers, 'Content-Type'),
);
}