Skip to main content

onepassword_shared/
types.rs

1#[derive(Debug, serde::Serialize)]
2#[serde(default, rename_all = "camelCase")]
3pub struct ClientConfig {
4    pub service_account_token: String,
5    pub integration_name: &'static str,
6    pub integration_version: &'static str,
7    pub sdk_version: &'static str,
8    pub request_library_name: &'static str,
9    pub request_library_version: &'static str,
10    pub os: &'static str,
11    pub os_version: &'static str,
12    pub architecture: &'static str,
13    pub programming_language: &'static str,
14}
15
16impl Default for ClientConfig {
17    fn default() -> Self {
18        Self {
19            service_account_token: Default::default(),
20            integration_name: option_env!("CARGO_PKG_NAME").unwrap_or_default(),
21            integration_version: option_env!("CARGO_PKG_VERSION").unwrap_or_default(),
22            sdk_version: "0030101",
23            os: "windows",
24            os_version: "0.0.0",
25            architecture: "x86_64",
26            programming_language: "Rust",
27            request_library_name: "reqwest",
28            request_library_version: "0.11.24",
29        }
30    }
31}
32
33#[derive(Debug, serde::Serialize)]
34#[serde(default, rename_all = "camelCase")]
35pub struct InvocationWrapper {
36    pub invocation: Invocation,
37}
38
39#[derive(Debug, serde::Serialize)]
40#[serde(default, rename_all = "camelCase")]
41pub struct Invocation {
42    pub client_id: u64,
43    pub parameters: InvocationParameters,
44}
45
46#[derive(Debug, serde::Serialize)]
47#[serde(tag = "name", content = "parameters")]
48pub enum InvocationParameters {
49    VaultsList {
50        _marker: (),
51    },
52    ItemsList {
53        vault_id: String,
54        filters: Vec<String>,
55    },
56    SecretsResolve {
57        secret_reference: String,
58    },
59}
60
61#[derive(Debug, serde::Deserialize)]
62pub struct Vault {
63    pub id: String,
64    pub title: String,
65}
66
67#[derive(Debug, serde::Deserialize)]
68pub struct Item {
69    pub id: String,
70    pub title: String,
71    pub category: String,
72    pub websites: Vec<Website>,
73}
74
75#[derive(Debug, serde::Deserialize)]
76pub struct Website {
77    pub url: String,
78}