< Summary

Class:Microsoft.Azure.CognitiveServices.Vision.Face.Models.IdentifyRequest
Assembly:Microsoft.Azure.CognitiveServices.Vision.Face
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\IdentifyRequest.cs
Covered lines:7
Uncovered lines:27
Coverable lines:34
Total lines:157
Line coverage:20.5% (7 of 34)
Covered branches:0
Total branches:22
Branch coverage:0% (0 of 22)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_FaceIds()-100%100%
get_PersonGroupId()-100%100%
get_LargePersonGroupId()-100%100%
get_MaxNumOfCandidatesReturned()-100%100%
get_ConfidenceThreshold()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\IdentifyRequest.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.CognitiveServices.Vision.Face.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// Request body for identify face operation.
 21    /// </summary>
 22    public partial class IdentifyRequest
 23    {
 24        /// <summary>
 25        /// Initializes a new instance of the IdentifyRequest class.
 26        /// </summary>
 427        public IdentifyRequest()
 28        {
 29            CustomInit();
 430        }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the IdentifyRequest class.
 34        /// </summary>
 35        /// <param name="faceIds">Array of query faces faceIds, created by the
 36        /// Face - Detect. Each of the faces are identified independently. The
 37        /// valid number of faceIds is between [1, 10].</param>
 38        /// <param name="personGroupId">PersonGroupId of the target person
 39        /// group, created by PersonGroup - Create. Parameter personGroupId and
 40        /// largePersonGroupId should not be provided at the same time.</param>
 41        /// <param name="largePersonGroupId">LargePersonGroupId of the target
 42        /// large person group, created by LargePersonGroup - Create. Parameter
 43        /// personGroupId and largePersonGroupId should not be provided at the
 44        /// same time.</param>
 45        /// <param name="maxNumOfCandidatesReturned">The range of
 46        /// maxNumOfCandidatesReturned is between 1 and 5 (default is
 47        /// 1).</param>
 48        /// <param name="confidenceThreshold">Confidence threshold of
 49        /// identification, used to judge whether one face belong to one
 50        /// person. The range of confidenceThreshold is [0, 1] (default
 51        /// specified by algorithm).</param>
 052        public IdentifyRequest(IList<System.Guid> faceIds, string personGroupId = default(string), string largePersonGro
 53        {
 054            FaceIds = faceIds;
 055            PersonGroupId = personGroupId;
 056            LargePersonGroupId = largePersonGroupId;
 057            MaxNumOfCandidatesReturned = maxNumOfCandidatesReturned;
 058            ConfidenceThreshold = confidenceThreshold;
 59            CustomInit();
 060        }
 61
 62        /// <summary>
 63        /// An initialization method that performs custom operations like setting defaults
 64        /// </summary>
 65        partial void CustomInit();
 66
 67        /// <summary>
 68        /// Gets or sets array of query faces faceIds, created by the Face -
 69        /// Detect. Each of the faces are identified independently. The valid
 70        /// number of faceIds is between [1, 10].
 71        /// </summary>
 72        [JsonProperty(PropertyName = "faceIds")]
 873        public IList<System.Guid> FaceIds { get; set; }
 74
 75        /// <summary>
 76        /// Gets or sets personGroupId of the target person group, created by
 77        /// PersonGroup - Create. Parameter personGroupId and
 78        /// largePersonGroupId should not be provided at the same time.
 79        /// </summary>
 80        [JsonProperty(PropertyName = "personGroupId")]
 881        public string PersonGroupId { get; set; }
 82
 83        /// <summary>
 84        /// Gets or sets largePersonGroupId of the target large person group,
 85        /// created by LargePersonGroup - Create. Parameter personGroupId and
 86        /// largePersonGroupId should not be provided at the same time.
 87        /// </summary>
 88        [JsonProperty(PropertyName = "largePersonGroupId")]
 889        public string LargePersonGroupId { get; set; }
 90
 91        /// <summary>
 92        /// Gets or sets the range of maxNumOfCandidatesReturned is between 1
 93        /// and 5 (default is 1).
 94        /// </summary>
 95        [JsonProperty(PropertyName = "maxNumOfCandidatesReturned")]
 896        public int? MaxNumOfCandidatesReturned { get; set; }
 97
 98        /// <summary>
 99        /// Gets or sets confidence threshold of identification, used to judge
 100        /// whether one face belong to one person. The range of
 101        /// confidenceThreshold is [0, 1] (default specified by algorithm).
 102        /// </summary>
 103        [JsonProperty(PropertyName = "confidenceThreshold")]
 8104        public double? ConfidenceThreshold { get; set; }
 105
 106        /// <summary>
 107        /// Validate the object.
 108        /// </summary>
 109        /// <exception cref="ValidationException">
 110        /// Thrown if validation fails
 111        /// </exception>
 112        public virtual void Validate()
 113        {
 0114            if (FaceIds == null)
 115            {
 0116                throw new ValidationException(ValidationRules.CannotBeNull, "FaceIds");
 117            }
 0118            if (FaceIds != null)
 119            {
 0120                if (FaceIds.Count > 10)
 121                {
 0122                    throw new ValidationException(ValidationRules.MaxItems, "FaceIds", 10);
 123                }
 124            }
 0125            if (PersonGroupId != null)
 126            {
 0127                if (PersonGroupId.Length > 64)
 128                {
 0129                    throw new ValidationException(ValidationRules.MaxLength, "PersonGroupId", 64);
 130                }
 0131                if (!System.Text.RegularExpressions.Regex.IsMatch(PersonGroupId, "^[a-z0-9-_]+$"))
 132                {
 0133                    throw new ValidationException(ValidationRules.Pattern, "PersonGroupId", "^[a-z0-9-_]+$");
 134                }
 135            }
 0136            if (LargePersonGroupId != null)
 137            {
 0138                if (LargePersonGroupId.Length > 64)
 139                {
 0140                    throw new ValidationException(ValidationRules.MaxLength, "LargePersonGroupId", 64);
 141                }
 0142                if (!System.Text.RegularExpressions.Regex.IsMatch(LargePersonGroupId, "^[a-z0-9-_]+$"))
 143                {
 0144                    throw new ValidationException(ValidationRules.Pattern, "LargePersonGroupId", "^[a-z0-9-_]+$");
 145                }
 146            }
 0147            if (MaxNumOfCandidatesReturned > 5)
 148            {
 0149                throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxNumOfCandidatesReturned", 5);
 150            }
 0151            if (MaxNumOfCandidatesReturned < 1)
 152            {
 0153                throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxNumOfCandidatesReturned", 1);
 154            }
 0155        }
 156    }
 157}