appwrite 0.13.0

Appwrite SDK for Rust
Documentation
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
//! Organization model for Appwrite SDK

use serde::{Deserialize, Serialize};

/// Organization
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(test, derive(Default))]
pub struct Organization {
    /// Team ID.
    #[serde(rename = "$id")]
    pub id: String,
    /// Team creation date in ISO 8601 format.
    #[serde(rename = "$createdAt")]
    pub created_at: String,
    /// Team update date in ISO 8601 format.
    #[serde(rename = "$updatedAt")]
    pub updated_at: String,
    /// Team name.
    #[serde(rename = "name")]
    pub name: String,
    /// Total number of team members.
    #[serde(rename = "total")]
    pub total: i64,
    /// Team preferences as a key-value object
    #[serde(rename = "prefs")]
    pub prefs: crate::models::Preferences,
    /// Project budget limit. Null when no budget is set.
    #[serde(rename = "billingBudget")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub billing_budget: Option<i64>,
    /// Project budget limit
    #[serde(rename = "budgetAlerts")]
    pub budget_alerts: Vec<i64>,
    /// Organization's billing plan ID.
    #[serde(rename = "billingPlan")]
    pub billing_plan: String,
    /// Organization's billing plan ID.
    #[serde(rename = "billingPlanId")]
    pub billing_plan_id: String,
    /// Organization's billing plan.
    #[serde(rename = "billingPlanDetails")]
    pub billing_plan_details: crate::models::BillingPlan,
    /// Billing email set for the organization.
    #[serde(rename = "billingEmail")]
    pub billing_email: String,
    /// Billing cycle start date.
    #[serde(rename = "billingStartDate")]
    pub billing_start_date: String,
    /// Current invoice cycle start date.
    #[serde(rename = "billingCurrentInvoiceDate")]
    pub billing_current_invoice_date: String,
    /// Next invoice cycle start date.
    #[serde(rename = "billingNextInvoiceDate")]
    pub billing_next_invoice_date: String,
    /// Start date of trial.
    #[serde(rename = "billingTrialStartDate")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub billing_trial_start_date: Option<String>,
    /// Number of trial days.
    #[serde(rename = "billingTrialDays")]
    pub billing_trial_days: i64,
    /// Current active aggregation id.
    #[serde(rename = "billingAggregationId")]
    pub billing_aggregation_id: String,
    /// Current active aggregation id.
    #[serde(rename = "billingInvoiceId")]
    pub billing_invoice_id: String,
    /// Default payment method.
    #[serde(rename = "paymentMethodId")]
    pub payment_method_id: String,
    /// Default payment method.
    #[serde(rename = "billingAddressId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub billing_address_id: Option<String>,
    /// Backup payment method.
    #[serde(rename = "backupPaymentMethodId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub backup_payment_method_id: Option<String>,
    /// Team status.
    #[serde(rename = "status")]
    pub status: String,
    /// Remarks on team status.
    #[serde(rename = "remarks")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub remarks: Option<String>,
    /// Organization agreements
    #[serde(rename = "agreementBAA")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub agreement_baa: Option<String>,
    /// Program manager's name.
    #[serde(rename = "programManagerName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub program_manager_name: Option<String>,
    /// Program manager's calendar link.
    #[serde(rename = "programManagerCalendar")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub program_manager_calendar: Option<String>,
    /// Program's discord channel name.
    #[serde(rename = "programDiscordChannelName")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub program_discord_channel_name: Option<String>,
    /// Program's discord channel URL.
    #[serde(rename = "programDiscordChannelUrl")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub program_discord_channel_url: Option<String>,
    /// Billing limits reached
    #[serde(rename = "billingLimits")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub billing_limits: Option<crate::models::BillingLimits>,
    /// Billing plan selected for downgrade.
    #[serde(rename = "billingPlanDowngrade")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub billing_plan_downgrade: Option<String>,
    /// Tax Id
    #[serde(rename = "billingTaxId")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub billing_tax_id: Option<String>,
    /// Marked for deletion
    #[serde(rename = "markedForDeletion")]
    pub marked_for_deletion: bool,
    /// Product with which the organization is associated (appwrite or imagine)
    #[serde(rename = "platform")]
    pub platform: String,
    /// Selected projects
    #[serde(rename = "projects")]
    pub projects: Vec<String>,
}

