=begin #Pulp 3 API #Fetch, Upload, Organize, and Distribute Software Packages The version of the OpenAPI document: v3 Contact: pulp-list@redhat.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.2.3 =end require 'cgi' module PulpPythonClient class PypiLegacyApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Upload a package # Upload package to the index. This is the endpoint that tools like Twine and Poetry use for their upload commands. # @param path [String] # @param content [File] A Python package release file to upload to the index. # @param sha256_digest [String] SHA256 of package to validate upload integrity. # @param [Hash] opts the optional parameters # @option opts [String] :action Defaults to `file_upload`, don't change it or request will fail! (default to 'file_upload') # @return [PackageUploadTaskResponse] def create(path, content, sha256_digest, opts = {}) data, _status_code, _headers = create_with_http_info(path, content, sha256_digest, opts) data end # Upload a package # Upload package to the index. This is the endpoint that tools like Twine and Poetry use for their upload commands. # @param path [String] # @param content [File] A Python package release file to upload to the index. # @param sha256_digest [String] SHA256 of package to validate upload integrity. # @param [Hash] opts the optional parameters # @option opts [String] :action Defaults to `file_upload`, don't change it or request will fail! # @return [Array<(PackageUploadTaskResponse, Integer, Hash)>] PackageUploadTaskResponse data, response status code and response headers def create_with_http_info(path, content, sha256_digest, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PypiLegacyApi.create ...' end # verify the required parameter 'path' is set if @api_client.config.client_side_validation && path.nil? fail ArgumentError, "Missing the required parameter 'path' when calling PypiLegacyApi.create" end # verify the required parameter 'content' is set if @api_client.config.client_side_validation && content.nil? fail ArgumentError, "Missing the required parameter 'content' when calling PypiLegacyApi.create" end # verify the required parameter 'sha256_digest' is set if @api_client.config.client_side_validation && sha256_digest.nil? fail ArgumentError, "Missing the required parameter 'sha256_digest' when calling PypiLegacyApi.create" end if @api_client.config.client_side_validation && sha256_digest.to_s.length > 64 fail ArgumentError, 'invalid value for "sha256_digest" when calling PypiLegacyApi.create, the character length must be smaller than or equal to 64.' end if @api_client.config.client_side_validation && sha256_digest.to_s.length < 64 fail ArgumentError, 'invalid value for "sha256_digest" when calling PypiLegacyApi.create, the character length must be great than or equal to 64.' end # resource path local_var_path = '/pypi/{path}/legacy/'.sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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(['multipart/form-data', 'application/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} form_params['content'] = content form_params['sha256_digest'] = sha256_digest form_params['action'] = opts[:'action'] if !opts[:'action'].nil? # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PackageUploadTaskResponse' # auth_names auth_names = opts[:auth_names] || ['basicAuth'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PypiLegacyApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end