api/generated/ruby/azure-iiot-opc-registry/generated/swagger/azure_opc_registry_client.rb
#
# Subscribe to discoverer registry events
#
# Register a user to receive discoverer events through SignalR.
#
# @param body [String] The user id that will receive discoverer events.
# @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.
#
Subscribe to discoverer registry events
Register a user to receive discoverer events through SignalR.
Subscribe to discoverer registry events Register a user to receive discoverer events through SignalR .
def subscribe1_async(body:nil, custom_headers:nil)
      request_headers = {}
      request_headers['Content-Type'] = 'application/json-patch+json; charset=utf-8'
      request_mapper = {
        client_side_validation: true,
        required: false,
        serialized_name: 'body',
        type: {
          name: 'String'
        }
      }
      request_content = self.serialize(request_mapper,  body)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
      path_template = 'v2/discovery/events'
      request_url = @base_url || self.base_url
      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = self.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
      end
      promise.execute
    end
def subscribe1_async ( body : nil , custom_headers : nil ) request_headers = { } request_headers [ 'Content-Type' ] = 'application/json-patch+json; charset=utf-8' request_mapper = { client_side_validation : true , required : false , serialized_name : 'body' , type : { name : 'String' } } request_content = self . serialize ( request_mapper , body ) request_content = request_content != nil ? JSON . generate ( request_content , quirks_mode : true ) : nil path_template = 'v2/discovery/events' request_url = @base_url || self . base_url options = { middlewares : [ [ MsRest :: RetryPolicyMiddleware , times : 3 , retry : 0.02 ] , [ :cookie_jar ] ] , body : request_content , headers : request_headers . merge ( custom_headers || { } ) , base_url : request_url } promise = self . 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 end promise . execute end
Subscribe to discoverer registry events
Register a user to receive discoverer events through SignalR.
Subscribe to discoverer registry events Register a user to receive discoverer events through SignalR .
# Serialize Request
Promise object which holds the HTTP response.
Promise object which holds the HTTP response .
Concurrent::Promise
body
The user id that will receive discoverer events.
The user id that will receive discoverer events .
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 .