api/generated/ruby/azure-iiot-opc-registry/generated/swagger/azure_opc_registry_client.rb
#
# Query applications
#
# List applications that match a query model. The returned model can contain a
# continuation token if more results are available. Call the
# GetListOfApplications operation using the token to retrieve more results.
#
# @param body [ApplicationRegistrationQueryApiModel] Application query
# @param page_size [Integer] Optional number of results to return
# @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.
#
Query applications
List applications that match a query model. The returned model can contain a
continuation token if more results are available. Call the
GetListOfApplications operation using the token to retrieve more results.
Query applications List applications that match a query model . The returned model can contain a continuation token if more results are available . Call the GetListOfApplications operation using the token to retrieve more results .
def query_applications_async(body, page_size:nil, custom_headers:nil)
      fail ArgumentError, 'body is nil' if body.nil?
      request_headers = {}
      request_headers['Content-Type'] = 'application/json-patch+json; charset=utf-8'
      request_mapper = azure.iiot.opc.registry::Models::ApplicationRegistrationQueryApiModel.mapper()
      request_content = self.serialize(request_mapper,  body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
      path_template = 'v2/applications/query'
      request_url = @base_url || self.base_url
      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          query_params: {'pageSize' => page_size},
          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
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = azure.iiot.opc.registry::Models::ApplicationInfoListApiModel.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
def query_applications_async ( body , page_size : nil , custom_headers : nil ) fail ArgumentError , 'body is nil' if body . nil? request_headers = { } request_headers [ 'Content-Type' ] = 'application/json-patch+json; charset=utf-8' request_mapper = azure . iiot . opc . registry :: Models :: ApplicationRegistrationQueryApiModel . mapper ( ) request_content = self . serialize ( request_mapper , body ) request_content = request_content != nil ? JSON . generate ( request_content , quirks_mode : true ) : nil path_template = 'v2/applications/query' request_url = @base_url || self . base_url options = { middlewares : [ [ MsRest :: RetryPolicyMiddleware , times : 3 , retry : 0.02 ] , [ :cookie_jar ] ] , query_params : { 'pageSize' => page_size } , 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 if status_code == 200 begin parsed_response = response_content . to_s . empty? ? nil : JSON . load ( response_content ) result_mapper = azure . iiot . opc . registry :: Models :: ApplicationInfoListApiModel . 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
Query applications
List applications that match a query model.
Query applications List applications that match a query model .
# Serialize Request # Deserialize Response
Promise object which holds the HTTP response.
Promise object which holds the HTTP response .
Concurrent::Promise
body
None
page_size
Optional number of results to return
Optional number of results to return
custom_headers
<not_specific>
<not_specific>
A hash of custom headers that will be added to the HTTP request.
A hash of custom headers that will be added to the HTTP request .