Skip to main content

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.816.0
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    /// The deployed version the draft forked from, as text whatever the kind (script hash, flow version id, app version id). Compare to the deployed head to tell a draft that is behind. Absent when there is no draft or it was never forked from a deploy. 
22    #[serde(rename = "draft_base", skip_serializing_if = "Option::is_none")]
23    pub draft_base: Option<String>,
24    #[serde(rename = "no_deployed", skip_serializing_if = "Option::is_none")]
25    pub no_deployed: Option<bool>,
26    #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
27    pub draft: Option<std::collections::HashMap<String, serde_json::Value>>,
28    /// 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. 
29    #[serde(rename = "other_drafts_users", skip_serializing_if = "Option::is_none")]
30    pub other_drafts_users: Option<Vec<models::UserDraftOverlayOtherDraftsUsersInner>>,
31}
32
33impl UserDraftOverlay {
34    /// 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. 
35    pub fn new(is_draft: bool) -> UserDraftOverlay {
36        UserDraftOverlay {
37            is_draft,
38            draft_saved_at: None,
39            draft_base: None,
40            no_deployed: None,
41            draft: None,
42            other_drafts_users: None,
43        }
44    }
45}
46