class Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Features

Features

Attributes

client[R]

@return [LuisAuthoringClient] reference to the LuisAuthoringClient

Private Class Methods

new(client) click to toggle source

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

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 17
def initialize(client)
  @client = client
end

Private Instance Methods

add_entity_feature(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:nil) click to toggle source

Adds a new feature relation to be used by the entity in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param entity_id The entity extractor ID. @param feature_relation_create_object [ModelFeatureInformation] A Feature relation information object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [OperationStatus] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 813
def add_entity_feature(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:nil)
  response = add_entity_feature_async(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
add_entity_feature_async(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:nil) click to toggle source

Adds a new feature relation to be used by the entity in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param entity_id The entity extractor ID. @param feature_relation_create_object [ModelFeatureInformation] A Feature relation information object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 850
def add_entity_feature_async(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'entity_id is nil' if entity_id.nil?
  fail ArgumentError, 'feature_relation_create_object is nil' if feature_relation_create_object.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::ModelFeatureInformation.mapper()
  request_content = @client.serialize(request_mapper,  feature_relation_create_object)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/entities/{entityId}/features'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'entityId' => entity_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
add_entity_feature_with_http_info(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:nil) click to toggle source

Adds a new feature relation to be used by the entity in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param entity_id The entity extractor ID. @param feature_relation_create_object [ModelFeatureInformation] A Feature relation information object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 832
def add_entity_feature_with_http_info(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:nil)
  add_entity_feature_async(app_id, version_id, entity_id, feature_relation_create_object, custom_headers:custom_headers).value!
end
add_intent_feature(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:nil) click to toggle source

Adds a new feature relation to be used by the intent in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param intent_id The intent classifier ID. @param feature_relation_create_object [ModelFeatureInformation] A Feature relation information object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [OperationStatus] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 699
def add_intent_feature(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:nil)
  response = add_intent_feature_async(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
add_intent_feature_async(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:nil) click to toggle source

Adds a new feature relation to be used by the intent in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param intent_id The intent classifier ID. @param feature_relation_create_object [ModelFeatureInformation] A Feature relation information object. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 736
def add_intent_feature_async(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'intent_id is nil' if intent_id.nil?
  fail ArgumentError, 'feature_relation_create_object is nil' if feature_relation_create_object.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::ModelFeatureInformation.mapper()
  request_content = @client.serialize(request_mapper,  feature_relation_create_object)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/intents/{intentId}/features'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'intentId' => intent_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
add_intent_feature_with_http_info(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:nil) click to toggle source

Adds a new feature relation to be used by the intent in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param intent_id The intent classifier ID. @param feature_relation_create_object [ModelFeatureInformation] A Feature relation information object. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 718
def add_intent_feature_with_http_info(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:nil)
  add_intent_feature_async(app_id, version_id, intent_id, feature_relation_create_object, custom_headers:custom_headers).value!
end
add_phrase_list(app_id, version_id, phraselist_create_object, custom_headers:nil) click to toggle source

Creates a new phraselist feature in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_create_object [PhraselistCreateObject] A Phraselist object containing Name, comma-separated Phrases and the isExchangeable boolean. Default value for isExchangeable is true. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Number] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 37
def add_phrase_list(app_id, version_id, phraselist_create_object, custom_headers:nil)
  response = add_phrase_list_async(app_id, version_id, phraselist_create_object, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
add_phrase_list_async(app_id, version_id, phraselist_create_object, custom_headers:nil) click to toggle source

Creates a new phraselist feature in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_create_object [PhraselistCreateObject] A Phraselist object containing Name, comma-separated Phrases and the isExchangeable boolean. Default value for isExchangeable is true. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 72
def add_phrase_list_async(app_id, version_id, phraselist_create_object, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'phraselist_create_object is nil' if phraselist_create_object.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::PhraselistCreateObject.mapper()
  request_content = @client.serialize(request_mapper,  phraselist_create_object)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/phraselists'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Number'
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
add_phrase_list_with_http_info(app_id, version_id, phraselist_create_object, custom_headers:nil) click to toggle source

Creates a new phraselist feature in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_create_object [PhraselistCreateObject] A Phraselist object containing Name, comma-separated Phrases and the isExchangeable boolean. Default value for isExchangeable is true. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 55
def add_phrase_list_with_http_info(app_id, version_id, phraselist_create_object, custom_headers:nil)
  add_phrase_list_async(app_id, version_id, phraselist_create_object, custom_headers:custom_headers).value!
end
delete_phrase_list(app_id, version_id, phraselist_id, custom_headers:nil) click to toggle source

Deletes a phraselist feature from a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be deleted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [OperationStatus] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 599
def delete_phrase_list(app_id, version_id, phraselist_id, custom_headers:nil)
  response = delete_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
delete_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:nil) click to toggle source

Deletes a phraselist feature from a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be deleted. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 630
def delete_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'phraselist_id is nil' if phraselist_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/phraselists/{phraselistId}'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'phraselistId' => phraselist_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
delete_phrase_list_with_http_info(app_id, version_id, phraselist_id, custom_headers:nil) click to toggle source

Deletes a phraselist feature from a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be deleted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 615
def delete_phrase_list_with_http_info(app_id, version_id, phraselist_id, custom_headers:nil)
  delete_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:custom_headers).value!
end
get_phrase_list(app_id, version_id, phraselist_id, custom_headers:nil) click to toggle source

Gets phraselist feature info in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be retrieved. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PhraseListFeatureInfo] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 383
def get_phrase_list(app_id, version_id, phraselist_id, custom_headers:nil)
  response = get_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:nil) click to toggle source

Gets phraselist feature info in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be retrieved. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 414
def get_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'phraselist_id is nil' if phraselist_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/phraselists/{phraselistId}'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'phraselistId' => phraselist_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::PhraseListFeatureInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
get_phrase_list_with_http_info(app_id, version_id, phraselist_id, custom_headers:nil) click to toggle source

Gets phraselist feature info in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be retrieved. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 399
def get_phrase_list_with_http_info(app_id, version_id, phraselist_id, custom_headers:nil)
  get_phrase_list_async(app_id, version_id, phraselist_id, custom_headers:custom_headers).value!
end
list(app_id, version_id, skip:0, take:100, custom_headers:nil) click to toggle source

Gets all the extraction phraselist and pattern features in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param skip [Integer] The number of entries to skip. Default value is 0. @param take [Integer] The number of entries to return. Maximum page size is

  1. Default is 100.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [FeaturesResponseObject] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 277
def list(app_id, version_id, skip:0, take:100, custom_headers:nil)
  response = list_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_async(app_id, version_id, skip:0, take:100, custom_headers:nil) click to toggle source

Gets all the extraction phraselist and pattern features in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param skip [Integer] The number of entries to skip. Default value is 0. @param take [Integer] The number of entries to return. Maximum page size is

  1. Default is 100.

@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 314
def list_async(app_id, version_id, skip:0, take:100, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/features'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      query_params: {'skip' => skip,'take' => take},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::FeaturesResponseObject.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_phrase_lists(app_id, version_id, skip:0, take:100, custom_headers:nil) click to toggle source

Gets all the phraselist features in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param skip [Integer] The number of entries to skip. Default value is 0. @param take [Integer] The number of entries to return. Maximum page size is

  1. Default is 100.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 154
def list_phrase_lists(app_id, version_id, skip:0, take:100, custom_headers:nil)
  response = list_phrase_lists_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_phrase_lists_async(app_id, version_id, skip:0, take:100, custom_headers:nil) click to toggle source

Gets all the phraselist features in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param skip [Integer] The number of entries to skip. Default value is 0. @param take [Integer] The number of entries to return. Maximum page size is

  1. Default is 100.

@param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 189
def list_phrase_lists_async(app_id, version_id, skip:0, take:100, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/phraselists'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      query_params: {'skip' => skip,'take' => take},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PhraseListFeatureInfoElementType',
                type: {
                  name: 'Composite',
                  class_name: 'PhraseListFeatureInfo'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
list_phrase_lists_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil) click to toggle source

Gets all the phraselist features in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param skip [Integer] The number of entries to skip. Default value is 0. @param take [Integer] The number of entries to return. Maximum page size is

  1. Default is 100.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 172
def list_phrase_lists_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
  list_phrase_lists_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
end
list_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil) click to toggle source

Gets all the extraction phraselist and pattern features in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param skip [Integer] The number of entries to skip. Default value is 0. @param take [Integer] The number of entries to return. Maximum page size is

  1. Default is 100.

@param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 296
def list_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
  list_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
end
update_phrase_list(app_id, version_id, phraselist_id, phraselist_update_object:nil, custom_headers:nil) click to toggle source

Updates the phrases, the state and the name of the phraselist feature in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be updated. @param phraselist_update_object [PhraselistUpdateObject] The new values for:

  • Just a boolean called IsActive, in which case the status of the feature

will be changed. - Name, Pattern, Mode, and a boolean called IsActive to update the feature. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [OperationStatus] operation results.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 485
def update_phrase_list(app_id, version_id, phraselist_id, phraselist_update_object:nil, custom_headers:nil)
  response = update_phrase_list_async(app_id, version_id, phraselist_id, phraselist_update_object:phraselist_update_object, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_phrase_list_async(app_id, version_id, phraselist_id, phraselist_update_object:nil, custom_headers:nil) click to toggle source

Updates the phrases, the state and the name of the phraselist feature in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be updated. @param phraselist_update_object [PhraselistUpdateObject] The new values for:

  • Just a boolean called IsActive, in which case the status of the feature

will be changed. - Name, Pattern, Mode, and a boolean called IsActive to update the feature. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 526
def update_phrase_list_async(app_id, version_id, phraselist_id, phraselist_update_object:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'phraselist_id is nil' if phraselist_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::PhraselistUpdateObject.mapper()
  request_content = @client.serialize(request_mapper,  phraselist_update_object)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/phraselists/{phraselistId}'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'phraselistId' => phraselist_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end
update_phrase_list_with_http_info(app_id, version_id, phraselist_id, phraselist_update_object:nil, custom_headers:nil) click to toggle source

Updates the phrases, the state and the name of the phraselist feature in a version of the application.

@param app_id The application ID. @param version_id [String] The version ID. @param phraselist_id [Integer] The ID of the feature to be updated. @param phraselist_update_object [PhraselistUpdateObject] The new values for:

  • Just a boolean called IsActive, in which case the status of the feature

will be changed. - Name, Pattern, Mode, and a boolean called IsActive to update the feature. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/features.rb, line 506
def update_phrase_list_with_http_info(app_id, version_id, phraselist_id, phraselist_update_object:nil, custom_headers:nil)
  update_phrase_list_async(app_id, version_id, phraselist_id, phraselist_update_object:phraselist_update_object, custom_headers:custom_headers).value!
end