ory_kratos_client/models/ui_node_input_attributes.rs
1/*
2 * Ory Identities API
3 *
4 * This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more.
5 *
6 * The version of the OpenAPI document: v26.2.0
7 * Contact: office@ory.sh
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// UiNodeInputAttributes : InputAttributes represents the attributes of an input node
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct UiNodeInputAttributes {
17 /// The autocomplete attribute for the input. email InputAttributeAutocompleteEmail tel InputAttributeAutocompleteTel url InputAttributeAutocompleteUrl current-password InputAttributeAutocompleteCurrentPassword new-password InputAttributeAutocompleteNewPassword one-time-code InputAttributeAutocompleteOneTimeCode username webauthn InputAttributeAutocompleteUsernameWebauthn
18 #[serde(rename = "autocomplete", skip_serializing_if = "Option::is_none")]
19 pub autocomplete: Option<AutocompleteEnum>,
20 /// Sets the input's disabled field to true or false.
21 #[serde(rename = "disabled")]
22 pub disabled: bool,
23 #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
24 pub label: Option<Box<models::UiText>>,
25 /// MaxLength may contain the input's maximum length.
26 #[serde(rename = "maxlength", skip_serializing_if = "Option::is_none")]
27 pub maxlength: Option<i64>,
28 /// The input's element name.
29 #[serde(rename = "name")]
30 pub name: String,
31 /// NodeType represents this node's types. It is a mirror of `node.type` and is primarily used to allow compatibility with OpenAPI 3.0. In this struct it technically always is \"input\". text Text input Input img Image a Anchor script Script div Division
32 #[serde(rename = "node_type")]
33 pub node_type: NodeTypeEnum,
34 /// OnClick may contain javascript which should be executed on click. This is primarily used for WebAuthn. Deprecated: Using OnClick requires the use of eval() which is a security risk. Use OnClickTrigger instead.
35 #[serde(rename = "onclick", skip_serializing_if = "Option::is_none")]
36 pub onclick: Option<String>,
37 /// OnClickTrigger may contain a WebAuthn trigger which should be executed on click. The trigger maps to a JavaScript function provided by Ory, which triggers actions such as PassKey registration or login. oryWebAuthnRegistration WebAuthnTriggersWebAuthnRegistration oryWebAuthnLogin WebAuthnTriggersWebAuthnLogin oryPasskeyLogin WebAuthnTriggersPasskeyLogin oryPasskeyLoginAutocompleteInit WebAuthnTriggersPasskeyLoginAutocompleteInit oryPasskeyRegistration WebAuthnTriggersPasskeyRegistration oryPasskeySettingsRegistration WebAuthnTriggersPasskeySettingsRegistration
38 #[serde(rename = "onclickTrigger", skip_serializing_if = "Option::is_none")]
39 pub onclick_trigger: Option<OnclickTriggerEnum>,
40 /// OnLoad may contain javascript which should be executed on load. This is primarily used for WebAuthn. Deprecated: Using OnLoad requires the use of eval() which is a security risk. Use OnLoadTrigger instead.
41 #[serde(rename = "onload", skip_serializing_if = "Option::is_none")]
42 pub onload: Option<String>,
43 /// OnLoadTrigger may contain a WebAuthn trigger which should be executed on load. The trigger maps to a JavaScript function provided by Ory, which triggers actions such as PassKey registration or login. oryWebAuthnRegistration WebAuthnTriggersWebAuthnRegistration oryWebAuthnLogin WebAuthnTriggersWebAuthnLogin oryPasskeyLogin WebAuthnTriggersPasskeyLogin oryPasskeyLoginAutocompleteInit WebAuthnTriggersPasskeyLoginAutocompleteInit oryPasskeyRegistration WebAuthnTriggersPasskeyRegistration oryPasskeySettingsRegistration WebAuthnTriggersPasskeySettingsRegistration
44 #[serde(rename = "onloadTrigger", skip_serializing_if = "Option::is_none")]
45 pub onload_trigger: Option<OnloadTriggerEnum>,
46 /// The input's pattern.
47 #[serde(rename = "pattern", skip_serializing_if = "Option::is_none")]
48 pub pattern: Option<String>,
49 /// Mark this input field as required.
50 #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
51 pub required: Option<bool>,
52 /// The input's element type. text InputAttributeTypeText password InputAttributeTypePassword number InputAttributeTypeNumber checkbox InputAttributeTypeCheckbox hidden InputAttributeTypeHidden email InputAttributeTypeEmail tel InputAttributeTypeTel submit InputAttributeTypeSubmit button InputAttributeTypeButton datetime-local InputAttributeTypeDateTimeLocal date InputAttributeTypeDate url InputAttributeTypeURI
53 #[serde(rename = "type")]
54 pub r#type: TypeEnum,
55 /// The input's value.
56 #[serde(rename = "value", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
57 pub value: Option<Option<serde_json::Value>>,
58}
59
60impl UiNodeInputAttributes {
61 /// InputAttributes represents the attributes of an input node
62 pub fn new(disabled: bool, name: String, node_type: NodeTypeEnum, r#type: TypeEnum) -> UiNodeInputAttributes {
63 UiNodeInputAttributes {
64 autocomplete: None,
65 disabled,
66 label: None,
67 maxlength: None,
68 name,
69 node_type,
70 onclick: None,
71 onclick_trigger: None,
72 onload: None,
73 onload_trigger: None,
74 pattern: None,
75 required: None,
76 r#type,
77 value: None,
78 }
79 }
80}
81/// The autocomplete attribute for the input. email InputAttributeAutocompleteEmail tel InputAttributeAutocompleteTel url InputAttributeAutocompleteUrl current-password InputAttributeAutocompleteCurrentPassword new-password InputAttributeAutocompleteNewPassword one-time-code InputAttributeAutocompleteOneTimeCode username webauthn InputAttributeAutocompleteUsernameWebauthn
82#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
83pub enum AutocompleteEnum {
84 #[serde(rename = "email")]
85 Email,
86 #[serde(rename = "tel")]
87 Tel,
88 #[serde(rename = "url")]
89 Url,
90 #[serde(rename = "current-password")]
91 CurrentPassword,
92 #[serde(rename = "new-password")]
93 NewPassword,
94 #[serde(rename = "one-time-code")]
95 OneTimeCode,
96 #[serde(rename = "username webauthn")]
97 UsernameWebauthn,
98}
99
100impl Default for AutocompleteEnum {
101 fn default() -> AutocompleteEnum {
102 Self::Email
103 }
104}
105/// NodeType represents this node's types. It is a mirror of `node.type` and is primarily used to allow compatibility with OpenAPI 3.0. In this struct it technically always is \"input\". text Text input Input img Image a Anchor script Script div Division
106#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
107pub enum NodeTypeEnum {
108 #[serde(rename = "input")]
109 Input,
110}
111
112impl Default for NodeTypeEnum {
113 fn default() -> NodeTypeEnum {
114 Self::Input
115 }
116}
117/// OnClickTrigger may contain a WebAuthn trigger which should be executed on click. The trigger maps to a JavaScript function provided by Ory, which triggers actions such as PassKey registration or login. oryWebAuthnRegistration WebAuthnTriggersWebAuthnRegistration oryWebAuthnLogin WebAuthnTriggersWebAuthnLogin oryPasskeyLogin WebAuthnTriggersPasskeyLogin oryPasskeyLoginAutocompleteInit WebAuthnTriggersPasskeyLoginAutocompleteInit oryPasskeyRegistration WebAuthnTriggersPasskeyRegistration oryPasskeySettingsRegistration WebAuthnTriggersPasskeySettingsRegistration
118#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
119pub enum OnclickTriggerEnum {
120 #[serde(rename = "oryWebAuthnRegistration")]
121 OryWebAuthnRegistration,
122 #[serde(rename = "oryWebAuthnLogin")]
123 OryWebAuthnLogin,
124 #[serde(rename = "oryPasskeyLogin")]
125 OryPasskeyLogin,
126 #[serde(rename = "oryPasskeyLoginAutocompleteInit")]
127 OryPasskeyLoginAutocompleteInit,
128 #[serde(rename = "oryPasskeyRegistration")]
129 OryPasskeyRegistration,
130 #[serde(rename = "oryPasskeySettingsRegistration")]
131 OryPasskeySettingsRegistration,
132}
133
134impl Default for OnclickTriggerEnum {
135 fn default() -> OnclickTriggerEnum {
136 Self::OryWebAuthnRegistration
137 }
138}
139/// OnLoadTrigger may contain a WebAuthn trigger which should be executed on load. The trigger maps to a JavaScript function provided by Ory, which triggers actions such as PassKey registration or login. oryWebAuthnRegistration WebAuthnTriggersWebAuthnRegistration oryWebAuthnLogin WebAuthnTriggersWebAuthnLogin oryPasskeyLogin WebAuthnTriggersPasskeyLogin oryPasskeyLoginAutocompleteInit WebAuthnTriggersPasskeyLoginAutocompleteInit oryPasskeyRegistration WebAuthnTriggersPasskeyRegistration oryPasskeySettingsRegistration WebAuthnTriggersPasskeySettingsRegistration
140#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
141pub enum OnloadTriggerEnum {
142 #[serde(rename = "oryWebAuthnRegistration")]
143 OryWebAuthnRegistration,
144 #[serde(rename = "oryWebAuthnLogin")]
145 OryWebAuthnLogin,
146 #[serde(rename = "oryPasskeyLogin")]
147 OryPasskeyLogin,
148 #[serde(rename = "oryPasskeyLoginAutocompleteInit")]
149 OryPasskeyLoginAutocompleteInit,
150 #[serde(rename = "oryPasskeyRegistration")]
151 OryPasskeyRegistration,
152 #[serde(rename = "oryPasskeySettingsRegistration")]
153 OryPasskeySettingsRegistration,
154}
155
156impl Default for OnloadTriggerEnum {
157 fn default() -> OnloadTriggerEnum {
158 Self::OryWebAuthnRegistration
159 }
160}
161/// The input's element type. text InputAttributeTypeText password InputAttributeTypePassword number InputAttributeTypeNumber checkbox InputAttributeTypeCheckbox hidden InputAttributeTypeHidden email InputAttributeTypeEmail tel InputAttributeTypeTel submit InputAttributeTypeSubmit button InputAttributeTypeButton datetime-local InputAttributeTypeDateTimeLocal date InputAttributeTypeDate url InputAttributeTypeURI
162#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
163pub enum TypeEnum {
164 #[serde(rename = "text")]
165 Text,
166 #[serde(rename = "password")]
167 Password,
168 #[serde(rename = "number")]
169 Number,
170 #[serde(rename = "checkbox")]
171 Checkbox,
172 #[serde(rename = "hidden")]
173 Hidden,
174 #[serde(rename = "email")]
175 Email,
176 #[serde(rename = "tel")]
177 Tel,
178 #[serde(rename = "submit")]
179 Submit,
180 #[serde(rename = "button")]
181 Button,
182 #[serde(rename = "datetime-local")]
183 DatetimeLocal,
184 #[serde(rename = "date")]
185 Date,
186 #[serde(rename = "url")]
187 Url,
188}
189
190impl Default for TypeEnum {
191 fn default() -> TypeEnum {
192 Self::Text
193 }
194}
195