computeDiff method

Future<GoogleCloudWebriskV1ComputeThreatListDiffResponse> computeDiff({
  1. int? constraints_maxDatabaseEntries,
  2. int? constraints_maxDiffEntries,
  3. List<String>? constraints_supportedCompressions,
  4. String? threatType,
  5. String? versionToken,
  6. String? $fields,
})

Gets the most recent threat list diffs.

These diffs should be applied to a local database of hashes to keep it up-to-date. If the local database is empty or excessively out-of-date, a complete snapshot of the database will be returned. This Method only updates a single ThreatList at a time. To update multiple ThreatList databases, this method needs to be called once for each list.

Request parameters:

constraints_maxDatabaseEntries - Sets the maximum number of entries that the client is willing to have in the local database. This should be a power of 2 between 210 and 220. If zero, no database size limit is set.

constraints_maxDiffEntries - The maximum size in number of entries. The diff will not contain more entries than this value. This should be a power of 2 between 210 and 220. If zero, no diff size limit is set.

constraints_supportedCompressions - The compression types supported by the client.

threatType - Required. The threat list to update. Only a single ThreatType should be specified per request. If you want to handle multiple ThreatTypes, you must make one request per ThreatType. Possible string values are:

  • "THREAT_TYPE_UNSPECIFIED" : No entries should match this threat type. This threat type is unused.
  • "MALWARE" : Malware targeting any platform.
  • "SOCIAL_ENGINEERING" : Social engineering targeting any platform.
  • "UNWANTED_SOFTWARE" : Unwanted software targeting any platform.
  • "SOCIAL_ENGINEERING_EXTENDED_COVERAGE" : A list of extended coverage social engineering URIs targeting any platform.

versionToken - The current version token of the client for the requested list (the client version that was received from the last successful diff). If the client does not have a version token (this is the first time calling ComputeThreatListDiff), this may be left empty and a full database snapshot will be returned.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleCloudWebriskV1ComputeThreatListDiffResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<GoogleCloudWebriskV1ComputeThreatListDiffResponse> computeDiff({
  core.int? constraints_maxDatabaseEntries,
  core.int? constraints_maxDiffEntries,
  core.List<core.String>? constraints_supportedCompressions,
  core.String? threatType,
  core.String? versionToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (constraints_maxDatabaseEntries != null)
      'constraints.maxDatabaseEntries': ['${constraints_maxDatabaseEntries}'],
    if (constraints_maxDiffEntries != null)
      'constraints.maxDiffEntries': ['${constraints_maxDiffEntries}'],
    if (constraints_supportedCompressions != null)
      'constraints.supportedCompressions': constraints_supportedCompressions,
    if (threatType != null) 'threatType': [threatType],
    if (versionToken != null) 'versionToken': [versionToken],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v1/threatLists:computeDiff';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return GoogleCloudWebriskV1ComputeThreatListDiffResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}