openapi_github/models/
installation.rs1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Installation {
17 #[serde(rename = "id")]
19 pub id: i32,
20 #[serde(rename = "account", deserialize_with = "Option::deserialize")]
21 pub account: Option<Box<models::InstallationAccount>>,
22 #[serde(rename = "repository_selection")]
24 pub repository_selection: RepositorySelection,
25 #[serde(rename = "access_tokens_url")]
26 pub access_tokens_url: String,
27 #[serde(rename = "repositories_url")]
28 pub repositories_url: String,
29 #[serde(rename = "html_url")]
30 pub html_url: String,
31 #[serde(rename = "app_id")]
32 pub app_id: i32,
33 #[serde(rename = "target_id")]
35 pub target_id: i32,
36 #[serde(rename = "target_type")]
37 pub target_type: String,
38 #[serde(rename = "permissions")]
39 pub permissions: Box<models::AppPermissions>,
40 #[serde(rename = "events")]
41 pub events: Vec<String>,
42 #[serde(rename = "created_at")]
43 pub created_at: String,
44 #[serde(rename = "updated_at")]
45 pub updated_at: String,
46 #[serde(rename = "single_file_name", deserialize_with = "Option::deserialize")]
47 pub single_file_name: Option<String>,
48 #[serde(rename = "has_multiple_single_files", skip_serializing_if = "Option::is_none")]
49 pub has_multiple_single_files: Option<bool>,
50 #[serde(rename = "single_file_paths", skip_serializing_if = "Option::is_none")]
51 pub single_file_paths: Option<Vec<String>>,
52 #[serde(rename = "app_slug")]
53 pub app_slug: String,
54 #[serde(rename = "suspended_by", deserialize_with = "Option::deserialize")]
55 pub suspended_by: Option<Box<models::SimpleUser>>,
56 #[serde(rename = "suspended_at", deserialize_with = "Option::deserialize")]
57 pub suspended_at: Option<String>,
58 #[serde(rename = "contact_email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
59 pub contact_email: Option<Option<String>>,
60}
61
62impl Installation {
63 pub fn new(id: i32, account: Option<models::InstallationAccount>, repository_selection: RepositorySelection, access_tokens_url: String, repositories_url: String, html_url: String, app_id: i32, target_id: i32, target_type: String, permissions: models::AppPermissions, events: Vec<String>, created_at: String, updated_at: String, single_file_name: Option<String>, app_slug: String, suspended_by: Option<models::SimpleUser>, suspended_at: Option<String>) -> Installation {
65 Installation {
66 id,
67 account: account.map(Box::new),
68 repository_selection,
69 access_tokens_url,
70 repositories_url,
71 html_url,
72 app_id,
73 target_id,
74 target_type,
75 permissions: Box::new(permissions),
76 events,
77 created_at,
78 updated_at,
79 single_file_name,
80 has_multiple_single_files: None,
81 single_file_paths: None,
82 app_slug,
83 suspended_by: suspended_by.map(Box::new),
84 suspended_at,
85 contact_email: None,
86 }
87 }
88}
89#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
91pub enum RepositorySelection {
92 #[serde(rename = "all")]
93 All,
94 #[serde(rename = "selected")]
95 Selected,
96}
97
98impl Default for RepositorySelection {
99 fn default() -> RepositorySelection {
100 Self::All
101 }
102}
103