Class: PulpPythonClient::PypiSimpleApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pulp_python_client/api/pypi_simple_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PypiSimpleApi

Returns a new instance of PypiSimpleApi.



19
20
21
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create(path, content, sha256_digest, opts = {}) ⇒ PackageUploadTaskResponse

Upload a package Upload package to the index. This endpoint has the same functionality as the upload endpoint at the ‘/legacy` url of the index. This is provided for convenience for users who want a single index url for all their Python tools. (pip, twine, poetry, pipenv, …)

Parameters:

  • path (String)
  • content (File)

    A Python package release file to upload to the index.

  • sha256_digest (String)

    SHA256 of package to validate upload integrity.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :action (String)

    Defaults to `file_upload`, don't change it or request will fail! (default to ‘file_upload’)

Returns:



30
31
32
33
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 30

def create(path, content, sha256_digest, opts = {})
  data, _status_code, _headers = create_with_http_info(path, content, sha256_digest, opts)
  data
end

#create_with_http_info(path, content, sha256_digest, opts = {}) ⇒ Array<(PackageUploadTaskResponse, Integer, Hash)>

Upload a package Upload package to the index. This endpoint has the same functionality as the upload endpoint at the &#x60;/legacy&#x60; url of the index. This is provided for convenience for users who want a single index url for all their Python tools. (pip, twine, poetry, pipenv, …)

Parameters:

  • path (String)
  • content (File)

    A Python package release file to upload to the index.

  • sha256_digest (String)

    SHA256 of package to validate upload integrity.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :action (String)

    Defaults to &#x60;file_upload&#x60;, don&#39;t change it or request will fail!

Returns:

  • (Array<(PackageUploadTaskResponse, Integer, Hash)>)

    PackageUploadTaskResponse data, response status code and response headers



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 43

def create_with_http_info(path, content, sha256_digest, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PypiSimpleApi.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 PypiSimpleApi.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 PypiSimpleApi.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 PypiSimpleApi.create"
  end
  if @api_client.config.client_side_validation && sha256_digest.to_s.length > 64
    fail ArgumentError, 'invalid value for "sha256_digest" when calling PypiSimpleApi.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 PypiSimpleApi.create, the character length must be great than or equal to 64.'
  end

  # resource path
  local_var_path = '/pypi/{path}/simple/'.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: PypiSimpleApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#read(path, opts = {}) ⇒ nil

Get index simple page Gets the simple api html page for the index.

Parameters:

  • path (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    A list of fields to include in the response.

  • :exclude_fields (String)

    A list of fields to exclude from the response.

Returns:

  • (nil)


118
119
120
121
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 118

def read(path, opts = {})
  read_with_http_info(path, opts)
  nil
end

#read_0(package, path, opts = {}) ⇒ nil

Get package simple page Retrieves the simple api html page for a package.

Parameters:

  • package (String)
  • path (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    A list of fields to include in the response.

  • :exclude_fields (String)

    A list of fields to exclude from the response.

Returns:

  • (nil)


185
186
187
188
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 185

def read_0(package, path, opts = {})
  read_0_with_http_info(package, path, opts)
  nil
end

#read_0_with_http_info(package, path, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get package simple page Retrieves the simple api html page for a package.

Parameters:

  • package (String)
  • path (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    A list of fields to include in the response.

  • :exclude_fields (String)

    A list of fields to exclude from the response.

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 198

def read_0_with_http_info(package, path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PypiSimpleApi.read_0 ...'
  end
  # verify the required parameter 'package' is set
  if @api_client.config.client_side_validation && package.nil?
    fail ArgumentError, "Missing the required parameter 'package' when calling PypiSimpleApi.read_0"
  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 PypiSimpleApi.read_0"
  end
  # resource path
  local_var_path = '/pypi/{path}/simple/{package}/'.sub('{' + 'package' + '}', CGI.escape(package.to_s).gsub('%2F', '/')).sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # 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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PypiSimpleApi#read_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#read_with_http_info(path, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get index simple page Gets the simple api html page for the index.

Parameters:

  • path (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :fields (String)

    A list of fields to include in the response.

  • :exclude_fields (String)

    A list of fields to exclude from the response.

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 130

def read_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PypiSimpleApi.read ...'
  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 PypiSimpleApi.read"
  end
  # resource path
  local_var_path = '/pypi/{path}/simple/'.sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = opts[:'exclude_fields'] if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] 

  # 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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PypiSimpleApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end