Project
DearDiary.get_project — Function
get_project(id::Integer)::Optional{Project}Get a Project by id.
Arguments
id::Integer: The id of the project to query.
Returns
A Project object. If the record does not exist, return nothing.
get_project(client::Client, id::Integer)::Optional{Project}Fetch a Project via GET /project/{id} on the API behind client. Returns nothing when the server replies 404 (record missing or viewer lacks ReadPermission) and raises ClientError for other failures.
DearDiary.get_projects — Function
get_projects(user::User)::Array{Project,1}Return the projects visible to user.
Admins see every project. Non-admins see only projects where they have a UserPermission record with ReadPermission granted; projects without a matching permission row are omitted entirely so the dashboard never shows cards the viewer cannot open.
Arguments
user::User: The viewer.
Returns
An array of Project objects scoped to the user's read access.
get_projects(client::Client)::Array{Project,1}List every Project the authenticated viewer can read via GET /project/. Admins receive every project; non-admins receive only those with ReadPermission granted.
DearDiary.create_project — Function
create_project(user_id::Integer, name::AbstractString)::NamedTuple{id::Optional{<:Int64},status::DataType}Create a Project.
Arguments
user_id::Integer: The id of the user creating the project. The user must have admin privileges.name::AbstractString: The name of the project.
Returns
- The created project ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
create_project(name::AbstractString)::NamedTuple{id::Optional{<:Int64},status::DataType}Create a Project. Uses the "default" user to create the project.
Arguments
name::AbstractString: The name of the project.
Returns
- The created project ID. If an error occurs,
nothingis returned. - An
UpsertResult.Createdif the record was successfully created,Duplicateif the record already exists,Unprocessableif the record violates a constraint, andErrorif an error occurred while creating the record.
create_project(client::Client, name::AbstractString)::Int64Create a Project named name via POST /project/. The route requires an admin viewer; non-admin callers receive 403 ADMIN_REQUIRED. Returns the new project id.
DearDiary.update_project — Function
update_project(id::Int, name::Optional{AbstractString}, description::Optional{AbstractString})::Type{<:UpsertResult}Update a Project record.
Arguments
id::Integer: The id of the project to update.name::Optional{AbstractString}: The new name for the project.description::Optional{AbstractString}: The new description for the project.
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.
update_project(client::Client, id::Integer; name=nothing, description=nothing)::NothingPatch a Project via PATCH /project/{id}. Any keyword left as nothing is left untouched server-side. Admin-only. Raises ClientError on failure.
DearDiary.delete_project — Function
delete_project(id::Integer)::BoolDelete a Project record. Also deletes all associated UserPermission and Experiment records.
Arguments
id::Integer: The id of the project to delete.
Returns
true if the record was successfully deleted, false otherwise.
delete_project(client::Client, id::Integer)::NothingDelete a Project (cascading UserPermission and Experiment records) via DELETE /project/{id}. Admin-only. Raises ClientError on failure.