check method

  1. @override
String? check()
override

Implementation

@override
String? check() {
  if (fields == null) return null;
  if (fields!.isEmpty) {
    throw const TransmissionCheckError("fields should not be empty");
  }
  final allowedChecker = RequestParamArgsChecker<TorrentGetArgument>(
      label: "$runtimeType.prohibited",
      fields: fields!,
      failedChecker: (f) => !allowedFields.contains(f));
  final deprecatedChecker = RequestParamArgsChecker<TorrentGetArgument>(
      label: "$runtimeType.deprecated",
      fields: fields!,
      failedChecker: (f) => deprecatedFields.contains(f));
  return RequestParam.buildCheckResult([
    allowedChecker.check(),
    deprecatedChecker.check(),
  ]);
}