Class: Mudbase::FilesApi
- Inherits:
-
Object
- Object
- Mudbase::FilesApi
- Defined in:
- lib/mudbase/api/files_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#confirm_direct_upload(confirm_direct_upload_request, opts = {}) ⇒ ConfirmUploadResponse
Confirm direct upload (scan + finalize metadata) After a client uploads directly to S3 using the presigned POST, call this endpoint to have the server scan the object, create the File record, and optionally quarantine if infected.
-
#confirm_direct_upload_with_http_info(confirm_direct_upload_request, opts = {}) ⇒ Array<(ConfirmUploadResponse, Integer, Hash)>
Confirm direct upload (scan + finalize metadata) After a client uploads directly to S3 using the presigned POST, call this endpoint to have the server scan the object, create the File record, and optionally quarantine if infected.
-
#delete_file(project_id, bucket_id, file_id, opts = {}) ⇒ MessageResponse
Delete file Delete a file from a bucket permanently.
-
#delete_file_with_http_info(project_id, bucket_id, file_id, opts = {}) ⇒ Array<(MessageResponse, Integer, Hash)>
Delete file Delete a file from a bucket permanently.
-
#download_bucket_file(file_id, opts = {}) ⇒ File
Download file from bucket Download a file from a bucket.
-
#download_bucket_file_with_http_info(file_id, opts = {}) ⇒ Array<(File, Integer, Hash)>
Download file from bucket Download a file from a bucket.
-
#download_file(file_id, opts = {}) ⇒ SignedUrlResponse
Generate a presigned URL for downloading a file Returns a time-limited provider-signed URL (S3) for direct download.
-
#download_file_with_http_info(file_id, opts = {}) ⇒ Array<(SignedUrlResponse, Integer, Hash)>
Generate a presigned URL for downloading a file Returns a time-limited provider-signed URL (S3) for direct download.
-
#generate_presigned_upload(generate_presigned_upload_request, opts = {}) ⇒ PresignedPostResponse
Generate presigned POST data for direct browser upload Issue a presigned POST (fields + url) for clients to upload directly to S3.
-
#generate_presigned_upload_with_http_info(generate_presigned_upload_request, opts = {}) ⇒ Array<(PresignedPostResponse, Integer, Hash)>
Generate presigned POST data for direct browser upload Issue a presigned POST (fields + url) for clients to upload directly to S3.
-
#generate_signed_url(project_id, bucket_id, file_id, opts = {}) ⇒ SignedUrlResponse
Generate signed URL for file Generate a time-limited signed URL for downloading a private file.
-
#generate_signed_url_with_http_info(project_id, bucket_id, file_id, opts = {}) ⇒ Array<(SignedUrlResponse, Integer, Hash)>
Generate signed URL for file Generate a time-limited signed URL for downloading a private file.
-
#get_file(project_id, bucket_id, file_id, opts = {}) ⇒ FileResponse
Get file metadata Get metadata for a specific file in a bucket.
-
#get_file_with_http_info(project_id, bucket_id, file_id, opts = {}) ⇒ Array<(FileResponse, Integer, Hash)>
Get file metadata Get metadata for a specific file in a bucket.
-
#initialize(api_client = ApiClient.default) ⇒ FilesApi
constructor
A new instance of FilesApi.
-
#list_files(project_id, bucket_id, opts = {}) ⇒ FileListResponse
List files in bucket List files in a bucket with pagination, search, and optional type filter.
-
#list_files_with_http_info(project_id, bucket_id, opts = {}) ⇒ Array<(FileListResponse, Integer, Hash)>
List files in bucket List files in a bucket with pagination, search, and optional type filter.
-
#upload_files(project_id, bucket_id, upload_files_to_bucket_request, opts = {}) ⇒ FileUploadResponse
Upload files to bucket Upload one or more files to a storage bucket using multipart/form-data.
-
#upload_files_with_http_info(project_id, bucket_id, upload_files_to_bucket_request, opts = {}) ⇒ Array<(FileUploadResponse, Integer, Hash)>
Upload files to bucket Upload one or more files to a storage bucket using multipart/form-data.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ FilesApi
Returns a new instance of FilesApi.
19 20 21 |
# File 'lib/mudbase/api/files_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/mudbase/api/files_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#confirm_direct_upload(confirm_direct_upload_request, opts = {}) ⇒ ConfirmUploadResponse
Confirm direct upload (scan + finalize metadata) After a client uploads directly to S3 using the presigned POST, call this endpoint to have the server scan the object, create the File record, and optionally quarantine if infected.
27 28 29 30 |
# File 'lib/mudbase/api/files_api.rb', line 27 def confirm_direct_upload(confirm_direct_upload_request, opts = {}) data, _status_code, _headers = confirm_direct_upload_with_http_info(confirm_direct_upload_request, opts) data end |
#confirm_direct_upload_with_http_info(confirm_direct_upload_request, opts = {}) ⇒ Array<(ConfirmUploadResponse, Integer, Hash)>
Confirm direct upload (scan + finalize metadata) After a client uploads directly to S3 using the presigned POST, call this endpoint to have the server scan the object, create the File record, and optionally quarantine if infected.
37 38 39 40 41 42 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 |
# File 'lib/mudbase/api/files_api.rb', line 37 def confirm_direct_upload_with_http_info(confirm_direct_upload_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.confirm_direct_upload ...' end # verify the required parameter 'confirm_direct_upload_request' is set if @api_client.config.client_side_validation && confirm_direct_upload_request.nil? fail ArgumentError, "Missing the required parameter 'confirm_direct_upload_request' when calling FilesApi.confirm_direct_upload" end # resource path local_var_path = '/api/files/upload/confirm' # 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']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(confirm_direct_upload_request) # return_type return_type = opts[:debug_return_type] || 'ConfirmUploadResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.confirm_direct_upload", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#confirm_direct_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_file(project_id, bucket_id, file_id, opts = {}) ⇒ MessageResponse
Delete file Delete a file from a bucket permanently. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
97 98 99 100 |
# File 'lib/mudbase/api/files_api.rb', line 97 def delete_file(project_id, bucket_id, file_id, opts = {}) data, _status_code, _headers = delete_file_with_http_info(project_id, bucket_id, file_id, opts) data end |
#delete_file_with_http_info(project_id, bucket_id, file_id, opts = {}) ⇒ Array<(MessageResponse, Integer, Hash)>
Delete file Delete a file from a bucket permanently. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 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 |
# File 'lib/mudbase/api/files_api.rb', line 109 def delete_file_with_http_info(project_id, bucket_id, file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.delete_file ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling FilesApi.delete_file" end # verify the required parameter 'bucket_id' is set if @api_client.config.client_side_validation && bucket_id.nil? fail ArgumentError, "Missing the required parameter 'bucket_id' when calling FilesApi.delete_file" end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.delete_file" end # resource path local_var_path = '/api/bucket/projects/{projectId}/buckets/{bucketId}/files/{fileId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'bucketId' + '}', CGI.escape(bucket_id.to_s)).sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # 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']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MessageResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.delete_file", :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(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#download_bucket_file(file_id, opts = {}) ⇒ File
Download file from bucket Download a file from a bucket. For public files, no authentication is required. For private files, a download token (obtained via signed URL endpoint) is required in the query parameter. Accepts: Token-based authentication via query parameter (for private files), or no authentication (for public files).
171 172 173 174 |
# File 'lib/mudbase/api/files_api.rb', line 171 def download_bucket_file(file_id, opts = {}) data, _status_code, _headers = download_bucket_file_with_http_info(file_id, opts) data end |
#download_bucket_file_with_http_info(file_id, opts = {}) ⇒ Array<(File, Integer, Hash)>
Download file from bucket Download a file from a bucket. For public files, no authentication is required. For private files, a download token (obtained via signed URL endpoint) is required in the query parameter. Accepts: Token-based authentication via query parameter (for private files), or no authentication (for public files).
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 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 |
# File 'lib/mudbase/api/files_api.rb', line 182 def download_bucket_file_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.download_bucket_file ...' end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.download_bucket_file" end # resource path local_var_path = '/api/bucket/files/{fileId}/download'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'File' # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"FilesApi.download_bucket_file", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#download_bucket_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#download_file(file_id, opts = {}) ⇒ SignedUrlResponse
Generate a presigned URL for downloading a file Returns a time-limited provider-signed URL (S3) for direct download. Server enforces RBAC before issuing the URL.
237 238 239 240 |
# File 'lib/mudbase/api/files_api.rb', line 237 def download_file(file_id, opts = {}) data, _status_code, _headers = download_file_with_http_info(file_id, opts) data end |
#download_file_with_http_info(file_id, opts = {}) ⇒ Array<(SignedUrlResponse, Integer, Hash)>
Generate a presigned URL for downloading a file Returns a time-limited provider-signed URL (S3) for direct download. Server enforces RBAC before issuing the URL.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/mudbase/api/files_api.rb', line 248 def download_file_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.download_file ...' end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.download_file" end # resource path local_var_path = '/api/files/{fileId}/download'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SignedUrlResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.download_file", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#generate_presigned_upload(generate_presigned_upload_request, opts = {}) ⇒ PresignedPostResponse
Generate presigned POST data for direct browser upload Issue a presigned POST (fields + url) for clients to upload directly to S3. The server stores the issued key with expiry and RBAC is enforced.
302 303 304 305 |
# File 'lib/mudbase/api/files_api.rb', line 302 def generate_presigned_upload(generate_presigned_upload_request, opts = {}) data, _status_code, _headers = generate_presigned_upload_with_http_info(generate_presigned_upload_request, opts) data end |
#generate_presigned_upload_with_http_info(generate_presigned_upload_request, opts = {}) ⇒ Array<(PresignedPostResponse, Integer, Hash)>
Generate presigned POST data for direct browser upload Issue a presigned POST (fields + url) for clients to upload directly to S3. The server stores the issued key with expiry and RBAC is enforced.
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
# File 'lib/mudbase/api/files_api.rb', line 312 def generate_presigned_upload_with_http_info(generate_presigned_upload_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.generate_presigned_upload ...' end # verify the required parameter 'generate_presigned_upload_request' is set if @api_client.config.client_side_validation && generate_presigned_upload_request.nil? fail ArgumentError, "Missing the required parameter 'generate_presigned_upload_request' when calling FilesApi.generate_presigned_upload" end # resource path local_var_path = '/api/files/upload/presigned' # 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']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(generate_presigned_upload_request) # return_type return_type = opts[:debug_return_type] || 'PresignedPostResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.generate_presigned_upload", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#generate_presigned_upload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#generate_signed_url(project_id, bucket_id, file_id, opts = {}) ⇒ SignedUrlResponse
Generate signed URL for file Generate a time-limited signed URL for downloading a private file. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
373 374 375 376 |
# File 'lib/mudbase/api/files_api.rb', line 373 def generate_signed_url(project_id, bucket_id, file_id, opts = {}) data, _status_code, _headers = generate_signed_url_with_http_info(project_id, bucket_id, file_id, opts) data end |
#generate_signed_url_with_http_info(project_id, bucket_id, file_id, opts = {}) ⇒ Array<(SignedUrlResponse, Integer, Hash)>
Generate signed URL for file Generate a time-limited signed URL for downloading a private file. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/mudbase/api/files_api.rb', line 386 def generate_signed_url_with_http_info(project_id, bucket_id, file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.generate_signed_url ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling FilesApi.generate_signed_url" end # verify the required parameter 'bucket_id' is set if @api_client.config.client_side_validation && bucket_id.nil? fail ArgumentError, "Missing the required parameter 'bucket_id' when calling FilesApi.generate_signed_url" end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.generate_signed_url" end # resource path local_var_path = '/api/bucket/projects/{projectId}/buckets/{bucketId}/files/{fileId}/signed-url'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'bucketId' + '}', CGI.escape(bucket_id.to_s)).sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # 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']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'generate_signed_url_request']) # return_type return_type = opts[:debug_return_type] || 'SignedUrlResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.generate_signed_url", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#generate_signed_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_file(project_id, bucket_id, file_id, opts = {}) ⇒ FileResponse
Get file metadata Get metadata for a specific file in a bucket. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
454 455 456 457 |
# File 'lib/mudbase/api/files_api.rb', line 454 def get_file(project_id, bucket_id, file_id, opts = {}) data, _status_code, _headers = get_file_with_http_info(project_id, bucket_id, file_id, opts) data end |
#get_file_with_http_info(project_id, bucket_id, file_id, opts = {}) ⇒ Array<(FileResponse, Integer, Hash)>
Get file metadata Get metadata for a specific file in a bucket. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/mudbase/api/files_api.rb', line 466 def get_file_with_http_info(project_id, bucket_id, file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.get_file ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling FilesApi.get_file" end # verify the required parameter 'bucket_id' is set if @api_client.config.client_side_validation && bucket_id.nil? fail ArgumentError, "Missing the required parameter 'bucket_id' when calling FilesApi.get_file" end # verify the required parameter 'file_id' is set if @api_client.config.client_side_validation && file_id.nil? fail ArgumentError, "Missing the required parameter 'file_id' when calling FilesApi.get_file" end # resource path local_var_path = '/api/bucket/projects/{projectId}/buckets/{bucketId}/files/{fileId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'bucketId' + '}', CGI.escape(bucket_id.to_s)).sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # 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']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FileResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.get_file", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#get_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_files(project_id, bucket_id, opts = {}) ⇒ FileListResponse
List files in bucket List files in a bucket with pagination, search, and optional type filter. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
532 533 534 535 |
# File 'lib/mudbase/api/files_api.rb', line 532 def list_files(project_id, bucket_id, opts = {}) data, _status_code, _headers = list_files_with_http_info(project_id, bucket_id, opts) data end |
#list_files_with_http_info(project_id, bucket_id, opts = {}) ⇒ Array<(FileListResponse, Integer, Hash)>
List files in bucket List files in a bucket with pagination, search, and optional type filter. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/mudbase/api/files_api.rb', line 547 def list_files_with_http_info(project_id, bucket_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.list_files ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling FilesApi.list_files" end # verify the required parameter 'bucket_id' is set if @api_client.config.client_side_validation && bucket_id.nil? fail ArgumentError, "Missing the required parameter 'bucket_id' when calling FilesApi.list_files" end # resource path local_var_path = '/api/bucket/projects/{projectId}/buckets/{bucketId}/files'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'bucketId' + '}', CGI.escape(bucket_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil? query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FileListResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.list_files", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#list_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#upload_files(project_id, bucket_id, upload_files_to_bucket_request, opts = {}) ⇒ FileUploadResponse
Upload files to bucket Upload one or more files to a storage bucket using multipart/form-data. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
610 611 612 613 |
# File 'lib/mudbase/api/files_api.rb', line 610 def upload_files(project_id, bucket_id, upload_files_to_bucket_request, opts = {}) data, _status_code, _headers = upload_files_with_http_info(project_id, bucket_id, upload_files_to_bucket_request, opts) data end |
#upload_files_with_http_info(project_id, bucket_id, upload_files_to_bucket_request, opts = {}) ⇒ Array<(FileUploadResponse, Integer, Hash)>
Upload files to bucket Upload one or more files to a storage bucket using multipart/form-data. Accepts ProjectBearerAuth (JWT) or ApiKeyAuth (X-API-Key).
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 |
# File 'lib/mudbase/api/files_api.rb', line 622 def upload_files_with_http_info(project_id, bucket_id, upload_files_to_bucket_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.upload_files ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling FilesApi.upload_files" end # verify the required parameter 'bucket_id' is set if @api_client.config.client_side_validation && bucket_id.nil? fail ArgumentError, "Missing the required parameter 'bucket_id' when calling FilesApi.upload_files" end # verify the required parameter 'upload_files_to_bucket_request' is set if @api_client.config.client_side_validation && upload_files_to_bucket_request.nil? fail ArgumentError, "Missing the required parameter 'upload_files_to_bucket_request' when calling FilesApi.upload_files" end # resource path local_var_path = '/api/bucket/projects/{projectId}/buckets/{bucketId}/files'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'bucketId' + '}', CGI.escape(bucket_id.to_s)) # 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']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json', 'multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(upload_files_to_bucket_request) # return_type return_type = opts[:debug_return_type] || 'FileUploadResponse' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.upload_files", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#upload_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |