Esempio n. 1
0
        /// <summary>
        ///     Set Query.
        /// </summary>
        /// <param name="value">
        ///     The <see cref="ThreatListUpdateQuery" /> made to the Google Safe Browsing API for which the threat
        ///     list update result has been returned.
        /// </param>
        /// <returns>
        ///     This threat list update result builder.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="value" /> is a null reference.
        /// </exception>
        public ThreatListUpdateResultBuilder SetQuery(ThreatListUpdateQuery value)
        {
            Guard.ThrowIf(nameof(value), value).Null();

            this.Query = value;
            return(this);
        }
Esempio n. 2
0
        /// <summary>
        ///     Add a Query.
        /// </summary>
        /// <param name="value">
        ///     A <see cref="ThreatListUpdateQuery" /> indicating a <see cref="ThreatList" /> to retrieve.
        /// </param>
        /// <returns>
        ///     This threat list update request builder.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="value" /> is a null reference.
        /// </exception>
        public ThreatListUpdateRequestBuilder AddQuery(ThreatListUpdateQuery value)
        {
            Guard.ThrowIf(nameof(value), value).Null();

            this.Queries.Add(value);
            return(this);
        }
Esempio n. 3
0
        /// <summary>
        ///     Set Query.
        /// </summary>
        /// <param name="valueAction">
        ///     An action to create the <see cref="ThreatListUpdateQuery" /> made to the Google Safe Browsing API for
        ///     which the threat list update result has been returned.
        /// </param>
        /// <returns>
        ///     This threat list update result builder.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">
        ///     Thrown if <paramref name="valueAction" /> is a null reference.
        /// </exception>
        public ThreatListUpdateResultBuilder SetQuery(Func <ThreatListUpdateQueryBuilder, ThreatListUpdateQuery> valueAction)
        {
            Guard.ThrowIf(nameof(valueAction), valueAction).Null();

            // ...
            //
            // Throws an exception if the operation fails.
            var threatListUpdateQueryBuilder = ThreatListUpdateQuery.Build();
            var threatListUpdateQuery        = valueAction(threatListUpdateQueryBuilder);

            this.SetQuery(threatListUpdateQuery);

            return(this);
        }
Esempio n. 4
0
        /// <summary>
        ///     Build a Threat List Update Query.
        /// </summary>
        /// <returns>
        ///     A <see cref="ThreatListUpdateQuery" />.
        /// </returns>
        public ThreatListUpdateQuery Build()
        {
            // ...
            //
            // Throws an exception if the operation fails.
            var threatListUpdateQuery = new ThreatListUpdateQuery(this);

            // ...
            //
            // Reinitialize the builder's state to prevent it from corrupting the immutable built object's state after
            // its built. If the object holds a reference to the builder's state, any mutation to the builder's state
            // will be reflected in the built object's state.
            this.ThreatListDescriptor = null;
            this.ThreatListState      = null;
            this.UpdateConstraints    = null;

            return(threatListUpdateQuery);
        }