=begin #Cloudsmith API #The API to the Cloudsmith Service OpenAPI spec version: v1 Contact: support@cloudsmith.io Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.2.3 =end require "uri" module CloudsmithApi class WebhooksApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create a specific webhook in a repository. # Create a specific webhook in a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [WebhooksCreate] :data # @return [RepositoryWebhook] def webhooks_create(owner, repo, opts = {}) data, _status_code, _headers = webhooks_create_with_http_info(owner, repo, opts) return data end # Create a specific webhook in a repository. # Create a specific webhook in a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [WebhooksCreate] :data # @return [Array<(RepositoryWebhook, Fixnum, Hash)>] RepositoryWebhook data, response status code and response headers def webhooks_create_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: WebhooksApi.webhooks_create ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling WebhooksApi.webhooks_create" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling WebhooksApi.webhooks_create" end # resource path local_var_path = "/webhooks/{owner}/{repo}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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(opts[:'data']) auth_names = ['apikey', 'basic', 'csrf_token'] 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 => 'RepositoryWebhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a specific webhook in a repository. # Delete a specific webhook in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [nil] def webhooks_delete(owner, repo, identifier, opts = {}) webhooks_delete_with_http_info(owner, repo, identifier, opts) return nil end # Delete a specific webhook in a repository. # Delete a specific webhook in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def webhooks_delete_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: WebhooksApi.webhooks_delete ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling WebhooksApi.webhooks_delete" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling WebhooksApi.webhooks_delete" end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling WebhooksApi.webhooks_delete" end # resource path local_var_path = "/webhooks/{owner}/{repo}/{identifier}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey', 'basic', 'csrf_token'] 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: WebhooksApi#webhooks_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a list of all webhooks in a repository. # Get a list of all webhooks in a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @return [Array] def webhooks_list(owner, repo, opts = {}) data, _status_code, _headers = webhooks_list_with_http_info(owner, repo, opts) return data end # Get a list of all webhooks in a repository. # Get a list of all webhooks in a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [Integer] :page A page number within the paginated result set. # @option opts [Integer] :page_size Number of results to return per page. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def webhooks_list_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: WebhooksApi.webhooks_list ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling WebhooksApi.webhooks_list" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling WebhooksApi.webhooks_list" end # resource path local_var_path = "/webhooks/{owner}/{repo}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey', 'basic', 'csrf_token'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a specific webhook in a repository. # Update a specific webhook in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [WebhooksPartialUpdate] :data # @return [RepositoryWebhook] def webhooks_partial_update(owner, repo, identifier, opts = {}) data, _status_code, _headers = webhooks_partial_update_with_http_info(owner, repo, identifier, opts) return data end # Update a specific webhook in a repository. # Update a specific webhook in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [WebhooksPartialUpdate] :data # @return [Array<(RepositoryWebhook, Fixnum, Hash)>] RepositoryWebhook data, response status code and response headers def webhooks_partial_update_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: WebhooksApi.webhooks_partial_update ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling WebhooksApi.webhooks_partial_update" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling WebhooksApi.webhooks_partial_update" end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling WebhooksApi.webhooks_partial_update" end # resource path local_var_path = "/webhooks/{owner}/{repo}/{identifier}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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(opts[:'data']) auth_names = ['apikey', 'basic', 'csrf_token'] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RepositoryWebhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_partial_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Views for working with repository webhooks. # Views for working with repository webhooks. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [RepositoryWebhook] def webhooks_read(owner, repo, identifier, opts = {}) data, _status_code, _headers = webhooks_read_with_http_info(owner, repo, identifier, opts) return data end # Views for working with repository webhooks. # Views for working with repository webhooks. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [Array<(RepositoryWebhook, Fixnum, Hash)>] RepositoryWebhook data, response status code and response headers def webhooks_read_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: WebhooksApi.webhooks_read ..." end # verify the required parameter 'owner' is set if @api_client.config.client_side_validation && owner.nil? fail ArgumentError, "Missing the required parameter 'owner' when calling WebhooksApi.webhooks_read" end # verify the required parameter 'repo' is set if @api_client.config.client_side_validation && repo.nil? fail ArgumentError, "Missing the required parameter 'repo' when calling WebhooksApi.webhooks_read" end # verify the required parameter 'identifier' is set if @api_client.config.client_side_validation && identifier.nil? fail ArgumentError, "Missing the required parameter 'identifier' when calling WebhooksApi.webhooks_read" end # resource path local_var_path = "/webhooks/{owner}/{repo}/{identifier}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey', 'basic', 'csrf_token'] 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 => 'RepositoryWebhook') if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhooksApi#webhooks_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end