Skip to main content

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.43
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.com/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    /// Region is the Ory Network region this identity is homed in. Set by the multi-region persister; empty on OSS and single-region deployments. eu-central EUCentral asia-northeast AsiaNorthEast us-east USEast us-west USWest eu EU asia Asia us US global Global
41    #[serde(rename = "region", skip_serializing_if = "Option::is_none")]
42    pub region: Option<RegionEnum>,
43    /// SchemaID is the ID of the JSON Schema to be used for validating the identity's traits.
44    #[serde(rename = "schema_id")]
45    pub schema_id: String,
46    /// SchemaURL is the URL of the endpoint where the identity's traits schema can be fetched from.  format: url
47    #[serde(rename = "schema_url")]
48    pub schema_url: String,
49    /// State is the identity's state.  This value has currently no effect. active StateActive inactive StateInactive
50    #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
51    pub state: Option<StateEnum>,
52    #[serde(rename = "state_changed_at", skip_serializing_if = "Option::is_none")]
53    pub state_changed_at: Option<String>,
54    /// 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`.
55    #[serde(rename = "traits", deserialize_with = "Option::deserialize")]
56    pub traits: Option<serde_json::Value>,
57    /// UpdatedAt is a helper struct field for gobuffalo.pop.
58    #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
59    pub updated_at: Option<String>,
60    /// VerifiableAddresses contains all the addresses that can be verified by the user.
61    #[serde(rename = "verifiable_addresses", skip_serializing_if = "Option::is_none")]
62    pub verifiable_addresses: Option<Vec<models::VerifiableIdentityAddress>>,
63}
64
65impl Identity {
66    /// An [identity](https://www.ory.com/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory.
67    pub fn new(id: String, schema_id: String, schema_url: String, traits: Option<serde_json::Value>) -> Identity {
68        Identity {
69            created_at: None,
70            credentials: None,
71            external_id: None,
72            id,
73            metadata_admin: None,
74            metadata_public: None,
75            organization_id: None,
76            recovery_addresses: None,
77            region: None,
78            schema_id,
79            schema_url,
80            state: None,
81            state_changed_at: None,
82            traits,
83            updated_at: None,
84            verifiable_addresses: None,
85        }
86    }
87}
88/// Region is the Ory Network region this identity is homed in. Set by the multi-region persister; empty on OSS and single-region deployments. eu-central EUCentral asia-northeast AsiaNorthEast us-east USEast us-west USWest eu EU asia Asia us US global Global
89#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
90pub enum RegionEnum {
91    #[serde(rename = "eu-central")]
92    EuCentral,
93    #[serde(rename = "asia-northeast")]
94    AsiaNortheast,
95    #[serde(rename = "us-east")]
96    UsEast,
97    #[serde(rename = "us-west")]
98    UsWest,
99    #[serde(rename = "eu")]
100    Eu,
101    #[serde(rename = "asia")]
102    Asia,
103    #[serde(rename = "us")]
104    Us,
105    #[serde(rename = "global")]
106    Global,
107}
108
109impl Default for RegionEnum {
110    fn default() -> RegionEnum {
111        Self::EuCentral
112    }
113}
114/// State is the identity's state.  This value has currently no effect. active StateActive inactive StateInactive
115#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
116pub enum StateEnum {
117    #[serde(rename = "active")]
118    Active,
119    #[serde(rename = "inactive")]
120    Inactive,
121}
122
123impl Default for StateEnum {
124    fn default() -> StateEnum {
125        Self::Active
126    }
127}
128