vapi_client/models/
token.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Token {
16    /// This is the tag for the token. It represents its scope.
17    #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
18    pub tag: Option<TagTrue>,
19    /// This is the unique identifier for the token.
20    #[serde(rename = "id")]
21    pub id: String,
22    /// This is unique identifier for the org that this token belongs to.
23    #[serde(rename = "orgId")]
24    pub org_id: String,
25    /// This is the ISO 8601 date-time string of when the token was created.
26    #[serde(rename = "createdAt")]
27    pub created_at: String,
28    /// This is the ISO 8601 date-time string of when the token was last updated.
29    #[serde(rename = "updatedAt")]
30    pub updated_at: String,
31    /// This is the token key.
32    #[serde(rename = "value")]
33    pub value: String,
34    /// This is the name of the token. This is just for your own reference.
35    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
36    pub name: Option<String>,
37    /// This are the restrictions for the token.
38    #[serde(rename = "restrictions", skip_serializing_if = "Option::is_none")]
39    pub restrictions: Option<models::TokenRestrictions>,
40}
41
42impl Token {
43    pub fn new(
44        id: String,
45        org_id: String,
46        created_at: String,
47        updated_at: String,
48        value: String,
49    ) -> Token {
50        Token {
51            tag: None,
52            id,
53            org_id,
54            created_at,
55            updated_at,
56            value,
57            name: None,
58            restrictions: None,
59        }
60    }
61}
62/// This is the tag for the token. It represents its scope.
63#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
64pub enum TagTrue {
65    #[serde(rename = "private")]
66    Private,
67    #[serde(rename = "public")]
68    Public,
69}
70
71impl Default for TagTrue {
72    fn default() -> TagTrue {
73        Self::Private
74    }
75}