updateUsage method

Future<Usage> updateUsage({
  1. required String keyId,
  2. required String usagePlanId,
  3. List<PatchOperation>? patchOperations,
})

Grants a temporary extension to the remaining quota of a usage plan associated with a specified API key.

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

Parameter keyId : The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.

Parameter usagePlanId : The Id of the usage plan associated with the usage data.

Parameter patchOperations : For more information about supported patch operations, see Patch Operations.

Implementation

Future<Usage> updateUsage({
  required String keyId,
  required String usagePlanId,
  List<PatchOperation>? patchOperations,
}) async {
  final $payload = <String, dynamic>{
    if (patchOperations != null) 'patchOperations': patchOperations,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/usageplans/${Uri.encodeComponent(usagePlanId)}/keys/${Uri.encodeComponent(keyId)}/usage',
    exceptionFnMap: _exceptionFns,
  );
  return Usage.fromJson(response);
}