updateMethodResponse method

Future<MethodResponse> updateMethodResponse({
  1. required String httpMethod,
  2. required String resourceId,
  3. required String restApiId,
  4. required String statusCode,
  5. List<PatchOperation>? patchOperations,
})

Updates an existing MethodResponse resource.

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

Parameter httpMethod : Required The HTTP verb of the Method resource.

Parameter resourceId : Required The Resource identifier for the MethodResponse resource.

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

Parameter statusCode : Required The status code for the MethodResponse resource.

Parameter patchOperations : A list of update operations to be applied to the specified resource and in the order specified in this list.

Implementation

Future<MethodResponse> updateMethodResponse({
  required String httpMethod,
  required String resourceId,
  required String restApiId,
  required String statusCode,
  List<PatchOperation>? patchOperations,
}) async {
  ArgumentError.checkNotNull(httpMethod, 'httpMethod');
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  ArgumentError.checkNotNull(restApiId, 'restApiId');
  ArgumentError.checkNotNull(statusCode, 'statusCode');
  final $payload = <String, dynamic>{
    if (patchOperations != null) 'patchOperations': patchOperations,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/restapis/${Uri.encodeComponent(restApiId)}/resources/${Uri.encodeComponent(resourceId)}/methods/${Uri.encodeComponent(httpMethod)}/responses/${Uri.encodeComponent(statusCode)}',
    exceptionFnMap: _exceptionFns,
  );
  return MethodResponse.fromJson(response);
}