openapi_github/models/
milestone.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/// Milestone : A collection of related issues and pull requests.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Milestone {
17    #[serde(rename = "closed_at", deserialize_with = "Option::deserialize")]
18    pub closed_at: Option<String>,
19    #[serde(rename = "closed_issues")]
20    pub closed_issues: i32,
21    #[serde(rename = "created_at")]
22    pub created_at: String,
23    #[serde(rename = "creator", deserialize_with = "Option::deserialize")]
24    pub creator: Option<Box<models::User1>>,
25    #[serde(rename = "description", deserialize_with = "Option::deserialize")]
26    pub description: Option<String>,
27    #[serde(rename = "due_on", deserialize_with = "Option::deserialize")]
28    pub due_on: Option<String>,
29    #[serde(rename = "html_url")]
30    pub html_url: String,
31    #[serde(rename = "id")]
32    pub id: i32,
33    #[serde(rename = "labels_url")]
34    pub labels_url: String,
35    #[serde(rename = "node_id")]
36    pub node_id: String,
37    /// The number of the milestone.
38    #[serde(rename = "number")]
39    pub number: i32,
40    #[serde(rename = "open_issues")]
41    pub open_issues: i32,
42    /// The state of the milestone.
43    #[serde(rename = "state")]
44    pub state: State,
45    /// The title of the milestone.
46    #[serde(rename = "title")]
47    pub title: String,
48    #[serde(rename = "updated_at")]
49    pub updated_at: String,
50    #[serde(rename = "url")]
51    pub url: String,
52}
53
54impl Milestone {
55    /// A collection of related issues and pull requests.
56    pub fn new(closed_at: Option<String>, closed_issues: i32, created_at: String, creator: Option<models::User1>, description: Option<String>, due_on: Option<String>, html_url: String, id: i32, labels_url: String, node_id: String, number: i32, open_issues: i32, state: State, title: String, updated_at: String, url: String) -> Milestone {
57        Milestone {
58            closed_at,
59            closed_issues,
60            created_at,
61            creator: creator.map(Box::new),
62            description,
63            due_on,
64            html_url,
65            id,
66            labels_url,
67            node_id,
68            number,
69            open_issues,
70            state,
71            title,
72            updated_at,
73            url,
74        }
75    }
76}
77/// The state of the milestone.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum State {
80    #[serde(rename = "open")]
81    Open,
82    #[serde(rename = "closed")]
83    Closed,
84}
85
86impl Default for State {
87    fn default() -> State {
88        Self::Open
89    }
90}
91