protected bool Equals(ValidationPriority other)
 {
     if (other == null)
     {
         throw new ArgumentNullException(nameof(other));
     }
     return(Value == other.Value);
 }
 /// <summary>
 /// Initializes a <see cref="FileValidationRequest"/> to be submitted to the Verifalia email validation engine.
 /// </summary>
 /// <param name="file">A <see cref="Stream"/> with the file content to submit.</param>
 /// <param name="contentType">The MIME content type of the file.</param>
 /// <param name="quality">An optional <see cref="QualityLevelName"/> referring to the expected results quality for the request.</param>
 /// <param name="deduplication">An optional <see cref="DeduplicationMode"/> to use while determining which email addresses are duplicates.</param>
 /// <param name="priority">An optional <see cref="ValidationPriority"/> (speed) of a validation job, relative to the parent Verifalia account.
 /// <remarks>Setting this value is useful only in the event there are multiple active concurrent validation jobs for the calling Verifalia
 /// account and the current request should be treated differently than the others, with regards to the processing speed.</remarks>
 /// </param>
 /// <param name="leaveOpen">True to leave the file object open after FileValidationRequest is disposed, false otherwise.</param>
 public FileValidationRequest(Stream file, MediaTypeHeaderValue contentType, QualityLevelName quality = default, DeduplicationMode deduplication = default, ValidationPriority priority = default, bool leaveOpen = default)
 {
     File          = file ?? throw new ArgumentNullException(nameof(file));
     ContentType   = contentType ?? throw new ArgumentNullException(nameof(contentType));
     Quality       = quality;
     Deduplication = deduplication;
     Priority      = priority;
     _leaveOpen    = leaveOpen;
 }
Пример #3
0
        /// <summary>
        /// Initializes a <see cref="ValidationRequest"/> to be submitted to the Verifalia email validation engine.
        /// </summary>
        /// <param name="entries">One or more <see cref="ValidationRequestEntry"/> to validate.</param>
        /// <param name="quality">An optional <see cref="QualityLevelName"/> referring to the expected results quality for the request.</param>
        /// <param name="deduplication">An optional <see cref="DeduplicationMode"/> to use while determining which email addresses are duplicates.</param>
        /// <param name="priority">An optional <see cref="ValidationPriority"/> (speed) of a validation job, relative to the parent Verifalia account.
        /// <remarks>Setting this value is useful only in the event there are multiple active concurrent validation jobs for the calling Verifalia
        /// account and the current request should be treated differently than the others, with regards to the processing speed.</remarks>
        /// </param>
        public ValidationRequest(IEnumerable <ValidationRequestEntry> entries, QualityLevelName quality = default, DeduplicationMode deduplication = default, ValidationPriority priority = default)
        {
            var enumeratedEntries = entries.ToArray();

            if (enumeratedEntries.Length == 0)
            {
                throw new ArgumentException("Can't create a validation request out of an empty collection of entries.", nameof(entries));
            }

            Entries       = enumeratedEntries;
            Quality       = quality;
            Deduplication = deduplication;
            Priority      = priority;
        }
        /// <summary>
        /// Initializes a <see cref="FileValidationRequest"/> to be submitted to the Verifalia email validation engine.
        /// </summary>
        /// <param name="fileInfo">A <see cref="FileInfo"/> instance pointing to the file to submit.</param>
        /// <param name="contentType">The MIME content type of the file.
        /// <remarks>If <see langword="null" /> (default value), the library attempts to guess the content type of the file based on its extension.</remarks>
        /// </param>
        /// <param name="quality">An optional <see cref="QualityLevelName"/> referring to the expected results quality for the request.</param>
        /// <param name="deduplication">An optional <see cref="DeduplicationMode"/> to use while determining which email addresses are duplicates.</param>
        /// <param name="priority">An optional <see cref="ValidationPriority"/> (speed) of a validation job, relative to the parent Verifalia account.
        /// <remarks>Setting this value is useful only in the event there are multiple active concurrent validation jobs for the calling Verifalia
        /// account and the current request should be treated differently than the others, with regards to the processing speed.</remarks>
        /// </param>
        public FileValidationRequest(FileInfo fileInfo, MediaTypeHeaderValue contentType = default, QualityLevelName quality = default, DeduplicationMode deduplication = default, ValidationPriority priority = default)
        {
            if (fileInfo == null)
            {
                throw new ArgumentNullException(nameof(fileInfo));
            }

            // Guess the content type, if no value has been specified

            contentType ??= TryGuessContentTypeFromFileExtension(fileInfo.Extension);
            ContentType = contentType ?? throw new ArgumentException($"Can't automatically guess the content type for the specified file extension '{fileInfo.Extension}', please pass it manually.", nameof(fileInfo));

            File          = fileInfo.Open(FileMode.Open, FileAccess.Read);
            Quality       = quality;
            Deduplication = deduplication;
            Priority      = priority;
            _leaveOpen    = false;
        }
 /// <summary>
 /// Initializes a <see cref="FileValidationRequest"/> to be submitted to the Verifalia email validation engine.
 /// </summary>
 /// <param name="path">The path of the file to submit.</param>
 /// <param name="contentType">The MIME content type of the file.
 /// <remarks>If <see langword="null" /> (default value), the library attempts to guess the content type of the file based on its extension.</remarks>
 /// </param>
 /// <param name="quality">An optional <see cref="QualityLevelName"/> referring to the expected results quality for the request.</param>
 /// <param name="deduplication">An optional <see cref="DeduplicationMode"/> to use while determining which email addresses are duplicates.</param>
 /// <param name="priority">An optional <see cref="ValidationPriority"/> (speed) of a validation job, relative to the parent Verifalia account.
 /// <remarks>Setting this value is useful only in the event there are multiple active concurrent validation jobs for the calling Verifalia
 /// account and the current request should be treated differently than the others, with regards to the processing speed.</remarks>
 /// </param>
 public FileValidationRequest(string path, MediaTypeHeaderValue contentType = default, QualityLevelName quality = default, DeduplicationMode deduplication = default, ValidationPriority priority = default)
     : this(new FileInfo(path),
            contentType,
            quality,
            deduplication,
            priority)
 {
 }
Пример #6
0
 /// <summary>
 /// Initializes a <see cref="ValidationRequest"/> to be submitted to the Verifalia email validation engine.
 /// </summary>
 /// <param name="emailAddresses">One or more email addresses to validate.</param>
 /// <param name="quality">An optional <see cref="QualityLevelName"/> referring to the expected results quality for the request.</param>
 /// <param name="deduplication">An optional <see cref="DeduplicationMode"/> to use while determining which email addresses are duplicates.</param>
 /// <param name="priority">An optional <see cref="ValidationPriority"/> (speed) of a validation job, relative to the parent Verifalia account.
 /// <remarks>Setting this value is useful only in the event there are multiple active concurrent validation jobs for the calling Verifalia
 /// account and the current request should be treated differently than the others, with regards to the processing speed.</remarks>
 /// </param>
 public ValidationRequest(IEnumerable <string> emailAddresses, QualityLevelName quality = default, DeduplicationMode deduplication = default, ValidationPriority priority = default)
     : this(emailAddresses.Select(emailAddress => new ValidationRequestEntry(emailAddress)), quality, deduplication, priority)
 {
 }