Skip to main content

ory_client/models/
ui_node_input_attributes.rs

1/*
2 * Ory APIs
3 *
4 * # Introduction Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.  ## SDKs This document describes the APIs available in the Ory Network. The APIs are available as SDKs for the following languages:  | Language       | Download SDK                                                     | Documentation                                                                        | | -------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | Dart           | [pub.dev](https://pub.dev/packages/ory_client)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/dart/README.md)       | | .NET           | [nuget.org](https://www.nuget.org/packages/Ory.Client/)          | [README](https://github.com/ory/sdk/blob/master/clients/client/dotnet/README.md)     | | Elixir         | [hex.pm](https://hex.pm/packages/ory_client)                     | [README](https://github.com/ory/sdk/blob/master/clients/client/elixir/README.md)     | | Go             | [github.com](https://github.com/ory/client-go)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/go/README.md)         | | Java           | [maven.org](https://search.maven.org/artifact/sh.ory/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/java/README.md)       | | JavaScript     | [npmjs.com](https://www.npmjs.com/package/@ory/client)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript/README.md) | | JavaScript (With fetch) | [npmjs.com](https://www.npmjs.com/package/@ory/client-fetch)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript-fetch/README.md) |  | PHP            | [packagist.org](https://packagist.org/packages/ory/client)       | [README](https://github.com/ory/sdk/blob/master/clients/client/php/README.md)        | | Python         | [pypi.org](https://pypi.org/project/ory-client/)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/python/README.md)     | | Ruby           | [rubygems.org](https://rubygems.org/gems/ory-client)             | [README](https://github.com/ory/sdk/blob/master/clients/client/ruby/README.md)       | | Rust           | [crates.io](https://crates.io/crates/ory-client)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/rust/README.md)       | 
5 *
6 * The version of the OpenAPI document: v1.22.96
7 * Contact: support@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 InputAttributeAutocompleteUsername 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    /// The inputmode attribute for the input, which hints at the virtual keyboard to show. numeric InputAttributeInputModeNumeric text InputAttributeInputModeText
24    #[serde(rename = "inputmode", skip_serializing_if = "Option::is_none")]
25    pub inputmode: Option<InputmodeEnum>,
26    #[serde(rename = "label", skip_serializing_if = "Option::is_none")]
27    pub label: Option<Box<models::UiText>>,
28    /// MaxLength may contain the input's maximum length.
29    #[serde(rename = "maxlength", skip_serializing_if = "Option::is_none")]
30    pub maxlength: Option<i64>,
31    /// The input's element name.
32    #[serde(rename = "name")]
33    pub name: String,
34    /// 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
35    #[serde(rename = "node_type")]
36    pub node_type: NodeTypeEnum,
37    /// 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.
38    #[serde(rename = "onclick", skip_serializing_if = "Option::is_none")]
39    pub onclick: Option<String>,
40    /// 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
41    #[serde(rename = "onclickTrigger", skip_serializing_if = "Option::is_none")]
42    pub onclick_trigger: Option<OnclickTriggerEnum>,
43    /// 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.
44    #[serde(rename = "onload", skip_serializing_if = "Option::is_none")]
45    pub onload: Option<String>,
46    /// 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
47    #[serde(rename = "onloadTrigger", skip_serializing_if = "Option::is_none")]
48    pub onload_trigger: Option<OnloadTriggerEnum>,
49    /// The allowed values for the input when the underlying JSON schema defines an `enum`. When present, clients should render the field as a select/dropdown rather than a free-form text input. When absent, clients continue to render a plain text input, so this field is backward compatible with UIs that do not look at it.
50    #[serde(rename = "options", skip_serializing_if = "Option::is_none")]
51    pub options: Option<Vec<models::UiNodeInputAttributesOption>>,
52    /// The input's pattern.
53    #[serde(rename = "pattern", skip_serializing_if = "Option::is_none")]
54    pub pattern: Option<String>,
55    /// Mark this input field as required.
56    #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
57    pub required: Option<bool>,
58    /// 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
59    #[serde(rename = "type")]
60    pub r#type: TypeEnum,
61    /// The input's value.
62    #[serde(rename = "value", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
63    pub value: Option<Option<serde_json::Value>>,
64}
65
66impl UiNodeInputAttributes {
67    /// InputAttributes represents the attributes of an input node
68    pub fn new(disabled: bool, name: String, node_type: NodeTypeEnum, r#type: TypeEnum) -> UiNodeInputAttributes {
69        UiNodeInputAttributes {
70            autocomplete: None,
71            disabled,
72            inputmode: None,
73            label: None,
74            maxlength: None,
75            name,
76            node_type,
77            onclick: None,
78            onclick_trigger: None,
79            onload: None,
80            onload_trigger: None,
81            options: None,
82            pattern: None,
83            required: None,
84            r#type,
85            value: None,
86        }
87    }
88}
89/// The autocomplete attribute for the input. email InputAttributeAutocompleteEmail tel InputAttributeAutocompleteTel url InputAttributeAutocompleteUrl current-password InputAttributeAutocompleteCurrentPassword new-password InputAttributeAutocompleteNewPassword one-time-code InputAttributeAutocompleteOneTimeCode username InputAttributeAutocompleteUsername username webauthn InputAttributeAutocompleteUsernameWebauthn
90#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
91pub enum AutocompleteEnum {
92    #[serde(rename = "email")]
93    Email,
94    #[serde(rename = "tel")]
95    Tel,
96    #[serde(rename = "url")]
97    Url,
98    #[serde(rename = "current-password")]
99    CurrentPassword,
100    #[serde(rename = "new-password")]
101    NewPassword,
102    #[serde(rename = "one-time-code")]
103    OneTimeCode,
104    #[serde(rename = "username")]
105    Username,
106    #[serde(rename = "username webauthn")]
107    UsernameWebauthn,
108}
109
110impl Default for AutocompleteEnum {
111    fn default() -> AutocompleteEnum {
112        Self::Email
113    }
114}
115/// The inputmode attribute for the input, which hints at the virtual keyboard to show. numeric InputAttributeInputModeNumeric text InputAttributeInputModeText
116#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
117pub enum InputmodeEnum {
118    #[serde(rename = "numeric")]
119    Numeric,
120    #[serde(rename = "text")]
121    Text,
122}
123
124impl Default for InputmodeEnum {
125    fn default() -> InputmodeEnum {
126        Self::Numeric
127    }
128}
129/// 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
130#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
131pub enum NodeTypeEnum {
132    #[serde(rename = "input")]
133    Input,
134}
135
136impl Default for NodeTypeEnum {
137    fn default() -> NodeTypeEnum {
138        Self::Input
139    }
140}
141/// 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
142#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
143pub enum OnclickTriggerEnum {
144    #[serde(rename = "oryWebAuthnRegistration")]
145    OryWebAuthnRegistration,
146    #[serde(rename = "oryWebAuthnLogin")]
147    OryWebAuthnLogin,
148    #[serde(rename = "oryPasskeyLogin")]
149    OryPasskeyLogin,
150    #[serde(rename = "oryPasskeyLoginAutocompleteInit")]
151    OryPasskeyLoginAutocompleteInit,
152    #[serde(rename = "oryPasskeyRegistration")]
153    OryPasskeyRegistration,
154    #[serde(rename = "oryPasskeySettingsRegistration")]
155    OryPasskeySettingsRegistration,
156}
157
158impl Default for OnclickTriggerEnum {
159    fn default() -> OnclickTriggerEnum {
160        Self::OryWebAuthnRegistration
161    }
162}
163/// 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
164#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
165pub enum OnloadTriggerEnum {
166    #[serde(rename = "oryWebAuthnRegistration")]
167    OryWebAuthnRegistration,
168    #[serde(rename = "oryWebAuthnLogin")]
169    OryWebAuthnLogin,
170    #[serde(rename = "oryPasskeyLogin")]
171    OryPasskeyLogin,
172    #[serde(rename = "oryPasskeyLoginAutocompleteInit")]
173    OryPasskeyLoginAutocompleteInit,
174    #[serde(rename = "oryPasskeyRegistration")]
175    OryPasskeyRegistration,
176    #[serde(rename = "oryPasskeySettingsRegistration")]
177    OryPasskeySettingsRegistration,
178}
179
180impl Default for OnloadTriggerEnum {
181    fn default() -> OnloadTriggerEnum {
182        Self::OryWebAuthnRegistration
183    }
184}
185/// 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
186#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
187pub enum TypeEnum {
188    #[serde(rename = "text")]
189    Text,
190    #[serde(rename = "password")]
191    Password,
192    #[serde(rename = "number")]
193    Number,
194    #[serde(rename = "checkbox")]
195    Checkbox,
196    #[serde(rename = "hidden")]
197    Hidden,
198    #[serde(rename = "email")]
199    Email,
200    #[serde(rename = "tel")]
201    Tel,
202    #[serde(rename = "submit")]
203    Submit,
204    #[serde(rename = "button")]
205    Button,
206    #[serde(rename = "datetime-local")]
207    DatetimeLocal,
208    #[serde(rename = "date")]
209    Date,
210    #[serde(rename = "url")]
211    Url,
212}
213
214impl Default for TypeEnum {
215    fn default() -> TypeEnum {
216        Self::Text
217    }
218}
219