ory_client/models/
identity.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.4
7 * Contact: support@ory.sh
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Identity : An [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Identity {
17    /// CreatedAt is a helper struct field for gobuffalo.pop.
18    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
19    pub created_at: Option<String>,
20    /// Credentials represents all credentials that can be used for authenticating this identity.
21    #[serde(rename = "credentials", skip_serializing_if = "Option::is_none")]
22    pub credentials: Option<std::collections::HashMap<String, models::IdentityCredentials>>,
23    /// ExternalID is an optional external ID of the identity. This is used to link the identity to an external system. If set, the external ID must be unique across all identities.
24    #[serde(rename = "external_id", skip_serializing_if = "Option::is_none")]
25    pub external_id: Option<String>,
26    /// ID is the identity's unique identifier.  The Identity ID can not be changed and can not be chosen. This ensures future compatibility and optimization for distributed stores such as CockroachDB.
27    #[serde(rename = "id")]
28    pub id: String,
29    /// NullJSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger and is NULLable-
30    #[serde(rename = "metadata_admin", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub metadata_admin: Option<Option<serde_json::Value>>,
32    /// NullJSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger and is NULLable-
33    #[serde(rename = "metadata_public", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub metadata_public: Option<Option<serde_json::Value>>,
35    #[serde(rename = "organization_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub organization_id: Option<Option<String>>,
37    /// RecoveryAddresses contains all the addresses that can be used to recover an identity.
38    #[serde(rename = "recovery_addresses", skip_serializing_if = "Option::is_none")]
39    pub recovery_addresses: Option<Vec<models::RecoveryIdentityAddress>>,
40    /// SchemaID is the ID of the JSON Schema to be used for validating the identity's traits.
41    #[serde(rename = "schema_id")]
42    pub schema_id: String,
43    /// SchemaURL is the URL of the endpoint where the identity's traits schema can be fetched from.  format: url
44    #[serde(rename = "schema_url")]
45    pub schema_url: String,
46    /// State is the identity's state.  This value has currently no effect. active StateActive inactive StateInactive
47    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
48    pub state: Option<StateEnum>,
49    #[serde(rename = "state_changed_at", skip_serializing_if = "Option::is_none")]
50    pub state_changed_at: Option<String>,
51    /// Traits represent an identity's traits. The identity is able to create, modify, and delete traits in a self-service manner. The input will always be validated against the JSON Schema defined in `schema_url`.
52    #[serde(rename = "traits", deserialize_with = "Option::deserialize")]
53    pub traits: Option<serde_json::Value>,
54    /// UpdatedAt is a helper struct field for gobuffalo.pop.
55    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
56    pub updated_at: Option<String>,
57    /// VerifiableAddresses contains all the addresses that can be verified by the user.
58    #[serde(rename = "verifiable_addresses", skip_serializing_if = "Option::is_none")]
59    pub verifiable_addresses: Option<Vec<models::VerifiableIdentityAddress>>,
60}
61
62impl Identity {
63    /// An [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory.
64    pub fn new(id: String, schema_id: String, schema_url: String, traits: Option<serde_json::Value>) -> Identity {
65        Identity {
66            created_at: None,
67            credentials: None,
68            external_id: None,
69            id,
70            metadata_admin: None,
71            metadata_public: None,
72            organization_id: None,
73            recovery_addresses: None,
74            schema_id,
75            schema_url,
76            state: None,
77            state_changed_at: None,
78            traits,
79            updated_at: None,
80            verifiable_addresses: None,
81        }
82    }
83}
84/// State is the identity's state.  This value has currently no effect. active StateActive inactive StateInactive
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum StateEnum {
87    #[serde(rename = "active")]
88    Active,
89    #[serde(rename = "inactive")]
90    Inactive,
91}
92
93impl Default for StateEnum {
94    fn default() -> StateEnum {
95        Self::Active
96    }
97}
98