Resource

DearDiary.get_resourceFunction
get_resource(id::Integer)::Optional{Resource}

Get a Resource by id.

Arguments

  • id::Integer: The id of the resource to query.

Returns

A Resource object. If the record does not exist, return nothing.

source
get_resource(client::Client, id::Integer)::Optional{Resource}

Fetch the metadata for a Resource via GET /resource/{id}. The returned struct's data field is always nothing — the JSON response carries metadata only. Fetch the artifact bytes separately with read_resource_data.

Returns nothing when the server replies 404 and raises ClientError for other failures.

source
DearDiary.get_resourcesFunction
get_resources(experiment_id::Integer)::Array{Resource, 1}

Get all Resource for a given experiment.

Arguments

  • experiment_id::Integer: The id of the experiment to query.

Returns

An array of Resource objects.

source
get_resources(experiment_id::Integer, page::Pagination)::PaginatedResponse{Resource}

Get a page of Resource records for an experiment, with total count populated.

Arguments

  • experiment_id::Integer: The id of the experiment to query.
  • page::Pagination: The page bounds (limit + offset).

Returns

A PaginatedResponse of Resource.

source
get_resources(client::Client, experiment_id::Integer)::Array{Resource,1}

Convenience wrapper around the paged form: returns the first page (default limit) of Resource records under experiment_id and discards the pagination envelope.

source
get_resources(client::Client, experiment_id::Integer, page::Pagination)::PaginatedResponse{Resource}

Fetch a page of Resource records under experiment_id via GET /resource/experiment/{experiment_id}?limit=…&offset=….

source
DearDiary.create_resourceFunction
create_resource(experiment_id::Integer, name::AbstractString, data::AbstractArray{UInt8,1})::NamedTuple{id::Optional{<:Int64},status::DataType}

Create a new Resource record.

Arguments

  • experiment_id::Integer: The id of the experiment to create the resource for.
  • name::AbstractString: The name of the resource.
  • data::AbstractArray{UInt8,1}: The binary data of the resource.

Returns

  • The created resource ID. If an error occurs, nothing is returned.
  • An UpsertResult. Created if the record was successfully created, Duplicate if the record already exists, Unprocessable if the record violates a constraint, and Error if an error occurred while creating the record.
source
create_resource(client::Client, experiment_id::Integer, name::AbstractString, data::AbstractVector{UInt8})::Int64

Upload a binary Resource to experiment_id via POST /resource/experiment/{experiment_id} as multipart/form-data. The parent experiment must be IN_PROGRESS. Returns the new resource id.

source
create_resource(client::Client, experiment_id::Integer, file_path::AbstractString)::Int64

Convenience overload that reads bytes from a file on disk and uploads them under the file's base name. Client-only helper — the local API does not provide a file-path overload.

source
DearDiary.update_resourceFunction
update_resource(id::Integer, name::Optional{AbstractString}, description::Optional{AbstractString}, data::Optional{AbstractArray{UInt8,1}})::Type{<:UpsertResult}

Update a Resource record.

Arguments

  • id::Integer: The id of the resource to update.
  • name::Optional{AbstractString}: The new name for the resource.
  • description::Optional{AbstractString}: The new description for the resource.
  • data::Optional{AbstractArray{UInt8,1}}: The new binary data for the resource.

Returns

An UpsertResult. Updated if the record was successfully updated (or no changes were made), Duplicate if the record already exists, Unprocessable if the record violates a constraint, and Error if an error occurred while creating the record.

source
update_resource(client::Client, id::Integer; name=nothing, description=nothing, data=nothing)::Nothing

Patch a Resource via PATCH /resource/{id} as multipart/form-data. Any keyword left as nothing is omitted from the multipart body, so partial updates work.

source
DearDiary.delete_resourceFunction
delete_resource(id::Integer)::Bool

Delete a Resource record. For non-SQLite backends the underlying artifact bytes are removed from the store first; SQLite-backed rows take their bytes down with the row.

Arguments

  • id::Integer: The id of the resource to delete.

Returns

true if the record was successfully deleted, false otherwise.

source
delete_resource(client::Client, id::Integer)::Nothing

Delete a Resource via DELETE /resource/{id}. Requires DeletePermission on the experiment's project.

source
DearDiary.read_resource_dataFunction
read_resource_data(id::Integer)::Optional{Vector{UInt8}}

Return the raw bytes of the Resource identified by id, fetching them from the configured backend. For SQLite-backed rows this is just resource.data; for external backends it dereferences resource.uri through the trait. Returns nothing when the row does not exist.

source
read_resource_data(client::Client, id::Integer)::Optional{Vector{UInt8}}

Download the raw bytes of a Resource via GET /resource/{id}/data. Returns the full body as a Vector{UInt8}, or nothing when the resource does not exist. The endpoint is backend-agnostic: SQLite-backed rows hand back the inline bytes, filesystem-backed rows stream from disk, and S3-backed rows are proxied through the object store.

source