1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
//! App model for Appwrite SDK
use serde::{Deserialize, Serialize};
/// App
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(test, derive(Default))]
pub struct App {
/// App ID.
#[serde(rename = "$id")]
pub id: String,
/// App creation time in ISO 8601 format.
#[serde(rename = "$createdAt")]
pub created_at: String,
/// App update date in ISO 8601 format.
#[serde(rename = "$updatedAt")]
pub updated_at: String,
/// Application name.
#[serde(rename = "name")]
pub name: String,
/// Application description shown to users during OAuth2 consent.
#[serde(rename = "description")]
pub description: String,
/// Application homepage URL shown to users during OAuth2 consent.
#[serde(rename = "clientUri")]
pub client_uri: String,
/// Application logo URL shown to users during OAuth2 consent.
#[serde(rename = "logoUri")]
pub logo_uri: String,
/// Application privacy policy URL shown to users during OAuth2 consent.
#[serde(rename = "privacyPolicyUrl")]
pub privacy_policy_url: String,
/// Application terms of service URL shown to users during OAuth2 consent.
#[serde(rename = "termsUrl")]
pub terms_url: String,
/// Application support or security contact emails.
#[serde(rename = "contacts")]
pub contacts: Vec<String>,
/// Application tagline shown to users during OAuth2 consent.
#[serde(rename = "tagline")]
pub tagline: String,
/// Application tags shown to users during OAuth2 consent.
#[serde(rename = "tags")]
pub tags: Vec<String>,
/// Application labels. Read-only for clients; only a server SDK using a
/// project API key can update them.
#[serde(rename = "labels")]
pub labels: Vec<String>,
/// Application image URLs shown to users during OAuth2 consent.
#[serde(rename = "images")]
pub images: Vec<String>,
/// Application support URL shown to users during OAuth2 consent.
#[serde(rename = "supportUrl")]
pub support_url: String,
/// Application data deletion URL shown to users during OAuth2 consent.
#[serde(rename = "dataDeletionUrl")]
pub data_deletion_url: String,
/// List of authorized redirect URIs. These URIs can be used to redirect users
/// after they authenticate.
#[serde(rename = "redirectUris")]
pub redirect_uris: Vec<String>,
/// List of authorized post-logout redirect URIs for OpenID Connect
/// RP-Initiated Logout. The logout endpoint only redirects users to URIs in
/// this list after ending their session.
#[serde(rename = "postLogoutRedirectUris")]
pub post_logout_redirect_uris: Vec<String>,
/// Whether the app is enabled or not.
#[serde(rename = "enabled")]
pub enabled: bool,
/// OAuth2 client type. `public` for SPAs, mobile, and native apps that cannot
/// keep a client secret (PKCE required); `confidential` for server-side
/// clients that authenticate with a client secret.
#[serde(rename = "type")]
pub r#type: String,
/// Whether this client may use the OAuth2 Device Authorization Grant (RFC
/// 8628).
#[serde(rename = "deviceFlow")]
pub device_flow: bool,
/// ID of team that owns the application, if owned by team. Otherwise, user ID
/// will be used.
#[serde(rename = "teamId")]
pub team_id: String,
/// ID of user who owns the application, if owned by user. Otherwise, team ID
/// will be used.
#[serde(rename = "userId")]
pub user_id: String,
/// Scopes the application requests when installed on a team.
/// Organization-level and project-level scopes only.
#[serde(rename = "installationScopes")]
pub installation_scopes: Vec<String>,
/// URL users are redirected to after creating or updating an installation of
/// this application. Empty for no redirect.
#[serde(rename = "installationRedirectUrl")]
pub installation_redirect_url: String,
/// List of application secrets.
#[serde(rename = "secrets")]
pub secrets: Vec<crate::models::AppSecret>,
}
impl App {
/// Get id
pub fn id(&self) -> &String {
&self.id
}
/// Get created_at
pub fn created_at(&self) -> &String {
&self.created_at
}
/// Get updated_at
pub fn updated_at(&self) -> &String {
&self.updated_at
}
/// Get name
pub fn name(&self) -> &String {
&self.name
}
/// Get description
pub fn description(&self) -> &String {
&self.description
}
/// Get client_uri
pub fn client_uri(&self) -> &String {
&self.client_uri
}
/// Get logo_uri
pub fn logo_uri(&self) -> &String {
&self.logo_uri
}
/// Get privacy_policy_url
pub fn privacy_policy_url(&self) -> &String {
&self.privacy_policy_url
}
/// Get terms_url
pub fn terms_url(&self) -> &String {
&self.terms_url
}
/// Get contacts
pub fn contacts(&self) -> &Vec<String> {
&self.contacts
}
/// Get tagline
pub fn tagline(&self) -> &String {
&self.tagline
}
/// Get tags
pub fn tags(&self) -> &Vec<String> {
&self.tags
}
/// Get labels
pub fn labels(&self) -> &Vec<String> {
&self.labels
}
/// Get images
pub fn images(&self) -> &Vec<String> {
&self.images
}
/// Get support_url
pub fn support_url(&self) -> &String {
&self.support_url
}
/// Get data_deletion_url
pub fn data_deletion_url(&self) -> &String {
&self.data_deletion_url
}
/// Get redirect_uris
pub fn redirect_uris(&self) -> &Vec<String> {
&self.redirect_uris
}
/// Get post_logout_redirect_uris
pub fn post_logout_redirect_uris(&self) -> &Vec<String> {
&self.post_logout_redirect_uris
}
/// Get enabled
pub fn enabled(&self) -> &bool {
&self.enabled
}
/// Get r#type
pub fn r#type(&self) -> &String {
&self.r#type
}
/// Get device_flow
pub fn device_flow(&self) -> &bool {
&self.device_flow
}
/// Get team_id
pub fn team_id(&self) -> &String {
&self.team_id
}
/// Get user_id
pub fn user_id(&self) -> &String {
&self.user_id
}
/// Get installation_scopes
pub fn installation_scopes(&self) -> &Vec<String> {
&self.installation_scopes
}
/// Get installation_redirect_url
pub fn installation_redirect_url(&self) -> &String {
&self.installation_redirect_url
}
/// Get secrets
pub fn secrets(&self) -> &Vec<crate::models::AppSecret> {
&self.secrets
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_app_creation() {
let _model = <App as Default>::default();
let _ = _model.id();
let _ = _model.created_at();
let _ = _model.updated_at();
let _ = _model.name();
let _ = _model.description();
let _ = _model.client_uri();
let _ = _model.logo_uri();
let _ = _model.privacy_policy_url();
let _ = _model.terms_url();
let _ = _model.contacts();
let _ = _model.tagline();
let _ = _model.tags();
let _ = _model.labels();
let _ = _model.images();
let _ = _model.support_url();
let _ = _model.data_deletion_url();
let _ = _model.redirect_uris();
let _ = _model.post_logout_redirect_uris();
let _ = _model.enabled();
let _ = _model.r#type();
let _ = _model.device_flow();
let _ = _model.team_id();
let _ = _model.user_id();
let _ = _model.installation_scopes();
let _ = _model.installation_redirect_url();
let _ = _model.secrets();
}
#[test]
fn test_app_serialization() {
let model = <App as Default>::default();
let json = serde_json::to_string(&model);
assert!(json.is_ok());
let deserialized: Result<App, _> = serde_json::from_str(&json.unwrap());
assert!(deserialized.is_ok());
}
}