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<Tag>,
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<Box<models::TokenRestrictions>>,
40}
41
42impl Token {
43    pub fn new(id: String, org_id: String, created_at: String, updated_at: String, value: String) -> Token {
44        Token {
45            tag: None,
46            id,
47            org_id,
48            created_at,
49            updated_at,
50            value,
51            name: None,
52            restrictions: None,
53        }
54    }
55}
56/// This is the tag for the token. It represents its scope.
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Tag {
59    #[serde(rename = "private")]
60    Private,
61    #[serde(rename = "public")]
62    Public,
63}
64
65impl Default for Tag {
66    fn default() -> Tag {
67        Self::Private
68    }
69}
70