diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision.rb new file mode 100644 index 0000000000..2a105e96d1 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision.rb @@ -0,0 +1,66 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +require 'uri' +require 'cgi' +require 'date' +require 'json' +require 'base64' +require 'erb' +require 'securerandom' +require 'time' +require 'timeliness' +require 'faraday' +require 'faraday-cookie_jar' +require 'concurrent' +require 'ms_rest' +require '2.0/generated/azure_cognitiveservices_computervision/module_definition' +require 'ms_rest_azure' + +module Azure::CognitiveServices::ComputerVision::V2_0 + autoload :ComputerVisionClient, '2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb' + + module Models + autoload :FaceDescription, '2.0/generated/azure_cognitiveservices_computervision/models/face_description.rb' + autoload :ImageMetadata, '2.0/generated/azure_cognitiveservices_computervision/models/image_metadata.rb' + autoload :Line, '2.0/generated/azure_cognitiveservices_computervision/models/line.rb' + autoload :ImageAnalysis, '2.0/generated/azure_cognitiveservices_computervision/models/image_analysis.rb' + autoload :TextOperationResult, '2.0/generated/azure_cognitiveservices_computervision/models/text_operation_result.rb' + autoload :OcrWord, '2.0/generated/azure_cognitiveservices_computervision/models/ocr_word.rb' + autoload :CelebritiesModel, '2.0/generated/azure_cognitiveservices_computervision/models/celebrities_model.rb' + autoload :OcrLine, '2.0/generated/azure_cognitiveservices_computervision/models/ocr_line.rb' + autoload :CategoryDetail, '2.0/generated/azure_cognitiveservices_computervision/models/category_detail.rb' + autoload :OcrRegion, '2.0/generated/azure_cognitiveservices_computervision/models/ocr_region.rb' + autoload :AdultInfo, '2.0/generated/azure_cognitiveservices_computervision/models/adult_info.rb' + autoload :OcrResult, '2.0/generated/azure_cognitiveservices_computervision/models/ocr_result.rb' + autoload :ImageType, '2.0/generated/azure_cognitiveservices_computervision/models/image_type.rb' + autoload :ModelDescription, '2.0/generated/azure_cognitiveservices_computervision/models/model_description.rb' + autoload :ImageCaption, '2.0/generated/azure_cognitiveservices_computervision/models/image_caption.rb' + autoload :ListModelsResult, '2.0/generated/azure_cognitiveservices_computervision/models/list_models_result.rb' + autoload :Word, '2.0/generated/azure_cognitiveservices_computervision/models/word.rb' + autoload :DomainModelResults, '2.0/generated/azure_cognitiveservices_computervision/models/domain_model_results.rb' + autoload :FaceRectangle, '2.0/generated/azure_cognitiveservices_computervision/models/face_rectangle.rb' + autoload :CelebrityResults, '2.0/generated/azure_cognitiveservices_computervision/models/celebrity_results.rb' + autoload :Category, '2.0/generated/azure_cognitiveservices_computervision/models/category.rb' + autoload :LandmarkResults, '2.0/generated/azure_cognitiveservices_computervision/models/landmark_results.rb' + autoload :ImageTag, '2.0/generated/azure_cognitiveservices_computervision/models/image_tag.rb' + autoload :ImageDescription, '2.0/generated/azure_cognitiveservices_computervision/models/image_description.rb' + autoload :RecognitionResult, '2.0/generated/azure_cognitiveservices_computervision/models/recognition_result.rb' + autoload :TagResult, '2.0/generated/azure_cognitiveservices_computervision/models/tag_result.rb' + autoload :ColorInfo, '2.0/generated/azure_cognitiveservices_computervision/models/color_info.rb' + autoload :ComputerVisionError, '2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error.rb' + autoload :LandmarksModel, '2.0/generated/azure_cognitiveservices_computervision/models/landmarks_model.rb' + autoload :ImageUrl, '2.0/generated/azure_cognitiveservices_computervision/models/image_url.rb' + autoload :ImageDescriptionDetails, '2.0/generated/azure_cognitiveservices_computervision/models/image_description_details.rb' + autoload :TextOperationStatusCodes, '2.0/generated/azure_cognitiveservices_computervision/models/text_operation_status_codes.rb' + autoload :Gender, '2.0/generated/azure_cognitiveservices_computervision/models/gender.rb' + autoload :ComputerVisionErrorCodes, '2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error_codes.rb' + autoload :VisualFeatureTypes, '2.0/generated/azure_cognitiveservices_computervision/models/visual_feature_types.rb' + autoload :OcrLanguages, '2.0/generated/azure_cognitiveservices_computervision/models/ocr_languages.rb' + autoload :TextRecognitionMode, '2.0/generated/azure_cognitiveservices_computervision/models/text_recognition_mode.rb' + autoload :AzureRegions, '2.0/generated/azure_cognitiveservices_computervision/models/azure_regions.rb' + autoload :Details, '2.0/generated/azure_cognitiveservices_computervision/models/details.rb' + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb new file mode 100644 index 0000000000..f5e354f339 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/computer_vision_client.rb @@ -0,0 +1,2261 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + # + # A service client - single point of access to the REST API. + # + class ComputerVisionClient < MsRestAzure::AzureServiceClient + include MsRestAzure + include MsRestAzure::Serialization + + # @return [String] the base URI of the service. + attr_reader :base_url + + # @return Credentials needed for the client to connect to Azure. + attr_reader :credentials1 + + # @return [AzureRegions] Supported Azure regions for Cognitive Services + # endpoints. Possible values include: 'westus', 'westeurope', + # 'southeastasia', 'eastus2', 'westcentralus', 'westus2', 'eastus', + # 'southcentralus', 'northeurope', 'eastasia', 'australiaeast', + # 'brazilsouth' + attr_accessor :azure_region + + # @return Subscription credentials which uniquely identify client + # subscription. + attr_accessor :credentials + + # @return [String] Gets or sets the preferred language for the response. + attr_accessor :accept_language + + # @return [Integer] Gets or sets the retry timeout in seconds for Long + # Running Operations. Default value is 30. + attr_accessor :long_running_operation_retry_timeout + + # @return [Boolean] When set to true a unique x-ms-client-request-id value + # is generated and included in each request. Default is true. + attr_accessor :generate_client_request_id + + # + # Creates initializes a new instance of the ComputerVisionClient class. + # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. + # @param options [Array] filters to be applied to the HTTP requests. + # + def initialize(credentials = nil, options = nil) + super(credentials, options) + @base_url = 'https://{AzureRegion}.api.cognitive.microsoft.com/vision/v2.0' + + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? + @credentials = credentials + + @accept_language = 'en-US' + @long_running_operation_retry_timeout = 30 + @generate_client_request_id = true + add_telemetry + end + + # + # Makes a request and returns the body of the response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Hash{String=>String}] containing the body of the response. + # Example: + # + # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" + # path = "/path" + # options = { + # body: request_content, + # query_params: {'api-version' => '2016-02-01'} + # } + # result = @client.make_request(:put, path, options) + # + def make_request(method, path, options = {}) + result = make_request_with_http_info(method, path, options) + result.body unless result.nil? + end + + # + # Makes a request and returns the operation response. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status. + # + def make_request_with_http_info(method, path, options = {}) + result = make_request_async(method, path, options).value! + result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) + result + end + + # + # Makes a request asynchronously. + # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. + # @param path [String] the path, relative to {base_url}. + # @param options [Hash{String=>String}] specifying any request options like :body. + # @return [Concurrent::Promise] Promise object which holds the HTTP response. + # + def make_request_async(method, path, options = {}) + fail ArgumentError, 'method is nil' if method.nil? + fail ArgumentError, 'path is nil' if path.nil? + + request_url = options[:base_url] || @base_url + + request_headers = @request_headers + request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? + options.merge!({headers: request_headers.merge(options[:headers] || {})}) + options.merge!({credentials: @credentials}) unless @credentials.nil? + + super(request_url, method, path, options) + end + + # + # This operation returns the list of domain-specific models that are supported + # by the Computer Vision API. Currently, the API only supports one + # domain-specific model: a celebrity recognizer. A successful response will be + # returned in JSON. If the request failed, the response will contain an error + # code and a message to help understand what went wrong. + # + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ListModelsResult] operation results. + # + def list_models(custom_headers = nil) + response = list_models_async(custom_headers).value! + response.body unless response.nil? + end + + # + # This operation returns the list of domain-specific models that are supported + # by the Computer Vision API. Currently, the API only supports one + # domain-specific model: a celebrity recognizer. A successful response will be + # returned in JSON. If the request failed, the response will contain an error + # code and a message to help understand what went wrong. + # + # @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. + # + def list_models_with_http_info(custom_headers = nil) + list_models_async(custom_headers).value! + end + + # + # This operation returns the list of domain-specific models that are supported + # by the Computer Vision API. Currently, the API only supports one + # domain-specific model: a celebrity recognizer. A successful response will be + # returned in JSON. If the request failed, the response will contain an error + # code and a message to help understand what went wrong. + # + # @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. + # + def list_models_async(custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + path_template = 'models' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ListModelsResult.mapper() + result.body = self.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 + + # + # This operation extracts a rich set of visual features based on the image + # content. Two input methods are supported -- (1) Uploading an image or (2) + # specifying an image URL. Within your request, there is an optional parameter + # to allow you to choose which features to return. By default, image + # categories are returned in the response. + # + # @param url [String] Publicly reachable URL of an image + # @param visual_features [Array] A string indicating what + # visual feature types to return. Multiple values should be comma-separated. + # Valid visual feature types include:Categories - categorizes image content + # according to a taxonomy defined in documentation. Tags - tags the image with + # a detailed list of words related to the image content. Description - + # describes the image content with a complete English sentence. Faces - detects + # if faces are present. If present, generate coordinates, gender and age. + # ImageType - detects if image is clipart or a line drawing. Color - determines + # the accent color, dominant color, and whether an image is black&white.Adult - + # detects if the image is pornographic in nature (depicts nudity or a sex act). + # Sexually suggestive content is also detected. + # @param details [Array
] A string indicating which domain-specific + # details to return. Multiple values should be comma-separated. Valid visual + # feature types include:Celebrities - identifies celebrities if detected in the + # image. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ImageAnalysis] operation results. + # + def analyze_image(url, visual_features = nil, details = nil, language = nil, custom_headers = nil) + response = analyze_image_async(url, visual_features, details, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation extracts a rich set of visual features based on the image + # content. Two input methods are supported -- (1) Uploading an image or (2) + # specifying an image URL. Within your request, there is an optional parameter + # to allow you to choose which features to return. By default, image + # categories are returned in the response. + # + # @param url [String] Publicly reachable URL of an image + # @param visual_features [Array] A string indicating what + # visual feature types to return. Multiple values should be comma-separated. + # Valid visual feature types include:Categories - categorizes image content + # according to a taxonomy defined in documentation. Tags - tags the image with + # a detailed list of words related to the image content. Description - + # describes the image content with a complete English sentence. Faces - detects + # if faces are present. If present, generate coordinates, gender and age. + # ImageType - detects if image is clipart or a line drawing. Color - determines + # the accent color, dominant color, and whether an image is black&white.Adult - + # detects if the image is pornographic in nature (depicts nudity or a sex act). + # Sexually suggestive content is also detected. + # @param details [Array
] A string indicating which domain-specific + # details to return. Multiple values should be comma-separated. Valid visual + # feature types include:Celebrities - identifies celebrities if detected in the + # image. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_with_http_info(url, visual_features = nil, details = nil, language = nil, custom_headers = nil) + analyze_image_async(url, visual_features, details, language, custom_headers).value! + end + + # + # This operation extracts a rich set of visual features based on the image + # content. Two input methods are supported -- (1) Uploading an image or (2) + # specifying an image URL. Within your request, there is an optional parameter + # to allow you to choose which features to return. By default, image + # categories are returned in the response. + # + # @param url [String] Publicly reachable URL of an image + # @param visual_features [Array] A string indicating what + # visual feature types to return. Multiple values should be comma-separated. + # Valid visual feature types include:Categories - categorizes image content + # according to a taxonomy defined in documentation. Tags - tags the image with + # a detailed list of words related to the image content. Description - + # describes the image content with a complete English sentence. Faces - detects + # if faces are present. If present, generate coordinates, gender and age. + # ImageType - detects if image is clipart or a line drawing. Color - determines + # the accent color, dominant color, and whether an image is black&white.Adult - + # detects if the image is pornographic in nature (depicts nudity or a sex act). + # Sexually suggestive content is also detected. + # @param details [Array
] A string indicating which domain-specific + # details to return. Multiple values should be comma-separated. Valid visual + # feature types include:Celebrities - identifies celebrities if detected in the + # image. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_async(url, visual_features = nil, details = nil, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'analyze' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'visualFeatures' => visual_features.nil? ? nil : visual_features.join(','),'details' => details.nil? ? nil : details.join(','),'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageAnalysis.mapper() + result.body = self.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 + + # + # This operation generates a thumbnail image with the user-specified width and + # height. By default, the service analyzes the image, identifies the region of + # interest (ROI), and generates smart cropping coordinates based on the ROI. + # Smart cropping helps when you specify an aspect ratio that differs from that + # of the input image. A successful response contains the thumbnail image + # binary. If the request failed, the response contains an error code and a + # message to help determine what went wrong. + # + # @param width [Integer] Width of the thumbnail. It must be between 1 and 1024. + # Recommended minimum of 50. + # @param height [Integer] Height of the thumbnail. It must be between 1 and + # 1024. Recommended minimum of 50. + # @param url [String] Publicly reachable URL of an image + # @param smart_cropping [Boolean] Boolean flag for enabling smart cropping. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [NOT_IMPLEMENTED] operation results. + # + def generate_thumbnail(width, height, url, smart_cropping = false, custom_headers = nil) + response = generate_thumbnail_async(width, height, url, smart_cropping, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation generates a thumbnail image with the user-specified width and + # height. By default, the service analyzes the image, identifies the region of + # interest (ROI), and generates smart cropping coordinates based on the ROI. + # Smart cropping helps when you specify an aspect ratio that differs from that + # of the input image. A successful response contains the thumbnail image + # binary. If the request failed, the response contains an error code and a + # message to help determine what went wrong. + # + # @param width [Integer] Width of the thumbnail. It must be between 1 and 1024. + # Recommended minimum of 50. + # @param height [Integer] Height of the thumbnail. It must be between 1 and + # 1024. Recommended minimum of 50. + # @param url [String] Publicly reachable URL of an image + # @param smart_cropping [Boolean] Boolean flag for enabling smart cropping. + # @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. + # + def generate_thumbnail_with_http_info(width, height, url, smart_cropping = false, custom_headers = nil) + generate_thumbnail_async(width, height, url, smart_cropping, custom_headers).value! + end + + # + # This operation generates a thumbnail image with the user-specified width and + # height. By default, the service analyzes the image, identifies the region of + # interest (ROI), and generates smart cropping coordinates based on the ROI. + # Smart cropping helps when you specify an aspect ratio that differs from that + # of the input image. A successful response contains the thumbnail image + # binary. If the request failed, the response contains an error code and a + # message to help determine what went wrong. + # + # @param width [Integer] Width of the thumbnail. It must be between 1 and 1024. + # Recommended minimum of 50. + # @param height [Integer] Height of the thumbnail. It must be between 1 and + # 1024. Recommended minimum of 50. + # @param url [String] Publicly reachable URL of an image + # @param smart_cropping [Boolean] Boolean flag for enabling smart cropping. + # @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. + # + def generate_thumbnail_async(width, height, url, smart_cropping = false, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'width is nil' if width.nil? + fail ArgumentError, 'height is nil' if height.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'generateThumbnail' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'width' => width,'height' => height,'smartCropping' => smart_cropping}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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 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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = { + required: false, + serialized_name: 'parsed_response', + type: { + name: 'Stream' + } + } + result.body = self.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 + + # + # Optical Character Recognition (OCR) detects printed text in an image and + # extracts the recognized characters into a machine-usable character stream. + # Upon success, the OCR results will be returned. Upon failure, the error code + # together with an error message will be returned. The error code can be one of + # InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, + # NotSupportedLanguage, or InternalServerError. + # + # @param detect_orientation [Boolean] Whether detect the text orientation in + # the image. With detectOrientation=true the OCR service tries to detect the + # image orientation and correct it before further processing (e.g. if it's + # upside-down). + # @param url [String] Publicly reachable URL of an image + # @param language [OcrLanguages] The BCP-47 language code of the text to be + # detected in the image. The default value is 'unk'. Possible values include: + # 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', + # 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', + # 'sr-Cyrl', 'sr-Latn', 'sk' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [OcrResult] operation results. + # + def recognize_printed_text(detect_orientation, url, language = nil, custom_headers = nil) + response = recognize_printed_text_async(detect_orientation, url, language, custom_headers).value! + response.body unless response.nil? + end + + # + # Optical Character Recognition (OCR) detects printed text in an image and + # extracts the recognized characters into a machine-usable character stream. + # Upon success, the OCR results will be returned. Upon failure, the error code + # together with an error message will be returned. The error code can be one of + # InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, + # NotSupportedLanguage, or InternalServerError. + # + # @param detect_orientation [Boolean] Whether detect the text orientation in + # the image. With detectOrientation=true the OCR service tries to detect the + # image orientation and correct it before further processing (e.g. if it's + # upside-down). + # @param url [String] Publicly reachable URL of an image + # @param language [OcrLanguages] The BCP-47 language code of the text to be + # detected in the image. The default value is 'unk'. Possible values include: + # 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', + # 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', + # 'sr-Cyrl', 'sr-Latn', 'sk' + # @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. + # + def recognize_printed_text_with_http_info(detect_orientation, url, language = nil, custom_headers = nil) + recognize_printed_text_async(detect_orientation, url, language, custom_headers).value! + end + + # + # Optical Character Recognition (OCR) detects printed text in an image and + # extracts the recognized characters into a machine-usable character stream. + # Upon success, the OCR results will be returned. Upon failure, the error code + # together with an error message will be returned. The error code can be one of + # InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, + # NotSupportedLanguage, or InternalServerError. + # + # @param detect_orientation [Boolean] Whether detect the text orientation in + # the image. With detectOrientation=true the OCR service tries to detect the + # image orientation and correct it before further processing (e.g. if it's + # upside-down). + # @param url [String] Publicly reachable URL of an image + # @param language [OcrLanguages] The BCP-47 language code of the text to be + # detected in the image. The default value is 'unk'. Possible values include: + # 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', + # 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', + # 'sr-Cyrl', 'sr-Latn', 'sk' + # @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. + # + def recognize_printed_text_async(detect_orientation, url, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'detect_orientation is nil' if detect_orientation.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'ocr' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'detectOrientation' => detect_orientation,'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::OcrResult.mapper() + result.body = self.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 + + # + # This operation generates a description of an image in human readable language + # with complete sentences. The description is based on a collection of content + # tags, which are also returned by the operation. More than one description can + # be generated for each image. Descriptions are ordered by their confidence + # score. All descriptions are in English. Two input methods are supported -- + # (1) Uploading an image or (2) specifying an image URL.A successful response + # will be returned in JSON. If the request failed, the response will contain + # an error code and a message to help understand what went wrong. + # + # @param url [String] Publicly reachable URL of an image + # @param max_candidates [String] Maximum number of candidate descriptions to be + # returned. The default is 1. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ImageDescription] operation results. + # + def describe_image(url, max_candidates = '1', language = nil, custom_headers = nil) + response = describe_image_async(url, max_candidates, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation generates a description of an image in human readable language + # with complete sentences. The description is based on a collection of content + # tags, which are also returned by the operation. More than one description can + # be generated for each image. Descriptions are ordered by their confidence + # score. All descriptions are in English. Two input methods are supported -- + # (1) Uploading an image or (2) specifying an image URL.A successful response + # will be returned in JSON. If the request failed, the response will contain + # an error code and a message to help understand what went wrong. + # + # @param url [String] Publicly reachable URL of an image + # @param max_candidates [String] Maximum number of candidate descriptions to be + # returned. The default is 1. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def describe_image_with_http_info(url, max_candidates = '1', language = nil, custom_headers = nil) + describe_image_async(url, max_candidates, language, custom_headers).value! + end + + # + # This operation generates a description of an image in human readable language + # with complete sentences. The description is based on a collection of content + # tags, which are also returned by the operation. More than one description can + # be generated for each image. Descriptions are ordered by their confidence + # score. All descriptions are in English. Two input methods are supported -- + # (1) Uploading an image or (2) specifying an image URL.A successful response + # will be returned in JSON. If the request failed, the response will contain + # an error code and a message to help understand what went wrong. + # + # @param url [String] Publicly reachable URL of an image + # @param max_candidates [String] Maximum number of candidate descriptions to be + # returned. The default is 1. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def describe_image_async(url, max_candidates = '1', language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'describe' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'maxCandidates' => max_candidates,'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageDescription.mapper() + result.body = self.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 + + # + # This operation generates a list of words, or tags, that are relevant to the + # content of the supplied image. The Computer Vision API can return tags based + # on objects, living beings, scenery or actions found in images. Unlike + # categories, tags are not organized according to a hierarchical classification + # system, but correspond to image content. Tags may contain hints to avoid + # ambiguity or provide context, for example the tag 'cello' may be accompanied + # by the hint 'musical instrument'. All tags are in English. + # + # @param url [String] Publicly reachable URL of an image + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TagResult] operation results. + # + def tag_image(url, language = nil, custom_headers = nil) + response = tag_image_async(url, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation generates a list of words, or tags, that are relevant to the + # content of the supplied image. The Computer Vision API can return tags based + # on objects, living beings, scenery or actions found in images. Unlike + # categories, tags are not organized according to a hierarchical classification + # system, but correspond to image content. Tags may contain hints to avoid + # ambiguity or provide context, for example the tag 'cello' may be accompanied + # by the hint 'musical instrument'. All tags are in English. + # + # @param url [String] Publicly reachable URL of an image + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def tag_image_with_http_info(url, language = nil, custom_headers = nil) + tag_image_async(url, language, custom_headers).value! + end + + # + # This operation generates a list of words, or tags, that are relevant to the + # content of the supplied image. The Computer Vision API can return tags based + # on objects, living beings, scenery or actions found in images. Unlike + # categories, tags are not organized according to a hierarchical classification + # system, but correspond to image content. Tags may contain hints to avoid + # ambiguity or provide context, for example the tag 'cello' may be accompanied + # by the hint 'musical instrument'. All tags are in English. + # + # @param url [String] Publicly reachable URL of an image + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def tag_image_async(url, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'tag' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::TagResult.mapper() + result.body = self.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 + + # + # This operation recognizes content within an image by applying a + # domain-specific model. The list of domain-specific models that are supported + # by the Computer Vision API can be retrieved using the /models GET request. + # Currently, the API only provides a single domain-specific model: celebrities. + # Two input methods are supported -- (1) Uploading an image or (2) specifying + # an image URL. A successful response will be returned in JSON. If the request + # failed, the response will contain an error code and a message to help + # understand what went wrong. + # + # @param model [String] The domain-specific content to recognize. + # @param url [String] Publicly reachable URL of an image + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [DomainModelResults] operation results. + # + def analyze_image_by_domain(model, url, language = nil, custom_headers = nil) + response = analyze_image_by_domain_async(model, url, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation recognizes content within an image by applying a + # domain-specific model. The list of domain-specific models that are supported + # by the Computer Vision API can be retrieved using the /models GET request. + # Currently, the API only provides a single domain-specific model: celebrities. + # Two input methods are supported -- (1) Uploading an image or (2) specifying + # an image URL. A successful response will be returned in JSON. If the request + # failed, the response will contain an error code and a message to help + # understand what went wrong. + # + # @param model [String] The domain-specific content to recognize. + # @param url [String] Publicly reachable URL of an image + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_by_domain_with_http_info(model, url, language = nil, custom_headers = nil) + analyze_image_by_domain_async(model, url, language, custom_headers).value! + end + + # + # This operation recognizes content within an image by applying a + # domain-specific model. The list of domain-specific models that are supported + # by the Computer Vision API can be retrieved using the /models GET request. + # Currently, the API only provides a single domain-specific model: celebrities. + # Two input methods are supported -- (1) Uploading an image or (2) specifying + # an image URL. A successful response will be returned in JSON. If the request + # failed, the response will contain an error code and a message to help + # understand what went wrong. + # + # @param model [String] The domain-specific content to recognize. + # @param url [String] Publicly reachable URL of an image + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_by_domain_async(model, url, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'model is nil' if model.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'models/{model}/analyze' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'model' => model}, + query_params: {'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::DomainModelResults.mapper() + result.body = self.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 + + # + # Recognize Text operation. When you use the Recognize Text interface, the + # response contains a field called 'Operation-Location'. The + # 'Operation-Location' field contains the URL that you must use for your Get + # Recognize Text Operation Result operation. + # + # @param mode [TextRecognitionMode] Type of text to recognize. Possible values + # include: 'Handwritten', 'Printed' + # @param url [String] Publicly reachable URL of an image + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def recognize_text(url, mode, custom_headers = nil) + response = recognize_text_async(url, mode, custom_headers).value! + nil + end + + # + # Recognize Text operation. When you use the Recognize Text interface, the + # response contains a field called 'Operation-Location'. The + # 'Operation-Location' field contains the URL that you must use for your Get + # Recognize Text Operation Result operation. + # + # @param mode [TextRecognitionMode] Type of text to recognize. Possible values + # include: 'Handwritten', 'Printed' + # @param url [String] Publicly reachable URL of an image + # @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. + # + def recognize_text_with_http_info(url, mode, custom_headers = nil) + recognize_text_async(url, mode, custom_headers).value! + end + + # + # Recognize Text operation. When you use the Recognize Text interface, the + # response contains a field called 'Operation-Location'. The + # 'Operation-Location' field contains the URL that you must use for your Get + # Recognize Text Operation Result operation. + # + # @param mode [TextRecognitionMode] Type of text to recognize. Possible values + # include: 'Handwritten', 'Printed' + # @param url [String] Publicly reachable URL of an image + # @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. + # + def recognize_text_async(url, mode, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'mode is nil' if mode.nil? + fail ArgumentError, 'url is nil' if url.nil? + + image_url = ImageUrl.new + unless url.nil? + image_url.url = url + end + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/json; charset=utf-8' + + # Serialize Request + request_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageUrl.mapper() + request_content = self.serialize(request_mapper, image_url) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'recognizeText' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'mode' => mode}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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 + end + + promise.execute + end + + # + # This interface is used for getting text operation result. The URL to this + # interface should be retrieved from 'Operation-Location' field returned from + # Recognize Text interface. + # + # @param operation_id [String] Id of the text operation returned in the + # response of the 'Recognize Text' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TextOperationResult] operation results. + # + def get_text_operation_result(operation_id, custom_headers = nil) + response = get_text_operation_result_async(operation_id, custom_headers).value! + response.body unless response.nil? + end + + # + # This interface is used for getting text operation result. The URL to this + # interface should be retrieved from 'Operation-Location' field returned from + # Recognize Text interface. + # + # @param operation_id [String] Id of the text operation returned in the + # response of the 'Recognize Text' + # @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. + # + def get_text_operation_result_with_http_info(operation_id, custom_headers = nil) + get_text_operation_result_async(operation_id, custom_headers).value! + end + + # + # This interface is used for getting text operation result. The URL to this + # interface should be retrieved from 'Operation-Location' field returned from + # Recognize Text interface. + # + # @param operation_id [String] Id of the text operation returned in the + # response of the 'Recognize Text' + # @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. + # + def get_text_operation_result_async(operation_id, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'operation_id is nil' if operation_id.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + path_template = 'textOperations/{operationId}' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'operationId' => operation_id}, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::TextOperationResult.mapper() + result.body = self.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 + + # + # This operation extracts a rich set of visual features based on the image + # content. + # + # @param image An image stream. + # @param visual_features [Array] A string indicating what + # visual feature types to return. Multiple values should be comma-separated. + # Valid visual feature types include:Categories - categorizes image content + # according to a taxonomy defined in documentation. Tags - tags the image with + # a detailed list of words related to the image content. Description - + # describes the image content with a complete English sentence. Faces - detects + # if faces are present. If present, generate coordinates, gender and age. + # ImageType - detects if image is clipart or a line drawing. Color - determines + # the accent color, dominant color, and whether an image is black&white.Adult - + # detects if the image is pornographic in nature (depicts nudity or a sex act). + # Sexually suggestive content is also detected. + # @param details [Enum] A string indicating which domain-specific details to + # return. Multiple values should be comma-separated. Valid visual feature types + # include:Celebrities - identifies celebrities if detected in the image. + # Possible values include: 'Celebrities', 'Landmarks' + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ImageAnalysis] operation results. + # + def analyze_image_in_stream(image, visual_features = nil, details = nil, language = nil, custom_headers = nil) + response = analyze_image_in_stream_async(image, visual_features, details, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation extracts a rich set of visual features based on the image + # content. + # + # @param image An image stream. + # @param visual_features [Array] A string indicating what + # visual feature types to return. Multiple values should be comma-separated. + # Valid visual feature types include:Categories - categorizes image content + # according to a taxonomy defined in documentation. Tags - tags the image with + # a detailed list of words related to the image content. Description - + # describes the image content with a complete English sentence. Faces - detects + # if faces are present. If present, generate coordinates, gender and age. + # ImageType - detects if image is clipart or a line drawing. Color - determines + # the accent color, dominant color, and whether an image is black&white.Adult - + # detects if the image is pornographic in nature (depicts nudity or a sex act). + # Sexually suggestive content is also detected. + # @param details [Enum] A string indicating which domain-specific details to + # return. Multiple values should be comma-separated. Valid visual feature types + # include:Celebrities - identifies celebrities if detected in the image. + # Possible values include: 'Celebrities', 'Landmarks' + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_in_stream_with_http_info(image, visual_features = nil, details = nil, language = nil, custom_headers = nil) + analyze_image_in_stream_async(image, visual_features, details, language, custom_headers).value! + end + + # + # This operation extracts a rich set of visual features based on the image + # content. + # + # @param image An image stream. + # @param visual_features [Array] A string indicating what + # visual feature types to return. Multiple values should be comma-separated. + # Valid visual feature types include:Categories - categorizes image content + # according to a taxonomy defined in documentation. Tags - tags the image with + # a detailed list of words related to the image content. Description - + # describes the image content with a complete English sentence. Faces - detects + # if faces are present. If present, generate coordinates, gender and age. + # ImageType - detects if image is clipart or a line drawing. Color - determines + # the accent color, dominant color, and whether an image is black&white.Adult - + # detects if the image is pornographic in nature (depicts nudity or a sex act). + # Sexually suggestive content is also detected. + # @param details [Enum] A string indicating which domain-specific details to + # return. Multiple values should be comma-separated. Valid visual feature types + # include:Celebrities - identifies celebrities if detected in the image. + # Possible values include: 'Celebrities', 'Landmarks' + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_in_stream_async(image, visual_features = nil, details = nil, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'image is nil' if image.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'analyze' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'visualFeatures' => visual_features.nil? ? nil : visual_features.join(','),'details' => details,'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageAnalysis.mapper() + result.body = self.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 + + # + # This operation generates a thumbnail image with the user-specified width and + # height. By default, the service analyzes the image, identifies the region of + # interest (ROI), and generates smart cropping coordinates based on the ROI. + # Smart cropping helps when you specify an aspect ratio that differs from that + # of the input image. A successful response contains the thumbnail image + # binary. If the request failed, the response contains an error code and a + # message to help determine what went wrong. + # + # @param width [Integer] Width of the thumbnail. It must be between 1 and 1024. + # Recommended minimum of 50. + # @param height [Integer] Height of the thumbnail. It must be between 1 and + # 1024. Recommended minimum of 50. + # @param image An image stream. + # @param smart_cropping [Boolean] Boolean flag for enabling smart cropping. + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [NOT_IMPLEMENTED] operation results. + # + def generate_thumbnail_in_stream(width, height, image, smart_cropping = false, custom_headers = nil) + response = generate_thumbnail_in_stream_async(width, height, image, smart_cropping, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation generates a thumbnail image with the user-specified width and + # height. By default, the service analyzes the image, identifies the region of + # interest (ROI), and generates smart cropping coordinates based on the ROI. + # Smart cropping helps when you specify an aspect ratio that differs from that + # of the input image. A successful response contains the thumbnail image + # binary. If the request failed, the response contains an error code and a + # message to help determine what went wrong. + # + # @param width [Integer] Width of the thumbnail. It must be between 1 and 1024. + # Recommended minimum of 50. + # @param height [Integer] Height of the thumbnail. It must be between 1 and + # 1024. Recommended minimum of 50. + # @param image An image stream. + # @param smart_cropping [Boolean] Boolean flag for enabling smart cropping. + # @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. + # + def generate_thumbnail_in_stream_with_http_info(width, height, image, smart_cropping = false, custom_headers = nil) + generate_thumbnail_in_stream_async(width, height, image, smart_cropping, custom_headers).value! + end + + # + # This operation generates a thumbnail image with the user-specified width and + # height. By default, the service analyzes the image, identifies the region of + # interest (ROI), and generates smart cropping coordinates based on the ROI. + # Smart cropping helps when you specify an aspect ratio that differs from that + # of the input image. A successful response contains the thumbnail image + # binary. If the request failed, the response contains an error code and a + # message to help determine what went wrong. + # + # @param width [Integer] Width of the thumbnail. It must be between 1 and 1024. + # Recommended minimum of 50. + # @param height [Integer] Height of the thumbnail. It must be between 1 and + # 1024. Recommended minimum of 50. + # @param image An image stream. + # @param smart_cropping [Boolean] Boolean flag for enabling smart cropping. + # @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. + # + def generate_thumbnail_in_stream_async(width, height, image, smart_cropping = false, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'width is nil' if width.nil? + fail ArgumentError, 'height is nil' if height.nil? + fail ArgumentError, 'image is nil' if image.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'generateThumbnail' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'width' => width,'height' => height,'smartCropping' => smart_cropping}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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 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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = { + required: false, + serialized_name: 'parsed_response', + type: { + name: 'Stream' + } + } + result.body = self.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 + + # + # Optical Character Recognition (OCR) detects printed text in an image and + # extracts the recognized characters into a machine-usable character stream. + # Upon success, the OCR results will be returned. Upon failure, the error code + # together with an error message will be returned. The error code can be one of + # InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, + # NotSupportedLanguage, or InternalServerError. + # + # @param detect_orientation [Boolean] Whether detect the text orientation in + # the image. With detectOrientation=true the OCR service tries to detect the + # image orientation and correct it before further processing (e.g. if it's + # upside-down). + # @param image An image stream. + # @param language [OcrLanguages] The BCP-47 language code of the text to be + # detected in the image. The default value is 'unk'. Possible values include: + # 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', + # 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', + # 'sr-Cyrl', 'sr-Latn', 'sk' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [OcrResult] operation results. + # + def recognize_printed_text_in_stream(detect_orientation, image, language = nil, custom_headers = nil) + response = recognize_printed_text_in_stream_async(detect_orientation, image, language, custom_headers).value! + response.body unless response.nil? + end + + # + # Optical Character Recognition (OCR) detects printed text in an image and + # extracts the recognized characters into a machine-usable character stream. + # Upon success, the OCR results will be returned. Upon failure, the error code + # together with an error message will be returned. The error code can be one of + # InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, + # NotSupportedLanguage, or InternalServerError. + # + # @param detect_orientation [Boolean] Whether detect the text orientation in + # the image. With detectOrientation=true the OCR service tries to detect the + # image orientation and correct it before further processing (e.g. if it's + # upside-down). + # @param image An image stream. + # @param language [OcrLanguages] The BCP-47 language code of the text to be + # detected in the image. The default value is 'unk'. Possible values include: + # 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', + # 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', + # 'sr-Cyrl', 'sr-Latn', 'sk' + # @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. + # + def recognize_printed_text_in_stream_with_http_info(detect_orientation, image, language = nil, custom_headers = nil) + recognize_printed_text_in_stream_async(detect_orientation, image, language, custom_headers).value! + end + + # + # Optical Character Recognition (OCR) detects printed text in an image and + # extracts the recognized characters into a machine-usable character stream. + # Upon success, the OCR results will be returned. Upon failure, the error code + # together with an error message will be returned. The error code can be one of + # InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, + # NotSupportedLanguage, or InternalServerError. + # + # @param detect_orientation [Boolean] Whether detect the text orientation in + # the image. With detectOrientation=true the OCR service tries to detect the + # image orientation and correct it before further processing (e.g. if it's + # upside-down). + # @param image An image stream. + # @param language [OcrLanguages] The BCP-47 language code of the text to be + # detected in the image. The default value is 'unk'. Possible values include: + # 'unk', 'zh-Hans', 'zh-Hant', 'cs', 'da', 'nl', 'en', 'fi', 'fr', 'de', 'el', + # 'hu', 'it', 'ja', 'ko', 'nb', 'pl', 'pt', 'ru', 'es', 'sv', 'tr', 'ar', 'ro', + # 'sr-Cyrl', 'sr-Latn', 'sk' + # @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. + # + def recognize_printed_text_in_stream_async(detect_orientation, image, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'detect_orientation is nil' if detect_orientation.nil? + fail ArgumentError, 'image is nil' if image.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'ocr' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'language' => language,'detectOrientation' => detect_orientation}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::OcrResult.mapper() + result.body = self.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 + + # + # This operation generates a description of an image in human readable language + # with complete sentences. The description is based on a collection of content + # tags, which are also returned by the operation. More than one description can + # be generated for each image. Descriptions are ordered by their confidence + # score. All descriptions are in English. Two input methods are supported -- + # (1) Uploading an image or (2) specifying an image URL.A successful response + # will be returned in JSON. If the request failed, the response will contain + # an error code and a message to help understand what went wrong. + # + # @param image An image stream. + # @param max_candidates [String] Maximum number of candidate descriptions to be + # returned. The default is 1. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [ImageDescription] operation results. + # + def describe_image_in_stream(image, max_candidates = '1', language = nil, custom_headers = nil) + response = describe_image_in_stream_async(image, max_candidates, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation generates a description of an image in human readable language + # with complete sentences. The description is based on a collection of content + # tags, which are also returned by the operation. More than one description can + # be generated for each image. Descriptions are ordered by their confidence + # score. All descriptions are in English. Two input methods are supported -- + # (1) Uploading an image or (2) specifying an image URL.A successful response + # will be returned in JSON. If the request failed, the response will contain + # an error code and a message to help understand what went wrong. + # + # @param image An image stream. + # @param max_candidates [String] Maximum number of candidate descriptions to be + # returned. The default is 1. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def describe_image_in_stream_with_http_info(image, max_candidates = '1', language = nil, custom_headers = nil) + describe_image_in_stream_async(image, max_candidates, language, custom_headers).value! + end + + # + # This operation generates a description of an image in human readable language + # with complete sentences. The description is based on a collection of content + # tags, which are also returned by the operation. More than one description can + # be generated for each image. Descriptions are ordered by their confidence + # score. All descriptions are in English. Two input methods are supported -- + # (1) Uploading an image or (2) specifying an image URL.A successful response + # will be returned in JSON. If the request failed, the response will contain + # an error code and a message to help understand what went wrong. + # + # @param image An image stream. + # @param max_candidates [String] Maximum number of candidate descriptions to be + # returned. The default is 1. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def describe_image_in_stream_async(image, max_candidates = '1', language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'image is nil' if image.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'describe' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'maxCandidates' => max_candidates,'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::ImageDescription.mapper() + result.body = self.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 + + # + # This operation generates a list of words, or tags, that are relevant to the + # content of the supplied image. The Computer Vision API can return tags based + # on objects, living beings, scenery or actions found in images. Unlike + # categories, tags are not organized according to a hierarchical classification + # system, but correspond to image content. Tags may contain hints to avoid + # ambiguity or provide context, for example the tag 'cello' may be accompanied + # by the hint 'musical instrument'. All tags are in English. + # + # @param image An image stream. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [TagResult] operation results. + # + def tag_image_in_stream(image, language = nil, custom_headers = nil) + response = tag_image_in_stream_async(image, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation generates a list of words, or tags, that are relevant to the + # content of the supplied image. The Computer Vision API can return tags based + # on objects, living beings, scenery or actions found in images. Unlike + # categories, tags are not organized according to a hierarchical classification + # system, but correspond to image content. Tags may contain hints to avoid + # ambiguity or provide context, for example the tag 'cello' may be accompanied + # by the hint 'musical instrument'. All tags are in English. + # + # @param image An image stream. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def tag_image_in_stream_with_http_info(image, language = nil, custom_headers = nil) + tag_image_in_stream_async(image, language, custom_headers).value! + end + + # + # This operation generates a list of words, or tags, that are relevant to the + # content of the supplied image. The Computer Vision API can return tags based + # on objects, living beings, scenery or actions found in images. Unlike + # categories, tags are not organized according to a hierarchical classification + # system, but correspond to image content. Tags may contain hints to avoid + # ambiguity or provide context, for example the tag 'cello' may be accompanied + # by the hint 'musical instrument'. All tags are in English. + # + # @param image An image stream. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def tag_image_in_stream_async(image, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'image is nil' if image.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'tag' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::TagResult.mapper() + result.body = self.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 + + # + # This operation recognizes content within an image by applying a + # domain-specific model. The list of domain-specific models that are supported + # by the Computer Vision API can be retrieved using the /models GET request. + # Currently, the API only provides a single domain-specific model: celebrities. + # Two input methods are supported -- (1) Uploading an image or (2) specifying + # an image URL. A successful response will be returned in JSON. If the request + # failed, the response will contain an error code and a message to help + # understand what went wrong. + # + # @param model [String] The domain-specific content to recognize. + # @param image An image stream. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # @return [DomainModelResults] operation results. + # + def analyze_image_by_domain_in_stream(model, image, language = nil, custom_headers = nil) + response = analyze_image_by_domain_in_stream_async(model, image, language, custom_headers).value! + response.body unless response.nil? + end + + # + # This operation recognizes content within an image by applying a + # domain-specific model. The list of domain-specific models that are supported + # by the Computer Vision API can be retrieved using the /models GET request. + # Currently, the API only provides a single domain-specific model: celebrities. + # Two input methods are supported -- (1) Uploading an image or (2) specifying + # an image URL. A successful response will be returned in JSON. If the request + # failed, the response will contain an error code and a message to help + # understand what went wrong. + # + # @param model [String] The domain-specific content to recognize. + # @param image An image stream. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_by_domain_in_stream_with_http_info(model, image, language = nil, custom_headers = nil) + analyze_image_by_domain_in_stream_async(model, image, language, custom_headers).value! + end + + # + # This operation recognizes content within an image by applying a + # domain-specific model. The list of domain-specific models that are supported + # by the Computer Vision API can be retrieved using the /models GET request. + # Currently, the API only provides a single domain-specific model: celebrities. + # Two input methods are supported -- (1) Uploading an image or (2) specifying + # an image URL. A successful response will be returned in JSON. If the request + # failed, the response will contain an error code and a message to help + # understand what went wrong. + # + # @param model [String] The domain-specific content to recognize. + # @param image An image stream. + # @param language [Enum] The desired language for output generation. If this + # parameter is not specified, the default value is "en".Supported + # languages:en - English, Default. es - Spanish, ja - Japanese, pt - + # Portuguese, zh - Simplified Chinese. Possible values include: 'en', 'es', + # 'ja', 'pt', 'zh' + # @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. + # + def analyze_image_by_domain_in_stream_async(model, image, language = nil, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'model is nil' if model.nil? + fail ArgumentError, 'image is nil' if image.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'models/{model}/analyze' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + path_params: {'model' => model}, + query_params: {'language' => language}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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? + # Deserialize Response + if status_code == 200 + begin + parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) + result_mapper = Azure::CognitiveServices::ComputerVision::V2_0::Models::DomainModelResults.mapper() + result.body = self.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 + + # + # Recognize Text operation. When you use the Recognize Text interface, the + # response contains a field called 'Operation-Location'. The + # 'Operation-Location' field contains the URL that you must use for your Get + # Recognize Text Operation Result operation. + # + # @param image An image stream. + # @param mode [TextRecognitionMode] Type of text to recognize. Possible values + # include: 'Handwritten', 'Printed' + # @param custom_headers [Hash{String => String}] A hash of custom headers that + # will be added to the HTTP request. + # + # + def recognize_text_in_stream(image, mode, custom_headers = nil) + response = recognize_text_in_stream_async(image, mode, custom_headers).value! + nil + end + + # + # Recognize Text operation. When you use the Recognize Text interface, the + # response contains a field called 'Operation-Location'. The + # 'Operation-Location' field contains the URL that you must use for your Get + # Recognize Text Operation Result operation. + # + # @param image An image stream. + # @param mode [TextRecognitionMode] Type of text to recognize. Possible values + # include: 'Handwritten', 'Printed' + # @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. + # + def recognize_text_in_stream_with_http_info(image, mode, custom_headers = nil) + recognize_text_in_stream_async(image, mode, custom_headers).value! + end + + # + # Recognize Text operation. When you use the Recognize Text interface, the + # response contains a field called 'Operation-Location'. The + # 'Operation-Location' field contains the URL that you must use for your Get + # Recognize Text Operation Result operation. + # + # @param image An image stream. + # @param mode [TextRecognitionMode] Type of text to recognize. Possible values + # include: 'Handwritten', 'Printed' + # @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. + # + def recognize_text_in_stream_async(image, mode, custom_headers = nil) + fail ArgumentError, 'azure_region is nil' if azure_region.nil? + fail ArgumentError, 'image is nil' if image.nil? + fail ArgumentError, 'mode is nil' if mode.nil? + + + request_headers = {} + + # Set Headers + request_headers['x-ms-client-request-id'] = SecureRandom.uuid + request_headers['accept-language'] = accept_language unless accept_language.nil? + + request_headers['Content-Type'] = 'application/octet-stream' + + # Serialize Request + request_mapper = { + required: true, + serialized_name: 'Image', + type: { + name: 'Stream' + } + } + request_content = self.serialize(request_mapper, image) + request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil + + path_template = 'recognizeText' + + request_url = @base_url || self.base_url + request_url = request_url.gsub('{AzureRegion}', azure_region) + + options = { + middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], + query_params: {'mode' => mode}, + body: request_content, + headers: request_headers.merge(custom_headers || {}), + base_url: request_url + } + promise = self.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 + end + + promise.execute + end + + + private + # + # Adds telemetry information. + # + def add_telemetry + sdk_information = 'azure_cognitiveservices_computervision' + if defined? Azure::CognitiveServices::ComputerVision::V2_0::VERSION + sdk_information = "#{sdk_information}/#{Azure::CognitiveServices::ComputerVision::V2_0::VERSION}" + end + add_user_agent_information(sdk_information) + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/adult_info.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/adult_info.rb new file mode 100644 index 0000000000..01982e1be8 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/adult_info.rb @@ -0,0 +1,78 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing whether the image contains adult-oriented content + # and/or is racy. + # + class AdultInfo + + include MsRestAzure + + # @return [Boolean] A value indicating if the image contains + # adult-oriented content. + attr_accessor :is_adult_content + + # @return [Boolean] A value indicating if the image is race. + attr_accessor :is_racy_content + + # @return [Float] Score from 0 to 1 that indicates how much of adult + # content is within the image. + attr_accessor :adult_score + + # @return [Float] Score from 0 to 1 that indicates how suggestive is the + # image. + attr_accessor :racy_score + + + # + # Mapper for AdultInfo class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'AdultInfo', + type: { + name: 'Composite', + class_name: 'AdultInfo', + model_properties: { + is_adult_content: { + required: false, + serialized_name: 'isAdultContent', + type: { + name: 'Boolean' + } + }, + is_racy_content: { + required: false, + serialized_name: 'isRacyContent', + type: { + name: 'Boolean' + } + }, + adult_score: { + required: false, + serialized_name: 'adultScore', + type: { + name: 'Double' + } + }, + racy_score: { + required: false, + serialized_name: 'racyScore', + type: { + name: 'Double' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/azure_regions.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/azure_regions.rb new file mode 100644 index 0000000000..b504ce978f --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/azure_regions.rb @@ -0,0 +1,26 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for AzureRegions + # + module AzureRegions + Westus = "westus" + Westeurope = "westeurope" + Southeastasia = "southeastasia" + Eastus2 = "eastus2" + Westcentralus = "westcentralus" + Westus2 = "westus2" + Eastus = "eastus" + Southcentralus = "southcentralus" + Northeurope = "northeurope" + Eastasia = "eastasia" + Australiaeast = "australiaeast" + Brazilsouth = "brazilsouth" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/category.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/category.rb new file mode 100644 index 0000000000..769572275a --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/category.rb @@ -0,0 +1,65 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing identified category. + # + class Category + + include MsRestAzure + + # @return [String] Name of the category. + attr_accessor :name + + # @return [Float] Scoring of the category. + attr_accessor :score + + # @return [CategoryDetail] + attr_accessor :detail + + + # + # Mapper for Category class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'Category', + type: { + name: 'Composite', + class_name: 'Category', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + score: { + required: false, + serialized_name: 'score', + type: { + name: 'Double' + } + }, + detail: { + required: false, + serialized_name: 'detail', + type: { + name: 'Composite', + class_name: 'CategoryDetail' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/category_detail.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/category_detail.rb new file mode 100644 index 0000000000..8822492c71 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/category_detail.rb @@ -0,0 +1,72 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing additional category details. + # + class CategoryDetail + + include MsRestAzure + + # @return [Array] An array of celebrities if any + # identified. + attr_accessor :celebrities + + # @return [Array] An array of landmarks if any + # identified. + attr_accessor :landmarks + + + # + # Mapper for CategoryDetail class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'CategoryDetail', + type: { + name: 'Composite', + class_name: 'CategoryDetail', + model_properties: { + celebrities: { + required: false, + serialized_name: 'celebrities', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'CelebritiesModelElementType', + type: { + name: 'Composite', + class_name: 'CelebritiesModel' + } + } + } + }, + landmarks: { + required: false, + serialized_name: 'landmarks', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'LandmarksModelElementType', + type: { + name: 'Composite', + class_name: 'LandmarksModel' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/celebrities_model.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/celebrities_model.rb new file mode 100644 index 0000000000..98596506c7 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/celebrities_model.rb @@ -0,0 +1,65 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing possible celebrity identification. + # + class CelebritiesModel + + include MsRestAzure + + # @return [String] Name of the celebrity. + attr_accessor :name + + # @return [Float] Level of confidence ranging from 0 to 1. + attr_accessor :confidence + + # @return [FaceRectangle] + attr_accessor :face_rectangle + + + # + # Mapper for CelebritiesModel class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'CelebritiesModel', + type: { + name: 'Composite', + class_name: 'CelebritiesModel', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + confidence: { + required: false, + serialized_name: 'confidence', + type: { + name: 'Double' + } + }, + face_rectangle: { + required: false, + serialized_name: 'faceRectangle', + type: { + name: 'Composite', + class_name: 'FaceRectangle' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/celebrity_results.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/celebrity_results.rb new file mode 100644 index 0000000000..66f9ed9654 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/celebrity_results.rb @@ -0,0 +1,73 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # List of celebrities recognized in the image. + # + class CelebrityResults + + include MsRestAzure + + # @return [Array] + attr_accessor :celebrities + + # @return [String] Id of the REST API request. + attr_accessor :request_id + + # @return [ImageMetadata] + attr_accessor :metadata + + + # + # Mapper for CelebrityResults class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'CelebrityResults', + type: { + name: 'Composite', + class_name: 'CelebrityResults', + model_properties: { + celebrities: { + required: false, + serialized_name: 'celebrities', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'CelebritiesModelElementType', + type: { + name: 'Composite', + class_name: 'CelebritiesModel' + } + } + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'metadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/color_info.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/color_info.rb new file mode 100644 index 0000000000..5b26d249c0 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/color_info.rb @@ -0,0 +1,91 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object providing additional metadata describing color attributes. + # + class ColorInfo + + include MsRestAzure + + # @return [String] Possible dominant foreground color. + attr_accessor :dominant_color_foreground + + # @return [String] Possible dominant background color. + attr_accessor :dominant_color_background + + # @return [Array] An array of possible dominant colors. + attr_accessor :dominant_colors + + # @return [String] Possible accent color. + attr_accessor :accent_color + + # @return [Boolean] A value indicating if the image is black and white. + attr_accessor :is_bwimg + + + # + # Mapper for ColorInfo class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ColorInfo', + type: { + name: 'Composite', + class_name: 'ColorInfo', + model_properties: { + dominant_color_foreground: { + required: false, + serialized_name: 'dominantColorForeground', + type: { + name: 'String' + } + }, + dominant_color_background: { + required: false, + serialized_name: 'dominantColorBackground', + type: { + name: 'String' + } + }, + dominant_colors: { + required: false, + serialized_name: 'dominantColors', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + accent_color: { + required: false, + serialized_name: 'accentColor', + type: { + name: 'String' + } + }, + is_bwimg: { + required: false, + serialized_name: 'isBWImg', + type: { + name: 'Boolean' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error.rb new file mode 100644 index 0000000000..357b5f0b35 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error.rb @@ -0,0 +1,71 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class ComputerVisionError + + include MsRestAzure + + # @return [ComputerVisionErrorCodes] The error code. Possible values + # include: 'InvalidImageUrl', 'InvalidImageFormat', 'InvalidImageSize', + # 'NotSupportedVisualFeature', 'NotSupportedImage', 'InvalidDetails', + # 'NotSupportedLanguage', 'BadArgument', 'FailedToProcess', 'Timeout', + # 'InternalServerError', 'Unspecified', 'StorageException' + attr_accessor :code + + # @return [String] A message explaining the error reported by the + # service. + attr_accessor :message + + # @return [String] A unique request identifier. + attr_accessor :request_id + + + # + # Mapper for ComputerVisionError class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ComputerVisionError', + type: { + name: 'Composite', + class_name: 'ComputerVisionError', + model_properties: { + code: { + required: true, + serialized_name: 'code', + type: { + name: 'Enum', + module: 'ComputerVisionErrorCodes' + } + }, + message: { + required: true, + serialized_name: 'message', + type: { + name: 'String' + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error_codes.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error_codes.rb new file mode 100644 index 0000000000..86266d36aa --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/computer_vision_error_codes.rb @@ -0,0 +1,27 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for ComputerVisionErrorCodes + # + module ComputerVisionErrorCodes + InvalidImageUrl = "InvalidImageUrl" + InvalidImageFormat = "InvalidImageFormat" + InvalidImageSize = "InvalidImageSize" + NotSupportedVisualFeature = "NotSupportedVisualFeature" + NotSupportedImage = "NotSupportedImage" + InvalidDetails = "InvalidDetails" + NotSupportedLanguage = "NotSupportedLanguage" + BadArgument = "BadArgument" + FailedToProcess = "FailedToProcess" + Timeout = "Timeout" + InternalServerError = "InternalServerError" + Unspecified = "Unspecified" + StorageException = "StorageException" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/details.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/details.rb new file mode 100644 index 0000000000..e344b20ea9 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/details.rb @@ -0,0 +1,16 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for Details + # + module Details + Celebrities = "Celebrities" + Landmarks = "Landmarks" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/domain_model_results.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/domain_model_results.rb new file mode 100644 index 0000000000..8839e76153 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/domain_model_results.rb @@ -0,0 +1,66 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Result of image analysis using a specific domain model including + # additional metadata. + # + class DomainModelResults + + include MsRestAzure + + # @return Model-specific response + attr_accessor :result + + # @return [String] Id of the REST API request. + attr_accessor :request_id + + # @return [ImageMetadata] + attr_accessor :metadata + + + # + # Mapper for DomainModelResults class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'DomainModelResults', + type: { + name: 'Composite', + class_name: 'DomainModelResults', + model_properties: { + result: { + required: false, + serialized_name: 'result', + type: { + name: 'Object' + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'metadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/face_description.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/face_description.rb new file mode 100644 index 0000000000..8130204d65 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/face_description.rb @@ -0,0 +1,67 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing a face identified in the image. + # + class FaceDescription + + include MsRestAzure + + # @return [Integer] Possible age of the face. + attr_accessor :age + + # @return [Gender] Possible gender of the face. Possible values include: + # 'Male', 'Female' + attr_accessor :gender + + # @return [FaceRectangle] + attr_accessor :face_rectangle + + + # + # Mapper for FaceDescription class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'FaceDescription', + type: { + name: 'Composite', + class_name: 'FaceDescription', + model_properties: { + age: { + required: false, + serialized_name: 'age', + type: { + name: 'Number' + } + }, + gender: { + required: false, + serialized_name: 'gender', + type: { + name: 'Enum', + module: 'Gender' + } + }, + face_rectangle: { + required: false, + serialized_name: 'faceRectangle', + type: { + name: 'Composite', + class_name: 'FaceRectangle' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/face_rectangle.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/face_rectangle.rb new file mode 100644 index 0000000000..3d467b9f2b --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/face_rectangle.rb @@ -0,0 +1,74 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing face rectangle. + # + class FaceRectangle + + include MsRestAzure + + # @return [Integer] X-coordinate of the top left point of the face. + attr_accessor :left + + # @return [Integer] Y-coordinate of the top left point of the face. + attr_accessor :top + + # @return [Integer] Width measured from the top-left point of the face. + attr_accessor :width + + # @return [Integer] Height measured from the top-left point of the face. + attr_accessor :height + + + # + # Mapper for FaceRectangle class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'FaceRectangle', + type: { + name: 'Composite', + class_name: 'FaceRectangle', + model_properties: { + left: { + required: false, + serialized_name: 'left', + type: { + name: 'Number' + } + }, + top: { + required: false, + serialized_name: 'top', + type: { + name: 'Number' + } + }, + width: { + required: false, + serialized_name: 'width', + type: { + name: 'Number' + } + }, + height: { + required: false, + serialized_name: 'height', + type: { + name: 'Number' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/gender.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/gender.rb new file mode 100644 index 0000000000..e80efdc1e3 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/gender.rb @@ -0,0 +1,16 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for Gender + # + module Gender + Male = "Male" + Female = "Female" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_analysis.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_analysis.rb new file mode 100644 index 0000000000..2abe058a83 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_analysis.rb @@ -0,0 +1,154 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Result of AnalyzeImage operation. + # + class ImageAnalysis + + include MsRestAzure + + # @return [Array] An array indicating identified categories. + attr_accessor :categories + + # @return [AdultInfo] + attr_accessor :adult + + # @return [ColorInfo] + attr_accessor :color + + # @return [ImageType] + attr_accessor :image_type + + # @return [Array] A list of tags with confidence level. + attr_accessor :tags + + # @return [ImageDescriptionDetails] + attr_accessor :description + + # @return [Array] An array of possible faces within the + # image. + attr_accessor :faces + + # @return [String] Id of the request for tracking purposes. + attr_accessor :request_id + + # @return [ImageMetadata] + attr_accessor :metadata + + + # + # Mapper for ImageAnalysis class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageAnalysis', + type: { + name: 'Composite', + class_name: 'ImageAnalysis', + model_properties: { + categories: { + required: false, + serialized_name: 'categories', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'CategoryElementType', + type: { + name: 'Composite', + class_name: 'Category' + } + } + } + }, + adult: { + required: false, + serialized_name: 'adult', + type: { + name: 'Composite', + class_name: 'AdultInfo' + } + }, + color: { + required: false, + serialized_name: 'color', + type: { + name: 'Composite', + class_name: 'ColorInfo' + } + }, + image_type: { + required: false, + serialized_name: 'imageType', + type: { + name: 'Composite', + class_name: 'ImageType' + } + }, + tags: { + required: false, + serialized_name: 'tags', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ImageTagElementType', + type: { + name: 'Composite', + class_name: 'ImageTag' + } + } + } + }, + description: { + required: false, + serialized_name: 'description', + type: { + name: 'Composite', + class_name: 'ImageDescriptionDetails' + } + }, + faces: { + required: false, + serialized_name: 'faces', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'FaceDescriptionElementType', + type: { + name: 'Composite', + class_name: 'FaceDescription' + } + } + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'metadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_caption.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_caption.rb new file mode 100644 index 0000000000..a5f9a444d3 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_caption.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An image caption, i.e. a brief description of what the image depicts. + # + class ImageCaption + + include MsRestAzure + + # @return [String] The text of the caption + attr_accessor :text + + # @return [Float] The level of confidence the service has in the caption + attr_accessor :confidence + + + # + # Mapper for ImageCaption class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageCaption', + type: { + name: 'Composite', + class_name: 'ImageCaption', + model_properties: { + text: { + required: false, + serialized_name: 'text', + type: { + name: 'String' + } + }, + confidence: { + required: false, + serialized_name: 'confidence', + type: { + name: 'Double' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_description.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_description.rb new file mode 100644 index 0000000000..384090f6db --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_description.rb @@ -0,0 +1,92 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # A collection of content tags, along with a list of captions sorted by + # confidence level, and image metadata. + # + class ImageDescription + + include MsRestAzure + + # @return [Array] A collection of image tags. + attr_accessor :tags + + # @return [Array] A list of captions, sorted by confidence + # level. + attr_accessor :captions + + # @return [String] Id of the REST API request. + attr_accessor :request_id + + # @return [ImageMetadata] + attr_accessor :metadata + + + # + # Mapper for ImageDescription class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageDescription', + type: { + name: 'Composite', + class_name: 'ImageDescription', + model_properties: { + tags: { + required: false, + serialized_name: 'description.tags', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + captions: { + required: false, + serialized_name: 'description.captions', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ImageCaptionElementType', + type: { + name: 'Composite', + class_name: 'ImageCaption' + } + } + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'metadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_description_details.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_description_details.rb new file mode 100644 index 0000000000..fd60fceada --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_description_details.rb @@ -0,0 +1,71 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # A collection of content tags, along with a list of captions sorted by + # confidence level, and image metadata. + # + class ImageDescriptionDetails + + include MsRestAzure + + # @return [Array] A collection of image tags. + attr_accessor :tags + + # @return [Array] A list of captions, sorted by confidence + # level. + attr_accessor :captions + + + # + # Mapper for ImageDescriptionDetails class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageDescriptionDetails', + type: { + name: 'Composite', + class_name: 'ImageDescriptionDetails', + model_properties: { + tags: { + required: false, + serialized_name: 'tags', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + captions: { + required: false, + serialized_name: 'captions', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ImageCaptionElementType', + type: { + name: 'Composite', + class_name: 'ImageCaption' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_metadata.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_metadata.rb new file mode 100644 index 0000000000..55bc04bc77 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_metadata.rb @@ -0,0 +1,64 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Image metadata + # + class ImageMetadata + + include MsRestAzure + + # @return [Integer] Image width + attr_accessor :width + + # @return [Integer] Image height + attr_accessor :height + + # @return [String] Image format + attr_accessor :format + + + # + # Mapper for ImageMetadata class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageMetadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata', + model_properties: { + width: { + required: false, + serialized_name: 'width', + type: { + name: 'Number' + } + }, + height: { + required: false, + serialized_name: 'height', + type: { + name: 'Number' + } + }, + format: { + required: false, + serialized_name: 'format', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_tag.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_tag.rb new file mode 100644 index 0000000000..5c66d28b1c --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_tag.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An image caption, i.e. a brief description of what the image depicts. + # + class ImageTag + + include MsRestAzure + + # @return [String] The tag value + attr_accessor :name + + # @return [Float] The level of confidence the service has in the caption + attr_accessor :confidence + + + # + # Mapper for ImageTag class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageTag', + type: { + name: 'Composite', + class_name: 'ImageTag', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + confidence: { + required: false, + serialized_name: 'confidence', + type: { + name: 'Double' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_type.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_type.rb new file mode 100644 index 0000000000..6fbe7efd37 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_type.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object providing possible image types and matching confidence levels. + # + class ImageType + + include MsRestAzure + + # @return [Float] Confidence level that the image is a clip art. + attr_accessor :clip_art_type + + # @return [Float] Confidence level that the image is a line drawing. + attr_accessor :line_drawing_type + + + # + # Mapper for ImageType class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageType', + type: { + name: 'Composite', + class_name: 'ImageType', + model_properties: { + clip_art_type: { + required: false, + serialized_name: 'clipArtType', + type: { + name: 'Double' + } + }, + line_drawing_type: { + required: false, + serialized_name: 'lineDrawingType', + type: { + name: 'Double' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_url.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_url.rb new file mode 100644 index 0000000000..33ef37eb1e --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/image_url.rb @@ -0,0 +1,45 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class ImageUrl + + include MsRestAzure + + # @return [String] Publicly reachable URL of an image + attr_accessor :url + + + # + # Mapper for ImageUrl class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ImageUrl', + type: { + name: 'Composite', + class_name: 'ImageUrl', + model_properties: { + url: { + required: true, + serialized_name: 'url', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmark_results.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmark_results.rb new file mode 100644 index 0000000000..f58a13c005 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmark_results.rb @@ -0,0 +1,73 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # List of landmarks recognized in the image. + # + class LandmarkResults + + include MsRestAzure + + # @return [Array] + attr_accessor :landmarks + + # @return [String] Id of the REST API request. + attr_accessor :request_id + + # @return [ImageMetadata] + attr_accessor :metadata + + + # + # Mapper for LandmarkResults class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'LandmarkResults', + type: { + name: 'Composite', + class_name: 'LandmarkResults', + model_properties: { + landmarks: { + required: false, + serialized_name: 'landmarks', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'LandmarksModelElementType', + type: { + name: 'Composite', + class_name: 'LandmarksModel' + } + } + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'metadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmark_results_landmarks_item.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmark_results_landmarks_item.rb new file mode 100644 index 0000000000..0c76ef579a --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmark_results_landmarks_item.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # A landmark recognized in the image + # + class LandmarkResultsLandmarksItem + + include MsRestAzure + + # @return [String] Name of the landmark. + attr_accessor :name + + # @return [Float] Confidence level for the landmark recognition. + attr_accessor :confidence + + + # + # Mapper for LandmarkResultsLandmarksItem class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'LandmarkResults_landmarksItem', + type: { + name: 'Composite', + class_name: 'LandmarkResultsLandmarksItem', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + confidence: { + required: false, + serialized_name: 'confidence', + type: { + name: 'Double' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmarks_model.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmarks_model.rb new file mode 100644 index 0000000000..d4bd44e76b --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/landmarks_model.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # A landmark recognized in the image + # + class LandmarksModel + + include MsRestAzure + + # @return [String] Name of the landmark. + attr_accessor :name + + # @return [Float] Confidence level for the landmark recognition. + attr_accessor :confidence + + + # + # Mapper for LandmarksModel class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'LandmarksModel', + type: { + name: 'Composite', + class_name: 'LandmarksModel', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + confidence: { + required: false, + serialized_name: 'confidence', + type: { + name: 'Double' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/line.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/line.rb new file mode 100644 index 0000000000..33991cfdf5 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/line.rb @@ -0,0 +1,80 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class Line + + include MsRestAzure + + # @return [Array] + attr_accessor :bounding_box + + # @return [String] + attr_accessor :text + + # @return [Array] + attr_accessor :words + + + # + # Mapper for Line class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'Line', + type: { + name: 'Composite', + class_name: 'Line', + model_properties: { + bounding_box: { + required: false, + serialized_name: 'boundingBox', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + text: { + required: false, + serialized_name: 'text', + type: { + name: 'String' + } + }, + words: { + required: false, + serialized_name: 'words', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'WordElementType', + type: { + name: 'Composite', + class_name: 'Word' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/list_models_result.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/list_models_result.rb new file mode 100644 index 0000000000..72b7e13ac2 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/list_models_result.rb @@ -0,0 +1,53 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Result of the List Domain Models operation. + # + class ListModelsResult + + include MsRestAzure + + # @return [Array] An array of supported models. + attr_accessor :models_property + + + # + # Mapper for ListModelsResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ListModelsResult', + type: { + name: 'Composite', + class_name: 'ListModelsResult', + model_properties: { + models_property: { + required: false, + read_only: true, + serialized_name: 'models', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ModelDescriptionElementType', + type: { + name: 'Composite', + class_name: 'ModelDescription' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/model_description.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/model_description.rb new file mode 100644 index 0000000000..0067fe162b --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/model_description.rb @@ -0,0 +1,61 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing supported model by name and categories. + # + class ModelDescription + + include MsRestAzure + + # @return [String] + attr_accessor :name + + # @return [Array] + attr_accessor :categories + + + # + # Mapper for ModelDescription class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'ModelDescription', + type: { + name: 'Composite', + class_name: 'ModelDescription', + model_properties: { + name: { + required: false, + serialized_name: 'name', + type: { + name: 'String' + } + }, + categories: { + required: false, + serialized_name: 'categories', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_languages.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_languages.rb new file mode 100644 index 0000000000..0bc8315857 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_languages.rb @@ -0,0 +1,41 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for OcrLanguages + # + module OcrLanguages + Unk = "unk" + ZhHans = "zh-Hans" + ZhHant = "zh-Hant" + Cs = "cs" + Da = "da" + Nl = "nl" + En = "en" + Fi = "fi" + Fr = "fr" + De = "de" + El = "el" + Hu = "hu" + It = "it" + Ja = "ja" + Ko = "ko" + Nb = "nb" + Pl = "pl" + Pt = "pt" + Ru = "ru" + Es = "es" + Sv = "sv" + Tr = "tr" + Ar = "ar" + Ro = "ro" + SrCyrl = "sr-Cyrl" + SrLatn = "sr-Latn" + Sk = "sk" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_line.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_line.rb new file mode 100644 index 0000000000..89c8539761 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_line.rb @@ -0,0 +1,68 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # An object describing a single recognized line of text. + # + class OcrLine + + include MsRestAzure + + # @return [String] Bounding box of a recognized line. The four integers + # represent the x-coordinate of the left edge, the y-coordinate of the + # top edge, width, and height of the bounding box, in the coordinate + # system of the input image, after it has been rotated around its center + # according to the detected text angle (see textAngle property), with the + # origin at the top-left corner, and the y-axis pointing down. + attr_accessor :bounding_box + + # @return [Array] An array of objects, where each object + # represents a recognized word. + attr_accessor :words + + + # + # Mapper for OcrLine class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'OcrLine', + type: { + name: 'Composite', + class_name: 'OcrLine', + model_properties: { + bounding_box: { + required: false, + serialized_name: 'boundingBox', + type: { + name: 'String' + } + }, + words: { + required: false, + serialized_name: 'words', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'OcrWordElementType', + type: { + name: 'Composite', + class_name: 'OcrWord' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_region.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_region.rb new file mode 100644 index 0000000000..edcf8a677e --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_region.rb @@ -0,0 +1,68 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # A region consists of multiple lines (e.g. a column of text in a + # multi-column document). + # + class OcrRegion + + include MsRestAzure + + # @return [String] Bounding box of a recognized region. The four integers + # represent the x-coordinate of the left edge, the y-coordinate of the + # top edge, width, and height of the bounding box, in the coordinate + # system of the input image, after it has been rotated around its center + # according to the detected text angle (see textAngle property), with the + # origin at the top-left corner, and the y-axis pointing down. + attr_accessor :bounding_box + + # @return [Array] + attr_accessor :lines + + + # + # Mapper for OcrRegion class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'OcrRegion', + type: { + name: 'Composite', + class_name: 'OcrRegion', + model_properties: { + bounding_box: { + required: false, + serialized_name: 'boundingBox', + type: { + name: 'String' + } + }, + lines: { + required: false, + serialized_name: 'lines', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'OcrLineElementType', + type: { + name: 'Composite', + class_name: 'OcrLine' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_result.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_result.rb new file mode 100644 index 0000000000..3ea2b12458 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_result.rb @@ -0,0 +1,97 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class OcrResult + + include MsRestAzure + + # @return [String] The BCP-47 language code of the text in the image. + attr_accessor :language + + # @return [Float] The angle, in degrees, of the detected text with + # respect to the closest horizontal or vertical direction. After rotating + # the input image clockwise by this angle, the recognized text lines + # become horizontal or vertical. In combination with the orientation + # property it can be used to overlay recognition results correctly on the + # original image, by rotating either the original image or recognition + # results by a suitable angle around the center of the original image. If + # the angle cannot be confidently detected, this property is not present. + # If the image contains text at different angles, only part of the text + # will be recognized correctly. + attr_accessor :text_angle + + # @return [String] Orientation of the text recognized in the image. The + # value (up,down,left, or right) refers to the direction that the top of + # the recognized text is facing, after the image has been rotated around + # its center according to the detected text angle (see textAngle + # property). + attr_accessor :orientation + + # @return [Array] An array of objects, where each object + # represents a region of recognized text. + attr_accessor :regions + + + # + # Mapper for OcrResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'OcrResult', + type: { + name: 'Composite', + class_name: 'OcrResult', + model_properties: { + language: { + required: false, + serialized_name: 'language', + type: { + name: 'String' + } + }, + text_angle: { + required: false, + serialized_name: 'textAngle', + type: { + name: 'Double' + } + }, + orientation: { + required: false, + serialized_name: 'orientation', + type: { + name: 'String' + } + }, + regions: { + required: false, + serialized_name: 'regions', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'OcrRegionElementType', + type: { + name: 'Composite', + class_name: 'OcrRegion' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_word.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_word.rb new file mode 100644 index 0000000000..cd4fc62fe1 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/ocr_word.rb @@ -0,0 +1,59 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Information on a recognized word. + # + class OcrWord + + include MsRestAzure + + # @return [String] Bounding box of a recognized word. The four integers + # represent the x-coordinate of the left edge, the y-coordinate of the + # top edge, width, and height of the bounding box, in the coordinate + # system of the input image, after it has been rotated around its center + # according to the detected text angle (see textAngle property), with the + # origin at the top-left corner, and the y-axis pointing down. + attr_accessor :bounding_box + + # @return [String] String value of a recognized word. + attr_accessor :text + + + # + # Mapper for OcrWord class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'OcrWord', + type: { + name: 'Composite', + class_name: 'OcrWord', + model_properties: { + bounding_box: { + required: false, + serialized_name: 'boundingBox', + type: { + name: 'String' + } + }, + text: { + required: false, + serialized_name: 'text', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/recognition_result.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/recognition_result.rb new file mode 100644 index 0000000000..4b3216aea0 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/recognition_result.rb @@ -0,0 +1,53 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class RecognitionResult + + include MsRestAzure + + # @return [Array] + attr_accessor :lines + + + # + # Mapper for RecognitionResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'RecognitionResult', + type: { + name: 'Composite', + class_name: 'RecognitionResult', + model_properties: { + lines: { + required: false, + serialized_name: 'lines', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'LineElementType', + type: { + name: 'Composite', + class_name: 'Line' + } + } + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/tag_result.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/tag_result.rb new file mode 100644 index 0000000000..4c92b93fb5 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/tag_result.rb @@ -0,0 +1,74 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # The results of a image tag operation, including any tags and image + # metadata. + # + class TagResult + + include MsRestAzure + + # @return [Array] A list of tags with confidence level. + attr_accessor :tags + + # @return [String] Id of the REST API request. + attr_accessor :request_id + + # @return [ImageMetadata] + attr_accessor :metadata + + + # + # Mapper for TagResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'TagResult', + type: { + name: 'Composite', + class_name: 'TagResult', + model_properties: { + tags: { + required: false, + serialized_name: 'tags', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'ImageTagElementType', + type: { + name: 'Composite', + class_name: 'ImageTag' + } + } + } + }, + request_id: { + required: false, + serialized_name: 'requestId', + type: { + name: 'String' + } + }, + metadata: { + required: false, + serialized_name: 'metadata', + type: { + name: 'Composite', + class_name: 'ImageMetadata' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_operation_result.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_operation_result.rb new file mode 100644 index 0000000000..b6534622b2 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_operation_result.rb @@ -0,0 +1,59 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class TextOperationResult + + include MsRestAzure + + # @return [TextOperationStatusCodes] Status of the text operation. + # Possible values include: 'Not Started', 'Running', 'Failed', + # 'Succeeded' + attr_accessor :status + + # @return [RecognitionResult] + attr_accessor :recognition_result + + + # + # Mapper for TextOperationResult class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'TextOperationResult', + type: { + name: 'Composite', + class_name: 'TextOperationResult', + model_properties: { + status: { + required: false, + serialized_name: 'status', + type: { + name: 'Enum', + module: 'TextOperationStatusCodes' + } + }, + recognition_result: { + required: false, + serialized_name: 'recognitionResult', + type: { + name: 'Composite', + class_name: 'RecognitionResult' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_operation_status_codes.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_operation_status_codes.rb new file mode 100644 index 0000000000..a9535d5858 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_operation_status_codes.rb @@ -0,0 +1,18 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for TextOperationStatusCodes + # + module TextOperationStatusCodes + NotStarted = "Not Started" + Running = "Running" + Failed = "Failed" + Succeeded = "Succeeded" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_recognition_mode.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_recognition_mode.rb new file mode 100644 index 0000000000..07b9956390 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/text_recognition_mode.rb @@ -0,0 +1,16 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for TextRecognitionMode + # + module TextRecognitionMode + Handwritten = "Handwritten" + Printed = "Printed" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/visual_feature_types.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/visual_feature_types.rb new file mode 100644 index 0000000000..2f4f2df0b6 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/visual_feature_types.rb @@ -0,0 +1,21 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Defines values for VisualFeatureTypes + # + module VisualFeatureTypes + ImageType = "ImageType" + Faces = "Faces" + Adult = "Adult" + Categories = "Categories" + Color = "Color" + Tags = "Tags" + Description = "Description" + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/word.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/word.rb new file mode 100644 index 0000000000..8a9194f1a8 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/models/word.rb @@ -0,0 +1,62 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + module Models + # + # Model object. + # + # + class Word + + include MsRestAzure + + # @return [Array] + attr_accessor :bounding_box + + # @return [String] + attr_accessor :text + + + # + # Mapper for Word class as Ruby Hash. + # This will be used for serialization/deserialization. + # + def self.mapper() + { + required: false, + serialized_name: 'Word', + type: { + name: 'Composite', + class_name: 'Word', + model_properties: { + bounding_box: { + required: false, + serialized_name: 'boundingBox', + type: { + name: 'Sequence', + element: { + required: false, + serialized_name: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + text: { + required: false, + serialized_name: 'text', + type: { + name: 'String' + } + } + } + } + } + end + end + end +end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/module_definition.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/module_definition.rb new file mode 100644 index 0000000000..6c8c09fc48 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/module_definition.rb @@ -0,0 +1,9 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure end +module Azure::CognitiveServices end +module Azure::CognitiveServices::ComputerVision end +module Azure::CognitiveServices::ComputerVision::V2_0 end diff --git a/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/version.rb b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/version.rb new file mode 100644 index 0000000000..22fcf31c68 --- /dev/null +++ b/data/azure_cognitiveservices_computervision/lib/2.0/generated/azure_cognitiveservices_computervision/version.rb @@ -0,0 +1,8 @@ +# encoding: utf-8 +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. + +module Azure::CognitiveServices::ComputerVision::V2_0 + VERSION = '0.16.0' +end diff --git a/data/azure_cognitiveservices_computervision/lib/azure_cognitiveservices_computervision.rb b/data/azure_cognitiveservices_computervision/lib/azure_cognitiveservices_computervision.rb index 29babbcd62..31bcf6b96c 100644 --- a/data/azure_cognitiveservices_computervision/lib/azure_cognitiveservices_computervision.rb +++ b/data/azure_cognitiveservices_computervision/lib/azure_cognitiveservices_computervision.rb @@ -2,5 +2,6 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. +require '2.0/generated/azure_cognitiveservices_computervision' require '1.0/generated/azure_cognitiveservices_computervision' require 'profiles/latest/computervision_latest_profile_client'