Class: Cadenya::Resources::Uploads
- Inherits:
-
Object
- Object
- Cadenya::Resources::Uploads
- Defined in:
- lib/cadenya/resources/uploads.rb,
sig/cadenya/resources/uploads.rbs
Overview
Issue short-lived presigned URLs for direct client-to-object-storage uploads. Created uploads can be referenced by id when creating or updating resources that accept binary content (e.g., MemoryEntry).
Instance Method Summary collapse
-
#create(metadata:, spec:, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Upload
Some parameter documentations has been truncated, see Models::UploadCreateParams for more details.
-
#initialize(client:) ⇒ Uploads
constructor
private
A new instance of Uploads.
-
#retrieve(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Upload
Retrieves the current state of an upload, including its lifecycle status.
Constructor Details
#initialize(client:) ⇒ Uploads
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Uploads.
74 75 76 |
# File 'lib/cadenya/resources/uploads.rb', line 74 def initialize(client:) @client = client end |
Instance Method Details
#create(metadata:, spec:, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Upload
Some parameter documentations has been truncated, see Models::UploadCreateParams for more details.
Issues a short-lived presigned URL for direct upload to object storage. The returned id is used to reference the upload from resources that accept binary content.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cadenya/resources/uploads.rb', line 29 def create(params) parsed, = Cadenya::UploadCreateParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :post, path: ["v1/workspaces/%1$s/uploads", workspace_id], body: parsed, model: Cadenya::Upload, options: ) end |
#retrieve(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Upload
Retrieves the current state of an upload, including its lifecycle status
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cadenya/resources/uploads.rb', line 57 def retrieve(id, params = {}) parsed, = Cadenya::UploadRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :get, path: ["v1/workspaces/%1$s/uploads/%2$s", workspace_id, id], model: Cadenya::Upload, options: ) end |