Skip to main content

windmill_api/models/
list_drafts_200_response_inner.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.762.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ListDrafts200ResponseInner {
16    #[serde(rename = "kind")]
17    pub kind: models::UserDraftItemKind,
18    #[serde(rename = "path")]
19    pub path: String,
20    /// Best-effort, read from the draft JSON's `summary` field when the editor shape carries one.
21    #[serde(rename = "summary", skip_serializing_if = "Option::is_none")]
22    pub summary: Option<String>,
23    /// User-typed friendly path from the draft JSON's `draft_path`, when set and different from the storage path (e.g. a never-deployed item parked at `u/{user}/draft_{uuid}`).
24    #[serde(rename = "draft_path", skip_serializing_if = "Option::is_none")]
25    pub draft_path: Option<String>,
26    /// No deployed counterpart exists at this path — the draft is the whole item.
27    #[serde(rename = "draft_only")]
28    pub draft_only: bool,
29    /// The listed draft is a legacy workspace-level row (email NULL) predating the per-user drafts migration. Only true when no per-user draft exists at this path.
30    #[serde(rename = "legacy_draft")]
31    pub legacy_draft: bool,
32    #[serde(rename = "created_at")]
33    pub created_at: String,
34    /// Whether the current user may deploy/discard this draft (same check the deploy/discard endpoints enforce).
35    #[serde(rename = "can_write")]
36    pub can_write: bool,
37    /// The row belongs to the current user (own draft or the legacy no-owner row) and is therefore actionable. Always true in the default listing; with `all_users=true`, other users' rows are false (view-only).
38    #[serde(rename = "mine")]
39    pub mine: bool,
40    /// Only present when `compare_to_workspace` was passed. True when this draft is identical to the parent's draft at the same path/kind/owner (cloned in on fork and never edited here).
41    #[serde(rename = "unchanged_from_parent", skip_serializing_if = "Option::is_none")]
42    pub unchanged_from_parent: Option<bool>,
43    /// Draft authors at this (path, kind) — the legacy NULL-email row surfaced as a null username. Populated only for the shared full-page-editor kinds (script/flow/app/raw_app); omitted for drawer kinds, which keep their drafts private. Feeds the Draft badge's owner-avatar circles. 
44    #[serde(rename = "draft_users", skip_serializing_if = "Option::is_none")]
45    pub draft_users: Option<Vec<models::ListScripts200ResponseInnerAllOfDraftUsersInner>>,
46}
47
48impl ListDrafts200ResponseInner {
49    pub fn new(kind: models::UserDraftItemKind, path: String, draft_only: bool, legacy_draft: bool, created_at: String, can_write: bool, mine: bool) -> ListDrafts200ResponseInner {
50        ListDrafts200ResponseInner {
51            kind,
52            path,
53            summary: None,
54            draft_path: None,
55            draft_only,
56            legacy_draft,
57            created_at,
58            can_write,
59            mine,
60            unchanged_from_parent: None,
61            draft_users: None,
62        }
63    }
64}
65