get method

Future<GoogleSecuritySafebrowsingV5HashList> get(
  1. String name, {
  2. int? sizeConstraints_maxDatabaseEntries,
  3. int? sizeConstraints_maxUpdateEntries,
  4. String? version,
  5. String? $fields,
})

Get the latest contents of a hash list.

A hash list may either by a threat list or a non-threat list such as the Global Cache. This is a standard Get method as defined by https://google.aip.dev/131 and the HTTP method is also GET.

Request parameters:

name - Required. The name of this particular hash list. It may be a threat list, or it may be the Global Cache.

sizeConstraints_maxDatabaseEntries - Sets the maximum number of entries that the client is willing to have in the local database for the list. (The server MAY cause the client to store less than this number of entries.) If omitted or zero, no database size limit is set.

sizeConstraints_maxUpdateEntries - The maximum size in number of entries. The update will not contain more entries than this value, but it is possible that the update will contain fewer entries than this value. This MUST be at least 1024. If omitted or zero, no update size limit is set.

version - The version of the hash list that the client already has. If this is the first time the client is fetching the hash list, this field MUST be left empty. Otherwise, the client SHOULD supply the version previously received from the server. The client MUST NOT manipulate those bytes. What's new in V5: in V4 of the API, this was called states; it is now renamed to version for clarity.

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

Completes with a GoogleSecuritySafebrowsingV5HashList.

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<GoogleSecuritySafebrowsingV5HashList> get(
  core.String name, {
  core.int? sizeConstraints_maxDatabaseEntries,
  core.int? sizeConstraints_maxUpdateEntries,
  core.String? version,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (sizeConstraints_maxDatabaseEntries != null)
      'sizeConstraints.maxDatabaseEntries': [
        '${sizeConstraints_maxDatabaseEntries}',
      ],
    if (sizeConstraints_maxUpdateEntries != null)
      'sizeConstraints.maxUpdateEntries': [
        '${sizeConstraints_maxUpdateEntries}',
      ],
    if (version != null) 'version': [version],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v5/hashList/' + commons.escapeVariable('$name');

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