azure_cognitiveservices_face 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/1.0/generated/azure_cognitiveservices_face.rb +38 -22
  3. data/lib/1.0/generated/azure_cognitiveservices_face/face.rb +554 -77
  4. data/lib/1.0/generated/azure_cognitiveservices_face/face_client.rb +24 -5
  5. data/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb +169 -36
  6. data/lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb +1559 -0
  7. data/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb +854 -0
  8. data/lib/1.0/generated/azure_cognitiveservices_face/large_person_group_person.rb +1151 -0
  9. data/lib/1.0/generated/azure_cognitiveservices_face/models/apply_snapshot_request.rb +69 -0
  10. data/lib/1.0/generated/azure_cognitiveservices_face/models/detected_face.rb +13 -0
  11. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_attributes.rb +1 -1
  12. data/lib/1.0/generated/azure_cognitiveservices_face/models/face_list.rb +10 -1
  13. data/lib/1.0/generated/azure_cognitiveservices_face/models/find_similar_request.rb +23 -1
  14. data/lib/1.0/generated/azure_cognitiveservices_face/models/gender.rb +0 -1
  15. data/lib/1.0/generated/azure_cognitiveservices_face/models/identify_request.rb +34 -16
  16. data/lib/1.0/generated/azure_cognitiveservices_face/models/large_face_list.rb +81 -0
  17. data/lib/1.0/generated/azure_cognitiveservices_face/models/large_person_group.rb +81 -0
  18. data/lib/1.0/generated/azure_cognitiveservices_face/models/meta_data_contract.rb +72 -0
  19. data/lib/1.0/generated/azure_cognitiveservices_face/models/name_and_user_data_contract.rb +1 -1
  20. data/lib/1.0/generated/azure_cognitiveservices_face/models/operation_status.rb +112 -0
  21. data/lib/1.0/generated/azure_cognitiveservices_face/models/operation_status_type.rb +18 -0
  22. data/lib/1.0/generated/azure_cognitiveservices_face/models/person_group.rb +11 -2
  23. data/lib/1.0/generated/azure_cognitiveservices_face/models/recognition_model.rb +16 -0
  24. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot.rb +136 -0
  25. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot_apply_mode.rb +15 -0
  26. data/lib/1.0/generated/azure_cognitiveservices_face/models/snapshot_object_type.rb +18 -0
  27. data/lib/1.0/generated/azure_cognitiveservices_face/models/take_snapshot_request.rb +101 -0
  28. data/lib/1.0/generated/azure_cognitiveservices_face/models/training_status.rb +25 -7
  29. data/lib/1.0/generated/azure_cognitiveservices_face/models/{update_person_face_request.rb → update_face_request.rb} +5 -5
  30. data/lib/1.0/generated/azure_cognitiveservices_face/models/update_snapshot_request.rb +73 -0
  31. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_face_to_face_request.rb +1 -1
  32. data/lib/1.0/generated/azure_cognitiveservices_face/models/verify_face_to_person_request.rb +27 -7
  33. data/lib/1.0/generated/azure_cognitiveservices_face/person_group_operations.rb +203 -34
  34. data/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb +49 -29
  35. data/lib/1.0/generated/azure_cognitiveservices_face/snapshot_operations.rb +969 -0
  36. data/lib/profiles/latest/modules/face_profile_module.rb +125 -69
  37. data/lib/version.rb +1 -1
  38. metadata +19 -3
