Google Cloud Web Risk v1beta1 API - Class WebRiskServiceV1Beta1Client (3.0.0-beta04)

public abstract class WebRiskServiceV1Beta1Client

Reference documentation and code samples for the Google Cloud Web Risk v1beta1 API class WebRiskServiceV1Beta1Client.

WebRiskServiceV1Beta1 client wrapper, for convenient use.

Inheritance

object > WebRiskServiceV1Beta1Client

Namespace

Google.Cloud.WebRisk.V1Beta1

Assembly

Google.Cloud.WebRisk.V1Beta1.dll

Remarks

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

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the WebRiskServiceV1Beta1 service, which is a host of "webrisk.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default WebRiskServiceV1Beta1 scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default WebRiskServiceV1Beta1 scopes are:

GrpcClient

public virtual WebRiskServiceV1Beta1.WebRiskServiceV1Beta1Client GrpcClient { get; }

The underlying gRPC WebRiskServiceV1Beta1 client

Property Value
Type Description
WebRiskServiceV1Beta1WebRiskServiceV1Beta1Client

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

ComputeThreatListDiff(ComputeThreatListDiffRequest, CallSettings)

public virtual ComputeThreatListDiffResponse ComputeThreatListDiff(ComputeThreatListDiffRequest request, CallSettings callSettings = null)

Gets the most recent threat list diffs.

Parameters
Name Description
request ComputeThreatListDiffRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ComputeThreatListDiffResponse

The RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
// Initialize request argument(s)
ComputeThreatListDiffRequest request = new ComputeThreatListDiffRequest
{
    ThreatType = ThreatType.Unspecified,
    VersionToken = ByteString.Empty,
    Constraints = new ComputeThreatListDiffRequest.Types.Constraints(),
};
// Make the request
ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client.ComputeThreatListDiff(request);

ComputeThreatListDiff(ThreatType, ByteString, Constraints, CallSettings)

public virtual ComputeThreatListDiffResponse ComputeThreatListDiff(ThreatType threatType, ByteString versionToken, ComputeThreatListDiffRequest.Types.Constraints constraints, CallSettings callSettings = null)

Gets the most recent threat list diffs.

Parameters
Name Description
threatType ThreatType

The ThreatList to update.

versionToken ByteString

The current version token of the client for the requested list (the client version that was received from the last successful diff).

constraints ComputeThreatListDiffRequestTypesConstraints

Required. The constraints associated with this request.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ComputeThreatListDiffResponse

The RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
// Initialize request argument(s)
ThreatType threatType = ThreatType.Unspecified;
ByteString versionToken = ByteString.Empty;
ComputeThreatListDiffRequest.Types.Constraints constraints = new ComputeThreatListDiffRequest.Types.Constraints();
// Make the request
ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client.ComputeThreatListDiff(threatType, versionToken, constraints);

ComputeThreatListDiffAsync(ComputeThreatListDiffRequest, CallSettings)

public virtual Task<ComputeThreatListDiffResponse> ComputeThreatListDiffAsync(ComputeThreatListDiffRequest request, CallSettings callSettings = null)

Gets the most recent threat list diffs.

Parameters
Name Description
request ComputeThreatListDiffRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
ComputeThreatListDiffRequest request = new ComputeThreatListDiffRequest
{
    ThreatType = ThreatType.Unspecified,
    VersionToken = ByteString.Empty,
    Constraints = new ComputeThreatListDiffRequest.Types.Constraints(),
};
// Make the request
ComputeThreatListDiffResponse response = await webRiskServiceV1Beta1Client.ComputeThreatListDiffAsync(request);

ComputeThreatListDiffAsync(ComputeThreatListDiffRequest, CancellationToken)

public virtual Task<ComputeThreatListDiffResponse> ComputeThreatListDiffAsync(ComputeThreatListDiffRequest request, CancellationToken cancellationToken)

Gets the most recent threat list diffs.

Parameters
Name Description
request ComputeThreatListDiffRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
ComputeThreatListDiffRequest request = new ComputeThreatListDiffRequest
{
    ThreatType = ThreatType.Unspecified,
    VersionToken = ByteString.Empty,
    Constraints = new ComputeThreatListDiffRequest.Types.Constraints(),
};
// Make the request
ComputeThreatListDiffResponse response = await webRiskServiceV1Beta1Client.ComputeThreatListDiffAsync(request);

ComputeThreatListDiffAsync(ThreatType, ByteString, Constraints, CallSettings)

