Client
Connection lifecycle
DearDiary.connect — Function
connect(base_url; username, password, token)::ClientBuild a Client pointed at base_url.
Pass username and password to sign in via POST /auth and store the issued token. Pass token instead to attach an already-issued bearer token. Pass neither when the server runs with auth disabled — the client will work without an Authorization header.
Arguments
base_url::AbstractString: Base URL of the server (with or without trailing slash).username::Optional{AbstractString}: Username for sign-in.password::Optional{AbstractString}: Password for sign-in.token::Optional{AbstractString}: Pre-issued bearer token.
Returns
A Client ready to issue authenticated requests.
DearDiary.disconnect — Function
disconnect(client::Client)::NothingClear the local token. The server is stateless so this is purely a client-side reset; any copies of the token issued earlier remain valid until they expire.
DearDiary.refresh_token! — Function
refresh_token!(client::Client)::ClientCall POST /auth/refresh and replace the client's token with the freshly-minted one.
DearDiary.whoami — Function
whoami(client::Client)::UserResponseResolve the user behind the current token via GET /auth/me. Also refreshes the cached client.user.