Google Cloud Web Risk v1 API - Class WebRiskServiceClient (2.5.0)

public abstract class WebRiskServiceClient

Reference documentation and code samples for the Google Cloud Web Risk v1 API class WebRiskServiceClient.

WebRiskService client wrapper, for convenient use.

Inheritance

object > WebRiskServiceClient

Derived Types

Namespace

Google.Cloud.WebRisk.V1

Assembly

Google.Cloud.WebRisk.V1.dll

Remarks

Web Risk 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 WebRiskService service, which is a host of "webrisk.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default WebRiskService scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default WebRiskService scopes are:

GrpcClient

public virtual WebRiskService.WebRiskServiceClient GrpcClient { get; }

The underlying gRPC WebRiskService client

Property Value
TypeDescription
WebRiskServiceWebRiskServiceClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

SubmitUriOperationsClient

public virtual OperationsClient SubmitUriOperationsClient { get; }

The long-running operations client for SubmitUri.

Property Value
TypeDescription
OperationsClient

Methods

ComputeThreatListDiff(ComputeThreatListDiffRequest, CallSettings)

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

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.

Parameters
NameDescription
requestComputeThreatListDiffRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ComputeThreatListDiffResponse

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.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 = webRiskServiceClient.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. 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.

Parameters
NameDescription
threatTypeThreatType

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.

versionTokenByteString

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.

constraintsComputeThreatListDiffRequestTypesConstraints

Required. The constraints associated with this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ComputeThreatListDiffResponse

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.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 = webRiskServiceClient.ComputeThreatListDiff(threatType, versionToken, constraints);

ComputeThreatListDiffAsync(ComputeThreatListDiffRequest, CallSettings)

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

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.

Parameters
NameDescription
requestComputeThreatListDiffRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.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 webRiskServiceClient.ComputeThreatListDiffAsync(request);

ComputeThreatListDiffAsync(ComputeThreatListDiffRequest, CancellationToken)

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

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.

Parameters
NameDescription
requestComputeThreatListDiffRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.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 webRiskServiceClient.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. 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.

Parameters
NameDescription
threatTypeThreatType

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.

versionTokenByteString

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.

constraintsComputeThreatListDiffRequestTypesConstraints

Required. The constraints associated with this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.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 webRiskServiceClient.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. 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.

Parameters
NameDescription
threatTypeThreatType

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.

versionTokenByteString

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.

constraintsComputeThreatListDiffRequestTypesConstraints

Required. The constraints associated with this request.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskComputeThreatListDiffResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.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 webRiskServiceClient.ComputeThreatListDiffAsync(threatType, versionToken, constraints);

Create()

public static WebRiskServiceClient Create()

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

Returns
TypeDescription
WebRiskServiceClient

The created WebRiskServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskWebRiskServiceClient

The task representing the created WebRiskServiceClient.

CreateSubmission(ProjectName, Submission, CallSettings)

public virtual Submission CreateSubmission(ProjectName parent, Submission submission, CallSettings callSettings = null)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
parentProjectName

Required. The name of the project that is making the submission. This string is in the format "projects/{project_number}".

submissionSubmission

Required. The submission that contains the content of the phishing report.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Submission

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Submission submission = new Submission();
// Make the request
Submission response = webRiskServiceClient.CreateSubmission(parent, submission);

CreateSubmission(CreateSubmissionRequest, CallSettings)

public virtual Submission CreateSubmission(CreateSubmissionRequest request, CallSettings callSettings = null)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
requestCreateSubmissionRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Submission

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
CreateSubmissionRequest request = new CreateSubmissionRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Submission = new Submission(),
};
// Make the request
Submission response = webRiskServiceClient.CreateSubmission(request);

CreateSubmission(string, Submission, CallSettings)

public virtual Submission CreateSubmission(string parent, Submission submission, CallSettings callSettings = null)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
parentstring

Required. The name of the project that is making the submission. This string is in the format "projects/{project_number}".

submissionSubmission

Required. The submission that contains the content of the phishing report.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Submission

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Submission submission = new Submission();
// Make the request
Submission response = webRiskServiceClient.CreateSubmission(parent, submission);

CreateSubmissionAsync(ProjectName, Submission, CallSettings)

public virtual Task<Submission> CreateSubmissionAsync(ProjectName parent, Submission submission, CallSettings callSettings = null)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
parentProjectName

Required. The name of the project that is making the submission. This string is in the format "projects/{project_number}".

submissionSubmission

Required. The submission that contains the content of the phishing report.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSubmission

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Submission submission = new Submission();
// Make the request
Submission response = await webRiskServiceClient.CreateSubmissionAsync(parent, submission);

CreateSubmissionAsync(ProjectName, Submission, CancellationToken)

public virtual Task<Submission> CreateSubmissionAsync(ProjectName parent, Submission submission, CancellationToken cancellationToken)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
parentProjectName

Required. The name of the project that is making the submission. This string is in the format "projects/{project_number}".

submissionSubmission

