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.733.1
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 /// 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.
41 #[serde(rename = "draft_users", skip_serializing_if = "Option::is_none")]
42 pub draft_users: Option<Vec<models::ListScripts200ResponseInnerAllOfDraftUsersInner>>,
43}
44
45impl ListDrafts200ResponseInner {
46 pub fn new(kind: models::UserDraftItemKind, path: String, draft_only: bool, legacy_draft: bool, created_at: String, can_write: bool, mine: bool) -> ListDrafts200ResponseInner {
47 ListDrafts200ResponseInner {
48 kind,
49 path,
50 summary: None,
51 draft_path: None,
52 draft_only,
53 legacy_draft,
54 created_at,
55 can_write,
56 mine,
57 draft_users: None,
58 }
59 }
60}
61