impl Organization {
    /// 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 total
    pub fn total(&self) -> &i64 {
        &self.total
    }

    /// Get prefs
    pub fn prefs(&self) -> &crate::models::Preferences {
        &self.prefs
    }

    /// Set billing_budget
    pub fn set_billing_budget(mut self, billing_budget: i64) -> Self {
        self.billing_budget = Some(billing_budget);
        self
    }

    /// Get billing_budget
    pub fn billing_budget(&self) -> Option<&i64> {
        self.billing_budget.as_ref()
    }

    /// Get budget_alerts
    pub fn budget_alerts(&self) -> &Vec<i64> {
        &self.budget_alerts
    }

    /// Get billing_plan
    pub fn billing_plan(&self) -> &String {
        &self.billing_plan
    }

    /// Get billing_plan_id
    pub fn billing_plan_id(&self) -> &String {
        &self.billing_plan_id
    }

    /// Get billing_plan_details
    pub fn billing_plan_details(&self) -> &crate::models::BillingPlan {
        &self.billing_plan_details
    }

    /// Get billing_email
    pub fn billing_email(&self) -> &String {
        &self.billing_email
    }

    /// Get billing_start_date
    pub fn billing_start_date(&self) -> &String {
        &self.billing_start_date
    }

    /// Get billing_current_invoice_date
    pub fn billing_current_invoice_date(&self) -> &String {
        &self.billing_current_invoice_date
    }

    /// Get billing_next_invoice_date
    pub fn billing_next_invoice_date(&self) -> &String {
        &self.billing_next_invoice_date
    }

    /// Set billing_trial_start_date
    pub fn set_billing_trial_start_date(mut self, billing_trial_start_date: String) -> Self {
        self.billing_trial_start_date = Some(billing_trial_start_date);
        self
    }

    /// Get billing_trial_start_date
    pub fn billing_trial_start_date(&self) -> Option<&String> {
        self.billing_trial_start_date.as_ref()
    }

    /// Get billing_trial_days
    pub fn billing_trial_days(&self) -> &i64 {
        &self.billing_trial_days
    }

    /// Get billing_aggregation_id
    pub fn billing_aggregation_id(&self) -> &String {
        &self.billing_aggregation_id
    }

    /// Get billing_invoice_id
    pub fn billing_invoice_id(&self) -> &String {
        &self.billing_invoice_id
    }

    /// Get payment_method_id
    pub fn payment_method_id(&self) -> &String {
        &self.payment_method_id
    }

    /// Set billing_address_id
    pub fn set_billing_address_id(mut self, billing_address_id: String) -> Self {
        self.billing_address_id = Some(billing_address_id);
        self
    }

    /// Get billing_address_id
    pub fn billing_address_id(&self) -> Option<&String> {
        self.billing_address_id.as_ref()
    }

    /// Set backup_payment_method_id
    pub fn set_backup_payment_method_id(mut self, backup_payment_method_id: String) -> Self {
        self.backup_payment_method_id = Some(backup_payment_method_id);
        self
    }

    /// Get backup_payment_method_id
    pub fn backup_payment_method_id(&self) -> Option<&String> {
        self.backup_payment_method_id.as_ref()
    }

    /// Get status
    pub fn status(&self) -> &String {
        &self.status
    }

    /// Set remarks
    pub fn set_remarks(mut self, remarks: String) -> Self {
        self.remarks = Some(remarks);
        self
    }

    /// Get remarks
    pub fn remarks(&self) -> Option<&String> {
        self.remarks.as_ref()
    }

    /// Set agreement_baa
    pub fn set_agreement_baa(mut self, agreement_baa: String) -> Self {
        self.agreement_baa = Some(agreement_baa);
        self
    }

    /// Get agreement_baa
    pub fn agreement_baa(&self) -> Option<&String> {
        self.agreement_baa.as_ref()
    }

