Class: Cadenya::Resources::Uploads
- Inherits:
-
Object
- Object
- Cadenya::Resources::Uploads
- Defined in:
- lib/cadenya/resources/uploads.rb
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(workspace_id, metadata:, spec:, 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:, 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.
70 71 72 |
# File 'lib/cadenya/resources/uploads.rb', line 70 def initialize(client:) @client = client end |
Instance Method Details
#create(workspace_id, metadata:, spec:, 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 |
# File 'lib/cadenya/resources/uploads.rb', line 29 def create(workspace_id, params) parsed, = Cadenya::UploadCreateParams.dump_request(params) @client.request( method: :post, path: ["v1/workspaces/%1$s/uploads", workspace_id], body: parsed, model: Cadenya::Upload, options: ) end |
#retrieve(id, workspace_id:, request_options: {}) ⇒ Cadenya::Models::Upload
Retrieves the current state of an upload, including its lifecycle status
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cadenya/resources/uploads.rb', line 53 def retrieve(id, params) parsed, = Cadenya::UploadRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/workspaces/%1$s/uploads/%2$s", workspace_id, id], model: Cadenya::Upload, options: ) end |