@@ -0,0 +1,854 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CognitiveServices::Face::V1_0
7
+ #
8
+ # An API for face detection, verification, and identification.
9
+ #
10
+ class LargePersonGroupOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the LargePersonGroupOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [FaceClient] reference to the FaceClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Create a new large person group with user-specified largePersonGroupId, name,
26
+ # an optional userData and recognitionModel.
27
+ # <br /> A large person group is the container of the uploaded person data,
28
+ # including face images and face recognition feature, and up to 1,000,000
29
+ # people.
30
+ # <br /> After creation, use [LargePersonGroup Person -
31
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
32
+ # to add person into the group, and call [LargePersonGroup -
33
+ # Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
34
+ # to get this group ready for [Face -
35
+ # Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
36
+ # <br /> The person face, image, and userData will be stored on server until
37
+ # [LargePersonGroup Person -
38
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
39
+ # or [LargePersonGroup -
40
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
41
+ # is called.
42
+ # <br />
43
+ # * Free-tier subscription quota: 1,000 large person groups.
44
+ # * S0-tier subscription quota: 1,000,000 large person groups.
45
+ # <br />
46
+ # 'recognitionModel' should be specified to associate with this large person
47
+ # group. The default value for 'recognitionModel' is 'recognition_01', if the
48
+ # latest model needed, please explicitly specify the model you need in this
49
+ # parameter. New faces that are added to an existing large person group will
50
+ # use the recognition model that's already associated with the collection.
51
+ # Existing face features in a large person group can't be updated to features
52
+ # extracted by another version of recognition model.
53
+ #
54
+ #
55
+ # @param large_person_group_id [String] Id referencing a particular large
56
+ # person group.
57
+ # @param name [String] User defined name, maximum length is 128.
58
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
59
+ # @param recognition_model [RecognitionModel] Possible values include:
60
+ # 'recognition_01', 'recognition_02'
61
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
62
+ # will be added to the HTTP request.
63
+ #
64
+ #
65
+ def create(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
66
+ response = create_async(large_person_group_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
67
+ nil
68
+ end
69
+
70
+ #
71
+ # Create a new large person group with user-specified largePersonGroupId, name,
72
+ # an optional userData and recognitionModel.
73
+ # <br /> A large person group is the container of the uploaded person data,
74
+ # including face images and face recognition feature, and up to 1,000,000
75
+ # people.
76
+ # <br /> After creation, use [LargePersonGroup Person -
77
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
78
+ # to add person into the group, and call [LargePersonGroup -
79
+ # Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
80
+ # to get this group ready for [Face -
81
+ # Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
82
+ # <br /> The person face, image, and userData will be stored on server until
83
+ # [LargePersonGroup Person -
84
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
85
+ # or [LargePersonGroup -
86
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
87
+ # is called.
88
+ # <br />
89
+ # * Free-tier subscription quota: 1,000 large person groups.
90
+ # * S0-tier subscription quota: 1,000,000 large person groups.
91
+ # <br />
92
+ # 'recognitionModel' should be specified to associate with this large person
93
+ # group. The default value for 'recognitionModel' is 'recognition_01', if the
94
+ # latest model needed, please explicitly specify the model you need in this
95
+ # parameter. New faces that are added to an existing large person group will
96
+ # use the recognition model that's already associated with the collection.
97
+ # Existing face features in a large person group can't be updated to features
98
+ # extracted by another version of recognition model.
99
+ #
100
+ #
101
+ # @param large_person_group_id [String] Id referencing a particular large
102
+ # person group.
103
+ # @param name [String] User defined name, maximum length is 128.
104
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
105
+ # @param recognition_model [RecognitionModel] Possible values include:
106
+ # 'recognition_01', 'recognition_02'
107
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
108
+ # will be added to the HTTP request.
109
+ #
110
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
111
+ #
112
+ def create_with_http_info(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
113
+ create_async(large_person_group_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
114
+ end
115
+
116
+ #
117
+ # Create a new large person group with user-specified largePersonGroupId, name,
118
+ # an optional userData and recognitionModel.
119
+ # <br /> A large person group is the container of the uploaded person data,
120
+ # including face images and face recognition feature, and up to 1,000,000
121
+ # people.
122
+ # <br /> After creation, use [LargePersonGroup Person -
123
+ # Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40)
124
+ # to add person into the group, and call [LargePersonGroup -
125
+ # Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4)
126
+ # to get this group ready for [Face -
127
+ # Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239).
128
+ # <br /> The person face, image, and userData will be stored on server until
129
+ # [LargePersonGroup Person -
130
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2)
131
+ # or [LargePersonGroup -
132
+ # Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f)
133
+ # is called.
134
+ # <br />
135
+ # * Free-tier subscription quota: 1,000 large person groups.
136
+ # * S0-tier subscription quota: 1,000,000 large person groups.
137
+ # <br />
138
+ # 'recognitionModel' should be specified to associate with this large person
139
+ # group. The default value for 'recognitionModel' is 'recognition_01', if the
140
+ # latest model needed, please explicitly specify the model you need in this
141
+ # parameter. New faces that are added to an existing large person group will
142
+ # use the recognition model that's already associated with the collection.
143
+ # Existing face features in a large person group can't be updated to features
144
+ # extracted by another version of recognition model.
145
+ #
146
+ #
147
+ # @param large_person_group_id [String] Id referencing a particular large
148
+ # person group.
149
+ # @param name [String] User defined name, maximum length is 128.
150
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
151
+ # @param recognition_model [RecognitionModel] Possible values include:
152
+ # 'recognition_01', 'recognition_02'
153
+ # @param [Hash{String => String}] A hash of custom headers that will be added
154
+ # to the HTTP request.
155
+ #
156
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
157
+ #
158
+ def create_async(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
159
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
160
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
161
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
162
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
163
+ fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128
164
+ fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
165
+
166
+ body = MetaDataContract.new
167
+ unless name.nil? && user_data.nil? && recognition_model.nil?
168
+ body.name = name
169
+ body.user_data = user_data
170
+ body.recognition_model = recognition_model
171
+ end
172
+
173
+ request_headers = {}
174
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
175
+
176
+ # Set Headers
177
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
178
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
179
+
180
+ # Serialize Request
181
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::MetaDataContract.mapper()
182
+ request_content = @client.serialize(request_mapper, body)
183
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
184
+
185
+ path_template = 'largepersongroups/{largePersonGroupId}'
186
+
187
+ request_url = @base_url || @client.base_url
188
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
189
+
190
+ options = {
191
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
192
+ path_params: {'largePersonGroupId' => large_person_group_id},
193
+ body: request_content,
194
+ headers: request_headers.merge(custom_headers || {}),
195
+ base_url: request_url
196
+ }
197
+ promise = @client.make_request_async(:put, path_template, options)
198
+
199
+ promise = promise.then do |result|
200
+ http_response = result.response
201
+ status_code = http_response.status
202
+ response_content = http_response.body
203
+ unless status_code == 200
204
+ error_model = JSON.load(response_content)
205
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
206
+ end
207
+
208
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
209
+
210
+ result
211
+ end
212
+
213
+ promise.execute
214
+ end
215
+
216
+ #
217
+ # Delete an existing large person group. Persisted face features of all people
218
+ # in the large person group will also be deleted.
219
+ #
220
+ # @param large_person_group_id [String] Id referencing a particular large
221
+ # person group.
222
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
223
+ # will be added to the HTTP request.
224
+ #
225
+ #
226
+ def delete(large_person_group_id, custom_headers:nil)
227
+ response = delete_async(large_person_group_id, custom_headers:custom_headers).value!
228
+ nil
229
+ end
230
+
231
+ #
232
+ # Delete an existing large person group. Persisted face features of all people
233
+ # in the large person group will also be deleted.
234
+ #
235
+ # @param large_person_group_id [String] Id referencing a particular large
236
+ # person group.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
241
+ #
242
+ def delete_with_http_info(large_person_group_id, custom_headers:nil)
243
+ delete_async(large_person_group_id, custom_headers:custom_headers).value!
244
+ end
245
+
246
+ #
247
+ # Delete an existing large person group. Persisted face features of all people
248
+ # in the large person group will also be deleted.
249
+ #
250
+ # @param large_person_group_id [String] Id referencing a particular large
251
+ # person group.
252
+ # @param [Hash{String => String}] A hash of custom headers that will be added
253
+ # to the HTTP request.
254
+ #
255
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
256
+ #
257
+ def delete_async(large_person_group_id, custom_headers:nil)
258
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
259
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
260
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
261
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
262
+
263
+
264
+ request_headers = {}
265
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
266
+
267
+ # Set Headers
268
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
269
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
270
+ path_template = 'largepersongroups/{largePersonGroupId}'
271
+
272
+ request_url = @base_url || @client.base_url
273
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
274
+
275
+ options = {
276
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
277
+ path_params: {'largePersonGroupId' => large_person_group_id},
278
+ headers: request_headers.merge(custom_headers || {}),
279
+ base_url: request_url
280
+ }
281
+ promise = @client.make_request_async(:delete, path_template, options)
282
+
283
+ promise = promise.then do |result|
284
+ http_response = result.response
285
+ status_code = http_response.status
286
+ response_content = http_response.body
287
+ unless status_code == 200
288
+ error_model = JSON.load(response_content)
289
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
290
+ end
291
+
292
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
293
+
294
+ result
295
+ end
296
+
297
+ promise.execute
298
+ end
299
+
300
+ #
301
+ # Retrieve the information of a large person group, including its name,
302
+ # userData and recognitionModel. This API returns large person group
303
+ # information only, use [LargePersonGroup Person -
304
+ # List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
305
+ # instead to retrieve person information under the large person group.
306
+ #
307
+ #
308
+ # @param large_person_group_id [String] Id referencing a particular large
309
+ # person group.
310
+ # @param return_recognition_model [Boolean] A value indicating whether the
311
+ # operation should return 'recognitionModel' in response.
312
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
313
+ # will be added to the HTTP request.
314
+ #
315
+ # @return [LargePersonGroup] operation results.
316
+ #
317
+ def get(large_person_group_id, return_recognition_model:false, custom_headers:nil)
318
+ response = get_async(large_person_group_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
319
+ response.body unless response.nil?
320
+ end
321
+
322
+ #
323
+ # Retrieve the information of a large person group, including its name,
324
+ # userData and recognitionModel. This API returns large person group
325
+ # information only, use [LargePersonGroup Person -
326
+ # List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
327
+ # instead to retrieve person information under the large person group.
328
+ #
329
+ #
330
+ # @param large_person_group_id [String] Id referencing a particular large
331
+ # person group.
332
+ # @param return_recognition_model [Boolean] A value indicating whether the
333
+ # operation should return 'recognitionModel' in response.
334
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
335
+ # will be added to the HTTP request.
336
+ #
337
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
338
+ #
339
+ def get_with_http_info(large_person_group_id, return_recognition_model:false, custom_headers:nil)
340
+ get_async(large_person_group_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
341
+ end
342
+
343
+ #
344
+ # Retrieve the information of a large person group, including its name,
345
+ # userData and recognitionModel. This API returns large person group
346
+ # information only, use [LargePersonGroup Person -
347
+ # List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1)
348
+ # instead to retrieve person information under the large person group.
349
+ #
350
+ #
351
+ # @param large_person_group_id [String] Id referencing a particular large
352
+ # person group.
353
+ # @param return_recognition_model [Boolean] A value indicating whether the
354
+ # operation should return 'recognitionModel' in response.
355
+ # @param [Hash{String => String}] A hash of custom headers that will be added
356
+ # to the HTTP request.
357
+ #
358
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
359
+ #
360
+ def get_async(large_person_group_id, return_recognition_model:false, custom_headers:nil)
361
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
362
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
363
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
364
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
365
+
366
+
367
+ request_headers = {}
368
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
369
+
370
+ # Set Headers
371
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
372
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
373
+ path_template = 'largepersongroups/{largePersonGroupId}'
374
+
375
+ request_url = @base_url || @client.base_url
376
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
377
+
378
+ options = {
379
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
380
+ path_params: {'largePersonGroupId' => large_person_group_id},
381
+ query_params: {'returnRecognitionModel' => return_recognition_model},
382
+ headers: request_headers.merge(custom_headers || {}),
383
+ base_url: request_url
384
+ }
385
+ promise = @client.make_request_async(:get, path_template, options)
386
+
387
+ promise = promise.then do |result|
388
+ http_response = result.response
389
+ status_code = http_response.status
390
+ response_content = http_response.body
391
+ unless status_code == 200
392
+ error_model = JSON.load(response_content)
393
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
394
+ end
395
+
396
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
397
+ # Deserialize Response
398
+ if status_code == 200
399
+ begin
400
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
401
+ result_mapper = Azure::CognitiveServices::Face::V1_0::Models::LargePersonGroup.mapper()
402
+ result.body = @client.deserialize(result_mapper, parsed_response)
403
+ rescue Exception => e
404
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
405
+ end
406
+ end
407
+
408
+ result
409
+ end
410
+
411
+ promise.execute
412
+ end
413
+
414
+ #
415
+ # Update an existing large person group's display name and userData. The
416
+ # properties which does not appear in request body will not be updated.
417
+ #
418
+ # @param large_person_group_id [String] Id referencing a particular large
419
+ # person group.
420
+ # @param name [String] User defined name, maximum length is 128.
421
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
422
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
423
+ # will be added to the HTTP request.
424
+ #
425
+ #
426
+ def update(large_person_group_id, name:nil, user_data:nil, custom_headers:nil)
427
+ response = update_async(large_person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
428
+ nil
429
+ end
430
+
431
+ #
432
+ # Update an existing large person group's display name and userData. The
433
+ # properties which does not appear in request body will not be updated.
434
+ #
435
+ # @param large_person_group_id [String] Id referencing a particular large
436
+ # person group.
437
+ # @param name [String] User defined name, maximum length is 128.
438
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
441
+ #
442
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
443
+ #
444
+ def update_with_http_info(large_person_group_id, name:nil, user_data:nil, custom_headers:nil)
445
+ update_async(large_person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
446
+ end
447
+
448
+ #
449
+ # Update an existing large person group's display name and userData. The
450
+ # properties which does not appear in request body will not be updated.
451
+ #
452
+ # @param large_person_group_id [String] Id referencing a particular large
453
+ # person group.
454
+ # @param name [String] User defined name, maximum length is 128.
455
+ # @param user_data [String] User specified data. Length should not exceed 16KB.
456
+ # @param [Hash{String => String}] A hash of custom headers that will be added
457
+ # to the HTTP request.
458
+ #
459
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
460
+ #
461
+ def update_async(large_person_group_id, name:nil, user_data:nil, custom_headers:nil)
462
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
463
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
464
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
465
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
466
+ fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128
467
+ fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
468
+
469
+ body = NameAndUserDataContract.new
470
+ unless name.nil? && user_data.nil?
471
+ body.name = name
472
+ body.user_data = user_data
473
+ end
474
+
475
+ request_headers = {}
476
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
477
+
478
+ # Set Headers
479
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
480
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
481
+
482
+ # Serialize Request
483
+ request_mapper = Azure::CognitiveServices::Face::V1_0::Models::NameAndUserDataContract.mapper()
484
+ request_content = @client.serialize(request_mapper, body)
485
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
486
+
487
+ path_template = 'largepersongroups/{largePersonGroupId}'
488
+
489
+ request_url = @base_url || @client.base_url
490
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
491
+
492
+ options = {
493
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
494
+ path_params: {'largePersonGroupId' => large_person_group_id},
495
+ body: request_content,
496
+ headers: request_headers.merge(custom_headers || {}),
497
+ base_url: request_url
498
+ }
499
+ promise = @client.make_request_async(:patch, path_template, options)
500
+
501
+ promise = promise.then do |result|
502
+ http_response = result.response
503
+ status_code = http_response.status
504
+ response_content = http_response.body
505
+ unless status_code == 200
506
+ error_model = JSON.load(response_content)
507
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
508
+ end
509
+
510
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
511
+
512
+ result
513
+ end
514
+
515
+ promise.execute
516
+ end
517
+
518
+ #
519
+ # Retrieve the training status of a large person group (completed or ongoing).
520
+ #
521
+ # @param large_person_group_id [String] Id referencing a particular large
522
+ # person group.
523
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
524
+ # will be added to the HTTP request.
525
+ #
526
+ # @return [TrainingStatus] operation results.
527
+ #
528
+ def get_training_status(large_person_group_id, custom_headers:nil)
529
+ response = get_training_status_async(large_person_group_id, custom_headers:custom_headers).value!
530
+ response.body unless response.nil?
531
+ end
532
+
533
+ #
534
+ # Retrieve the training status of a large person group (completed or ongoing).
535
+ #
536
+ # @param large_person_group_id [String] Id referencing a particular large
537
+ # person group.
538
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
539
+ # will be added to the HTTP request.
540
+ #
541
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
542
+ #
543
+ def get_training_status_with_http_info(large_person_group_id, custom_headers:nil)
544
+ get_training_status_async(large_person_group_id, custom_headers:custom_headers).value!
545
+ end
546
+
547
+ #
548
+ # Retrieve the training status of a large person group (completed or ongoing).
549
+ #
550
+ # @param large_person_group_id [String] Id referencing a particular large
551
+ # person group.
552
+ # @param [Hash{String => String}] A hash of custom headers that will be added
553
+ # to the HTTP request.
554
+ #
555
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
556
+ #
557
+ def get_training_status_async(large_person_group_id, custom_headers:nil)
558
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
559
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
560
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
561
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
562
+
563
+
564
+ request_headers = {}
565
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
566
+
567
+ # Set Headers
568
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
569
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
570
+ path_template = 'largepersongroups/{largePersonGroupId}/training'
571
+
572
+ request_url = @base_url || @client.base_url
573
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
574
+
575
+ options = {
576
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
577
+ path_params: {'largePersonGroupId' => large_person_group_id},
578
+ headers: request_headers.merge(custom_headers || {}),
579
+ base_url: request_url
580
+ }
581
+ promise = @client.make_request_async(:get, path_template, options)
582
+
583
+ promise = promise.then do |result|
584
+ http_response = result.response
585
+ status_code = http_response.status
586
+ response_content = http_response.body
587
+ unless status_code == 200
588
+ error_model = JSON.load(response_content)
589
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
590
+ end
591
+
592
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
593
+ # Deserialize Response
594
+ if status_code == 200
595
+ begin
596
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
597
+ result_mapper = Azure::CognitiveServices::Face::V1_0::Models::TrainingStatus.mapper()
598
+ result.body = @client.deserialize(result_mapper, parsed_response)
599
+ rescue Exception => e
600
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
601
+ end
602
+ end
603
+
604
+ result
605
+ end
606
+
607
+ promise.execute
608
+ end
609
+
610
+ #
611
+ # List all existing large person groups’ largePersonGroupId, name, userData and
612
+ # recognitionModel.<br />
613
+ # * Large person groups are stored in alphabetical order of largePersonGroupId.
614
+ # * "start" parameter (string, optional) is a user-provided largePersonGroupId
615
+ # value that returned entries have larger ids by string comparison. "start" set
616
+ # to empty to indicate return from the first item.
617
+ # * "top" parameter (int, optional) specifies the number of entries to return.
618
+ # A maximal of 1000 entries can be returned in one call. To fetch more, you can
619
+ # specify "start" with the last returned entry’s Id of the current call.
620
+ # <br />
621
+ # For example, total 5 large person groups: "group1", ..., "group5".
622
+ # <br /> "start=&top=" will return all 5 groups.
623
+ # <br /> "start=&top=2" will return "group1", "group2".
624
+ # <br /> "start=group2&top=3" will return "group3", "group4", "group5".
625
+ #
626
+ #
627
+ # @param start [String] List large person groups from the least
628
+ # largePersonGroupId greater than the "start".
629
+ # @param top [Integer] The number of large person groups to list.
630
+ # @param return_recognition_model [Boolean] A value indicating whether the
631
+ # operation should return 'recognitionModel' in response.
632
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
633
+ # will be added to the HTTP request.
634
+ #
635
+ # @return [Array] operation results.
636
+ #
637
+ def list(start:nil, top:1000, return_recognition_model:false, custom_headers:nil)
638
+ response = list_async(start:start, top:top, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
639
+ response.body unless response.nil?
640
+ end
641
+
642
+ #
643
+ # List all existing large person groups’ largePersonGroupId, name, userData and
644
+ # recognitionModel.<br />
645
+ # * Large person groups are stored in alphabetical order of largePersonGroupId.
646
+ # * "start" parameter (string, optional) is a user-provided largePersonGroupId
647
+ # value that returned entries have larger ids by string comparison. "start" set
648
+ # to empty to indicate return from the first item.
649
+ # * "top" parameter (int, optional) specifies the number of entries to return.
650
+ # A maximal of 1000 entries can be returned in one call. To fetch more, you can
651
+ # specify "start" with the last returned entry’s Id of the current call.
652
+ # <br />
653
+ # For example, total 5 large person groups: "group1", ..., "group5".
654
+ # <br /> "start=&top=" will return all 5 groups.
655
+ # <br /> "start=&top=2" will return "group1", "group2".
656
+ # <br /> "start=group2&top=3" will return "group3", "group4", "group5".
657
+ #
658
+ #
659
+ # @param start [String] List large person groups from the least
660
+ # largePersonGroupId greater than the "start".
661
+ # @param top [Integer] The number of large person groups to list.
662
+ # @param return_recognition_model [Boolean] A value indicating whether the
663
+ # operation should return 'recognitionModel' in response.
664
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
665
+ # will be added to the HTTP request.
666
+ #
667
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
668
+ #
669
+ def list_with_http_info(start:nil, top:1000, return_recognition_model:false, custom_headers:nil)
670
+ list_async(start:start, top:top, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
671
+ end
672
+
673
+ #
674
+ # List all existing large person groups’ largePersonGroupId, name, userData and
675
+ # recognitionModel.<br />
676
+ # * Large person groups are stored in alphabetical order of largePersonGroupId.
677
+ # * "start" parameter (string, optional) is a user-provided largePersonGroupId
678
+ # value that returned entries have larger ids by string comparison. "start" set
679
+ # to empty to indicate return from the first item.
680
+ # * "top" parameter (int, optional) specifies the number of entries to return.
681
+ # A maximal of 1000 entries can be returned in one call. To fetch more, you can
682
+ # specify "start" with the last returned entry’s Id of the current call.
683
+ # <br />
684
+ # For example, total 5 large person groups: "group1", ..., "group5".
685
+ # <br /> "start=&top=" will return all 5 groups.
686
+ # <br /> "start=&top=2" will return "group1", "group2".
687
+ # <br /> "start=group2&top=3" will return "group3", "group4", "group5".
688
+ #
689
+ #
690
+ # @param start [String] List large person groups from the least
691
+ # largePersonGroupId greater than the "start".
692
+ # @param top [Integer] The number of large person groups to list.
693
+ # @param return_recognition_model [Boolean] A value indicating whether the
694
+ # operation should return 'recognitionModel' in response.
695
+ # @param [Hash{String => String}] A hash of custom headers that will be added
696
+ # to the HTTP request.
697
+ #
698
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
699
+ #
700
+ def list_async(start:nil, top:1000, return_recognition_model:false, custom_headers:nil)
701
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
702
+ fail ArgumentError, "'start' should satisfy the constraint - 'MaxLength': '64'" if !start.nil? && start.length > 64
703
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
704
+ fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
705
+
706
+
707
+ request_headers = {}
708
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
709
+
710
+ # Set Headers
711
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
712
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
713
+ path_template = 'largepersongroups'
714
+
715
+ request_url = @base_url || @client.base_url
716
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
717
+
718
+ options = {
719
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
720
+ query_params: {'start' => start,'top' => top,'returnRecognitionModel' => return_recognition_model},
721
+ headers: request_headers.merge(custom_headers || {}),
722
+ base_url: request_url
723
+ }
724
+ promise = @client.make_request_async(:get, path_template, options)
725
+
726
+ promise = promise.then do |result|
727
+ http_response = result.response
728
+ status_code = http_response.status
729
+ response_content = http_response.body
730
+ unless status_code == 200
731
+ error_model = JSON.load(response_content)
732
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
733
+ end
734
+
735
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
736
+ # Deserialize Response
737
+ if status_code == 200
738
+ begin
739
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
740
+ result_mapper = {
741
+ client_side_validation: true,
742
+ required: false,
743
+ serialized_name: 'parsed_response',
744
+ type: {
745
+ name: 'Sequence',
746
+ element: {
747
+ client_side_validation: true,
748
+ required: false,
749
+ serialized_name: 'LargePersonGroupElementType',
750
+ type: {
751
+ name: 'Composite',
752
+ class_name: 'LargePersonGroup'
753
+ }
754
+ }
755
+ }
756
+ }
757
+ result.body = @client.deserialize(result_mapper, parsed_response)
758
+ rescue Exception => e
759
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
760
+ end
761
+ end
762
+
763
+ result
764
+ end
765
+
766
+ promise.execute
767
+ end
768
+
769
+ #
770
+ # Queue a large person group training task, the training task may not be
771
+ # started immediately.
772
+ #
773
+ # @param large_person_group_id [String] Id referencing a particular large
774
+ # person group.
775
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
776
+ # will be added to the HTTP request.
777
+ #
778
+ #
779
+ def train(large_person_group_id, custom_headers:nil)
780
+ response = train_async(large_person_group_id, custom_headers:custom_headers).value!
781
+ nil
782
+ end
783
+
784
+ #
785
+ # Queue a large person group training task, the training task may not be
786
+ # started immediately.
787
+ #
788
+ # @param large_person_group_id [String] Id referencing a particular large
789
+ # person group.
790
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
791
+ # will be added to the HTTP request.
792
+ #
793
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
794
+ #
795
+ def train_with_http_info(large_person_group_id, custom_headers:nil)
796
+ train_async(large_person_group_id, custom_headers:custom_headers).value!
797
+ end
798
+
799
+ #
800
+ # Queue a large person group training task, the training task may not be
801
+ # started immediately.
802
+ #
803
+ # @param large_person_group_id [String] Id referencing a particular large
804
+ # person group.
805
+ # @param [Hash{String => String}] A hash of custom headers that will be added
806
+ # to the HTTP request.
807
+ #
808
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
809
+ #
810
+ def train_async(large_person_group_id, custom_headers:nil)
811
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
812
+ fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil?
813
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64
814
+ fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
815
+
816
+
817
+ request_headers = {}
818
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
819
+
820
+ # Set Headers
821
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
822
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
823
+ path_template = 'largepersongroups/{largePersonGroupId}/train'
824
+
825
+ request_url = @base_url || @client.base_url
826
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
827
+
828
+ options = {
829
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
830
+ path_params: {'largePersonGroupId' => large_person_group_id},
831
+ headers: request_headers.merge(custom_headers || {}),
832
+ base_url: request_url
833
+ }
834
+ promise = @client.make_request_async(:post, path_template, options)
835
+
836
+ promise = promise.then do |result|
837
+ http_response = result.response
838
+ status_code = http_response.status
839
+ response_content = http_response.body
840
+ unless status_code == 202
841
+ error_model = JSON.load(response_content)
842
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
843
+ end
844
+
845
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
846
+
847
+ result
848
+ end
849
+
850
+ promise.execute
851
+ end
852
+
853
+ end
854
+ end