class Azure::CognitiveServices::Face::V1_0::LargePersonGroupOperations
An API for face detection, verification, and identification.
Attributes
@return [FaceClient] reference to the FaceClient
Private Class Methods
Creates and initializes a new instance of the LargePersonGroupOperations
class. @param client service class for accessing basic functionality.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 17 def initialize(client) @client = client end
Private Instance Methods
Create a new large person group with user-specified largePersonGroupId, name, an optional userData and recognitionModel. <br /> A large person group is the container of the uploaded person data, including face recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40) to add person into the group, and call [LargePersonGroup - Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4) to get this group ready for [Face - Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). <br /> No image will be stored. Only the person's extracted face features and userData will be stored on server until [LargePersonGroup Person - Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2) or [LargePersonGroup - Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f) is called. <br/>'recognitionModel' should be specified to associate with this large person group. The default value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the model you need in this parameter. New faces that are added to an existing large person group will use the recognition model that's already associated with the collection. Existing face features in a large person group can't be updated to features extracted by another version of recognition model.
-
'recognition_01': The default recognition model for [LargePersonGroup -
Create](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d). All those large person groups created before 2019 March are bonded with this recognition model.
-
'recognition_02': Recognition model released in 2019 March.
'recognition_02' is recommended since its overall accuracy is improved compared with 'recognition_01'.
Large person group quota:
-
Free-tier subscription quota: 1,000 large person groups.
-
S0-tier subscription quota: 1,000,000 large person groups.
@param large_person_group_id [String] Id referencing a particular large person group. @param name [String] User defined name, maximum length is 128. @param user_data [String] User specified data. Length should not exceed 16KB. @param recognition_model [RecognitionModel] Possible values include: 'recognition_01', 'recognition_02' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 71 def create(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil) response = create_async(large_person_group_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value! nil end
Create a new large person group with user-specified largePersonGroupId, name, an optional userData and recognitionModel. <br /> A large person group is the container of the uploaded person data, including face recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40) to add person into the group, and call [LargePersonGroup - Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4) to get this group ready for [Face - Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). <br /> No image will be stored. Only the person's extracted face features and userData will be stored on server until [LargePersonGroup Person - Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2) or [LargePersonGroup - Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f) is called. <br/>'recognitionModel' should be specified to associate with this large person group. The default value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the model you need in this parameter. New faces that are added to an existing large person group will use the recognition model that's already associated with the collection. Existing face features in a large person group can't be updated to features extracted by another version of recognition model.
-
'recognition_01': The default recognition model for [LargePersonGroup -
Create](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d). All those large person groups created before 2019 March are bonded with this recognition model.
-
'recognition_02': Recognition model released in 2019 March.
'recognition_02' is recommended since its overall accuracy is improved compared with 'recognition_01'.
Large person group quota:
-
Free-tier subscription quota: 1,000 large person groups.
-
S0-tier subscription quota: 1,000,000 large person groups.
@param large_person_group_id [String] Id referencing a particular large person group. @param name [String] User defined name, maximum length is 128. @param user_data [String] User specified data. Length should not exceed 16KB. @param recognition_model [RecognitionModel] Possible values include: 'recognition_01', 'recognition_02' @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 176 def create_async(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil? fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64 fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil? fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128 fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384 body = MetaDataContract.new unless name.nil? && user_data.nil? && recognition_model.nil? body.name = name body.user_data = user_data body.recognition_model = recognition_model end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Face::V1_0::Models::MetaDataContract.mapper() request_content = @client.serialize(request_mapper, body) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'largepersongroups/{largePersonGroupId}' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'largePersonGroupId' => large_person_group_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:put, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
Create a new large person group with user-specified largePersonGroupId, name, an optional userData and recognitionModel. <br /> A large person group is the container of the uploaded person data, including face recognition feature, and up to 1,000,000 people. <br /> After creation, use [LargePersonGroup Person - Create](/docs/services/563879b61984550e40cbbe8d/operations/599adcba3a7b9412a4d53f40) to add person into the group, and call [LargePersonGroup - Train](/docs/services/563879b61984550e40cbbe8d/operations/599ae2d16ac60f11b48b5aa4) to get this group ready for [Face - Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). <br /> No image will be stored. Only the person's extracted face features and userData will be stored on server until [LargePersonGroup Person - Delete](/docs/services/563879b61984550e40cbbe8d/operations/599ade5c6ac60f11b48b5aa2) or [LargePersonGroup - Delete](/docs/services/563879b61984550e40cbbe8d/operations/599adc216ac60f11b48b5a9f) is called. <br/>'recognitionModel' should be specified to associate with this large person group. The default value for 'recognitionModel' is 'recognition_01', if the latest model needed, please explicitly specify the model you need in this parameter. New faces that are added to an existing large person group will use the recognition model that's already associated with the collection. Existing face features in a large person group can't be updated to features extracted by another version of recognition model.
-
'recognition_01': The default recognition model for [LargePersonGroup -
Create](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d). All those large person groups created before 2019 March are bonded with this recognition model.
-
'recognition_02': Recognition model released in 2019 March.
'recognition_02' is recommended since its overall accuracy is improved compared with 'recognition_01'.
Large person group quota:
-
Free-tier subscription quota: 1,000 large person groups.
-
S0-tier subscription quota: 1,000,000 large person groups.
@param large_person_group_id [String] Id referencing a particular large person group. @param name [String] User defined name, maximum length is 128. @param user_data [String] User specified data. Length should not exceed 16KB. @param recognition_model [RecognitionModel] Possible values include: 'recognition_01', 'recognition_02' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 124 def create_with_http_info(large_person_group_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil) create_async(large_person_group_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value! end
Delete an existing large person group. Persisted face features of all people in the large person group will also be deleted.
@param large_person_group_id [String] Id referencing a particular large person group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 246 def delete(large_person_group_id, custom_headers:nil) response = delete_async(large_person_group_id, custom_headers:custom_headers).value! nil end
Delete an existing large person group. Persisted face features of all people in the large person group will also be deleted.
@param large_person_group_id [String] Id referencing a particular large person group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 277 def delete_async(large_person_group_id, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil? fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64 fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'largepersongroups/{largePersonGroupId}' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'largePersonGroupId' => large_person_group_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:delete, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
Delete an existing large person group. Persisted face features of all people in the large person group will also be deleted.
@param large_person_group_id [String] Id referencing a particular large person group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 262 def delete_with_http_info(large_person_group_id, custom_headers:nil) delete_async(large_person_group_id, custom_headers:custom_headers).value! end
Retrieve the information of a large person group, including its name, userData and recognitionModel. This API returns large person group information only, use [LargePersonGroup Person - List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1) instead to retrieve person information under the large person group.
@param large_person_group_id [String] Id referencing a particular large person group. @param return_recognition_model [Boolean] A value indicating whether the operation should return 'recognitionModel' in response. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [LargePersonGroup] operation results.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 339 def get(large_person_group_id, return_recognition_model:false, custom_headers:nil) response = get_async(large_person_group_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieve the information of a large person group, including its name, userData and recognitionModel. This API returns large person group information only, use [LargePersonGroup Person - List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1) instead to retrieve person information under the large person group.
@param large_person_group_id [String] Id referencing a particular large person group. @param return_recognition_model [Boolean] A value indicating whether the operation should return 'recognitionModel' in response. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 382 def get_async(large_person_group_id, return_recognition_model:false, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil? fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64 fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'largepersongroups/{largePersonGroupId}' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'largePersonGroupId' => large_person_group_id}, query_params: {'returnRecognitionModel' => return_recognition_model}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Face::V1_0::Models::LargePersonGroup.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Retrieve the training status of a large person group (completed or ongoing).
@param large_person_group_id [String] Id referencing a particular large person group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [TrainingStatus] operation results.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 554 def get_training_status(large_person_group_id, custom_headers:nil) response = get_training_status_async(large_person_group_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Retrieve the training status of a large person group (completed or ongoing).
@param large_person_group_id [String] Id referencing a particular large person group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 583 def get_training_status_async(large_person_group_id, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil? fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64 fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'largepersongroups/{largePersonGroupId}/training' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'largePersonGroupId' => large_person_group_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::CognitiveServices::Face::V1_0::Models::TrainingStatus.mapper() result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
Retrieve the training status of a large person group (completed or ongoing).
@param large_person_group_id [String] Id referencing a particular large person group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 569 def get_training_status_with_http_info(large_person_group_id, custom_headers:nil) get_training_status_async(large_person_group_id, custom_headers:custom_headers).value! end
Retrieve the information of a large person group, including its name, userData and recognitionModel. This API returns large person group information only, use [LargePersonGroup Person - List](/docs/services/563879b61984550e40cbbe8d/operations/599adda06ac60f11b48b5aa1) instead to retrieve person information under the large person group.
@param large_person_group_id [String] Id referencing a particular large person group. @param return_recognition_model [Boolean] A value indicating whether the operation should return 'recognitionModel' in response. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 361 def get_with_http_info(large_person_group_id, return_recognition_model:false, custom_headers:nil) get_async(large_person_group_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value! end
List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br />
-
Large person groups are stored in alphabetical order of largePersonGroupId.
-
“start” parameter (string, optional) is a user-provided largePersonGroupId
value that returned entries have larger ids by string comparison. “start” set to empty to indicate return from the first item.
-
“top” parameter (int, optional) specifies the number of entries to return.
A maximal of 1000 entries can be returned in one call. To fetch more, you can specify “start” with the last returned entry’s Id of the current call. <br /> For example, total 5 large person groups: “group1”, …, “group5”. <br /> “start=&top=” will return all 5 groups. <br /> “start=&top=2” will return “group1”, “group2”. <br /> “start=group2&top=3” will return “group3”, “group4”, “group5”.
@param start [String] List large person groups from the least largePersonGroupId greater than the “start”. @param top [Integer] The number of large person groups to list. @param return_recognition_model [Boolean] A value indicating whether the operation should return 'recognitionModel' in response. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 665 def list(start:nil, top:1000, return_recognition_model:false, custom_headers:nil) response = list_async(start:start, top:top, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value! response.body unless response.nil? end
List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br />
-
Large person groups are stored in alphabetical order of largePersonGroupId.
-
“start” parameter (string, optional) is a user-provided largePersonGroupId
value that returned entries have larger ids by string comparison. “start” set to empty to indicate return from the first item.
-
“top” parameter (int, optional) specifies the number of entries to return.
A maximal of 1000 entries can be returned in one call. To fetch more, you can specify “start” with the last returned entry’s Id of the current call. <br /> For example, total 5 large person groups: “group1”, …, “group5”. <br /> “start=&top=” will return all 5 groups. <br /> “start=&top=2” will return “group1”, “group2”. <br /> “start=group2&top=3” will return “group3”, “group4”, “group5”.
@param start [String] List large person groups from the least largePersonGroupId greater than the “start”. @param top [Integer] The number of large person groups to list. @param return_recognition_model [Boolean] A value indicating whether the operation should return 'recognitionModel' in response. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 728 def list_async(start:nil, top:1000, return_recognition_model:false, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, "'start' should satisfy the constraint - 'MaxLength': '64'" if !start.nil? && start.length > 64 fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMaximum': '1000'" if !top.nil? && top > 1000 fail ArgumentError, "'top' should satisfy the constraint - 'InclusiveMinimum': '1'" if !top.nil? && top < 1 request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'largepersongroups' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], query_params: {'start' => start,'top' => top,'returnRecognitionModel' => return_recognition_model}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = { client_side_validation: true, required: false, serialized_name: 'parsed_response', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'LargePersonGroupElementType', type: { name: 'Composite', class_name: 'LargePersonGroup' } } } } result.body = @client.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end
List all existing large person groups’ largePersonGroupId, name, userData and recognitionModel.<br />
-
Large person groups are stored in alphabetical order of largePersonGroupId.
-
“start” parameter (string, optional) is a user-provided largePersonGroupId
value that returned entries have larger ids by string comparison. “start” set to empty to indicate return from the first item.
-
“top” parameter (int, optional) specifies the number of entries to return.
A maximal of 1000 entries can be returned in one call. To fetch more, you can specify “start” with the last returned entry’s Id of the current call. <br /> For example, total 5 large person groups: “group1”, …, “group5”. <br /> “start=&top=” will return all 5 groups. <br /> “start=&top=2” will return “group1”, “group2”. <br /> “start=group2&top=3” will return “group3”, “group4”, “group5”.
@param start [String] List large person groups from the least largePersonGroupId greater than the “start”. @param top [Integer] The number of large person groups to list. @param return_recognition_model [Boolean] A value indicating whether the operation should return 'recognitionModel' in response. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 697 def list_with_http_info(start:nil, top:1000, return_recognition_model:false, custom_headers:nil) list_async(start:start, top:top, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value! end
Queue a large person group training task, the training task may not be started immediately.
@param large_person_group_id [String] Id referencing a particular large person group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 809 def train(large_person_group_id, custom_headers:nil) response = train_async(large_person_group_id, custom_headers:custom_headers).value! nil end
Queue a large person group training task, the training task may not be started immediately.
@param large_person_group_id [String] Id referencing a particular large person group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 840 def train_async(large_person_group_id, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil? fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64 fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? path_template = 'largepersongroups/{largePersonGroupId}/train' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'largePersonGroupId' => large_person_group_id}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:post, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 202 error_model = JSON.load(response_content) fail MsRest::HttpOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
Queue a large person group training task, the training task may not be started immediately.
@param large_person_group_id [String] Id referencing a particular large person group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 825 def train_with_http_info(large_person_group_id, custom_headers:nil) train_async(large_person_group_id, custom_headers:custom_headers).value! end
Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated.
@param large_person_group_id [String] Id referencing a particular large person group. @param name [String] User defined name, maximum length is 128. @param user_data [String] User specified data. Length should not exceed 16KB. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 450 def update(large_person_group_id, name:nil, user_data:nil, custom_headers:nil) response = update_async(large_person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value! nil end
Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated.
@param large_person_group_id [String] Id referencing a particular large person group. @param name [String] User defined name, maximum length is 128. @param user_data [String] User specified data. Length should not exceed 16KB. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 485 def update_async(large_person_group_id, name:nil, user_data:nil, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'large_person_group_id is nil' if large_person_group_id.nil? fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'MaxLength': '64'" if !large_person_group_id.nil? && large_person_group_id.length > 64 fail ArgumentError, "'large_person_group_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_person_group_id.nil? && large_person_group_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil? fail ArgumentError, "'name' should satisfy the constraint - 'MaxLength': '128'" if !name.nil? && name.length > 128 fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '16384'" if !user_data.nil? && user_data.length > 16384 body = NameAndUserDataContract.new unless name.nil? && user_data.nil? body.name = name body.user_data = user_data end request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil? # Serialize Request request_mapper = Azure::CognitiveServices::Face::V1_0::Models::NameAndUserDataContract.mapper() request_content = @client.serialize(request_mapper, body) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'largepersongroups/{largePersonGroupId}' request_url = @base_url || @client.base_url request_url = request_url.gsub('{Endpoint}', @client.endpoint) options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'largePersonGroupId' => large_person_group_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:patch, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? result end promise.execute end
Update an existing large person group's display name and userData. The properties which does not appear in request body will not be updated.
@param large_person_group_id [String] Id referencing a particular large person group. @param name [String] User defined name, maximum length is 128. @param user_data [String] User specified data. Length should not exceed 16KB. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/1.0/generated/azure_cognitiveservices_face/large_person_group_operations.rb, line 468 def update_with_http_info(large_person_group_id, name:nil, user_data:nil, custom_headers:nil) update_async(large_person_group_id, name:name, user_data:user_data, custom_headers:custom_headers).value! end