1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.780.0
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct EmbedTokenResponse {
/// 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.
#[serde(rename = "token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub token: Option<Option<String>>,
/// Expiration of the embed token.
#[serde(rename = "expiration", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub expiration: Option<Option<String>>,
/// 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.
#[serde(rename = "raw_app")]
pub raw_app: bool,
/// Publisher opted this app into sandbox isolation. When false the viewer runs the app same-origin with its full session.
#[serde(rename = "sandbox")]
pub sandbox: bool,
/// The resolved app path; the embedder uses it to scope the app's backing localStorage per app.
#[serde(rename = "app_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub app_path: Option<Option<String>>,
/// The resolved workspace; pairs with app_path so apps at the same path in different workspaces don't share a localStorage store.
#[serde(rename = "workspace_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub workspace_id: Option<Option<String>>,
/// 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.
#[serde(rename = "sdk_scopes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub sdk_scopes: Option<Option<Vec<String>>>,
/// The caller's own email, returned alongside sdk_scopes so the viewer can key its stored \"do not ask again\" per person.
#[serde(rename = "viewer_email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub viewer_email: Option<Option<String>>,
}
impl EmbedTokenResponse {
pub fn new(raw_app: bool, sandbox: bool) -> EmbedTokenResponse {
EmbedTokenResponse {
token: None,
expiration: None,
raw_app,
sandbox,
app_path: None,
workspace_id: None,
sdk_scopes: None,
viewer_email: None,
}
}
}