Required. The submission that contains the content of the phishing report.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSubmission

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
Submission submission = new Submission();
// Make the request
Submission response = await webRiskServiceClient.CreateSubmissionAsync(parent, submission);

CreateSubmissionAsync(CreateSubmissionRequest, CallSettings)

public virtual Task<Submission> CreateSubmissionAsync(CreateSubmissionRequest request, CallSettings callSettings = null)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
requestCreateSubmissionRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSubmission

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
CreateSubmissionRequest request = new CreateSubmissionRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Submission = new Submission(),
};
// Make the request
Submission response = await webRiskServiceClient.CreateSubmissionAsync(request);

CreateSubmissionAsync(CreateSubmissionRequest, CancellationToken)

public virtual Task<Submission> CreateSubmissionAsync(CreateSubmissionRequest request, CancellationToken cancellationToken)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
requestCreateSubmissionRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSubmission

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
CreateSubmissionRequest request = new CreateSubmissionRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Submission = new Submission(),
};
// Make the request
Submission response = await webRiskServiceClient.CreateSubmissionAsync(request);

CreateSubmissionAsync(string, Submission, CallSettings)

public virtual Task<Submission> CreateSubmissionAsync(string parent, Submission submission, CallSettings callSettings = null)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
parentstring

Required. The name of the project that is making the submission. This string is in the format "projects/{project_number}".

submissionSubmission

Required. The submission that contains the content of the phishing report.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSubmission

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Submission submission = new Submission();
// Make the request
Submission response = await webRiskServiceClient.CreateSubmissionAsync(parent, submission);

CreateSubmissionAsync(string, Submission, CancellationToken)

public virtual Task<Submission> CreateSubmissionAsync(string parent, Submission submission, CancellationToken cancellationToken)

Creates a Submission of a URI suspected of containing phishing content to be reviewed. If the result verifies the existence of malicious phishing content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
parentstring

Required. The name of the project that is making the submission. This string is in the format "projects/{project_number}".

submissionSubmission

Required. The submission that contains the content of the phishing report.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSubmission

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
Submission submission = new Submission();
// Make the request
Submission response = await webRiskServiceClient.CreateSubmissionAsync(parent, submission);

PollOnceSubmitUri(string, CallSettings)

