=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
Generator version: 7.10.0
=endrequire'cgi'modulePulpPythonClientclassPypiLegacyApiattr_accessor:api_clientdefinitialize(api_client=ApiClient.default)@api_client=api_clientend# 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 [Array<String>] :x_task_diagnostics List of profilers to use on tasks.# @option opts [String] :action Defaults to `file_upload`, don't change it or request will fail! (default to 'file_upload')# @option opts [ProtocolVersionEnum] :protocol_version Protocol version to use for the upload. Only version 1 is supported. * `1` - 1# @option opts [FiletypeEnum] :filetype Type of artifact to upload. * `bdist_wheel` - bdist_wheel * `sdist` - sdist# @option opts [MetadataVersionEnum] :metadata_version Metadata version of the uploaded package. * `1.0` - 1.0 * `1.1` - 1.1 * `1.2` - 1.2 * `2.0` - 2.0 * `2.1` - 2.1 * `2.2` - 2.2 * `2.3` - 2.3 * `2.4` - 2.4# @option opts [Object] :attestations # @return [PackageUploadTaskResponse]defcreate(path,content,sha256_digest,opts={})data,_status_code,_headers=create_with_http_info(path,content,sha256_digest,opts)dataend# 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 [Array<String>] :x_task_diagnostics List of profilers to use on tasks.# @option opts [String] :action Defaults to `file_upload`, don't change it or request will fail! (default to 'file_upload')# @option opts [ProtocolVersionEnum] :protocol_version Protocol version to use for the upload. Only version 1 is supported. * `1` - 1# @option opts [FiletypeEnum] :filetype Type of artifact to upload. * `bdist_wheel` - bdist_wheel * `sdist` - sdist# @option opts [MetadataVersionEnum] :metadata_version Metadata version of the uploaded package. * `1.0` - 1.0 * `1.1` - 1.1 * `1.2` - 1.2 * `2.0` - 2.0 * `2.1` - 2.1 * `2.2` - 2.2 * `2.3` - 2.3 * `2.4` - 2.4# @option opts [Object] :attestations # @return [Array<(PackageUploadTaskResponse, Integer, Hash)>] PackageUploadTaskResponse data, response status code and response headersdefcreate_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 setif@api_client.config.client_side_validation&&path.nil?failArgumentError,"Missing the required parameter 'path' when calling PypiLegacyApi.create"end# verify the required parameter 'content' is setif@api_client.config.client_side_validation&&content.nil?failArgumentError,"Missing the required parameter 'content' when calling PypiLegacyApi.create"end# verify the required parameter 'sha256_digest' is setif@api_client.config.client_side_validation&&sha256_digest.nil?failArgumentError,"Missing the required parameter 'sha256_digest' when calling PypiLegacyApi.create"endif@api_client.config.client_side_validation&&sha256_digest.to_s.length>64failArgumentError,'invalid value for "sha256_digest" when calling PypiLegacyApi.create, the character length must be smaller than or equal to 64.'endif@api_client.config.client_side_validation&&sha256_digest.to_s.length<64failArgumentError,'invalid value for "sha256_digest" when calling PypiLegacyApi.create, the character length must be great than or equal to 64.'endif@api_client.config.client_side_validation&&!opts[:'action'].nil?&&opts[:'action'].to_s.length<1failArgumentError,'invalid value for "opts[:"action"]" when calling PypiLegacyApi.create, the character length must be great than or equal to 1.'end# resource pathlocal_var_path='/pypi/{path}/legacy/'.sub('{'+'path'+'}',CGI.escape(path.to_s).gsub('%2F','/'))# query parametersquery_params=opts[:query_params]||{}# header parametersheader_params=opts[:header_params]||{}# HTTP header 'Accept' (if needed)header_params['Accept']=@api_client.select_header_accept(['application/json'])unlessheader_params['Accept']# HTTP header 'Content-Type'content_type=@api_client.select_header_content_type(['multipart/form-data','application/x-www-form-urlencoded'])if!content_type.nil?header_params['Content-Type']=content_typeendheader_params[:'X-Task-Diagnostics']=@api_client.build_collection_param(opts[:'x_task_diagnostics'],:csv)if!opts[:'x_task_diagnostics'].nil?# form parametersform_params=opts[:form_params]||{}form_params['content']=contentform_params['sha256_digest']=sha256_digestform_params['action']=opts[:'action']if!opts[:'action'].nil?form_params['protocol_version']=opts[:'protocol_version']if!opts[:'protocol_version'].nil?form_params['filetype']=opts[:'filetype']if!opts[:'filetype'].nil?form_params['metadata_version']=opts[:'metadata_version']if!opts[:'metadata_version'].nil?form_params['attestations']=opts[:'attestations']if!opts[:'attestations'].nil?# http body (model)post_body=opts[:debug_body]# return_typereturn_type=opts[:debug_return_type]||'PackageUploadTaskResponse'# auth_namesauth_names=opts[:debug_auth_names]||['basicAuth']new_options=opts.merge(:operation=>:"PypiLegacyApi.create",: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}"endreturndata,status_code,headersendendend