azure_cognitiveservices_face 0.16.0
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.rb +78 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/face.rb +955 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/face_client.rb +145 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/face_list_operations.rb +857 -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/azure_regions.rb +26 -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 +82 -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 +92 -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 +121 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/models/gender.rb +17 -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 +105 -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/makeup.rb +59 -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/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 +72 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/models/similar_face.rb +73 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/models/training_status.rb +89 -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_person_face_request.rb +50 -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 +75 -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 +678 -0
- data/lib/1.0/generated/azure_cognitiveservices_face/person_group_person.rb +1121 -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 +253 -0
- data/lib/version.rb +7 -0
- metadata +180 -0
@@ -0,0 +1,75 @@
|
|
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
|
+
module Models
|
8
|
+
#
|
9
|
+
# Request body for verify operation.
|
10
|
+
#
|
11
|
+
class VerifyFaceToPersonRequest
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return FaceId the face, comes from Face - Detect
|
16
|
+
attr_accessor :face_id
|
17
|
+
|
18
|
+
# @return [String] Using existing personGroupId and personId for fast
|
19
|
+
# loading a specified person. personGroupId is created in Person
|
20
|
+
# Groups.Create.
|
21
|
+
attr_accessor :person_group_id
|
22
|
+
|
23
|
+
# @return Specify a certain person in a person group. personId is created
|
24
|
+
# in Persons.Create.
|
25
|
+
attr_accessor :person_id
|
26
|
+
|
27
|
+
|
28
|
+
#
|
29
|
+
# Mapper for VerifyFaceToPersonRequest class as Ruby Hash.
|
30
|
+
# This will be used for serialization/deserialization.
|
31
|
+
#
|
32
|
+
def self.mapper()
|
33
|
+
{
|
34
|
+
client_side_validation: true,
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'VerifyFaceToPersonRequest',
|
37
|
+
type: {
|
38
|
+
name: 'Composite',
|
39
|
+
class_name: 'VerifyFaceToPersonRequest',
|
40
|
+
model_properties: {
|
41
|
+
face_id: {
|
42
|
+
client_side_validation: true,
|
43
|
+
required: true,
|
44
|
+
serialized_name: 'faceId',
|
45
|
+
type: {
|
46
|
+
name: 'String'
|
47
|
+
}
|
48
|
+
},
|
49
|
+
person_group_id: {
|
50
|
+
client_side_validation: true,
|
51
|
+
required: true,
|
52
|
+
serialized_name: 'personGroupId',
|
53
|
+
constraints: {
|
54
|
+
MaxLength: 64,
|
55
|
+
Pattern: '^[a-z0-9-_]+$'
|
56
|
+
},
|
57
|
+
type: {
|
58
|
+
name: 'String'
|
59
|
+
}
|
60
|
+
},
|
61
|
+
person_id: {
|
62
|
+
client_side_validation: true,
|
63
|
+
required: true,
|
64
|
+
serialized_name: 'personId',
|
65
|
+
type: {
|
66
|
+
name: 'String'
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,62 @@
|
|
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
|
+
module Models
|
8
|
+
#
|
9
|
+
# Result of the verify operation.
|
10
|
+
#
|
11
|
+
class VerifyResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Boolean] True if the two faces belong to the same person or
|
16
|
+
# the face belongs to the person, otherwise false.
|
17
|
+
attr_accessor :is_identical
|
18
|
+
|
19
|
+
# @return [Float] A number indicates the similarity confidence of whether
|
20
|
+
# two faces belong to the same person, or whether the face belongs to the
|
21
|
+
# person. By default, isIdentical is set to True if similarity confidence
|
22
|
+
# is greater than or equal to 0.5. This is useful for advanced users to
|
23
|
+
# override "isIdentical" and fine-tune the result on their own data.
|
24
|
+
attr_accessor :confidence
|
25
|
+
|
26
|
+
|
27
|
+
#
|
28
|
+
# Mapper for VerifyResult class as Ruby Hash.
|
29
|
+
# This will be used for serialization/deserialization.
|
30
|
+
#
|
31
|
+
def self.mapper()
|
32
|
+
{
|
33
|
+
client_side_validation: true,
|
34
|
+
required: false,
|
35
|
+
serialized_name: 'VerifyResult',
|
36
|
+
type: {
|
37
|
+
name: 'Composite',
|
38
|
+
class_name: 'VerifyResult',
|
39
|
+
model_properties: {
|
40
|
+
is_identical: {
|
41
|
+
client_side_validation: true,
|
42
|
+
required: true,
|
43
|
+
serialized_name: 'isIdentical',
|
44
|
+
type: {
|
45
|
+
name: 'Boolean'
|
46
|
+
}
|
47
|
+
},
|
48
|
+
confidence: {
|
49
|
+
client_side_validation: true,
|
50
|
+
required: true,
|
51
|
+
serialized_name: 'confidence',
|
52
|
+
type: {
|
53
|
+
name: 'Double'
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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 end
|
7
|
+
module Azure::CognitiveServices end
|
8
|
+
module Azure::CognitiveServices::Face end
|
9
|
+
module Azure::CognitiveServices::Face::V1_0 end
|
@@ -0,0 +1,678 @@
|
|
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 and
|
26
|
+
# user-provided userData.
|
27
|
+
#
|
28
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
29
|
+
# @param name [String] User defined name, maximum length is 128.
|
30
|
+
# @param user_data [String] User specified data. Length should not exceed 16KB.
|
31
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
32
|
+
# will be added to the HTTP request.
|
33
|
+
#
|
34
|
+
#
|
35
|
+
def create(person_group_id, name:nil, user_data:nil, custom_headers:nil)
|
36
|
+
response = create_async(person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Create a new person group with specified personGroupId, name and
|
42
|
+
# user-provided userData.
|
43
|
+
#
|
44
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
45
|
+
# @param name [String] User defined name, maximum length is 128.
|
46
|
+
# @param user_data [String] User specified data. Length should not exceed 16KB.
|
47
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
48
|
+
# will be added to the HTTP request.
|
49
|
+
#
|
50
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
51
|
+
#
|
52
|
+
def create_with_http_info(person_group_id, name:nil, user_data:nil, custom_headers:nil)
|
53
|
+
create_async(person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Create a new person group with specified personGroupId, name and
|
58
|
+
# user-provided userData.
|
59
|
+
#
|
60
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
61
|
+
# @param name [String] User defined name, maximum length is 128.
|
62
|
+
# @param user_data [String] User specified data. Length should not exceed 16KB.
|
63
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
64
|
+
# to the HTTP request.
|
65
|
+
#
|
66
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
67
|
+
#
|
68
|
+
def create_async(person_group_id, name:nil, user_data:nil, custom_headers:nil)
|
69
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
70
|
+
fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
|
71
|
+
fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
|
72
|
+
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?
|
73
|
+
fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128
|
74
|
+
fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
|
75
|
+
|
76
|
+
body = NameAndUserDataContract.new
|
77
|
+
unless name.nil? && user_data.nil?
|
78
|
+
body.name = name
|
79
|
+
body.user_data = user_data
|
80
|
+
end
|
81
|
+
|
82
|
+
request_headers = {}
|
83
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
84
|
+
|
85
|
+
# Set Headers
|
86
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
87
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
88
|
+
|
89
|
+
# Serialize Request
|
90
|
+
request_mapper = Azure::CognitiveServices::Face::V1_0::Models::NameAndUserDataContract.mapper()
|
91
|
+
request_content = @client.serialize(request_mapper, body)
|
92
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
93
|
+
|
94
|
+
path_template = 'persongroups/{personGroupId}'
|
95
|
+
|
96
|
+
request_url = @base_url || @client.base_url
|
97
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
98
|
+
|
99
|
+
options = {
|
100
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
101
|
+
path_params: {'personGroupId' => person_group_id},
|
102
|
+
body: request_content,
|
103
|
+
headers: request_headers.merge(custom_headers || {}),
|
104
|
+
base_url: request_url
|
105
|
+
}
|
106
|
+
promise = @client.make_request_async(:put, path_template, options)
|
107
|
+
|
108
|
+
promise = promise.then do |result|
|
109
|
+
http_response = result.response
|
110
|
+
status_code = http_response.status
|
111
|
+
response_content = http_response.body
|
112
|
+
unless status_code == 200
|
113
|
+
error_model = JSON.load(response_content)
|
114
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
115
|
+
end
|
116
|
+
|
117
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
118
|
+
|
119
|
+
result
|
120
|
+
end
|
121
|
+
|
122
|
+
promise.execute
|
123
|
+
end
|
124
|
+
|
125
|
+
#
|
126
|
+
# Delete an existing person group. Persisted face images of all people in the
|
127
|
+
# person group will also be deleted.
|
128
|
+
#
|
129
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
130
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
131
|
+
# will be added to the HTTP request.
|
132
|
+
#
|
133
|
+
#
|
134
|
+
def delete(person_group_id, custom_headers:nil)
|
135
|
+
response = delete_async(person_group_id, custom_headers:custom_headers).value!
|
136
|
+
nil
|
137
|
+
end
|
138
|
+
|
139
|
+
#
|
140
|
+
# Delete an existing person group. Persisted face images of all people in the
|
141
|
+
# person group will also be deleted.
|
142
|
+
#
|
143
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
144
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
145
|
+
# will be added to the HTTP request.
|
146
|
+
#
|
147
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
148
|
+
#
|
149
|
+
def delete_with_http_info(person_group_id, custom_headers:nil)
|
150
|
+
delete_async(person_group_id, custom_headers:custom_headers).value!
|
151
|
+
end
|
152
|
+
|
153
|
+
#
|
154
|
+
# Delete an existing person group. Persisted face images of all people in the
|
155
|
+
# person group will also be deleted.
|
156
|
+
#
|
157
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
158
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
159
|
+
# to the HTTP request.
|
160
|
+
#
|
161
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
162
|
+
#
|
163
|
+
def delete_async(person_group_id, custom_headers:nil)
|
164
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
165
|
+
fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
|
166
|
+
fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
|
167
|
+
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?
|
168
|
+
|
169
|
+
|
170
|
+
request_headers = {}
|
171
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
172
|
+
|
173
|
+
# Set Headers
|
174
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
175
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
176
|
+
path_template = 'persongroups/{personGroupId}'
|
177
|
+
|
178
|
+
request_url = @base_url || @client.base_url
|
179
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
180
|
+
|
181
|
+
options = {
|
182
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
183
|
+
path_params: {'personGroupId' => person_group_id},
|
184
|
+
headers: request_headers.merge(custom_headers || {}),
|
185
|
+
base_url: request_url
|
186
|
+
}
|
187
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
188
|
+
|
189
|
+
promise = promise.then do |result|
|
190
|
+
http_response = result.response
|
191
|
+
status_code = http_response.status
|
192
|
+
response_content = http_response.body
|
193
|
+
unless status_code == 200
|
194
|
+
error_model = JSON.load(response_content)
|
195
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
196
|
+
end
|
197
|
+
|
198
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
199
|
+
|
200
|
+
result
|
201
|
+
end
|
202
|
+
|
203
|
+
promise.execute
|
204
|
+
end
|
205
|
+
|
206
|
+
#
|
207
|
+
# Retrieve the information of a person group, including its name and userData.
|
208
|
+
#
|
209
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
210
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
211
|
+
# will be added to the HTTP request.
|
212
|
+
#
|
213
|
+
# @return [PersonGroup] operation results.
|
214
|
+
#
|
215
|
+
def get(person_group_id, custom_headers:nil)
|
216
|
+
response = get_async(person_group_id, custom_headers:custom_headers).value!
|
217
|
+
response.body unless response.nil?
|
218
|
+
end
|
219
|
+
|
220
|
+
#
|
221
|
+
# Retrieve the information of a person group, including its name and userData.
|
222
|
+
#
|
223
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
224
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
225
|
+
# will be added to the HTTP request.
|
226
|
+
#
|
227
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
228
|
+
#
|
229
|
+
def get_with_http_info(person_group_id, custom_headers:nil)
|
230
|
+
get_async(person_group_id, custom_headers:custom_headers).value!
|
231
|
+
end
|
232
|
+
|
233
|
+
#
|
234
|
+
# Retrieve the information of a person group, including its name and userData.
|
235
|
+
#
|
236
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
237
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
238
|
+
# to the HTTP request.
|
239
|
+
#
|
240
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
241
|
+
#
|
242
|
+
def get_async(person_group_id, custom_headers:nil)
|
243
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
244
|
+
fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
|
245
|
+
fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
|
246
|
+
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?
|
247
|
+
|
248
|
+
|
249
|
+
request_headers = {}
|
250
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
251
|
+
|
252
|
+
# Set Headers
|
253
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
254
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
255
|
+
path_template = 'persongroups/{personGroupId}'
|
256
|
+
|
257
|
+
request_url = @base_url || @client.base_url
|
258
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
259
|
+
|
260
|
+
options = {
|
261
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
262
|
+
path_params: {'personGroupId' => person_group_id},
|
263
|
+
headers: request_headers.merge(custom_headers || {}),
|
264
|
+
base_url: request_url
|
265
|
+
}
|
266
|
+
promise = @client.make_request_async(:get, path_template, options)
|
267
|
+
|
268
|
+
promise = promise.then do |result|
|
269
|
+
http_response = result.response
|
270
|
+
status_code = http_response.status
|
271
|
+
response_content = http_response.body
|
272
|
+
unless status_code == 200
|
273
|
+
error_model = JSON.load(response_content)
|
274
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
275
|
+
end
|
276
|
+
|
277
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
278
|
+
# Deserialize Response
|
279
|
+
if status_code == 200
|
280
|
+
begin
|
281
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
282
|
+
result_mapper = Azure::CognitiveServices::Face::V1_0::Models::PersonGroup.mapper()
|
283
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
284
|
+
rescue Exception => e
|
285
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
result
|
290
|
+
end
|
291
|
+
|
292
|
+
promise.execute
|
293
|
+
end
|
294
|
+
|
295
|
+
#
|
296
|
+
# Update an existing person group's display name and userData. The properties
|
297
|
+
# which does not appear in request body will not be updated.
|
298
|
+
#
|
299
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
300
|
+
# @param name [String] User defined name, maximum length is 128.
|
301
|
+
# @param user_data [String] User specified data. Length should not exceed 16KB.
|
302
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
303
|
+
# will be added to the HTTP request.
|
304
|
+
#
|
305
|
+
#
|
306
|
+
def update(person_group_id, name:nil, user_data:nil, custom_headers:nil)
|
307
|
+
response = update_async(person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
|
308
|
+
nil
|
309
|
+
end
|
310
|
+
|
311
|
+
#
|
312
|
+
# Update an existing person group's display name and userData. The properties
|
313
|
+
# which does not appear in request body will not be updated.
|
314
|
+
#
|
315
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
316
|
+
# @param name [String] User defined name, maximum length is 128.
|
317
|
+
# @param user_data [String] User specified data. Length should not exceed 16KB.
|
318
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
319
|
+
# will be added to the HTTP request.
|
320
|
+
#
|
321
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
322
|
+
#
|
323
|
+
def update_with_http_info(person_group_id, name:nil, user_data:nil, custom_headers:nil)
|
324
|
+
update_async(person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
|
325
|
+
end
|
326
|
+
|
327
|
+
#
|
328
|
+
# Update an existing person group's display name and userData. The properties
|
329
|
+
# which does not appear in request body will not be updated.
|
330
|
+
#
|
331
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
332
|
+
# @param name [String] User defined name, maximum length is 128.
|
333
|
+
# @param user_data [String] User specified data. Length should not exceed 16KB.
|
334
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
335
|
+
# to the HTTP request.
|
336
|
+
#
|
337
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
338
|
+
#
|
339
|
+
def update_async(person_group_id, name:nil, user_data:nil, custom_headers:nil)
|
340
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
341
|
+
fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
|
342
|
+
fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
|
343
|
+
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?
|
344
|
+
fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128
|
345
|
+
fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384
|
346
|
+
|
347
|
+
body = NameAndUserDataContract.new
|
348
|
+
unless name.nil? && user_data.nil?
|
349
|
+
body.name = name
|
350
|
+
body.user_data = user_data
|
351
|
+
end
|
352
|
+
|
353
|
+
request_headers = {}
|
354
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
355
|
+
|
356
|
+
# Set Headers
|
357
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
358
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
359
|
+
|
360
|
+
# Serialize Request
|
361
|
+
request_mapper = Azure::CognitiveServices::Face::V1_0::Models::NameAndUserDataContract.mapper()
|
362
|
+
request_content = @client.serialize(request_mapper, body)
|
363
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
364
|
+
|
365
|
+
path_template = 'persongroups/{personGroupId}'
|
366
|
+
|
367
|
+
request_url = @base_url || @client.base_url
|
368
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
369
|
+
|
370
|
+
options = {
|
371
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
372
|
+
path_params: {'personGroupId' => person_group_id},
|
373
|
+
body: request_content,
|
374
|
+
headers: request_headers.merge(custom_headers || {}),
|
375
|
+
base_url: request_url
|
376
|
+
}
|
377
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
378
|
+
|
379
|
+
promise = promise.then do |result|
|
380
|
+
http_response = result.response
|
381
|
+
status_code = http_response.status
|
382
|
+
response_content = http_response.body
|
383
|
+
unless status_code == 200
|
384
|
+
error_model = JSON.load(response_content)
|
385
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
386
|
+
end
|
387
|
+
|
388
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
389
|
+
|
390
|
+
result
|
391
|
+
end
|
392
|
+
|
393
|
+
promise.execute
|
394
|
+
end
|
395
|
+
|
396
|
+
#
|
397
|
+
# Retrieve the training status of a person group (completed or ongoing).
|
398
|
+
#
|
399
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
400
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
401
|
+
# will be added to the HTTP request.
|
402
|
+
#
|
403
|
+
# @return [TrainingStatus] operation results.
|
404
|
+
#
|
405
|
+
def get_training_status(person_group_id, custom_headers:nil)
|
406
|
+
response = get_training_status_async(person_group_id, custom_headers:custom_headers).value!
|
407
|
+
response.body unless response.nil?
|
408
|
+
end
|
409
|
+
|
410
|
+
#
|
411
|
+
# Retrieve the training status of a person group (completed or ongoing).
|
412
|
+
#
|
413
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
414
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
415
|
+
# will be added to the HTTP request.
|
416
|
+
#
|
417
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
418
|
+
#
|
419
|
+
def get_training_status_with_http_info(person_group_id, custom_headers:nil)
|
420
|
+
get_training_status_async(person_group_id, custom_headers:custom_headers).value!
|
421
|
+
end
|
422
|
+
|
423
|
+
#
|
424
|
+
# Retrieve the training status of a person group (completed or ongoing).
|
425
|
+
#
|
426
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
427
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
428
|
+
# to the HTTP request.
|
429
|
+
#
|
430
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
431
|
+
#
|
432
|
+
def get_training_status_async(person_group_id, custom_headers:nil)
|
433
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
434
|
+
fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
|
435
|
+
fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
|
436
|
+
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?
|
437
|
+
|
438
|
+
|
439
|
+
request_headers = {}
|
440
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
441
|
+
|
442
|
+
# Set Headers
|
443
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
444
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
445
|
+
path_template = 'persongroups/{personGroupId}/training'
|
446
|
+
|
447
|
+
request_url = @base_url || @client.base_url
|
448
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
449
|
+
|
450
|
+
options = {
|
451
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
452
|
+
path_params: {'personGroupId' => person_group_id},
|
453
|
+
headers: request_headers.merge(custom_headers || {}),
|
454
|
+
base_url: request_url
|
455
|
+
}
|
456
|
+
promise = @client.make_request_async(:get, path_template, options)
|
457
|
+
|
458
|
+
promise = promise.then do |result|
|
459
|
+
http_response = result.response
|
460
|
+
status_code = http_response.status
|
461
|
+
response_content = http_response.body
|
462
|
+
unless status_code == 200
|
463
|
+
error_model = JSON.load(response_content)
|
464
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
465
|
+
end
|
466
|
+
|
467
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
468
|
+
# Deserialize Response
|
469
|
+
if status_code == 200
|
470
|
+
begin
|
471
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
472
|
+
result_mapper = Azure::CognitiveServices::Face::V1_0::Models::TrainingStatus.mapper()
|
473
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
474
|
+
rescue Exception => e
|
475
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
476
|
+
end
|
477
|
+
end
|
478
|
+
|
479
|
+
result
|
480
|
+
end
|
481
|
+
|
482
|
+
promise.execute
|
483
|
+
end
|
484
|
+
|
485
|
+
#
|
486
|
+
# List person groups and their information.
|
487
|
+
#
|
488
|
+
# @param start [String] List person groups from the least personGroupId greater
|
489
|
+
# than the "start".
|
490
|
+
# @param top [Integer] The number of person groups to list.
|
491
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
492
|
+
# will be added to the HTTP request.
|
493
|
+
#
|
494
|
+
# @return [Array] operation results.
|
495
|
+
#
|
496
|
+
def list(start:nil, top:1000, custom_headers:nil)
|
497
|
+
response = list_async(start:start, top:top, custom_headers:custom_headers).value!
|
498
|
+
response.body unless response.nil?
|
499
|
+
end
|
500
|
+
|
501
|
+
#
|
502
|
+
# List person groups and their information.
|
503
|
+
#
|
504
|
+
# @param start [String] List person groups from the least personGroupId greater
|
505
|
+
# than the "start".
|
506
|
+
# @param top [Integer] The number of person groups to list.
|
507
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
508
|
+
# will be added to the HTTP request.
|
509
|
+
#
|
510
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
511
|
+
#
|
512
|
+
def list_with_http_info(start:nil, top:1000, custom_headers:nil)
|
513
|
+
list_async(start:start, top:top, custom_headers:custom_headers).value!
|
514
|
+
end
|
515
|
+
|
516
|
+
#
|
517
|
+
# List person groups and their information.
|
518
|
+
#
|
519
|
+
# @param start [String] List person groups from the least personGroupId greater
|
520
|
+
# than the "start".
|
521
|
+
# @param top [Integer] The number of person groups to list.
|
522
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
523
|
+
# to the HTTP request.
|
524
|
+
#
|
525
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
526
|
+
#
|
527
|
+
def list_async(start:nil, top:1000, custom_headers:nil)
|
528
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
529
|
+
fail ArgumentError, "'start' should satisfy the constraint - 'MaxLength': '64'" if !start.nil? && start.length > 64
|
530
|
+
fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000
|
531
|
+
fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1
|
532
|
+
|
533
|
+
|
534
|
+
request_headers = {}
|
535
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
536
|
+
|
537
|
+
# Set Headers
|
538
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
539
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
540
|
+
path_template = 'persongroups'
|
541
|
+
|
542
|
+
request_url = @base_url || @client.base_url
|
543
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
544
|
+
|
545
|
+
options = {
|
546
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
547
|
+
query_params: {'start' => start,'top' => top},
|
548
|
+
headers: request_headers.merge(custom_headers || {}),
|
549
|
+
base_url: request_url
|
550
|
+
}
|
551
|
+
promise = @client.make_request_async(:get, path_template, options)
|
552
|
+
|
553
|
+
promise = promise.then do |result|
|
554
|
+
http_response = result.response
|
555
|
+
status_code = http_response.status
|
556
|
+
response_content = http_response.body
|
557
|
+
unless status_code == 200
|
558
|
+
error_model = JSON.load(response_content)
|
559
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
560
|
+
end
|
561
|
+
|
562
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
563
|
+
# Deserialize Response
|
564
|
+
if status_code == 200
|
565
|
+
begin
|
566
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
567
|
+
result_mapper = {
|
568
|
+
client_side_validation: true,
|
569
|
+
required: false,
|
570
|
+
serialized_name: 'parsed_response',
|
571
|
+
type: {
|
572
|
+
name: 'Sequence',
|
573
|
+
element: {
|
574
|
+
client_side_validation: true,
|
575
|
+
required: false,
|
576
|
+
serialized_name: 'PersonGroupElementType',
|
577
|
+
type: {
|
578
|
+
name: 'Composite',
|
579
|
+
class_name: 'PersonGroup'
|
580
|
+
}
|
581
|
+
}
|
582
|
+
}
|
583
|
+
}
|
584
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
585
|
+
rescue Exception => e
|
586
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
587
|
+
end
|
588
|
+
end
|
589
|
+
|
590
|
+
result
|
591
|
+
end
|
592
|
+
|
593
|
+
promise.execute
|
594
|
+
end
|
595
|
+
|
596
|
+
#
|
597
|
+
# Queue a person group training task, the training task may not be started
|
598
|
+
# immediately.
|
599
|
+
#
|
600
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
601
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
602
|
+
# will be added to the HTTP request.
|
603
|
+
#
|
604
|
+
#
|
605
|
+
def train(person_group_id, custom_headers:nil)
|
606
|
+
response = train_async(person_group_id, custom_headers:custom_headers).value!
|
607
|
+
nil
|
608
|
+
end
|
609
|
+
|
610
|
+
#
|
611
|
+
# Queue a person group training task, the training task may not be started
|
612
|
+
# immediately.
|
613
|
+
#
|
614
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
615
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
616
|
+
# will be added to the HTTP request.
|
617
|
+
#
|
618
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
619
|
+
#
|
620
|
+
def train_with_http_info(person_group_id, custom_headers:nil)
|
621
|
+
train_async(person_group_id, custom_headers:custom_headers).value!
|
622
|
+
end
|
623
|
+
|
624
|
+
#
|
625
|
+
# Queue a person group training task, the training task may not be started
|
626
|
+
# immediately.
|
627
|
+
#
|
628
|
+
# @param person_group_id [String] Id referencing a particular person group.
|
629
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
630
|
+
# to the HTTP request.
|
631
|
+
#
|
632
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
633
|
+
#
|
634
|
+
def train_async(person_group_id, custom_headers:nil)
|
635
|
+
fail ArgumentError, '@client.azure_region is nil' if @client.azure_region.nil?
|
636
|
+
fail ArgumentError, 'person_group_id is nil' if person_group_id.nil?
|
637
|
+
fail ArgumentError, "'person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !person_group_id.nil? && person_group_id.length > 64
|
638
|
+
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?
|
639
|
+
|
640
|
+
|
641
|
+
request_headers = {}
|
642
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
643
|
+
|
644
|
+
# Set Headers
|
645
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
646
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
647
|
+
path_template = 'persongroups/{personGroupId}/train'
|
648
|
+
|
649
|
+
request_url = @base_url || @client.base_url
|
650
|
+
request_url = request_url.gsub('{AzureRegion}', @client.azure_region)
|
651
|
+
|
652
|
+
options = {
|
653
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
654
|
+
path_params: {'personGroupId' => person_group_id},
|
655
|
+
headers: request_headers.merge(custom_headers || {}),
|
656
|
+
base_url: request_url
|
657
|
+
}
|
658
|
+
promise = @client.make_request_async(:post, path_template, options)
|
659
|
+
|
660
|
+
promise = promise.then do |result|
|
661
|
+
http_response = result.response
|
662
|
+
status_code = http_response.status
|
663
|
+
response_content = http_response.body
|
664
|
+
unless status_code == 202
|
665
|
+
error_model = JSON.load(response_content)
|
666
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
667
|
+
end
|
668
|
+
|
669
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
670
|
+
|
671
|
+
result
|
672
|
+
end
|
673
|
+
|
674
|
+
promise.execute
|
675
|
+
end
|
676
|
+
|
677
|
+
end
|
678
|
+
end
|