importApiKeys method

Future<ApiKeyIds> importApiKeys({
  1. required Uint8List body,
  2. required ApiKeysFormat format,
  3. bool? failOnWarnings,
})

Import API keys from an external source, such as a CSV-formatted file.

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

Parameter body : The payload of the POST request to import API keys. For the payload format, see API Key File Format.

Parameter format : A query parameter to specify the input format to imported API keys. Currently, only the csv format is supported.

Parameter failOnWarnings : A query parameter to indicate whether to rollback ApiKey importation (true) or not (false) when error is encountered.

Implementation

Future<ApiKeyIds> importApiKeys({
  required Uint8List body,
  required ApiKeysFormat format,
  bool? failOnWarnings,
}) async {
  ArgumentError.checkNotNull(body, 'body');
  ArgumentError.checkNotNull(format, 'format');
  final $query = <String, List<String>>{
    'format': [format.toValue()],
    if (failOnWarnings != null) 'failonwarnings': [failOnWarnings.toString()],
  };
  final response = await _protocol.send(
    payload: body,
    method: 'POST',
    requestUri: '/apikeys?mode=import',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ApiKeyIds.fromJson(response);
}