public virtual Operation<Submission, SubmitUriMetadata> PollOnceSubmitUri(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of SubmitUri.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationSubmissionSubmitUriMetadata

The result of polling the operation.

PollOnceSubmitUriAsync(string, CallSettings)

public virtual Task<Operation<Submission, SubmitUriMetadata>> PollOnceSubmitUriAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of SubmitUri.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationSubmissionSubmitUriMetadata

A task representing the result of polling the operation.

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
NameDescription
requestSearchHashesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SearchHashesResponse

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
SearchHashesRequest request = new SearchHashesRequest
{
    HashPrefix = ByteString.Empty,
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchHashesResponse response = webRiskServiceClient.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
NameDescription
hashPrefixByteString

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded. Note that if this parameter is provided by a URI, it must be encoded using the web safe base64 variant (RFC 4648).

threatTypesIEnumerableThreatType

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SearchHashesResponse

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
ByteString hashPrefix = ByteString.Empty;
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchHashesResponse response = webRiskServiceClient.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
NameDescription
requestSearchHashesRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
SearchHashesRequest request = new SearchHashesRequest
{
    HashPrefix = ByteString.Empty,
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchHashesResponse response = await webRiskServiceClient.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
NameDescription
requestSearchHashesRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
SearchHashesRequest request = new SearchHashesRequest
{
    HashPrefix = ByteString.Empty,
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchHashesResponse response = await webRiskServiceClient.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
NameDescription
hashPrefixByteString

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded. Note that if this parameter is provided by a URI, it must be encoded using the web safe base64 variant (RFC 4648).

threatTypesIEnumerableThreatType

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
ByteString hashPrefix = ByteString.Empty;
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchHashesResponse response = await webRiskServiceClient.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
NameDescription
hashPrefixByteString

A hash prefix, consisting of the most significant 4-32 bytes of a SHA256 hash. For JSON requests, this field is base64-encoded. Note that if this parameter is provided by a URI, it must be encoded using the web safe base64 variant (RFC 4648).

threatTypesIEnumerableThreatType

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSearchHashesResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
ByteString hashPrefix = ByteString.Empty;
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchHashesResponse response = await webRiskServiceClient.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. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.

Parameters
NameDescription
requestSearchUrisRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SearchUrisResponse

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
SearchUrisRequest request = new SearchUrisRequest
{
    Uri = "",
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchUrisResponse response = webRiskServiceClient.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. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.

Parameters
NameDescription
uristring

Required. The URI to be checked for matches.

threatTypesIEnumerableThreatType

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
SearchUrisResponse

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
string uri = "";
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchUrisResponse response = webRiskServiceClient.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. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.

Parameters
NameDescription
requestSearchUrisRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
SearchUrisRequest request = new SearchUrisRequest
{
    Uri = "",
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchUrisResponse response = await webRiskServiceClient.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. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.

Parameters
NameDescription
requestSearchUrisRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
SearchUrisRequest request = new SearchUrisRequest
{
    Uri = "",
    ThreatTypes =
    {
        ThreatType.Unspecified,
    },
};
// Make the request
SearchUrisResponse response = await webRiskServiceClient.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. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.

Parameters
NameDescription
uristring

Required. The URI to be checked for matches.

threatTypesIEnumerableThreatType

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
string uri = "";
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchUrisResponse response = await webRiskServiceClient.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. Multiple threatLists may be searched in a single query. The response will list all requested threatLists the URI was found to match. If the URI is not found on any of the requested ThreatList an empty response will be returned.

Parameters
NameDescription
uristring

Required. The URI to be checked for matches.

threatTypesIEnumerableThreatType

Required. The ThreatLists to search in. Multiple ThreatLists may be specified.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskSearchUrisResponse

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
string uri = "";
IEnumerable<ThreatType> threatTypes = new ThreatType[]
{
    ThreatType.Unspecified,
};
// Make the request
SearchUrisResponse response = await webRiskServiceClient.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
TypeDescription
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.

SubmitUri(SubmitUriRequest, CallSettings)

public virtual Operation<Submission, SubmitUriMetadata> SubmitUri(SubmitUriRequest request, CallSettings callSettings = null)

Submits a URI suspected of containing malicious content to be reviewed. Returns a google.longrunning.Operation which, once the review is complete, is updated with its result. You can use the Pub/Sub API to receive notifications for the returned Operation. If the result verifies the existence of malicious content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
requestSubmitUriRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationSubmissionSubmitUriMetadata

The RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = WebRiskServiceClient.Create();
// Initialize request argument(s)
SubmitUriRequest request = new SubmitUriRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Submission = new Submission(),
    ThreatInfo = new ThreatInfo(),
    ThreatDiscovery = new ThreatDiscovery(),
};
// Make the request
Operation<Submission, SubmitUriMetadata> response = webRiskServiceClient.SubmitUri(request);

// Poll until the returned long-running operation is complete
Operation<Submission, SubmitUriMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Submission result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Submission, SubmitUriMetadata> retrievedResponse = webRiskServiceClient.PollOnceSubmitUri(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Submission retrievedResult = retrievedResponse.Result;
}

SubmitUriAsync(SubmitUriRequest, CallSettings)

public virtual Task<Operation<Submission, SubmitUriMetadata>> SubmitUriAsync(SubmitUriRequest request, CallSettings callSettings = null)

Submits a URI suspected of containing malicious content to be reviewed. Returns a google.longrunning.Operation which, once the review is complete, is updated with its result. You can use the Pub/Sub API to receive notifications for the returned Operation. If the result verifies the existence of malicious content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
requestSubmitUriRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationSubmissionSubmitUriMetadata

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
SubmitUriRequest request = new SubmitUriRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Submission = new Submission(),
    ThreatInfo = new ThreatInfo(),
    ThreatDiscovery = new ThreatDiscovery(),
};
// Make the request
Operation<Submission, SubmitUriMetadata> response = await webRiskServiceClient.SubmitUriAsync(request);

// Poll until the returned long-running operation is complete
Operation<Submission, SubmitUriMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Submission result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Submission, SubmitUriMetadata> retrievedResponse = await webRiskServiceClient.PollOnceSubmitUriAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Submission retrievedResult = retrievedResponse.Result;
}

SubmitUriAsync(SubmitUriRequest, CancellationToken)

public virtual Task<Operation<Submission, SubmitUriMetadata>> SubmitUriAsync(SubmitUriRequest request, CancellationToken cancellationToken)

Submits a URI suspected of containing malicious content to be reviewed. Returns a google.longrunning.Operation which, once the review is complete, is updated with its result. You can use the Pub/Sub API to receive notifications for the returned Operation. If the result verifies the existence of malicious content, the site will be added to the Google's Social Engineering lists in order to protect users that could get exposed to this threat in the future. Only allowlisted projects can use this method during Early Access. Please reach out to Sales or your customer engineer to obtain access.

Parameters
NameDescription
requestSubmitUriRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationSubmissionSubmitUriMetadata

A Task containing the RPC response.

Example
// Create client
WebRiskServiceClient webRiskServiceClient = await WebRiskServiceClient.CreateAsync();
// Initialize request argument(s)
SubmitUriRequest request = new SubmitUriRequest
{
    ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
    Submission = new Submission(),
    ThreatInfo = new ThreatInfo(),
    ThreatDiscovery = new ThreatDiscovery(),
};
// Make the request
Operation<Submission, SubmitUriMetadata> response = await webRiskServiceClient.SubmitUriAsync(request);

// Poll until the returned long-running operation is complete
Operation<Submission, SubmitUriMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Submission result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Submission, SubmitUriMetadata> retrievedResponse = await webRiskServiceClient.PollOnceSubmitUriAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Submission retrievedResult = retrievedResponse.Result;
}