=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 EntitlementsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create a specific entitlement in a repository. # Create a specific entitlement in a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsCreate] :data # @return [RepositoryToken] def entitlements_create(owner, repo, opts = {}) data, _status_code, _headers = entitlements_create_with_http_info(owner, repo, opts) return data end # Create a specific entitlement in a repository. # Create a specific entitlement in a repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsCreate] :data # @return [Array<(RepositoryToken, Fixnum, Hash)>] RepositoryToken data, response status code and response headers def entitlements_create_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_create" end # resource path local_var_path = "/entitlements/{owner}/{repo}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} query_params[:'show_tokens'] = opts[:'show_tokens'] if !opts[:'show_tokens'].nil? # 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', '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 => 'RepositoryToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a specific entitlement in a repository. # Delete a specific entitlement in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [nil] def entitlements_delete(owner, repo, identifier, opts = {}) entitlements_delete_with_http_info(owner, repo, identifier, opts) return nil end # Delete a specific entitlement in a repository. # Delete a specific entitlement 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 entitlements_delete_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_delete" end # resource path local_var_path = "/entitlements/{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', '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: EntitlementsApi#entitlements_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Disable an entitlement token in a repository. # Disable an entitlement token in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [nil] def entitlements_disable(owner, repo, identifier, opts = {}) entitlements_disable_with_http_info(owner, repo, identifier, opts) return nil end # Disable an entitlement token in a repository. # Disable an entitlement token 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 entitlements_disable_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_disable ..." 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 EntitlementsApi.entitlements_disable" 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 EntitlementsApi.entitlements_disable" 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 EntitlementsApi.entitlements_disable" end # resource path local_var_path = "/entitlements/{owner}/{repo}/{identifier}/disable/".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', '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) if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_disable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Enable an entitlement token in a repository. # Enable an entitlement token in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [nil] def entitlements_enable(owner, repo, identifier, opts = {}) entitlements_enable_with_http_info(owner, repo, identifier, opts) return nil end # Enable an entitlement token in a repository. # Enable an entitlement token 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 entitlements_enable_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_enable ..." 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 EntitlementsApi.entitlements_enable" 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 EntitlementsApi.entitlements_enable" 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 EntitlementsApi.entitlements_enable" end # resource path local_var_path = "/entitlements/{owner}/{repo}/{identifier}/enable/".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', '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) if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_enable\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a list of all entitlements in a repository. # Get a list of all entitlements 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. # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @return [Array] def entitlements_list(owner, repo, opts = {}) data, _status_code, _headers = entitlements_list_with_http_info(owner, repo, opts) return data end # Get a list of all entitlements in a repository. # Get a list of all entitlements 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. # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def entitlements_list_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_list" end # resource path local_var_path = "/entitlements/{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? query_params[:'show_tokens'] = opts[:'show_tokens'] if !opts[:'show_tokens'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey', '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: EntitlementsApi#entitlements_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a specific entitlement in a repository. # Update a specific entitlement in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsPartialUpdate] :data # @return [RepositoryToken] def entitlements_partial_update(owner, repo, identifier, opts = {}) data, _status_code, _headers = entitlements_partial_update_with_http_info(owner, repo, identifier, opts) return data end # Update a specific entitlement in a repository. # Update a specific entitlement in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsPartialUpdate] :data # @return [Array<(RepositoryToken, Fixnum, Hash)>] RepositoryToken data, response status code and response headers def entitlements_partial_update_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_partial_update" end # resource path local_var_path = "/entitlements/{owner}/{repo}/{identifier}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'show_tokens'] = opts[:'show_tokens'] if !opts[:'show_tokens'].nil? # 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', '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 => 'RepositoryToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_partial_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a specific entitlement in a repository. # Get a specific entitlement in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @return [RepositoryToken] def entitlements_read(owner, repo, identifier, opts = {}) data, _status_code, _headers = entitlements_read_with_http_info(owner, repo, identifier, opts) return data end # Get a specific entitlement in a repository. # Get a specific entitlement in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @return [Array<(RepositoryToken, Fixnum, Hash)>] RepositoryToken data, response status code and response headers def entitlements_read_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_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 EntitlementsApi.entitlements_read" end # resource path local_var_path = "/entitlements/{owner}/{repo}/{identifier}/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'show_tokens'] = opts[:'show_tokens'] if !opts[:'show_tokens'].nil? # header parameters header_params = {} # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['apikey', '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 => 'RepositoryToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Refresh an entitlement token in a repository. # Refresh an entitlement token in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsRefresh] :data # @return [RepositoryTokenRefresh] def entitlements_refresh(owner, repo, identifier, opts = {}) data, _status_code, _headers = entitlements_refresh_with_http_info(owner, repo, identifier, opts) return data end # Refresh an entitlement token in a repository. # Refresh an entitlement token in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsRefresh] :data # @return [Array<(RepositoryTokenRefresh, Fixnum, Hash)>] RepositoryTokenRefresh data, response status code and response headers def entitlements_refresh_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_refresh ..." 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 EntitlementsApi.entitlements_refresh" 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 EntitlementsApi.entitlements_refresh" 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 EntitlementsApi.entitlements_refresh" end # resource path local_var_path = "/entitlements/{owner}/{repo}/{identifier}/refresh/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'show_tokens'] = opts[:'show_tokens'] if !opts[:'show_tokens'].nil? # 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', '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 => 'RepositoryTokenRefresh') if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_refresh\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reset the statistics for an entitlement token in a repository. # Reset the statistics for an entitlement token in a repository. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @return [nil] def entitlements_reset(owner, repo, identifier, opts = {}) entitlements_reset_with_http_info(owner, repo, identifier, opts) return nil end # Reset the statistics for an entitlement token in a repository. # Reset the statistics for an entitlement token 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 entitlements_reset_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_reset ..." 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 EntitlementsApi.entitlements_reset" 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 EntitlementsApi.entitlements_reset" 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 EntitlementsApi.entitlements_reset" end # resource path local_var_path = "/entitlements/{owner}/{repo}/{identifier}/reset/".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', '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) if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_reset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Synchronise tokens from a source repository. # Synchronise tokens from a source repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsSync] :data # @return [RepositoryTokenSync] def entitlements_sync(owner, repo, opts = {}) data, _status_code, _headers = entitlements_sync_with_http_info(owner, repo, opts) return data end # Synchronise tokens from a source repository. # Synchronise tokens from a source repository. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [BOOLEAN] :show_tokens Show entitlement token strings in results # @option opts [EntitlementsSync] :data # @return [Array<(RepositoryTokenSync, Fixnum, Hash)>] RepositoryTokenSync data, response status code and response headers def entitlements_sync_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: EntitlementsApi.entitlements_sync ..." 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 EntitlementsApi.entitlements_sync" 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 EntitlementsApi.entitlements_sync" end # resource path local_var_path = "/entitlements/{owner}/{repo}/sync/".sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} query_params[:'show_tokens'] = opts[:'show_tokens'] if !opts[:'show_tokens'].nil? # 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', '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 => 'RepositoryTokenSync') if @api_client.config.debugging @api_client.config.logger.debug "API called: EntitlementsApi#entitlements_sync\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end