public virtual Task<ComputeThreatListDiffResponse> ComputeThreatListDiffAsync(ThreatType threatType, ByteString versionToken, ComputeThreatListDiffRequest.Types.Constraints constraints, CallSettings callSettings = null)

Gets the most recent threat list diffs.

Parameters
Name Description
threatType ThreatType

The ThreatList to update.

versionToken ByteString

The current version token of the client for the requested list (the client version that was received from the last successful diff).

constraints ComputeThreatListDiffRequestTypesConstraints

Required. The constraints associated with this request.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
ThreatType threatType = ThreatType.Unspecified;
ByteString versionToken = ByteString.Empty;
ComputeThreatListDiffRequest.Types.Constraints constraints = new ComputeThreatListDiffRequest.Types.Constraints();
// Make the request
ComputeThreatListDiffResponse response = await webRiskServiceV1Beta1Client.ComputeThreatListDiffAsync(threatType, versionToken, constraints);

ComputeThreatListDiffAsync(ThreatType, ByteString, Constraints, CancellationToken)

public virtual Task<ComputeThreatListDiffResponse> ComputeThreatListDiffAsync(ThreatType threatType, ByteString versionToken, ComputeThreatListDiffRequest.Types.Constraints constraints, CancellationToken cancellationToken)

Gets the most recent threat list diffs.

Parameters
Name Description
threatType ThreatType

The ThreatList to update.

versionToken ByteString

The current version token of the client for the requested list (the client version that was received from the last successful diff).

constraints ComputeThreatListDiffRequestTypesConstraints

Required. The constraints associated with this request.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
ThreatType threatType = ThreatType.Unspecified;
ByteString versionToken = ByteString.Empty;
ComputeThreatListDiffRequest.Types.Constraints constraints = new ComputeThreatListDiffRequest.Types.Constraints();
// Make the request
ComputeThreatListDiffResponse response = await webRiskServiceV1Beta1Client.ComputeThreatListDiffAsync(threatType, versionToken, constraints);

Create()

public static WebRiskServiceV1Beta1Client Create()

Synchronously creates a WebRiskServiceV1Beta1Client using the default credentials, endpoint and settings. To specify custom credentials or other settings, use WebRiskServiceV1Beta1ClientBuilder.

Returns
Type Description
WebRiskServiceV1Beta1Client

The created WebRiskServiceV1Beta1Client.

CreateAsync(CancellationToken)

public static Task<WebRiskServiceV1Beta1Client> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a WebRiskServiceV1Beta1Client using the default credentials, endpoint and settings. To specify custom credentials or other settings, use WebRiskServiceV1Beta1ClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskWebRiskServiceV1Beta1Client

The task representing the created WebRiskServiceV1Beta1Client.

SearchHashes(SearchHashesRequest, CallSettings)

public virtual SearchHashesResponse SearchHashes(SearchHashesRequest request, CallSettings callSettings = null)

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
Name Description
request SearchHashesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SearchHashesResponse

The RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
// Initialize request argument(s)
SearchHashesRequest request = new SearchHashesRequest
{
    HashPrefix = ByteString.Empty,
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchHashesResponse response = webRiskServiceV1Beta1Client.SearchHashes(request);

SearchHashes(ByteString, IEnumerable<ThreatType>, CallSettings)

public virtual SearchHashesResponse SearchHashes(ByteString hashPrefix, IEnumerable<ThreatType> threatTypes, CallSettings callSettings = null)

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
Name Description
hashPrefix ByteString

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded.

threatTypes IEnumerableThreatType

Required. The ThreatLists to search in.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SearchHashesResponse

The RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
// Initialize request argument(s)
ByteString hashPrefix = ByteString.Empty;
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchHashesResponse response = webRiskServiceV1Beta1Client.SearchHashes(hashPrefix, threatTypes);

SearchHashesAsync(SearchHashesRequest, CallSettings)

public virtual Task<SearchHashesResponse> SearchHashesAsync(SearchHashesRequest request, CallSettings callSettings = null)

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
Name Description
request SearchHashesRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
SearchHashesRequest request = new SearchHashesRequest
{
    HashPrefix = ByteString.Empty,
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchHashesResponse response = await webRiskServiceV1Beta1Client.SearchHashesAsync(request);

SearchHashesAsync(SearchHashesRequest, CancellationToken)

public virtual Task<SearchHashesResponse> SearchHashesAsync(SearchHashesRequest request, CancellationToken cancellationToken)

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
Name Description
request SearchHashesRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
SearchHashesRequest request = new SearchHashesRequest
{
    HashPrefix = ByteString.Empty,
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchHashesResponse response = await webRiskServiceV1Beta1Client.SearchHashesAsync(request);

SearchHashesAsync(ByteString, IEnumerable<ThreatType>, CallSettings)

public virtual Task<SearchHashesResponse> SearchHashesAsync(ByteString hashPrefix, IEnumerable<ThreatType> threatTypes, CallSettings callSettings = null)

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
Name Description
hashPrefix ByteString

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded.

threatTypes IEnumerableThreatType

Required. The ThreatLists to search in.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
ByteString hashPrefix = ByteString.Empty;
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchHashesResponse response = await webRiskServiceV1Beta1Client.SearchHashesAsync(hashPrefix, threatTypes);

SearchHashesAsync(ByteString, IEnumerable<ThreatType>, CancellationToken)

public virtual Task<SearchHashesResponse> SearchHashesAsync(ByteString hashPrefix, IEnumerable<ThreatType> threatTypes, CancellationToken cancellationToken)

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
Name Description
hashPrefix ByteString

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded.

threatTypes IEnumerableThreatType

Required. The ThreatLists to search in.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
ByteString hashPrefix = ByteString.Empty;
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchHashesResponse response = await webRiskServiceV1Beta1Client.SearchHashesAsync(hashPrefix, threatTypes);

SearchUris(SearchUrisRequest, CallSettings)

public virtual SearchUrisResponse SearchUris(SearchUrisRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request SearchUrisRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SearchUrisResponse

The RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
// Initialize request argument(s)
SearchUrisRequest request = new SearchUrisRequest
{
    Uri = "",
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchUrisResponse response = webRiskServiceV1Beta1Client.SearchUris(request);

SearchUris(string, IEnumerable<ThreatType>, CallSettings)

public virtual SearchUrisResponse SearchUris(string uri, IEnumerable<ThreatType> threatTypes, CallSettings callSettings = null)

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

Parameters
Name Description
uri string

Required. The URI to be checked for matches.

threatTypes IEnumerableThreatType

Required. The ThreatLists to search in.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SearchUrisResponse

The RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client.Create();
// Initialize request argument(s)
string uri = "";
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchUrisResponse response = webRiskServiceV1Beta1Client.SearchUris(uri, threatTypes);

SearchUrisAsync(SearchUrisRequest, CallSettings)

public virtual Task<SearchUrisResponse> SearchUrisAsync(SearchUrisRequest request, CallSettings callSettings = null)

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

Parameters
Name Description
request SearchUrisRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
SearchUrisRequest request = new SearchUrisRequest
{
    Uri = "",
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchUrisResponse response = await webRiskServiceV1Beta1Client.SearchUrisAsync(request);

SearchUrisAsync(SearchUrisRequest, CancellationToken)

public virtual Task<SearchUrisResponse> SearchUrisAsync(SearchUrisRequest request, CancellationToken cancellationToken)

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

Parameters
Name Description
request SearchUrisRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
SearchUrisRequest request = new SearchUrisRequest
{
    Uri = "",
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchUrisResponse response = await webRiskServiceV1Beta1Client.SearchUrisAsync(request);

SearchUrisAsync(string, IEnumerable<ThreatType>, CallSettings)

public virtual Task<SearchUrisResponse> SearchUrisAsync(string uri, IEnumerable<ThreatType> threatTypes, CallSettings callSettings = null)

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

Parameters
Name Description
uri string

Required. The URI to be checked for matches.

threatTypes IEnumerableThreatType

Required. The ThreatLists to search in.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
string uri = "";
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchUrisResponse response = await webRiskServiceV1Beta1Client.SearchUrisAsync(uri, threatTypes);

SearchUrisAsync(string, IEnumerable<ThreatType>, CancellationToken)

public virtual Task<SearchUrisResponse> SearchUrisAsync(string uri, IEnumerable<ThreatType> threatTypes, CancellationToken cancellationToken)

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

Parameters
Name Description
uri string

Required. The URI to be checked for matches.

threatTypes IEnumerableThreatType

Required. The ThreatLists to search in.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = await WebRiskServiceV1Beta1Client.CreateAsync();
// Initialize request argument(s)
string uri = "";
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchUrisResponse response = await webRiskServiceV1Beta1Client.SearchUrisAsync(uri, threatTypes);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.