    /// Set program_manager_name
    pub fn set_program_manager_name(mut self, program_manager_name: String) -> Self {
        self.program_manager_name = Some(program_manager_name);
        self
    }

    /// Get program_manager_name
    pub fn program_manager_name(&self) -> Option<&String> {
        self.program_manager_name.as_ref()
    }

    /// Set program_manager_calendar
    pub fn set_program_manager_calendar(mut self, program_manager_calendar: String) -> Self {
        self.program_manager_calendar = Some(program_manager_calendar);
        self
    }

    /// Get program_manager_calendar
    pub fn program_manager_calendar(&self) -> Option<&String> {
        self.program_manager_calendar.as_ref()
    }

    /// Set program_discord_channel_name
    pub fn set_program_discord_channel_name(mut self, program_discord_channel_name: String) -> Self {
        self.program_discord_channel_name = Some(program_discord_channel_name);
        self
    }

    /// Get program_discord_channel_name
    pub fn program_discord_channel_name(&self) -> Option<&String> {
        self.program_discord_channel_name.as_ref()
    }

    /// Set program_discord_channel_url
    pub fn set_program_discord_channel_url(mut self, program_discord_channel_url: String) -> Self {
        self.program_discord_channel_url = Some(program_discord_channel_url);
        self
    }

    /// Get program_discord_channel_url
    pub fn program_discord_channel_url(&self) -> Option<&String> {
        self.program_discord_channel_url.as_ref()
    }

    /// Set billing_limits
    pub fn set_billing_limits(mut self, billing_limits: crate::models::BillingLimits) -> Self {
        self.billing_limits = Some(billing_limits);
        self
    }

    /// Get billing_limits
    pub fn billing_limits(&self) -> Option<&crate::models::BillingLimits> {
        self.billing_limits.as_ref()
    }

    /// Set billing_plan_downgrade
    pub fn set_billing_plan_downgrade(mut self, billing_plan_downgrade: String) -> Self {
        self.billing_plan_downgrade = Some(billing_plan_downgrade);
        self
    }

    /// Get billing_plan_downgrade
    pub fn billing_plan_downgrade(&self) -> Option<&String> {
        self.billing_plan_downgrade.as_ref()
    }

    /// Set billing_tax_id
    pub fn set_billing_tax_id(mut self, billing_tax_id: String) -> Self {
        self.billing_tax_id = Some(billing_tax_id);
        self
    }

    /// Get billing_tax_id
    pub fn billing_tax_id(&self) -> Option<&String> {
        self.billing_tax_id.as_ref()
    }

    /// Get marked_for_deletion
    pub fn marked_for_deletion(&self) -> &bool {
        &self.marked_for_deletion
    }

    /// Get platform
    pub fn platform(&self) -> &String {
        &self.platform
    }

    /// Get projects
    pub fn projects(&self) -> &Vec<String> {
        &self.projects
    }

}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_organization_creation() {
        let _model = <Organization as Default>::default();
        let _ = _model.id();
        let _ = _model.created_at();
        let _ = _model.updated_at();
        let _ = _model.name();
        let _ = _model.total();
        let _ = _model.prefs();
        let _ = _model.budget_alerts();
        let _ = _model.billing_plan();
        let _ = _model.billing_plan_id();
        let _ = _model.billing_plan_details();
        let _ = _model.billing_email();
        let _ = _model.billing_start_date();
        let _ = _model.billing_current_invoice_date();
        let _ = _model.billing_next_invoice_date();
        let _ = _model.billing_trial_days();
        let _ = _model.billing_aggregation_id();
        let _ = _model.billing_invoice_id();
        let _ = _model.payment_method_id();
        let _ = _model.status();
        let _ = _model.marked_for_deletion();
        let _ = _model.platform();
        let _ = _model.projects();
    }

    #[test]
    fn test_organization_serialization() {
        let model = <Organization as Default>::default();
        let json = serde_json::to_string(&model);
        assert!(json.is_ok());

        let deserialized: Result<Organization, _> = serde_json::from_str(&json.unwrap());
        assert!(deserialized.is_ok());
    }
}