windmill_api/models/user_draft_overlay.rs
1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.725.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// UserDraftOverlay : Overlay fields added to every \"get by path\" response that accepts the `get_draft` query parameter. The deployed payload is sent untouched in the response body; the authed user's saved draft for this path — whatever shape the editor wrote — is attached as the sibling `draft` field when `get_draft=true` and a draft exists. The frontend pairs the two to present diff / reset / discard UI; the server never merges them. When `no_deployed=true` there is no deployed row at this path — the response body is a best-effort stand-in synthesized from the draft, and only `draft` is canonical. Callers should disable \"diff vs deployed\" UI in that case.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct UserDraftOverlay {
17 #[serde(rename = "is_draft")]
18 pub is_draft: bool,
19 #[serde(rename = "draft_saved_at", skip_serializing_if = "Option::is_none")]
20 pub draft_saved_at: Option<String>,
21 #[serde(rename = "no_deployed", skip_serializing_if = "Option::is_none")]
22 pub no_deployed: Option<bool>,
23 #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
24 pub draft: Option<std::collections::HashMap<String, serde_json::Value>>,
25 /// Other workspace users (and the legacy NULL-email row, if any) with a saved draft at the same path. Populated only on the authed user's \"get by path\" responses for kinds the editor surfaces a fork banner for (script, flow, app, raw_app). Empty / omitted for kinds without that UI.
26 #[serde(rename = "other_drafts_users", skip_serializing_if = "Option::is_none")]
27 pub other_drafts_users: Option<Vec<models::UserDraftOverlayOtherDraftsUsersInner>>,
28}
29
30impl UserDraftOverlay {
31 /// Overlay fields added to every \"get by path\" response that accepts the `get_draft` query parameter. The deployed payload is sent untouched in the response body; the authed user's saved draft for this path — whatever shape the editor wrote — is attached as the sibling `draft` field when `get_draft=true` and a draft exists. The frontend pairs the two to present diff / reset / discard UI; the server never merges them. When `no_deployed=true` there is no deployed row at this path — the response body is a best-effort stand-in synthesized from the draft, and only `draft` is canonical. Callers should disable \"diff vs deployed\" UI in that case.
32 pub fn new(is_draft: bool) -> UserDraftOverlay {
33 UserDraftOverlay {
34 is_draft,
35 draft_saved_at: None,
36 no_deployed: None,
37 draft: None,
38 other_drafts_users: None,
39 }
40 }
41}
42