=begin #Hydrogen Nucleus API #The Hydrogen Nucleus API OpenAPI spec version: 1.9.4 Contact: info@hydrogenplatform.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'uri' module NucleusApi class WebhookApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create a webhook # One active webhook service is allowed at all times. # @param webhook_request webhookRequest # @param [Hash] opts the optional parameters # @return [Webhook] def create_webhook_using_post(webhook_request, opts = {}) data, _status_code, _headers = create_webhook_using_post_with_http_info(webhook_request, opts) data end # Create a webhook # One active webhook service is allowed at all times. # @param webhook_request webhookRequest # @param [Hash] opts the optional parameters # @return [Array<(Webhook, Fixnum, Hash)>] Webhook data, response status code and response headers def create_webhook_using_post_with_http_info(webhook_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookApi.create_webhook_using_post ...' end # verify the required parameter 'webhook_request' is set if @api_client.config.client_side_validation && webhook_request.nil? fail ArgumentError, "Missing the required parameter 'webhook_request' when calling WebhookApi.create_webhook_using_post" end # resource path local_var_path = '/nucleus/v1/webhook' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(webhook_request) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Webhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookApi#create_webhook_using_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a webhook # Permanently delete a webhook for your firm. The webhook_id must be provided. # @param webhook_id UUID webhook_id # @param [Hash] opts the optional parameters # @return [nil] def delete_webhook_using_delete(webhook_id, opts = {}) delete_webhook_using_delete_with_http_info(webhook_id, opts) nil end # Delete a webhook # Permanently delete a webhook for your firm. The webhook_id must be provided. # @param webhook_id UUID webhook_id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_webhook_using_delete_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookApi.delete_webhook_using_delete ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookApi.delete_webhook_using_delete" end # resource path local_var_path = '/nucleus/v1/webhook/{webhook_id}'.sub('{' + 'webhook_id' + '}', webhook_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookApi#delete_webhook_using_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List all webhooks # Get information for all webhooks defined for your firm. # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :ascending ascending (default to false) # @option opts [String] :filter filter # @option opts [String] :order_by order_by (default to update_date) # @option opts [Integer] :page page (default to 0) # @option opts [Integer] :size size (default to 25) # @return [PageWebhook] def get_webhook_all_using_get(opts = {}) data, _status_code, _headers = get_webhook_all_using_get_with_http_info(opts) data end # List all webhooks # Get information for all webhooks defined for your firm. # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :ascending ascending # @option opts [String] :filter filter # @option opts [String] :order_by order_by # @option opts [Integer] :page page # @option opts [Integer] :size size # @return [Array<(PageWebhook, Fixnum, Hash)>] PageWebhook data, response status code and response headers def get_webhook_all_using_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_all_using_get ...' end # resource path local_var_path = '/nucleus/v1/webhook' # query parameters query_params = {} query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PageWebhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookApi#get_webhook_all_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a webhook # Retrieve the information for a specific webhook. The webhook_id must be provided. # @param webhook_id UUID webhook_id # @param [Hash] opts the optional parameters # @return [Webhook] def get_webhook_using_get(webhook_id, opts = {}) data, _status_code, _headers = get_webhook_using_get_with_http_info(webhook_id, opts) data end # Retrieve a webhook # Retrieve the information for a specific webhook. The webhook_id must be provided. # @param webhook_id UUID webhook_id # @param [Hash] opts the optional parameters # @return [Array<(Webhook, Fixnum, Hash)>] Webhook data, response status code and response headers def get_webhook_using_get_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_using_get ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookApi.get_webhook_using_get" end # resource path local_var_path = '/nucleus/v1/webhook/{webhook_id}'.sub('{' + 'webhook_id' + '}', webhook_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Webhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookApi#get_webhook_using_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a webhook # Update a webhook for your firm. The webhook_id must be provided # @param webhook webhook # @param webhook_id UUID webhook_id # @param [Hash] opts the optional parameters # @return [Webhook] def update_webhook_using_put(webhook, webhook_id, opts = {}) data, _status_code, _headers = update_webhook_using_put_with_http_info(webhook, webhook_id, opts) data end # Update a webhook # Update a webhook for your firm. The webhook_id must be provided # @param webhook webhook # @param webhook_id UUID webhook_id # @param [Hash] opts the optional parameters # @return [Array<(Webhook, Fixnum, Hash)>] Webhook data, response status code and response headers def update_webhook_using_put_with_http_info(webhook, webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookApi.update_webhook_using_put ...' end # verify the required parameter 'webhook' is set if @api_client.config.client_side_validation && webhook.nil? fail ArgumentError, "Missing the required parameter 'webhook' when calling WebhookApi.update_webhook_using_put" end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookApi.update_webhook_using_put" end # resource path local_var_path = '/nucleus/v1/webhook/{webhook_id}'.sub('{' + 'webhook_id' + '}', webhook_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(webhook) auth_names = ['oauth2'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Webhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookApi#update_webhook_using_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end