=begin #Cloudsmith API (v1) #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.4.26 =end require 'uri' module CloudsmithApi class FilesApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Abort a multipart file upload. # Abort a multipart file upload. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [nil] def files_abort(owner, repo, identifier, opts = {}) files_abort_with_http_info(owner, repo, identifier, opts) nil end # Abort a multipart file upload. # Abort a multipart file upload. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def files_abort_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_abort ...' 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 FilesApi.files_abort" 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 FilesApi.files_abort" 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 FilesApi.files_abort" end # resource path local_var_path = '/files/{owner}/{repo}/{identifier}/abort/'.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 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # 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'] 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: FilesApi#files_abort\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Complete a multipart file upload. # Complete a multipart file upload. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [PackageFileUpload] def files_complete(owner, repo, identifier, opts = {}) data, _status_code, _headers = files_complete_with_http_info(owner, repo, identifier, opts) data end # Complete a multipart file upload. # Complete a multipart file upload. # @param owner # @param repo # @param identifier # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [Array<(PackageFileUpload, Fixnum, Hash)>] PackageFileUpload data, response status code and response headers def files_complete_with_http_info(owner, repo, identifier, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_complete ...' 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 FilesApi.files_complete" 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 FilesApi.files_complete" 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 FilesApi.files_complete" end # resource path local_var_path = '/files/{owner}/{repo}/{identifier}/complete/'.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 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # 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'] 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 => 'PackageFileUpload') if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_complete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Request URL(s) to upload new package file upload(s) to. # Request URL(s) to upload new package file upload(s) to. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [PackageFileUpload] def files_create(owner, repo, opts = {}) data, _status_code, _headers = files_create_with_http_info(owner, repo, opts) data end # Request URL(s) to upload new package file upload(s) to. # Request URL(s) to upload new package file upload(s) to. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [Array<(PackageFileUpload, Fixnum, Hash)>] PackageFileUpload data, response status code and response headers def files_create_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_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 FilesApi.files_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 FilesApi.files_create" end # resource path local_var_path = '/files/{owner}/{repo}/'.sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # 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'] 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 => 'PackageFileUpload') if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get upload information to perform a multipart file upload. # Get upload information to perform a multipart file upload. # @param owner # @param repo # @param identifier # @param filename The filename of the file being uploaded # @param [Hash] opts the optional parameters # @option opts [Integer] :part_number The part number to be uploaded next # @return [PackageFilePartsUpload] def files_info(owner, repo, identifier, filename, opts = {}) data, _status_code, _headers = files_info_with_http_info(owner, repo, identifier, filename, opts) data end # Get upload information to perform a multipart file upload. # Get upload information to perform a multipart file upload. # @param owner # @param repo # @param identifier # @param filename The filename of the file being uploaded # @param [Hash] opts the optional parameters # @option opts [Integer] :part_number The part number to be uploaded next # @return [Array<(PackageFilePartsUpload, Fixnum, Hash)>] PackageFilePartsUpload data, response status code and response headers def files_info_with_http_info(owner, repo, identifier, filename, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_info ...' 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 FilesApi.files_info" 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 FilesApi.files_info" 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 FilesApi.files_info" end # verify the required parameter 'filename' is set if @api_client.config.client_side_validation && filename.nil? fail ArgumentError, "Missing the required parameter 'filename' when calling FilesApi.files_info" end # resource path local_var_path = '/files/{owner}/{repo}/{identifier}/info/'.sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s).sub('{' + 'identifier' + '}', identifier.to_s) # query parameters query_params = {} query_params[:'filename'] = filename query_params[:'part_number'] = opts[:'part_number'] if !opts[:'part_number'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # 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 = nil auth_names = ['apikey', 'basic'] 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 => 'PackageFilePartsUpload') if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate parameters used for create. # Validate parameters used for create. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [nil] def files_validate(owner, repo, opts = {}) files_validate_with_http_info(owner, repo, opts) nil end # Validate parameters used for create. # Validate parameters used for create. # @param owner # @param repo # @param [Hash] opts the optional parameters # @option opts [PackageFileUploadRequest] :data # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def files_validate_with_http_info(owner, repo, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_validate ...' 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 FilesApi.files_validate" 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 FilesApi.files_validate" end # resource path local_var_path = '/files/{owner}/{repo}/validate/'.sub('{' + 'owner' + '}', owner.to_s).sub('{' + 'repo' + '}', repo.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # 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'] 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: FilesApi#files_validate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end