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