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