vapi_client/models/
token.rs

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