Skip to main content

windmill_api/models/
embed_token_response.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.780.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 EmbedTokenResponse {
16    /// Scoped token for the app. For sandboxed low-code apps this is the embed token handed to the opaque iframe. For a raw app it is the viewer-scoped frontend SDK token, returned only when the app is sandboxed, its policy declares frontend_sdk_scopes, and the request carries sdk_consent=true. Absent for anonymous viewers and whenever no token is needed. 
17    #[serde(rename = "token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
18    pub token: Option<Option<String>>,
19    /// Expiration of the embed token.
20    #[serde(rename = "expiration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub expiration: Option<Option<String>>,
22    /// Raw apps render single-iframe and skip the opaque-viewer indirection and the embed token entirely. A sandboxed one may still carry a token here: the viewer-scoped frontend SDK token, which is a different credential from the low-code embed token. 
23    #[serde(rename = "raw_app")]
24    pub raw_app: bool,
25    /// Publisher opted this app into sandbox isolation. When false the viewer runs the app same-origin with its full session.
26    #[serde(rename = "sandbox")]
27    pub sandbox: bool,
28    /// The resolved app path; the embedder uses it to scope the app's backing localStorage per app.
29    #[serde(rename = "app_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub app_path: Option<Option<String>>,
31    /// The resolved workspace; pairs with app_path so apps at the same path in different workspaces don't share a localStorage store.
32    #[serde(rename = "workspace_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub workspace_id: Option<Option<String>>,
34    /// Sandboxed raw apps: scopes the app policy declares for the frontend SDK token. Null when the app is unsandboxed, however the policy reads. The viewer renders these in the permission prompt; token stays absent until the endpoint is re-called with sdk_consent=true. 
35    #[serde(rename = "sdk_scopes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub sdk_scopes: Option<Option<Vec<String>>>,
37    /// The caller's own email, returned alongside sdk_scopes so the viewer can key its stored \"do not ask again\" per person. 
38    #[serde(rename = "viewer_email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub viewer_email: Option<Option<String>>,
40}
41
42impl EmbedTokenResponse {
43    pub fn new(raw_app: bool, sandbox: bool) -> EmbedTokenResponse {
44        EmbedTokenResponse {
45            token: None,
46            expiration: None,
47            raw_app,
48            sandbox,
49            app_path: None,
50            workspace_id: None,
51            sdk_scopes: None,
52            viewer_email: None,
53        }
54    }
55}
56