updateApiKey method

Future<UpdateApiKeyResponse> updateApiKey({
  1. required String apiId,
  2. required String id,
  3. String? description,
  4. int? expires,
})

Updates an API key. The key can be updated while it is not deleted.

May throw BadRequestException. May throw NotFoundException. May throw UnauthorizedException. May throw LimitExceededException. May throw InternalFailureException. May throw ApiKeyValidityOutOfBoundsException.

Parameter apiId : The ID for the GraphQL API.

Parameter id : The API key ID.

Parameter description : A description of the purpose of the API key.

Parameter expires : The time from update time after which the API key expires. The date is represented as seconds since the epoch. For more information, see .

Implementation

Future<UpdateApiKeyResponse> updateApiKey({
  required String apiId,
  required String id,
  String? description,
  int? expires,
}) async {
  ArgumentError.checkNotNull(apiId, 'apiId');
  ArgumentError.checkNotNull(id, 'id');
  final $payload = <String, dynamic>{
    if (description != null) 'description': description,
    if (expires != null) 'expires': expires,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v1/apis/${Uri.encodeComponent(apiId)}/apikeys/${Uri.encodeComponent(id)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateApiKeyResponse.fromJson(response);
}