1use serde::{Deserialize, Serialize};
2
3use crate::util::QueryBuilder;
4
5#[derive(Clone, Debug, Deserialize)]
7pub struct App {
8 pub app_id: String,
10 #[serde(default)]
12 pub slug: Option<String>,
13 #[serde(default)]
15 pub name: Option<String>,
16 #[serde(default)]
18 pub updated_at: Option<String>,
19 #[serde(default)]
21 pub description: Option<String>,
22 #[serde(default)]
24 pub logo_url: Option<String>,
25 #[serde(default)]
27 pub terms_url: Option<String>,
28 #[serde(default)]
30 pub privacy_url: Option<String>,
31 #[serde(default)]
33 pub categories: Vec<String>,
34 #[serde(default)]
36 pub owner_signup_limit: Option<u32>,
37}
38
39#[derive(Clone, Debug, Default)]
41pub struct AppsListFilters {
42 pub limit: Option<u32>,
44 pub page_token: Option<String>,
46 pub category: Option<String>,
48}
49
50impl AppsListFilters {
51 pub(crate) fn query(&self) -> Vec<(&'static str, String)> {
52 QueryBuilder::new()
53 .opt("limit", self.limit.as_ref())
54 .opt("page_token", self.page_token.as_ref())
55 .opt("category", self.category.as_ref())
56 .build()
57 }
58}
59
60#[derive(Clone, Debug, Deserialize)]
62pub struct AppList {
63 pub count: u64,
65 #[serde(default)]
67 pub apps: Vec<App>,
68 #[serde(default)]
70 pub next_page_token: Option<String>,
71}
72
73#[derive(Clone, Debug, Deserialize)]
75pub struct AppSearchList {
76 pub count: u64,
78 #[serde(default)]
80 pub apps: Vec<App>,
81}
82
83#[derive(Clone, Debug, Default, Serialize)]
87pub struct ConnectApp {
88 #[serde(skip_serializing_if = "Option::is_none")]
90 pub inbox_id: Option<String>,
91 #[serde(skip_serializing_if = "Option::is_none")]
93 pub accept_disclosure: Option<bool>,
94}
95
96#[derive(Clone, Debug, Deserialize)]
98pub struct ConnectAppResult {
99 pub api_key_id: String,
101 pub magic_url: String,
103 pub expires_at: String,
105}
106
107#[derive(Clone, Debug, Deserialize)]
109pub struct AppAccountList {
110 #[serde(default)]
112 pub app: Option<App>,
113 pub count: u64,
115 #[serde(default)]
117 pub accounts: Vec<crate::Account>,
118 #[serde(default)]
120 pub next_page_token: Option<String>,
121}