tinkoff_invest_api/
google.api.rs

1/// An indicator of the behavior of a given field (for example, that a field
2/// is required in requests, or given as output but ignored as input).
3/// This **does not** change the behavior in protocol buffers itself; it only
4/// denotes the behavior and may affect how API tooling handles the field.
5///
6/// Note: This enum **may** receive new values in the future.
7#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
8#[repr(i32)]
9pub enum FieldBehavior {
10    /// Conventional default for enums. Do not use this.
11    Unspecified = 0,
12    /// Specifically denotes a field as optional.
13    /// While all fields in protocol buffers are optional, this may be specified
14    /// for emphasis if appropriate.
15    Optional = 1,
16    /// Denotes a field as required.
17    /// This indicates that the field **must** be provided as part of the request,
18    /// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
19    Required = 2,
20    /// Denotes a field as output only.
21    /// This indicates that the field is provided in responses, but including the
22    /// field in a request does nothing (the server *must* ignore it and
23    /// *must not* throw an error as a result of the field's presence).
24    OutputOnly = 3,
25    /// Denotes a field as input only.
26    /// This indicates that the field is provided in requests, and the
27    /// corresponding field is not included in output.
28    InputOnly = 4,
29    /// Denotes a field as immutable.
30    /// This indicates that the field may be set once in a request to create a
31    /// resource, but may not be changed thereafter.
32    Immutable = 5,
33    /// Denotes that a (repeated) field is an unordered list.
34    /// This indicates that the service may provide the elements of the list
35    /// in any arbitrary  order, rather than the order the user originally
36    /// provided. Additionally, the list's order may or may not be stable.
37    UnorderedList = 6,
38    /// Denotes that this field returns a non-empty default value if not set.
39    /// This indicates that if the user provides the empty value in a request,
40    /// a non-empty value will be returned. The user will not be aware of what
41    /// non-empty value to expect.
42    NonEmptyDefault = 7,
43}
44impl FieldBehavior {
45    /// String value of the enum field names used in the ProtoBuf definition.
46    ///
47    /// The values are not transformed in any way and thus are considered stable
48    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
49    pub fn as_str_name(&self) -> &'static str {
50        match self {
51            FieldBehavior::Unspecified => "FIELD_BEHAVIOR_UNSPECIFIED",
52            FieldBehavior::Optional => "OPTIONAL",
53            FieldBehavior::Required => "REQUIRED",
54            FieldBehavior::OutputOnly => "OUTPUT_ONLY",
55            FieldBehavior::InputOnly => "INPUT_ONLY",
56            FieldBehavior::Immutable => "IMMUTABLE",
57            FieldBehavior::UnorderedList => "UNORDERED_LIST",
58            FieldBehavior::NonEmptyDefault => "NON_EMPTY_DEFAULT",
59        }
60    }
61    /// Creates an enum from field names used in the ProtoBuf definition.
62    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
63        match value {
64            "FIELD_BEHAVIOR_UNSPECIFIED" => Some(Self::Unspecified),
65            "OPTIONAL" => Some(Self::Optional),
66            "REQUIRED" => Some(Self::Required),
67            "OUTPUT_ONLY" => Some(Self::OutputOnly),
68            "INPUT_ONLY" => Some(Self::InputOnly),
69            "IMMUTABLE" => Some(Self::Immutable),
70            "UNORDERED_LIST" => Some(Self::UnorderedList),
71            "NON_EMPTY_DEFAULT" => Some(Self::NonEmptyDefault),
72            _ => None,
73        }
74    }
75}