createResource method

Future<Resource> createResource({
  1. required String parentId,
  2. required String pathPart,
  3. required String restApiId,
})

Creates a Resource resource.

May throw UnauthorizedException. May throw NotFoundException. May throw ConflictException. May throw LimitExceededException. May throw BadRequestException. May throw TooManyRequestsException.

Parameter parentId : Required The parent resource's identifier.

Parameter pathPart : The last path segment for this resource.

Parameter restApiId : Required The string identifier of the associated RestApi.

Implementation

Future<Resource> createResource({
  required String parentId,
  required String pathPart,
  required String restApiId,
}) async {
  ArgumentError.checkNotNull(parentId, 'parentId');
  ArgumentError.checkNotNull(pathPart, 'pathPart');
  ArgumentError.checkNotNull(restApiId, 'restApiId');
  final $payload = <String, dynamic>{
    'pathPart': pathPart,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/restapis/${Uri.encodeComponent(restApiId)}/resources/${Uri.encodeComponent(parentId)}',
    exceptionFnMap: _exceptionFns,
  );
  return Resource.fromJson(response);
}