/// <summary> /// Get Threat List Updates Asynchronously. /// </summary> /// <param name="this"> /// A <see cref="IBrowsingClient" />. /// </param> /// <param name="request"> /// A <see cref="ThreatListUpdateRequest" />. /// </param> /// <returns> /// A <see cref="ThreatListUpdateResponse" />. /// </returns> /// <exception cref="Gee.External.Browsing.Clients.BrowsingClientException"> /// Thrown if an error communicating with the Google Safe Browsing API occurs. /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="this" /> is a null reference, or if <paramref name="request" /> is a null /// reference. /// </exception> /// <exception cref="System.ObjectDisposedException"> /// Thrown if <paramref name="this" /> is disposed. /// </exception> /// <exception cref="System.TimeoutException"> /// Thrown if communication with the Google Safe Browsing API times out. /// </exception> public static Task <ThreatListUpdateResponse> GetThreatListUpdatesAsync(this IBrowsingClient @this, ThreatListUpdateRequest request) { Guard.ThrowIf(nameof(@this), @this).Null(); // ... // // Throws an exception if the operation fails. var getThreatListUpdatesTask = @this.GetThreatListUpdatesAsync(request, CancellationToken.None); return(getThreatListUpdatesTask); }
/// <summary> /// Get Threat List Updates Asynchronously. /// </summary> /// <param name="this"> /// A <see cref="IBrowsingClient" />. /// </param> /// <param name="threatList"> /// A <see cref="ThreatList" /> to retrieve. /// </param> /// <param name="updateConstraints"> /// The <see cref="ThreatListUpdateConstraints" /> to apply when <paramref name="threatList" /> is /// retrieved. A null reference indicates no <see cref="ThreatListUpdateConstraints" /> should be applied. /// </param> /// <param name="cancellationToken"> /// A cancellation token to cancel the asynchronous operation with. /// </param> /// <returns> /// A <see cref="ThreatListUpdateResponse" />. /// </returns> /// <exception cref="Gee.External.Browsing.Clients.BrowsingClientException"> /// Thrown if an error communicating with the Google Safe Browsing API occurs. /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="this" /> is a null reference, or if <paramref name="threatList" /> is a /// null reference. /// </exception> /// <exception cref="System.ObjectDisposedException"> /// Thrown if the <paramref name="this" /> is disposed. /// </exception> /// <exception cref="System.OperationCanceledException"> /// Thrown if the asynchronous operation is cancelled. /// </exception> /// <exception cref="System.TimeoutException"> /// Thrown if communication with the Google Safe Browsing API times out. /// </exception> public static Task <ThreatListUpdateResponse> GetThreatListUpdatesAsync(this IBrowsingClient @this, ThreatList threatList, ThreatListUpdateConstraints updateConstraints, CancellationToken cancellationToken) { Guard.ThrowIf(nameof(@this), @this).Null(); Guard.ThrowIf(nameof(threatList), threatList).Null(); var threatListUpdateRequestBuilder = ThreatListUpdateRequest.Build(); threatListUpdateRequestBuilder.AddQuery(b => { b.SetThreatListDescriptor(threatList.Descriptor); b.SetThreatListState(threatList.State); b.SetUpdateConstraints(updateConstraints); return(b.Build()); }); // ... // // Throws an exception if the operation fails. var threatListUpdateRequest = threatListUpdateRequestBuilder.Build(); var getThreatListUpdatesTask = @this.GetThreatListUpdatesAsync(threatListUpdateRequest, cancellationToken); return(getThreatListUpdatesTask); }
/// <summary> /// Get Threat List Updates Asynchronously. /// </summary> /// <param name="this"> /// A <see cref="IBrowsingClient" />. /// </param> /// <param name="threatList"> /// A <see cref="ThreatList" /> to retrieve. /// </param> /// <param name="updateConstraints"> /// The <see cref="ThreatListUpdateConstraints" /> to apply when <paramref name="threatList" /> is /// retrieved. A null reference indicates no <see cref="ThreatListUpdateConstraints" /> should be applied. /// </param> /// <returns> /// A <see cref="ThreatListUpdateResponse" />. /// </returns> /// <exception cref="Gee.External.Browsing.Clients.BrowsingClientException"> /// Thrown if an error communicating with the Google Safe Browsing API occurs. /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="this" /> is a null reference, or if <paramref name="threatList" /> is a /// null reference. /// </exception> /// <exception cref="System.ObjectDisposedException"> /// Thrown if the <paramref name="this" /> is disposed. /// </exception> /// <exception cref="System.TimeoutException"> /// Thrown if communication with the Google Safe Browsing API times out. /// </exception> public static Task <ThreatListUpdateResponse> GetThreatListUpdatesAsync(this IBrowsingClient @this, ThreatList threatList, ThreatListUpdateConstraints updateConstraints) => @this.GetThreatListUpdatesAsync(threatList, updateConstraints, CancellationToken.None);
/// <summary> /// Get Threat List Updates Asynchronously. /// </summary> /// <param name="this"> /// A <see cref="IBrowsingClient" />. /// </param> /// <param name="threatLists"> /// A collection of <see cref="ThreatList" /> to retrieve. /// </param> /// <returns> /// A <see cref="ThreatListUpdateResponse" />. /// </returns> /// <exception cref="Gee.External.Browsing.Clients.BrowsingClientException"> /// Thrown if an error communicating with the Google Safe Browsing API occurs. /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown if <paramref name="this" /> is a null reference, or if <paramref name="threatLists" /> is a /// null reference. /// </exception> /// <exception cref="System.ObjectDisposedException"> /// Thrown if the <paramref name="this" /> is disposed. /// </exception> /// <exception cref="System.TimeoutException"> /// Thrown if communication with the Google Safe Browsing API times out. /// </exception> public static Task <ThreatListUpdateResponse> GetThreatListUpdatesAsync(this IBrowsingClient @this, IEnumerable <ThreatList> threatLists) => @this.GetThreatListUpdatesAsync(threatLists, CancellationToken.None);