class Azure::CognitiveServices::Face::V1_0::LargeFaceListOperations

An API for face detection, verification, and identification.

Attributes

client[R]

@return [FaceClient] reference to the FaceClient

Private Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the LargeFaceListOperations class. @param client service class for accessing basic functionality.

# File lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

add_face_from_stream(large_face_list_id, image, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil) click to toggle source

Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) or [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Note persistedFaceId is different from faceId generated by [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236).

  • Higher face image quality means better recognition precision. Please

consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.

  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed

image file size is from 1KB to 6MB.

  • “targetFace” rectangle should contain one face. Zero or multiple faces will

be regarded as an error. If the provided “targetFace” rectangle is not returned from [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), there’s no guarantee to detect and add the face successfully.

  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or

large occlusions will cause failures.

  • Adding/deleting faces to/from a same face list are processed sequentially

and to/from different face lists are in parallel.

  • The minimum detectable face size is 36x36 pixels in an image no larger than

1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.

  • Different 'detectionModel' values can be provided. To use and compare

different detection models, please refer to [How to specify a detection model](docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) | Model | Recommended use-case(s) | | ———- | ——– | | 'detection_01': | The default detection model for [LargeFaceList - Add Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. |

Quota:

  • Free-tier subscription quota: 1,000 faces per large face list.

  • S0-tier subscription quota: 1,000,000 faces per large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @param image An image stream. @param user_data [String] User-specified data about the face for any purpose. The maximum length is 1KB. @param target_face [Array<Integer>] A face rectangle to specify the target face to be added to a person in the format of “targetFace=left,top,width,height”. E.g. “targetFace=10,10,100,100”. If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. @param detection_model [DetectionModel] Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_02' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PersistedFace] operation results.

# File lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb, line 1675
def add_face_from_stream(large_face_list_id, image, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil)
  response = add_face_from_stream_async(large_face_list_id, image, user_data:user_data, target_face:target_face, detection_model:detection_model, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
add_face_from_stream_async(large_face_list_id, image, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil) click to toggle source

Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) or [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Note persistedFaceId is different from faceId generated by [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236).

  • Higher face image quality means better recognition precision. Please

consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.

  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed

image file size is from 1KB to 6MB.

  • “targetFace” rectangle should contain one face. Zero or multiple faces will

be regarded as an error. If the provided “targetFace” rectangle is not returned from [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), there’s no guarantee to detect and add the face successfully.

  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or

large occlusions will cause failures.

  • Adding/deleting faces to/from a same face list are processed sequentially

and to/from different face lists are in parallel.

  • The minimum detectable face size is 36x36 pixels in an image no larger than

1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.

  • Different 'detectionModel' values can be provided. To use and compare

different detection models, please refer to [How to specify a detection model](docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) | Model | Recommended use-case(s) | | ———- | ——– | | 'detection_01': | The default detection model for [LargeFaceList - Add Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. |

Quota:

  • Free-tier subscription quota: 1,000 faces per large face list.

  • S0-tier subscription quota: 1,000,000 faces per large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @param image An image stream. @param user_data [String] User-specified data about the face for any purpose. The maximum length is 1KB. @param target_face [Array<Integer>] A face rectangle to specify the target face to be added to a person in the format of “targetFace=left,top,width,height”. E.g. “targetFace=10,10,100,100”. If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. @param detection_model [DetectionModel] Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_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_face_list_operations.rb, line 1822
def add_face_from_stream_async(large_face_list_id, image, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
  fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '1024'" if !user_data.nil? && user_data.length > 1024
  fail ArgumentError, 'image is nil' if image.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/octet-stream'

  # 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 = {
    client_side_validation: true,
    required: true,
    serialized_name: 'Image',
    type: {
      name: 'Stream'
    }
  }
  request_content = @client.serialize(request_mapper,  image)

  path_template = 'largefacelists/{largeFaceListId}/persistedfaces'

  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: {'largeFaceListId' => large_face_list_id},
      query_params: {'userData' => user_data,'targetFace' => target_face.nil? ? nil : target_face.join(','),'detectionModel' => detection_model},
      body: request_content,
      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 == 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::PersistedFace.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
add_face_from_stream_with_http_info(large_face_list_id, image, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil) click to toggle source

Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) or [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Note persistedFaceId is different from faceId generated by [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236).

  • Higher face image quality means better recognition precision. Please

consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.

  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed

image file size is from 1KB to 6MB.

  • “targetFace” rectangle should contain one face. Zero or multiple faces will

be regarded as an error. If the provided “targetFace” rectangle is not returned from [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), there’s no guarantee to detect and add the face successfully.

  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or

large occlusions will cause failures.

  • Adding/deleting faces to/from a same face list are processed sequentially

and to/from different face lists are in parallel.

  • The minimum detectable face size is 36x36 pixels in an image no larger than

1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.

  • Different 'detectionModel' values can be provided. To use and compare

different detection models, please refer to [How to specify a detection model](docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) | Model | Recommended use-case(s) | | ———- | ——– | | 'detection_01': | The default detection model for [LargeFaceList - Add Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. |

Quota:

  • Free-tier subscription quota: 1,000 faces per large face list.

  • S0-tier subscription quota: 1,000,000 faces per large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @param image An image stream. @param user_data [String] User-specified data about the face for any purpose. The maximum length is 1KB. @param target_face [Array<Integer>] A face rectangle to specify the target face to be added to a person in the format of “targetFace=left,top,width,height”. E.g. “targetFace=10,10,100,100”. If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. @param detection_model [DetectionModel] Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_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_face_list_operations.rb, line 1749
def add_face_from_stream_with_http_info(large_face_list_id, image, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil)
  add_face_from_stream_async(large_face_list_id, image, user_data:user_data, target_face:target_face, detection_model:detection_model, custom_headers:custom_headers).value!
end
add_face_from_url(large_face_list_id, url, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil) click to toggle source

Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) or [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Note persistedFaceId is different from faceId generated by [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236).

  • Higher face image quality means better recognition precision. Please

consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.

  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed

image file size is from 1KB to 6MB.

  • “targetFace” rectangle should contain one face. Zero or multiple faces will

be regarded as an error. If the provided “targetFace” rectangle is not returned from [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), there’s no guarantee to detect and add the face successfully.

  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or

large occlusions will cause failures.

  • Adding/deleting faces to/from a same face list are processed sequentially

and to/from different face lists are in parallel.

  • The minimum detectable face size is 36x36 pixels in an image no larger than

1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.

  • Different 'detectionModel' values can be provided. To use and compare

different detection models, please refer to [How to specify a detection model](docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) | Model | Recommended use-case(s) | | ———- | ——– | | 'detection_01': | The default detection model for [LargeFaceList - Add Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. |

Quota:

  • Free-tier subscription quota: 1,000 faces per large face list.

  • S0-tier subscription quota: 1,000,000 faces per large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @param url [String] Publicly reachable URL of an image @param user_data [String] User-specified data about the face for any purpose. The maximum length is 1KB. @param target_face [Array<Integer>] A face rectangle to specify the target face to be added to a person in the format of “targetFace=left,top,width,height”. E.g. “targetFace=10,10,100,100”. If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. @param detection_model [DetectionModel] Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_02' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PersistedFace] operation results.

# File lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb, line 1262
def add_face_from_url(large_face_list_id, url, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil)
  response = add_face_from_url_async(large_face_list_id, url, user_data:user_data, target_face:target_face, detection_model:detection_model, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
add_face_from_url_async(large_face_list_id, url, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil) click to toggle source

Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) or [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Note persistedFaceId is different from faceId generated by [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236).

  • Higher face image quality means better recognition precision. Please

consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.

  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed

image file size is from 1KB to 6MB.

  • “targetFace” rectangle should contain one face. Zero or multiple faces will

be regarded as an error. If the provided “targetFace” rectangle is not returned from [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), there’s no guarantee to detect and add the face successfully.

  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or

large occlusions will cause failures.

  • Adding/deleting faces to/from a same face list are processed sequentially

and to/from different face lists are in parallel.

  • The minimum detectable face size is 36x36 pixels in an image no larger than

1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.

  • Different 'detectionModel' values can be provided. To use and compare

different detection models, please refer to [How to specify a detection model](docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) | Model | Recommended use-case(s) | | ———- | ——– | | 'detection_01': | The default detection model for [LargeFaceList - Add Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. |

Quota:

  • Free-tier subscription quota: 1,000 faces per large face list.

  • S0-tier subscription quota: 1,000,000 faces per large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @param url [String] Publicly reachable URL of an image @param user_data [String] User-specified data about the face for any purpose. The maximum length is 1KB. @param target_face [Array<Integer>] A face rectangle to specify the target face to be added to a person in the format of “targetFace=left,top,width,height”. E.g. “targetFace=10,10,100,100”. If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. @param detection_model [DetectionModel] Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_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_face_list_operations.rb, line 1409
def add_face_from_url_async(large_face_list_id, url, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
  fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '1024'" if !user_data.nil? && user_data.length > 1024
  fail ArgumentError, 'url is nil' if url.nil?

  image_url = ImageUrl.new
  unless url.nil?
    image_url.url = url
  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::ImageUrl.mapper()
  request_content = @client.serialize(request_mapper,  image_url)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'largefacelists/{largeFaceListId}/persistedfaces'

  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: {'largeFaceListId' => large_face_list_id},
      query_params: {'userData' => user_data,'targetFace' => target_face.nil? ? nil : target_face.join(','),'detectionModel' => detection_model},
      body: request_content,
      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 == 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::PersistedFace.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
add_face_from_url_with_http_info(large_face_list_id, url, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil) click to toggle source

Add a face to a specified large face list, up to 1,000,000 faces. <br /> To deal with an image contains multiple faces, input face can be specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face. No image will be stored. Only the extracted face feature will be stored on server until [LargeFaceList Face - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a158c8ad2de3616c086f2d4) or [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Note persistedFaceId is different from faceId generated by [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236).

  • Higher face image quality means better recognition precision. Please

consider high-quality faces: frontal, clear, and face size is 200x200 pixels (100 pixels between eyes) or bigger.

  • JPEG, PNG, GIF (the first frame), and BMP format are supported. The allowed

image file size is from 1KB to 6MB.

  • “targetFace” rectangle should contain one face. Zero or multiple faces will

be regarded as an error. If the provided “targetFace” rectangle is not returned from [Face - Detect](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236), there’s no guarantee to detect and add the face successfully.

  • Out of detectable face size (36x36 - 4096x4096 pixels), large head-pose, or

large occlusions will cause failures.

  • Adding/deleting faces to/from a same face list are processed sequentially

and to/from different face lists are in parallel.

  • The minimum detectable face size is 36x36 pixels in an image no larger than

1920x1080 pixels. Images with dimensions higher than 1920x1080 pixels will need a proportionally larger minimum face size.

  • Different 'detectionModel' values can be provided. To use and compare

different detection models, please refer to [How to specify a detection model](docs.microsoft.com/en-us/azure/cognitive-services/face/face-api-how-to-topics/specify-detection-model) | Model | Recommended use-case(s) | | ———- | ——– | | 'detection_01': | The default detection model for [LargeFaceList - Add Face](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3). Recommend for near frontal face detection. For scenarios with exceptionally large angle (head-pose) faces, occluded faces or wrong image orientation, the faces in such cases may not be detected. | | 'detection_02': | Detection model released in 2019 May with improved accuracy especially on small, side and blurry faces. |

Quota:

  • Free-tier subscription quota: 1,000 faces per large face list.

  • S0-tier subscription quota: 1,000,000 faces per large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @param url [String] Publicly reachable URL of an image @param user_data [String] User-specified data about the face for any purpose. The maximum length is 1KB. @param target_face [Array<Integer>] A face rectangle to specify the target face to be added to a person in the format of “targetFace=left,top,width,height”. E.g. “targetFace=10,10,100,100”. If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image. @param detection_model [DetectionModel] Name of detection model. Detection model is used to detect faces in the submitted image. A detection model name can be provided when performing Face - Detect or (Large)FaceList - Add Face or (Large)PersonGroup - Add Face. The default value is 'detection_01', if another model is needed, please explicitly specify it. Possible values include: 'detection_01', 'detection_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_face_list_operations.rb, line 1336
def add_face_from_url_with_http_info(large_face_list_id, url, user_data:nil, target_face:nil, detection_model:nil, custom_headers:nil)
  add_face_from_url_async(large_face_list_id, url, user_data:user_data, target_face:target_face, detection_model:detection_model, custom_headers:custom_headers).value!
end
create(large_face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil) click to toggle source

Create an empty large face list with user-specified largeFaceListId, name, an optional userData and recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - Find Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). <br /> After creation, user should use [LargeFaceList Face - Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3) to import the faces and [LargeFaceList - Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1) to make it ready for [Face - Find Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). No image will be stored. Only the extracted face features are stored on server until [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, or as a light way face identification. But if the actual use is to identify person, please use [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244) / [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d) and [Face - Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). <br/>'recognitionModel' should be specified to associate with this large face list. 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 face list will use the recognition model that's already associated with the collection. Existing face features in a large face list can't be updated to features extracted by another version of recognition model.

  • 'recognition_01': The default recognition model for [LargeFaceList-

Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc). All those large face lists 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 face list quota:

  • Free-tier subscription quota: 64 large face lists.

  • S0-tier subscription quota: 1,000,000 large face lists.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 77
def create(large_face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
  response = create_async(large_face_list_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
  nil
end
create_async(large_face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil) click to toggle source

Create an empty large face list with user-specified largeFaceListId, name, an optional userData and recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - Find Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). <br /> After creation, user should use [LargeFaceList Face - Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3) to import the faces and [LargeFaceList - Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1) to make it ready for [Face - Find Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). No image will be stored. Only the extracted face features are stored on server until [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, or as a light way face identification. But if the actual use is to identify person, please use [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244) / [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d) and [Face - Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). <br/>'recognitionModel' should be specified to associate with this large face list. 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 face list will use the recognition model that's already associated with the collection. Existing face features in a large face list can't be updated to features extracted by another version of recognition model.

  • 'recognition_01': The default recognition model for [LargeFaceList-

Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc). All those large face lists 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 face list quota:

  • Free-tier subscription quota: 64 large face lists.

  • S0-tier subscription quota: 1,000,000 large face lists.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 194
def create_async(large_face_list_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_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_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 = 'largefacelists/{largeFaceListId}'

  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: {'largeFaceListId' => large_face_list_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 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
create_with_http_info(large_face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil) click to toggle source

Create an empty large face list with user-specified largeFaceListId, name, an optional userData and recognitionModel. <br /> Large face list is a list of faces, up to 1,000,000 faces, and used by [Face - Find Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). <br /> After creation, user should use [LargeFaceList Face - Add](/docs/services/563879b61984550e40cbbe8d/operations/5a158c10d2de3616c086f2d3) to import the faces and [LargeFaceList - Train](/docs/services/563879b61984550e40cbbe8d/operations/5a158422d2de3616c086f2d1) to make it ready for [Face - Find Similar](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395237). No image will be stored. Only the extracted face features are stored on server until [LargeFaceList - Delete](/docs/services/563879b61984550e40cbbe8d/operations/5a1580d5d2de3616c086f2cd) is called. <br /> Find Similar is used for scenario like finding celebrity-like faces, similar face filtering, or as a light way face identification. But if the actual use is to identify person, please use [PersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395244) / [LargePersonGroup](/docs/services/563879b61984550e40cbbe8d/operations/599acdee6ac60f11b48b5a9d) and [Face - Identify](/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395239). <br/>'recognitionModel' should be specified to associate with this large face list. 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 face list will use the recognition model that's already associated with the collection. Existing face features in a large face list can't be updated to features extracted by another version of recognition model.

  • 'recognition_01': The default recognition model for [LargeFaceList-

Create](/docs/services/563879b61984550e40cbbe8d/operations/5a157b68d2de3616c086f2cc). All those large face lists 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 face list quota:

  • Free-tier subscription quota: 64 large face lists.

  • S0-tier subscription quota: 1,000,000 large face lists.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 136
def create_with_http_info(large_face_list_id, name:nil, user_data:nil, recognition_model:nil, custom_headers:nil)
  create_async(large_face_list_id, name:name, user_data:user_data, recognition_model:recognition_model, custom_headers:custom_headers).value!
end
delete(large_face_list_id, custom_headers:nil) click to toggle source

Delete a specified large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 470
def delete(large_face_list_id, custom_headers:nil)
  response = delete_async(large_face_list_id, custom_headers:custom_headers).value!
  nil
end
delete_async(large_face_list_id, custom_headers:nil) click to toggle source

Delete a specified large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 499
def delete_async(large_face_list_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_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 = 'largefacelists/{largeFaceListId}'

  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: {'largeFaceListId' => large_face_list_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_face(large_face_list_id, persisted_face_id, custom_headers:nil) click to toggle source

Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face lists are in parallel.

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @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_face_list_operations.rb, line 896
def delete_face(large_face_list_id, persisted_face_id, custom_headers:nil)
  response = delete_face_async(large_face_list_id, persisted_face_id, custom_headers:custom_headers).value!
  nil
end
delete_face_async(large_face_list_id, persisted_face_id, custom_headers:nil) click to toggle source

Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face lists are in parallel.

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @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_face_list_operations.rb, line 935
def delete_face_async(large_face_list_id, persisted_face_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
  fail ArgumentError, 'persisted_face_id is nil' if persisted_face_id.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 = 'largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}'

  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: {'largeFaceListId' => large_face_list_id,'persistedFaceId' => persisted_face_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_face_with_http_info(large_face_list_id, persisted_face_id, custom_headers:nil) click to toggle source

Delete a face from a large face list by specified largeFaceListId and persistedFaceId. <br /> Adding/deleting faces to/from a same large face list are processed sequentially and to/from different large face lists are in parallel.

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @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_face_list_operations.rb, line 916
def delete_face_with_http_info(large_face_list_id, persisted_face_id, custom_headers:nil)
  delete_face_async(large_face_list_id, persisted_face_id, custom_headers:custom_headers).value!
end
delete_with_http_info(large_face_list_id, custom_headers:nil) click to toggle source

Delete a specified large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 485
def delete_with_http_info(large_face_list_id, custom_headers:nil)
  delete_async(large_face_list_id, custom_headers:custom_headers).value!
end
get(large_face_list_id, return_recognition_model:false, custom_headers:nil) click to toggle source

Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel.

@param large_face_list_id [String] Id referencing a particular large face 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 [LargeFaceList] operation results.

# File lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb, line 267
def get(large_face_list_id, return_recognition_model:false, custom_headers:nil)
  response = get_async(large_face_list_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(large_face_list_id, return_recognition_model:false, custom_headers:nil) click to toggle source

Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel.

@param large_face_list_id [String] Id referencing a particular large face 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_face_list_operations.rb, line 302
def get_async(large_face_list_id, return_recognition_model:false, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_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 = 'largefacelists/{largeFaceListId}'

  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: {'largeFaceListId' => large_face_list_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::LargeFaceList.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
get_face(large_face_list_id, persisted_face_id, custom_headers:nil) click to toggle source

Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId).

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PersistedFace] operation results.

# File lib/1.0/generated/azure_cognitiveservices_face/large_face_list_operations.rb, line 994
def get_face(large_face_list_id, persisted_face_id, custom_headers:nil)
  response = get_face_async(large_face_list_id, persisted_face_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_face_async(large_face_list_id, persisted_face_id, custom_headers:nil) click to toggle source

Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId).

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @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_face_list_operations.rb, line 1029
def get_face_async(large_face_list_id, persisted_face_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
  fail ArgumentError, 'persisted_face_id is nil' if persisted_face_id.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 = 'largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}'

  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: {'largeFaceListId' => large_face_list_id,'persistedFaceId' => persisted_face_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::PersistedFace.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
get_face_with_http_info(large_face_list_id, persisted_face_id, custom_headers:nil) click to toggle source

Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId).

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @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_face_list_operations.rb, line 1012
def get_face_with_http_info(large_face_list_id, persisted_face_id, custom_headers:nil)
  get_face_async(large_face_list_id, persisted_face_id, custom_headers:custom_headers).value!
end
get_training_status(large_face_list_id, custom_headers:nil) click to toggle source

Retrieve the training status of a large face list (completed or ongoing).

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 554
def get_training_status(large_face_list_id, custom_headers:nil)
  response = get_training_status_async(large_face_list_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_training_status_async(large_face_list_id, custom_headers:nil) click to toggle source

Retrieve the training status of a large face list (completed or ongoing).

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 583
def get_training_status_async(large_face_list_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_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 = 'largefacelists/{largeFaceListId}/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: {'largeFaceListId' => large_face_list_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
get_training_status_with_http_info(large_face_list_id, custom_headers:nil) click to toggle source

Retrieve the training status of a large face list (completed or ongoing).

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 569
def get_training_status_with_http_info(large_face_list_id, custom_headers:nil)
  get_training_status_async(large_face_list_id, custom_headers:custom_headers).value!
end
get_with_http_info(large_face_list_id, return_recognition_model:false, custom_headers:nil) click to toggle source

Retrieve a large face list’s largeFaceListId, name, userData and recognitionModel.

@param large_face_list_id [String] Id referencing a particular large face 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_face_list_operations.rb, line 285
def get_with_http_info(large_face_list_id, return_recognition_model:false, custom_headers:nil)
  get_async(large_face_list_id, return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
end
list(return_recognition_model:false, custom_headers:nil) click to toggle source

List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get face information inside largeFaceList use [LargeFaceList Face - Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)<br />

  • Large face lists are stored in alphabetical order of largeFaceListId.

  • “start” parameter (string, optional) is a user-provided largeFaceListId

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 lists: “list1”, …, “list5”. <br /> “start=&top=” will return all 5 lists. <br /> “start=&top=2” will return “list1”, “list2”. <br /> “start=list2&top=3” will return “list3”, “list4”, “list5”.

@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_face_list_operations.rb, line 665
def list(return_recognition_model:false, custom_headers:nil)
  response = list_async(return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_async(return_recognition_model:false, custom_headers:nil) click to toggle source

List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get face information inside largeFaceList use [LargeFaceList Face - Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)<br />

  • Large face lists are stored in alphabetical order of largeFaceListId.

  • “start” parameter (string, optional) is a user-provided largeFaceListId

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 lists: “list1”, …, “list5”. <br /> “start=&top=” will return all 5 lists. <br /> “start=&top=2” will return “list1”, “list2”. <br /> “start=list2&top=3” will return “list3”, “list4”, “list5”.

@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_face_list_operations.rb, line 728
def list_async(return_recognition_model:false, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.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 = 'largefacelists'

  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: {'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: 'LargeFaceListElementType',
                type: {
                  name: 'Composite',
                  class_name: 'LargeFaceList'
                }
            }
          }
        }
        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_faces(large_face_list_id, start:nil, top:nil, custom_headers:nil) click to toggle source

List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).

@param large_face_list_id [String] Id referencing a particular large face list. @param start [String] Starting face id to return (used to list a range of faces). @param top [Integer] Number of faces to return starting with the face id indicated by the 'start' parameter. @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_face_list_operations.rb, line 1493
def list_faces(large_face_list_id, start:nil, top:nil, custom_headers:nil)
  response = list_faces_async(large_face_list_id, start:start, top:top, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_faces_async(large_face_list_id, start:nil, top:nil, custom_headers:nil) click to toggle source

List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).

@param large_face_list_id [String] Id referencing a particular large face list. @param start [String] Starting face id to return (used to list a range of faces). @param top [Integer] Number of faces to return starting with the face id indicated by the 'start' parameter. @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_face_list_operations.rb, line 1532
def list_faces_async(large_face_list_id, start:nil, top:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
  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 = 'largefacelists/{largeFaceListId}/persistedfaces'

  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: {'largeFaceListId' => large_face_list_id},
      query_params: {'start' => start,'top' => top},
      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: 'PersistedFaceElementType',
                type: {
                  name: 'Composite',
                  class_name: 'PersistedFace'
                }
            }
          }
        }
        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_faces_with_http_info(large_face_list_id, start:nil, top:nil, custom_headers:nil) click to toggle source

List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).

@param large_face_list_id [String] Id referencing a particular large face list. @param start [String] Starting face id to return (used to list a range of faces). @param top [Integer] Number of faces to return starting with the face id indicated by the 'start' parameter. @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_face_list_operations.rb, line 1513
def list_faces_with_http_info(large_face_list_id, start:nil, top:nil, custom_headers:nil)
  list_faces_async(large_face_list_id, start:start, top:top, custom_headers:custom_headers).value!
end
list_with_http_info(return_recognition_model:false, custom_headers:nil) click to toggle source

List large face lists’ information of largeFaceListId, name, userData and recognitionModel. <br /> To get face information inside largeFaceList use [LargeFaceList Face - Get](/docs/services/563879b61984550e40cbbe8d/operations/5a158cf2d2de3616c086f2d5)<br />

  • Large face lists are stored in alphabetical order of largeFaceListId.

  • “start” parameter (string, optional) is a user-provided largeFaceListId

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 lists: “list1”, …, “list5”. <br /> “start=&top=” will return all 5 lists. <br /> “start=&top=2” will return “list1”, “list2”. <br /> “start=list2&top=3” will return “list3”, “list4”, “list5”.

@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_face_list_operations.rb, line 697
def list_with_http_info(return_recognition_model:false, custom_headers:nil)
  list_async(return_recognition_model:return_recognition_model, custom_headers:custom_headers).value!
end
train(large_face_list_id, custom_headers:nil) click to toggle source

Queue a large face list training task, the training task may not be started immediately.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 806
def train(large_face_list_id, custom_headers:nil)
  response = train_async(large_face_list_id, custom_headers:custom_headers).value!
  nil
end
train_async(large_face_list_id, custom_headers:nil) click to toggle source

Queue a large face list training task, the training task may not be started immediately.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 837
def train_async(large_face_list_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_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 = 'largefacelists/{largeFaceListId}/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: {'largeFaceListId' => large_face_list_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
train_with_http_info(large_face_list_id, custom_headers:nil) click to toggle source

Queue a large face list training task, the training task may not be started immediately.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 822
def train_with_http_info(large_face_list_id, custom_headers:nil)
  train_async(large_face_list_id, custom_headers:custom_headers).value!
end
update(large_face_list_id, name:nil, user_data:nil, custom_headers:nil) click to toggle source

Update information of a large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 369
def update(large_face_list_id, name:nil, user_data:nil, custom_headers:nil)
  response = update_async(large_face_list_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
  nil
end
update_async(large_face_list_id, name:nil, user_data:nil, custom_headers:nil) click to toggle source

Update information of a large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 402
def update_async(large_face_list_id, name:nil, user_data:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_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 = 'largefacelists/{largeFaceListId}'

  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: {'largeFaceListId' => large_face_list_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_face(large_face_list_id, persisted_face_id, user_data:nil, custom_headers:nil) click to toggle source

Update a persisted face's userData field.

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @param user_data [String] User-provided data attached to the face. The size limit is 1KB. @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_face_list_operations.rb, line 1098
def update_face(large_face_list_id, persisted_face_id, user_data:nil, custom_headers:nil)
  response = update_face_async(large_face_list_id, persisted_face_id, user_data:user_data, custom_headers:custom_headers).value!
  nil
end
update_face_async(large_face_list_id, persisted_face_id, user_data:nil, custom_headers:nil) click to toggle source

Update a persisted face's userData field.

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @param user_data [String] User-provided data attached to the face. The size limit is 1KB. @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_face_list_operations.rb, line 1135
def update_face_async(large_face_list_id, persisted_face_id, user_data:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'large_face_list_id is nil' if large_face_list_id.nil?
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'MaxLength': '64'" if !large_face_list_id.nil? && large_face_list_id.length > 64
  fail ArgumentError, "'large_face_list_id' should satisfy the constraint - 'Pattern': '^[a-z0-9-_]+$'" if !large_face_list_id.nil? && large_face_list_id.match(Regexp.new('^^[a-z0-9-_]+$$')).nil?
  fail ArgumentError, 'persisted_face_id is nil' if persisted_face_id.nil?
  fail ArgumentError, "'user_data' should satisfy the constraint - 'MaxLength': '1024'" if !user_data.nil? && user_data.length > 1024

  body = UpdateFaceRequest.new
  unless user_data.nil?
    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::UpdateFaceRequest.mapper()
  request_content = @client.serialize(request_mapper,  body)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'largefacelists/{largeFaceListId}/persistedfaces/{persistedFaceId}'

  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: {'largeFaceListId' => large_face_list_id,'persistedFaceId' => persisted_face_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_face_with_http_info(large_face_list_id, persisted_face_id, user_data:nil, custom_headers:nil) click to toggle source

Update a persisted face's userData field.

@param large_face_list_id [String] Id referencing a particular large face list. @param persisted_face_id Id referencing a particular persistedFaceId of an existing face. @param user_data [String] User-provided data attached to the face. The size limit is 1KB. @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_face_list_operations.rb, line 1117
def update_face_with_http_info(large_face_list_id, persisted_face_id, user_data:nil, custom_headers:nil)
  update_face_async(large_face_list_id, persisted_face_id, user_data:user_data, custom_headers:custom_headers).value!
end
update_with_http_info(large_face_list_id, name:nil, user_data:nil, custom_headers:nil) click to toggle source

Update information of a large face list.

@param large_face_list_id [String] Id referencing a particular large face list. @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_face_list_operations.rb, line 386
def update_with_http_info(large_face_list_id, name:nil, user_data:nil, custom_headers:nil)
  update_async(large_face_list_id, name:name, user_data:user_data, custom_headers:custom_headers).value!
end