updateUsage method
Future<Usage>
updateUsage({
- required String keyId,
- required String usagePlanId,
- List<
PatchOperation> ? patchOperations,
Grants a temporary extension to the remaining quota of a usage plan associated with a specified API key.
May throw UnauthorizedException. May throw TooManyRequestsException. May throw BadRequestException. May throw NotFoundException.
Parameter keyId
:
Required
The identifier of the API key associated with the usage plan in
which a temporary extension is granted to the remaining quota.
Parameter usagePlanId
:
Required
The Id of the usage plan associated with the usage data.
Parameter patchOperations
:
A list of update operations to be applied to the specified resource and in
the order specified in this list.
Implementation
Future<Usage> updateUsage({
required String keyId,
required String usagePlanId,
List<PatchOperation>? patchOperations,
}) async {
ArgumentError.checkNotNull(keyId, 'keyId');
ArgumentError.checkNotNull(usagePlanId, 'usagePlanId');
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);
}