| | 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 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Vision.Face |
| | 12 | | { |
| | 13 | | using Models; |
| | 14 | | using System.Collections; |
| | 15 | | using System.Collections.Generic; |
| | 16 | | using System.Threading; |
| | 17 | | using System.Threading.Tasks; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Extension methods for PersonGroupOperations. |
| | 21 | | /// </summary> |
| | 22 | | public static partial class PersonGroupOperationsExtensions |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Create a new person group with specified personGroupId, name, user-provided |
| | 26 | | /// userData and recognitionModel. |
| | 27 | | /// <br /> A person group is the container of the uploaded person data, |
| | 28 | | /// including face recognition features. |
| | 29 | | /// <br /> After creation, use [PersonGroup Person - |
| | 30 | | /// Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523c) |
| | 31 | | /// to add persons into the group, and then call [PersonGroup - |
| | 32 | | /// Train](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395249) |
| | 33 | | /// to get this group ready for [Face - |
| | 34 | | /// Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). |
| | 35 | | /// <br /> No image will be stored. Only the person's extracted face |
| | 36 | | /// features and userData will be stored on server until [PersonGroup Person - |
| | 37 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523d) |
| | 38 | | /// or [PersonGroup - |
| | 39 | | /// Delete](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395245) |
| | 40 | | /// is called. |
| | 41 | | /// <br/>'recognitionModel' should be specified to associate with this |
| | 42 | | /// person group. The default value for 'recognitionModel' is 'recognition_01', |
| | 43 | | /// if the latest model needed, please explicitly specify the model you need in |
| | 44 | | /// this parameter. New faces that are added to an existing person group will |
| | 45 | | /// use the recognition model that's already associated with the collection. |
| | 46 | | /// Existing face features in a person group can't be updated to features |
| | 47 | | /// extracted by another version of recognition model. |
| | 48 | | /// * 'recognition_01': The default recognition model for [PersonGroup - |
| | 49 | | /// Create](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244). |
| | 50 | | /// All those person groups created before 2019 March are bonded with this |
| | 51 | | /// recognition model. |
| | 52 | | /// * 'recognition_02': Recognition model released in 2019 March. |
| | 53 | | /// 'recognition_02' is recommended since its overall accuracy is improved |
| | 54 | | /// compared with 'recognition_01'. |
| | 55 | | /// |
| | 56 | | /// Person group quota: |
| | 57 | | /// * Free-tier subscription quota: 1,000 person groups. Each holds up to 1,000 |
| | 58 | | /// persons. |
| | 59 | | /// * S0-tier subscription quota: 1,000,000 person groups. Each holds up to |
| | 60 | | /// 10,000 persons. |
| | 61 | | /// * to handle larger scale face identification problem, please consider using |
| | 62 | | /// [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d). |
| | 63 | | /// </summary> |
| | 64 | | /// <param name='operations'> |
| | 65 | | /// The operations group for this extension method. |
| | 66 | | /// </param> |
| | 67 | | /// <param name='personGroupId'> |
| | 68 | | /// Id referencing a particular person group. |
| | 69 | | /// </param> |
| | 70 | | /// <param name='name'> |
| | 71 | | /// User defined name, maximum length is 128. |
| | 72 | | /// </param> |
| | 73 | | /// <param name='userData'> |
| | 74 | | /// User specified data. Length should not exceed 16KB. |
| | 75 | | /// </param> |
| | 76 | | /// <param name='recognitionModel'> |
| | 77 | | /// Possible values include: 'recognition_01', 'recognition_02' |
| | 78 | | /// </param> |
| | 79 | | /// <param name='cancellationToken'> |
| | 80 | | /// The cancellation token. |
| | 81 | | /// </param> |
| | 82 | | public static async Task CreateAsync(this IPersonGroupOperations operations, string personGroupId, string na |
| | 83 | | { |
| 8 | 84 | | (await operations.CreateWithHttpMessagesAsync(personGroupId, name, userData, recognitionModel, null, can |
| 8 | 85 | | } |
| | 86 | |
|
| | 87 | | /// <summary> |
| | 88 | | /// Delete an existing person group. Persisted face features of all people in |
| | 89 | | /// the person group will also be deleted. |
| | 90 | | /// </summary> |
| | 91 | | /// <param name='operations'> |
| | 92 | | /// The operations group for this extension method. |
| | 93 | | /// </param> |
| | 94 | | /// <param name='personGroupId'> |
| | 95 | | /// Id referencing a particular person group. |
| | 96 | | /// </param> |
| | 97 | | /// <param name='cancellationToken'> |
| | 98 | | /// The cancellation token. |
| | 99 | | /// </param> |
| | 100 | | public static async Task DeleteAsync(this IPersonGroupOperations operations, string personGroupId, Cancellat |
| | 101 | | { |
| 10 | 102 | | (await operations.DeleteWithHttpMessagesAsync(personGroupId, null, cancellationToken).ConfigureAwait(fal |
| 10 | 103 | | } |
| | 104 | |
|
| | 105 | | /// <summary> |
| | 106 | | /// Retrieve person group name, userData and recognitionModel. To get person |
| | 107 | | /// information under this personGroup, use [PersonGroup Person - |
| | 108 | | /// List](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395241). |
| | 109 | | /// </summary> |
| | 110 | | /// <param name='operations'> |
| | 111 | | /// The operations group for this extension method. |
| | 112 | | /// </param> |
| | 113 | | /// <param name='personGroupId'> |
| | 114 | | /// Id referencing a particular person group. |
| | 115 | | /// </param> |
| | 116 | | /// <param name='returnRecognitionModel'> |
| | 117 | | /// A value indicating whether the operation should return 'recognitionModel' |
| | 118 | | /// in response. |
| | 119 | | /// </param> |
| | 120 | | /// <param name='cancellationToken'> |
| | 121 | | /// The cancellation token. |
| | 122 | | /// </param> |
| | 123 | | public static async Task<PersonGroup> GetAsync(this IPersonGroupOperations operations, string personGroupId, |
| | 124 | | { |
| 2 | 125 | | using (var _result = await operations.GetWithHttpMessagesAsync(personGroupId, returnRecognitionModel, nu |
| | 126 | | { |
| 2 | 127 | | return _result.Body; |
| | 128 | | } |
| 2 | 129 | | } |
| | 130 | |
|
| | 131 | | /// <summary> |
| | 132 | | /// Update an existing person group's display name and userData. The properties |
| | 133 | | /// which does not appear in request body will not be updated. |
| | 134 | | /// </summary> |
| | 135 | | /// <param name='operations'> |
| | 136 | | /// The operations group for this extension method. |
| | 137 | | /// </param> |
| | 138 | | /// <param name='personGroupId'> |
| | 139 | | /// Id referencing a particular person group. |
| | 140 | | /// </param> |
| | 141 | | /// <param name='name'> |
| | 142 | | /// User defined name, maximum length is 128. |
| | 143 | | /// </param> |
| | 144 | | /// <param name='userData'> |
| | 145 | | /// User specified data. Length should not exceed 16KB. |
| | 146 | | /// </param> |
| | 147 | | /// <param name='cancellationToken'> |
| | 148 | | /// The cancellation token. |
| | 149 | | /// </param> |
| | 150 | | public static async Task UpdateAsync(this IPersonGroupOperations operations, string personGroupId, string na |
| | 151 | | { |
| 0 | 152 | | (await operations.UpdateWithHttpMessagesAsync(personGroupId, name, userData, null, cancellationToken).Co |
| 0 | 153 | | } |
| | 154 | |
|
| | 155 | | /// <summary> |
| | 156 | | /// Retrieve the training status of a person group (completed or ongoing). |
| | 157 | | /// </summary> |
| | 158 | | /// <param name='operations'> |
| | 159 | | /// The operations group for this extension method. |
| | 160 | | /// </param> |
| | 161 | | /// <param name='personGroupId'> |
| | 162 | | /// Id referencing a particular person group. |
| | 163 | | /// </param> |
| | 164 | | /// <param name='cancellationToken'> |
| | 165 | | /// The cancellation token. |
| | 166 | | /// </param> |
| | 167 | | public static async Task<TrainingStatus> GetTrainingStatusAsync(this IPersonGroupOperations operations, stri |
| | 168 | | { |
| 6 | 169 | | using (var _result = await operations.GetTrainingStatusWithHttpMessagesAsync(personGroupId, null, cancel |
| | 170 | | { |
| 6 | 171 | | return _result.Body; |
| | 172 | | } |
| 6 | 173 | | } |
| | 174 | |
|
| | 175 | | /// <summary> |
| | 176 | | /// List person groups’ personGroupId, name, userData and |
| | 177 | | /// recognitionModel.<br /> |
| | 178 | | /// * Person groups are stored in alphabetical order of personGroupId. |
| | 179 | | /// * "start" parameter (string, optional) is a user-provided personGroupId |
| | 180 | | /// value that returned entries have larger ids by string comparison. "start" |
| | 181 | | /// set to empty to indicate return from the first item. |
| | 182 | | /// * "top" parameter (int, optional) specifies the number of entries to |
| | 183 | | /// return. A maximal of 1000 entries can be returned in one call. To fetch |
| | 184 | | /// more, you can specify "start" with the last returned entry’s Id of the |
| | 185 | | /// current call. |
| | 186 | | /// <br /> |
| | 187 | | /// For example, total 5 person groups: "group1", ..., "group5". |
| | 188 | | /// <br /> "start=&top=" will return all 5 groups. |
| | 189 | | /// <br /> "start=&top=2" will return "group1", "group2". |
| | 190 | | /// <br /> "start=group2&top=3" will return "group3", "group4", |
| | 191 | | /// "group5". |
| | 192 | | /// |
| | 193 | | /// </summary> |
| | 194 | | /// <param name='operations'> |
| | 195 | | /// The operations group for this extension method. |
| | 196 | | /// </param> |
| | 197 | | /// <param name='start'> |
| | 198 | | /// List person groups from the least personGroupId greater than the "start". |
| | 199 | | /// </param> |
| | 200 | | /// <param name='top'> |
| | 201 | | /// The number of person groups to list. |
| | 202 | | /// </param> |
| | 203 | | /// <param name='returnRecognitionModel'> |
| | 204 | | /// A value indicating whether the operation should return 'recognitionModel' |
| | 205 | | /// in response. |
| | 206 | | /// </param> |
| | 207 | | /// <param name='cancellationToken'> |
| | 208 | | /// The cancellation token. |
| | 209 | | /// </param> |
| | 210 | | public static async Task<IList<PersonGroup>> ListAsync(this IPersonGroupOperations operations, string start |
| | 211 | | { |
| 0 | 212 | | using (var _result = await operations.ListWithHttpMessagesAsync(start, top, returnRecognitionModel, null |
| | 213 | | { |
| 0 | 214 | | return _result.Body; |
| | 215 | | } |
| 0 | 216 | | } |
| | 217 | |
|
| | 218 | | /// <summary> |
| | 219 | | /// Queue a person group training task, the training task may not be started |
| | 220 | | /// immediately. |
| | 221 | | /// </summary> |
| | 222 | | /// <param name='operations'> |
| | 223 | | /// The operations group for this extension method. |
| | 224 | | /// </param> |
| | 225 | | /// <param name='personGroupId'> |
| | 226 | | /// Id referencing a particular person group. |
| | 227 | | /// </param> |
| | 228 | | /// <param name='cancellationToken'> |
| | 229 | | /// The cancellation token. |
| | 230 | | /// </param> |
| | 231 | | public static async Task TrainAsync(this IPersonGroupOperations operations, string personGroupId, Cancellati |
| | 232 | | { |
| 4 | 233 | | (await operations.TrainWithHttpMessagesAsync(personGroupId, null, cancellationToken).ConfigureAwait(fals |
| 4 | 234 | | } |
| | 235 | |
|
| | 236 | | } |
| | 237 | | } |