Exemplo n.º 1
0
        /// <summary>
        ///     Use a HTTP Client.
        /// </summary>
        /// <param name="apiKey">
        ///     A Google Safe Browsing API key to authenticate to the Google Safe Browsing API with.
        /// </param>
        /// <remarks>
        ///     Use an <see cref="HttpBrowsingClient" /> to communicate with the Google Safe Browsing API. The
        ///     <see cref="BaseBrowsingService" /> takes ownership of the HTTP client and will dispose it when the
        ///     service itself is disposed.
        /// </remarks>
        /// <returns>
        ///     This service builder.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="apiKey" /> is a null reference.
        /// </exception>
        public T UseHttpClient(string apiKey)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            var httpClient = new HttpBrowsingClient(apiKey);

            this.SetClient(httpClient, true);
            return((T)this);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Use an HTTP Client.
        /// </summary>
        /// <remarks>
        ///     Use an <see cref="HttpBrowsingClient" /> to communicate with the Google Safe Browsing API. The
        ///     <see cref="BrowsingDatabaseManager" /> takes ownership of the HTTP client and will dispose it when the
        ///     database manager itself is disposed.
        /// </remarks>
        /// <param name="apiKey">
        ///     A Google Safe Browsing API key to authenticate to the Google Safe Browsing API with.
        /// </param>
        /// <returns>
        ///     This database manager builder.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="apiKey" /> is a null reference.
        /// </exception>
        public BrowsingDatabaseManagerBuilder UseHttpClient(string apiKey)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            var httpClient = new HttpBrowsingClient(apiKey);

            this.SetClient(httpClient, true);
            return(this);
        }