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
-
#api_files_download_file_id_get(file_id, opts = {}) ⇒ ApiFilesDownloadFileIdGet200Response
Get a download URL for a file Returns a URL to download the file.
-
#api_files_download_file_id_get_with_http_info(file_id, opts = {}) ⇒ Array<(ApiFilesDownloadFileIdGet200Response, Integer, Hash)>
Get a download URL for a file Returns a URL to download the file.
-
#api_files_logo_redirect_get(key, opts = {}) ⇒ nil
Redirect to an org/project logo's content Unauthenticated.
-
#api_files_logo_redirect_get_with_http_info(key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Redirect to an org/project logo's content Unauthenticated.
-
#api_files_public_file_id_get(file_id, opts = {}) ⇒ nil
Redirect to a public file's content Unauthenticated.
-
#api_files_public_file_id_get_with_http_info(file_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Redirect to a public file's content Unauthenticated.
-
#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 PUT URL, 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 PUT URL, 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 a presigned PUT URL for direct browser upload Issue a presigned PUT URL for clients to upload directly to object storage.
-
#generate_presigned_upload_with_http_info(generate_presigned_upload_request, opts = {}) ⇒ Array<(PresignedPostResponse, Integer, Hash)>
Generate a presigned PUT URL for direct browser upload Issue a presigned PUT URL for clients to upload directly to object storage.
-
#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_with_http_info(project_id, bucket_id, opts = {}) ⇒ Array<(FileListResponse, Integer, Hash)>
List files in bucket.
-
#upload_files(project_id, bucket_id, files, 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, files, opts = {}) ⇒ Array<(FileUploadResponse, Integer, Hash)>
Upload files to bucket Upload one or more files to a storage bucket using multipart/form-data.
Constructor Details
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
#api_files_download_file_id_get(file_id, opts = {}) ⇒ ApiFilesDownloadFileIdGet200Response
Get a download URL for a file Returns a URL to download the file. For private files a short-lived signed URL is generated; the lifetime can be tuned per request via the optional expiresIn query parameter (seconds, clamped to a safe server-configured range). For public (public-read) files the permanent world-readable URL is returned with isPublic true and a warning, since signing a public object provides no protection. Accepts a JWT (Bearer) or a project API key.
28 29 30 31 |
# File 'lib/mudbase/api/files_api.rb', line 28 def api_files_download_file_id_get(file_id, opts = {}) data, _status_code, _headers = api_files_download_file_id_get_with_http_info(file_id, opts) data end |
#api_files_download_file_id_get_with_http_info(file_id, opts = {}) ⇒ Array<(ApiFilesDownloadFileIdGet200Response, Integer, Hash)>
Get a download URL for a file Returns a URL to download the file. For private files a short-lived signed URL is generated; the lifetime can be tuned per request via the optional expiresIn query parameter (seconds, clamped to a safe server-configured range). For public (public-read) files the permanent world-readable URL is returned with isPublic true and a warning, since signing a public object provides no protection. Accepts a JWT (Bearer) or a project API key.
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 89 90 |
# File 'lib/mudbase/api/files_api.rb', line 39 def api_files_download_file_id_get_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.api_files_download_file_id_get ...' 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.api_files_download_file_id_get" end if @api_client.config.client_side_validation && !opts[:'expires_in'].nil? && opts[:'expires_in'] < 1 fail ArgumentError, 'invalid value for "opts[:"expires_in"]" when calling FilesApi.api_files_download_file_id_get, must be greater than or equal to 1.' end # resource path local_var_path = '/api/files/download/{fileId}'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'expiresIn'] = opts[:'expires_in'] if !opts[:'expires_in'].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] || 'ApiFilesDownloadFileIdGet200Response' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKeyAuth', 'ProjectBearerAuth'] = opts.merge( :operation => :"FilesApi.api_files_download_file_id_get", :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#api_files_download_file_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#api_files_logo_redirect_get(key, opts = {}) ⇒ nil
Redirect to an org/project logo's content
Unauthenticated. Logos are always meant to be public branding assets, but Cloudflare R2 has no per-object ACL, so this route (not the bucket) is what actually serves them - the key query param is validated against the exact shape logoStorageService.uploadLogo() produces before signing, so this can never be used to fetch an arbitrary storage key. 302-redirects to a short-lived signed GET url.
97 98 99 100 |
# File 'lib/mudbase/api/files_api.rb', line 97 def api_files_logo_redirect_get(key, opts = {}) api_files_logo_redirect_get_with_http_info(key, opts) nil end |
#api_files_logo_redirect_get_with_http_info(key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Redirect to an org/project logo's content Unauthenticated. Logos are always meant to be public branding assets, but Cloudflare R2 has no per-object ACL, so this route (not the bucket) is what actually serves them - the `key` query param is validated against the exact shape logoStorageService.uploadLogo() produces before signing, so this can never be used to fetch an arbitrary storage key. 302-redirects to a short-lived signed GET url.
107 108 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 |
# File 'lib/mudbase/api/files_api.rb', line 107 def api_files_logo_redirect_get_with_http_info(key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.api_files_logo_redirect_get ...' end # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? fail ArgumentError, "Missing the required parameter 'key' when calling FilesApi.api_files_logo_redirect_get" end # resource path local_var_path = '/api/files/logo-redirect' # query parameters query_params = opts[:query_params] || {} query_params[:'key'] = key # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"FilesApi.api_files_logo_redirect_get", :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#api_files_logo_redirect_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#api_files_public_file_id_get(file_id, opts = {}) ⇒ nil
Redirect to a public file's content Unauthenticated. Only serves files with isPublic=true whose upload has been confirmed and whose virus scan came back clean - Cloudflare R2 has no per-object ACL, so this route (not the storage bucket) is what actually decides whether a "public" file's bytes are reachable. 302-redirects to a fresh, short-lived (60s) signed GET url so the actual bytes are still served straight off Cloudflare's edge.
159 160 161 162 |
# File 'lib/mudbase/api/files_api.rb', line 159 def api_files_public_file_id_get(file_id, opts = {}) api_files_public_file_id_get_with_http_info(file_id, opts) nil end |
#api_files_public_file_id_get_with_http_info(file_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Redirect to a public file's content Unauthenticated. Only serves files with isPublic=true whose upload has been confirmed and whose virus scan came back clean - Cloudflare R2 has no per-object ACL, so this route (not the storage bucket) is what actually decides whether a "public" file's bytes are reachable. 302-redirects to a fresh, short-lived (60s) signed GET url so the actual bytes are still served straight off Cloudflare's edge.
169 170 171 172 173 174 175 176 177 178 179 180 181 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 |
# File 'lib/mudbase/api/files_api.rb', line 169 def api_files_public_file_id_get_with_http_info(file_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.api_files_public_file_id_get ...' 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.api_files_public_file_id_get" end # resource path local_var_path = '/api/files/public/{fileId}'.sub('{' + 'fileId' + '}', CGI.escape(file_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || [] = opts.merge( :operation => :"FilesApi.api_files_public_file_id_get", :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#api_files_public_file_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#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 PUT URL, call this endpoint to have the server scan the object, create the File record, and optionally quarantine if infected.
220 221 222 223 |
# File 'lib/mudbase/api/files_api.rb', line 220 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 PUT URL, call this endpoint to have the server scan the object, create the File record, and optionally quarantine if infected.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 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 |
# File 'lib/mudbase/api/files_api.rb', line 230 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: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
290 291 292 293 |
# File 'lib/mudbase/api/files_api.rb', line 290 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: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
302 303 304 305 306 307 308 309 310 311 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 |
# File 'lib/mudbase/api/files_api.rb', line 302 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] || ['OrgBearerAuth', '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).
364 365 366 367 |
# File 'lib/mudbase/api/files_api.rb', line 364 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).
375 376 377 378 379 380 381 382 383 384 385 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 |
# File 'lib/mudbase/api/files_api.rb', line 375 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.
430 431 432 433 |
# File 'lib/mudbase/api/files_api.rb', line 430 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.
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/mudbase/api/files_api.rb', line 441 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 a presigned PUT URL for direct browser upload
Issue a presigned PUT URL for clients to upload directly to object storage. The server stores the issued key with expiry and RBAC is enforced. PUT (not POST) is used because Cloudflare R2 does not implement the S3 POST Object API. The client must PUT the file body to url with the exact headers returned (a Content-Type mismatch fails with SignatureDoesNotMatch). maxFileUploadBytes is enforced server-side by /api/files/upload/confirm after the upload, not by the presigned URL itself.
495 496 497 498 |
# File 'lib/mudbase/api/files_api.rb', line 495 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 a presigned PUT URL for direct browser upload Issue a presigned PUT URL for clients to upload directly to object storage. The server stores the issued key with expiry and RBAC is enforced. PUT (not POST) is used because Cloudflare R2 does not implement the S3 POST Object API. The client must PUT the file body to `url` with the exact `headers` returned (a Content-Type mismatch fails with SignatureDoesNotMatch). `maxFileUploadBytes` is enforced server-side by `/api/files/upload/confirm` after the upload, not by the presigned URL itself.
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
# File 'lib/mudbase/api/files_api.rb', line 505 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: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
566 567 568 569 |
# File 'lib/mudbase/api/files_api.rb', line 566 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: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/mudbase/api/files_api.rb', line 579 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] || ['OrgBearerAuth', '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: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
647 648 649 650 |
# File 'lib/mudbase/api/files_api.rb', line 647 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: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 |
# File 'lib/mudbase/api/files_api.rb', line 659 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] || ['OrgBearerAuth', '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
724 725 726 727 |
# File 'lib/mudbase/api/files_api.rb', line 724 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
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 |
# File 'lib/mudbase/api/files_api.rb', line 738 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] || ['OrgBearerAuth', '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, files, opts = {}) ⇒ FileUploadResponse
Upload files to bucket
Upload one or more files to a storage bucket using multipart/form-data. Per-file size is limited by the org plan (maxFileUploadBytes) and bucket maxFileSize, whichever is stricter. Exceeding the limit returns 413. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
801 802 803 804 |
# File 'lib/mudbase/api/files_api.rb', line 801 def upload_files(project_id, bucket_id, files, opts = {}) data, _status_code, _headers = upload_files_with_http_info(project_id, bucket_id, files, opts) data end |
#upload_files_with_http_info(project_id, bucket_id, files, opts = {}) ⇒ Array<(FileUploadResponse, Integer, Hash)>
Upload files to bucket Upload one or more files to a storage bucket using multipart/form-data. Per-file size is limited by the org plan (`maxFileUploadBytes`) and bucket `maxFileSize`, whichever is stricter. Exceeding the limit returns 413. Accepts: OrgBearerAuth (for admin users), ProjectBearerAuth (JWT for authenticated users), or ApiKeyAuth (X-API-Key for programmatic access). Both ProjectBearerAuth and ApiKeyAuth are fully implemented.
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
# File 'lib/mudbase/api/files_api.rb', line 813 def upload_files_with_http_info(project_id, bucket_id, files, 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 'files' is set if @api_client.config.client_side_validation && files.nil? fail ArgumentError, "Missing the required parameter 'files' 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(['multipart/form-data']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} form_params['files'] = @api_client.build_collection_param(files, :multi) # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'FileUploadResponse' # auth_names auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', '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 |