Skip to main content

fireblocks_sdk/models/
session_dto.rs

1// Fireblocks API
2//
3// Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain.  - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com)
4//
5// The version of the OpenAPI document: 1.8.0
6// Contact: developers@fireblocks.com
7// Generated by: https://openapi-generator.tech
8
9use {
10    crate::models,
11    serde::{Deserialize, Serialize},
12};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SessionDto {
16    /// Id of the connection
17    #[serde(rename = "id")]
18    pub id: String,
19    /// Id of the user that created the connection
20    #[serde(rename = "userId")]
21    pub user_id: String,
22    /// Metadata of the connection (provided by the dapp)
23    #[serde(rename = "sessionMetadata")]
24    pub session_metadata: models::SessionMetadata,
25    /// The vault to connect
26    #[serde(rename = "vaultAccountId")]
27    pub vault_account_id: f64,
28    /// The default fee level
29    #[serde(rename = "feeLevel")]
30    pub fee_level: FeeLevel,
31    /// The chains approved for the connection
32    #[serde(rename = "chainIds")]
33    pub chain_ids: Vec<String>,
34    /// The connection's type
35    #[serde(rename = "connectionType")]
36    pub connection_type: ConnectionType,
37    /// The method through which the connection was established
38    #[serde(rename = "connectionMethod")]
39    pub connection_method: ConnectionMethod,
40    /// Timestamp of the session's creation
41    #[serde(rename = "creationDate")]
42    pub creation_date: String,
43}
44
45impl SessionDto {
46    pub fn new(
47        id: String,
48        user_id: String,
49        session_metadata: models::SessionMetadata,
50        vault_account_id: f64,
51        fee_level: FeeLevel,
52        chain_ids: Vec<String>,
53        connection_type: ConnectionType,
54        connection_method: ConnectionMethod,
55        creation_date: String,
56    ) -> SessionDto {
57        SessionDto {
58            id,
59            user_id,
60            session_metadata,
61            vault_account_id,
62            fee_level,
63            chain_ids,
64            connection_type,
65            connection_method,
66            creation_date,
67        }
68    }
69}
70/// The default fee level
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum FeeLevel {
73    #[serde(rename = "MEDIUM")]
74    Medium,
75    #[serde(rename = "HIGH")]
76    High,
77}
78
79impl Default for FeeLevel {
80    fn default() -> FeeLevel {
81        Self::Medium
82    }
83}
84/// The connection's type
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum ConnectionType {
87    #[serde(rename = "WalletConnect")]
88    WalletConnect,
89}
90
91impl Default for ConnectionType {
92    fn default() -> ConnectionType {
93        Self::WalletConnect
94    }
95}
96/// The method through which the connection was established
97#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
98pub enum ConnectionMethod {
99    #[serde(rename = "DESKTOP")]
100    Desktop,
101    #[serde(rename = "MOBILE")]
102    Mobile,
103    #[serde(rename = "API")]
104    Api,
105}
106
107impl Default for ConnectionMethod {
108    fn default() -> ConnectionMethod {
109        Self::Desktop
110    }
111}