openapi_github/models/
codespace_with_full_repository.rs

1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CodespaceWithFullRepository : A codespace.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CodespaceWithFullRepository {
17    #[serde(rename = "id")]
18    pub id: i32,
19    /// Automatically generated name of this codespace.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// Display name for this codespace.
23    #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub display_name: Option<Option<String>>,
25    /// UUID identifying this codespace's environment.
26    #[serde(rename = "environment_id", deserialize_with = "Option::deserialize")]
27    pub environment_id: Option<String>,
28    #[serde(rename = "owner")]
29    pub owner: Box<models::SimpleUser>,
30    #[serde(rename = "billable_owner")]
31    pub billable_owner: Box<models::SimpleUser>,
32    #[serde(rename = "repository")]
33    pub repository: Box<models::FullRepository>,
34    #[serde(rename = "machine", deserialize_with = "Option::deserialize")]
35    pub machine: Option<Box<models::NullableCodespaceMachine>>,
36    /// Path to devcontainer.json from repo root used to create Codespace.
37    #[serde(rename = "devcontainer_path", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
38    pub devcontainer_path: Option<Option<String>>,
39    /// Whether the codespace was created from a prebuild.
40    #[serde(rename = "prebuild", deserialize_with = "Option::deserialize")]
41    pub prebuild: Option<bool>,
42    #[serde(rename = "created_at")]
43    pub created_at: String,
44    #[serde(rename = "updated_at")]
45    pub updated_at: String,
46    /// Last known time this codespace was started.
47    #[serde(rename = "last_used_at")]
48    pub last_used_at: String,
49    /// State of this codespace.
50    #[serde(rename = "state")]
51    pub state: State,
52    /// API URL for this codespace.
53    #[serde(rename = "url")]
54    pub url: String,
55    #[serde(rename = "git_status")]
56    pub git_status: Box<models::CodespaceGitStatus>,
57    /// The initally assigned location of a new codespace.
58    #[serde(rename = "location")]
59    pub location: Location,
60    /// The number of minutes of inactivity after which this codespace will be automatically stopped.
61    #[serde(rename = "idle_timeout_minutes", deserialize_with = "Option::deserialize")]
62    pub idle_timeout_minutes: Option<i32>,
63    /// URL to access this codespace on the web.
64    #[serde(rename = "web_url")]
65    pub web_url: String,
66    /// API URL to access available alternate machine types for this codespace.
67    #[serde(rename = "machines_url")]
68    pub machines_url: String,
69    /// API URL to start this codespace.
70    #[serde(rename = "start_url")]
71    pub start_url: String,
72    /// API URL to stop this codespace.
73    #[serde(rename = "stop_url")]
74    pub stop_url: String,
75    /// API URL to publish this codespace to a new repository.
76    #[serde(rename = "publish_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
77    pub publish_url: Option<Option<String>>,
78    /// API URL for the Pull Request associated with this codespace, if any.
79    #[serde(rename = "pulls_url", deserialize_with = "Option::deserialize")]
80    pub pulls_url: Option<String>,
81    #[serde(rename = "recent_folders")]
82    pub recent_folders: Vec<String>,
83    #[serde(rename = "runtime_constraints", skip_serializing_if = "Option::is_none")]
84    pub runtime_constraints: Option<Box<models::CodespaceRuntimeConstraints>>,
85    /// Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it.
86    #[serde(rename = "pending_operation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
87    pub pending_operation: Option<Option<bool>>,
88    /// Text to show user when codespace is disabled by a pending operation
89    #[serde(rename = "pending_operation_disabled_reason", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
90    pub pending_operation_disabled_reason: Option<Option<String>>,
91    /// Text to show user when codespace idle timeout minutes has been overriden by an organization policy
92    #[serde(rename = "idle_timeout_notice", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
93    pub idle_timeout_notice: Option<Option<String>>,
94    /// Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).
95    #[serde(rename = "retention_period_minutes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
96    pub retention_period_minutes: Option<Option<i32>>,
97    /// When a codespace will be auto-deleted based on the \"retention_period_minutes\" and \"last_used_at\"
98    #[serde(rename = "retention_expires_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
99    pub retention_expires_at: Option<Option<String>>,
100}
101
102impl CodespaceWithFullRepository {
103    /// A codespace.
104    pub fn new(id: i32, name: String, environment_id: Option<String>, owner: models::SimpleUser, billable_owner: models::SimpleUser, repository: models::FullRepository, machine: Option<models::NullableCodespaceMachine>, prebuild: Option<bool>, created_at: String, updated_at: String, last_used_at: String, state: State, url: String, git_status: models::CodespaceGitStatus, location: Location, idle_timeout_minutes: Option<i32>, web_url: String, machines_url: String, start_url: String, stop_url: String, pulls_url: Option<String>, recent_folders: Vec<String>) -> CodespaceWithFullRepository {
105        CodespaceWithFullRepository {
106            id,
107            name,
108            display_name: None,
109            environment_id,
110            owner: Box::new(owner),
111            billable_owner: Box::new(billable_owner),
112            repository: Box::new(repository),
113            machine: machine.map(Box::new),
114            devcontainer_path: None,
115            prebuild,
116            created_at,
117            updated_at,
118            last_used_at,
119            state,
120            url,
121            git_status: Box::new(git_status),
122            location,
123            idle_timeout_minutes,
124            web_url,
125            machines_url,
126            start_url,
127            stop_url,
128            publish_url: None,
129            pulls_url,
130            recent_folders,
131            runtime_constraints: None,
132            pending_operation: None,
133            pending_operation_disabled_reason: None,
134            idle_timeout_notice: None,
135            retention_period_minutes: None,
136            retention_expires_at: None,
137        }
138    }
139}
140/// State of this codespace.
141#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
142pub enum State {
143    #[serde(rename = "Unknown")]
144    Unknown,
145    #[serde(rename = "Created")]
146    Created,
147    #[serde(rename = "Queued")]
148    Queued,
149    #[serde(rename = "Provisioning")]
150    Provisioning,
151    #[serde(rename = "Available")]
152    Available,
153    #[serde(rename = "Awaiting")]
154    Awaiting,
155    #[serde(rename = "Unavailable")]
156    Unavailable,
157    #[serde(rename = "Deleted")]
158    Deleted,
159    #[serde(rename = "Moved")]
160    Moved,
161    #[serde(rename = "Shutdown")]
162    Shutdown,
163    #[serde(rename = "Archived")]
164    Archived,
165    #[serde(rename = "Starting")]
166    Starting,
167    #[serde(rename = "ShuttingDown")]
168    ShuttingDown,
169    #[serde(rename = "Failed")]
170    Failed,
171    #[serde(rename = "Exporting")]
172    Exporting,
173    #[serde(rename = "Updating")]
174    Updating,
175    #[serde(rename = "Rebuilding")]
176    Rebuilding,
177}
178
179impl Default for State {
180    fn default() -> State {
181        Self::Unknown
182    }
183}
184/// The initally assigned location of a new codespace.
185#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
186pub enum Location {
187    #[serde(rename = "EastUs")]
188    EastUs,
189    #[serde(rename = "SouthEastAsia")]
190    SouthEastAsia,
191    #[serde(rename = "WestEurope")]
192    WestEurope,
193    #[serde(rename = "WestUs2")]
194    WestUs2,
195}
196
197impl Default for Location {
198    fn default() -> Location {
199        Self::EastUs
200    }
201}
202