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.17.2
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 /// 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.
24 #[serde(rename = "id")]
25 pub id: String,
26 /// NullJSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger and is NULLable-
27 #[serde(rename = "metadata_admin", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28 pub metadata_admin: Option<Option<serde_json::Value>>,
29 /// NullJSONRawMessage represents a json.RawMessage that works well with JSON, SQL, and Swagger and is NULLable-
30 #[serde(rename = "metadata_public", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31 pub metadata_public: Option<Option<serde_json::Value>>,
32 #[serde(rename = "organization_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33 pub organization_id: Option<Option<String>>,
34 /// RecoveryAddresses contains all the addresses that can be used to recover an identity.
35 #[serde(rename = "recovery_addresses", skip_serializing_if = "Option::is_none")]
36 pub recovery_addresses: Option<Vec<models::RecoveryIdentityAddress>>,
37 /// SchemaID is the ID of the JSON Schema to be used for validating the identity's traits.
38 #[serde(rename = "schema_id")]
39 pub schema_id: String,
40 /// SchemaURL is the URL of the endpoint where the identity's traits schema can be fetched from. format: url
41 #[serde(rename = "schema_url")]
42 pub schema_url: String,
43 /// State is the identity's state. This value has currently no effect. active StateActive inactive StateInactive
44 #[serde(rename = "state", skip_serializing_if = "Option::is_none")]
45 pub state: Option<StateEnum>,
46 #[serde(rename = "state_changed_at", skip_serializing_if = "Option::is_none")]
47 pub state_changed_at: Option<String>,
48 /// 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`.
49 #[serde(rename = "traits", deserialize_with = "Option::deserialize")]
50 pub traits: Option<serde_json::Value>,
51 /// UpdatedAt is a helper struct field for gobuffalo.pop.
52 #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")]
53 pub updated_at: Option<String>,
54 /// VerifiableAddresses contains all the addresses that can be verified by the user.
55 #[serde(rename = "verifiable_addresses", skip_serializing_if = "Option::is_none")]
56 pub verifiable_addresses: Option<Vec<models::VerifiableIdentityAddress>>,
57}
58
59impl Identity {
60 /// An [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory.
61 pub fn new(id: String, schema_id: String, schema_url: String, traits: Option<serde_json::Value>) -> Identity {
62 Identity {
63 created_at: None,
64 credentials: None,
65 id,
66 metadata_admin: None,
67 metadata_public: None,
68 organization_id: None,
69 recovery_addresses: None,
70 schema_id,
71 schema_url,
72 state: None,
73 state_changed_at: None,
74 traits,
75 updated_at: None,
76 verifiable_addresses: None,
77 }
78 }
79}
80/// State is the identity's state. This value has currently no effect. active StateActive inactive StateInactive
81#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
82pub enum StateEnum {
83 #[serde(rename = "active")]
84 Active,
85 #[serde(rename = "inactive")]
86 Inactive,
87}
88
89impl Default for StateEnum {
90 fn default() -> StateEnum {
91 Self::Active
92 }
93}
94