getResource method
Lists information about a resource.
May throw UnauthorizedException. May throw NotFoundException. May throw TooManyRequestsException.
Parameter resourceId
:
Required
The identifier for the Resource resource.
Parameter restApiId
:
Required
The string identifier of the associated RestApi.
Parameter embed
:
A query parameter to retrieve the specified resources embedded in the
returned Resource representation in the response. This
embed
parameter value is a list of comma-separated strings.
Currently, the request supports only retrieval of the embedded
Method resources this way. The query parameter value must be a
single-valued list and contain the "methods"
string. For
example, GET
/restapis/{restapi_id}/resources/{resource_id}?embed=methods
.
Implementation
Future<Resource> getResource({
required String resourceId,
required String restApiId,
List<String>? embed,
}) async {
ArgumentError.checkNotNull(resourceId, 'resourceId');
ArgumentError.checkNotNull(restApiId, 'restApiId');
final $query = <String, List<String>>{
if (embed != null) 'embed': embed,
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/restapis/${Uri.encodeComponent(restApiId)}/resources/${Uri.encodeComponent(resourceId)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return Resource.fromJson(response);
}