Class v1beta1.WebRiskServiceV1Beta1Client (4.0.2)

Web Risk v1beta1 API defines an interface to detect malicious URLs on your website and in client applications. v1beta1

Package

@google-cloud/web-risk

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of WebRiskServiceV1Beta1Client.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new WebRiskServiceV1Beta1Client({fallback: true}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

webRiskServiceV1Beta1Stub

webRiskServiceV1Beta1Stub?: Promise<{
        [name: string]: Function;
    }>;

Methods

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

computeThreatListDiff(request, options)

computeThreatListDiff(request?: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, options?: CallOptions): Promise<[
        protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse,
        (protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest | undefined),
        {} | undefined
    ]>;

Gets the most recent threat list diffs.

Parameters
NameDescription
request IComputeThreatListDiffRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, (protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The ThreatList to update.
   */
  // const threatType = {}
  /**
   *  The current version token of the client for the requested list (the
   *  client version that was received from the last successful diff).
   */
  // const versionToken = Buffer.from('string')
  /**
   *  Required. The constraints associated with this request.
   */
  // const constraints = {}

  // Imports the Webrisk library
  const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1;

  // Instantiates a client
  const webriskClient = new WebRiskServiceV1Beta1Client();

  async function callComputeThreatListDiff() {
    // Construct request
    const request = {
      threatType,
      constraints,
    };

    // Run request
    const response = await webriskClient.computeThreatListDiff(request);
    console.log(response);
  }

  callComputeThreatListDiff();

computeThreatListDiff(request, options, callback)

computeThreatListDiff(request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, options: CallOptions, callback: Callback<protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IComputeThreatListDiffRequest
options CallOptions
callback Callback<protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

computeThreatListDiff(request, callback)

computeThreatListDiff(request: protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest, callback: Callback<protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IComputeThreatListDiffRequest
callback Callback<protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffResponse, protos.google.cloud.webrisk.v1beta1.IComputeThreatListDiffRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

searchHashes(request, options)

searchHashes(request?: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse,
        protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | undefined,
        {} | undefined
    ]>;

Gets the full hashes that match the requested hash prefix. This is used after a hash prefix is looked up in a threatList and there is a match. The client side threatList only holds partial hashes so the client must query this method to determine if there is a full hash match of a threat.

Parameters
NameDescription
request ISearchHashesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
   *  hash. For JSON requests, this field is base64-encoded.
   */
  // const hashPrefix = Buffer.from('string')
  /**
   *  Required. The ThreatLists to search in.
   */
  // const threatTypes = [1,2,3,4]

  // Imports the Webrisk library
  const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1;

  // Instantiates a client
  const webriskClient = new WebRiskServiceV1Beta1Client();

  async function callSearchHashes() {
    // Construct request
    const request = {
      threatTypes,
    };

    // Run request
    const response = await webriskClient.searchHashes(request);
    console.log(response);
  }

  callSearchHashes();

searchHashes(request, options, callback)

searchHashes(request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, options: CallOptions, callback: Callback<protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISearchHashesRequest
options CallOptions
callback Callback<protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

searchHashes(request, callback)

searchHashes(request: protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest, callback: Callback<protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISearchHashesRequest
callback Callback<protos.google.cloud.webrisk.v1beta1.ISearchHashesResponse, protos.google.cloud.webrisk.v1beta1.ISearchHashesRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

searchUris(request, options)

searchUris(request?: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, options?: CallOptions): Promise<[
        protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse,
        protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | undefined,
        {} | undefined
    ]>;

This method is used to check whether a URI is on a given threatList.

Parameters
NameDescription
request ISearchUrisRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The URI to be checked for matches.
   */
  // const uri = 'abc123'
  /**
   *  Required. The ThreatLists to search in.
   */
  // const threatTypes = [1,2,3,4]

  // Imports the Webrisk library
  const {WebRiskServiceV1Beta1Client} = require('@google-cloud/web-risk').v1beta1;

  // Instantiates a client
  const webriskClient = new WebRiskServiceV1Beta1Client();

  async function callSearchUris() {
    // Construct request
    const request = {
      uri,
      threatTypes,
    };

    // Run request
    const response = await webriskClient.searchUris(request);
    console.log(response);
  }

  callSearchUris();

searchUris(request, options, callback)

searchUris(request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, options: CallOptions, callback: Callback<protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISearchUrisRequest
options CallOptions
callback Callback<protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

searchUris(request, callback)

searchUris(request: protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest, callback: Callback<protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ISearchUrisRequest
callback Callback<protos.google.cloud.webrisk.v1beta1.ISearchUrisResponse, protos.google.cloud.webrisk.v1beta1.ISearchUrisRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void