Skip to main content

build_edit_request_from_json

Function build_edit_request_from_json 

Source
fn build_edit_request_from_json(
    existing: SendView,
    req: SendView,
    overrides: EditOverrides,
) -> Result<SendEditRequest>
Expand description

Build an edit request by merging a full-object [SendView] (req) over the existing server row, replicating the legacy CLI’s precedence.

Unlike the flag-only build_edit_request, the JSON object is a full replace, not a sparse patch: every JSON-owned field (name, notes, disabled, hideEmail, expirationDate, text/file, …) unconditionally overwrites the existing value, so a field absent from the JSON is cleared — matching legacy’s documented “fetch the full object, edit it, resubmit the whole thing” workflow.

Precedence exceptions: --deleteInDays, --maxAccessCount, --password, and --emails CLI flags win over the JSON field when explicitly provided (flag > JSON > existing), and auth falls back to AuthEdit::Preserve when neither a flag nor the JSON supplies one — so a resubmit never silently strips a previously configured password/email gate.