openapi_github/models/
simple_classroom_assignment.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/// SimpleClassroomAssignment : A GitHub Classroom assignment
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct SimpleClassroomAssignment {
17    /// Unique identifier of the repository.
18    #[serde(rename = "id")]
19    pub id: i32,
20    /// Whether an accepted assignment creates a public repository.
21    #[serde(rename = "public_repo")]
22    pub public_repo: bool,
23    /// Assignment title.
24    #[serde(rename = "title")]
25    pub title: String,
26    /// Whether it's a Group Assignment or Individual Assignment.
27    #[serde(rename = "type")]
28    pub r#type: Type,
29    /// The link that a student can use to accept the assignment.
30    #[serde(rename = "invite_link")]
31    pub invite_link: String,
32    /// Whether the invitation link is enabled. Visiting an enabled invitation link will accept the assignment.
33    #[serde(rename = "invitations_enabled")]
34    pub invitations_enabled: bool,
35    /// Sluggified name of the assignment.
36    #[serde(rename = "slug")]
37    pub slug: String,
38    /// Whether students are admins on created repository on accepted assignment.
39    #[serde(rename = "students_are_repo_admins")]
40    pub students_are_repo_admins: bool,
41    /// Whether feedback pull request will be created on assignment acceptance.
42    #[serde(rename = "feedback_pull_requests_enabled")]
43    pub feedback_pull_requests_enabled: bool,
44    /// The maximum allowable teams for the assignment.
45    #[serde(rename = "max_teams", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
46    pub max_teams: Option<Option<i32>>,
47    /// The maximum allowable members per team.
48    #[serde(rename = "max_members", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub max_members: Option<Option<i32>>,
50    /// The selected editor for the assignment.
51    #[serde(rename = "editor")]
52    pub editor: String,
53    /// The number of students that have accepted the assignment.
54    #[serde(rename = "accepted")]
55    pub accepted: i32,
56    /// The number of students that have submitted the assignment.
57    #[serde(rename = "submitted")]
58    pub submitted: i32,
59    /// The number of students that have passed the assignment.
60    #[serde(rename = "passing")]
61    pub passing: i32,
62    /// The programming language used in the assignment.
63    #[serde(rename = "language")]
64    pub language: String,
65    /// The time at which the assignment is due.
66    #[serde(rename = "deadline", deserialize_with = "Option::deserialize")]
67    pub deadline: Option<String>,
68    #[serde(rename = "classroom")]
69    pub classroom: Box<models::SimpleClassroom>,
70}
71
72impl SimpleClassroomAssignment {
73    /// A GitHub Classroom assignment
74    pub fn new(id: i32, public_repo: bool, title: String, r#type: Type, invite_link: String, invitations_enabled: bool, slug: String, students_are_repo_admins: bool, feedback_pull_requests_enabled: bool, editor: String, accepted: i32, submitted: i32, passing: i32, language: String, deadline: Option<String>, classroom: models::SimpleClassroom) -> SimpleClassroomAssignment {
75        SimpleClassroomAssignment {
76            id,
77            public_repo,
78            title,
79            r#type,
80            invite_link,
81            invitations_enabled,
82            slug,
83            students_are_repo_admins,
84            feedback_pull_requests_enabled,
85            max_teams: None,
86            max_members: None,
87            editor,
88            accepted,
89            submitted,
90            passing,
91            language,
92            deadline,
93            classroom: Box::new(classroom),
94        }
95    }
96}
97/// Whether it's a Group Assignment or Individual Assignment.
98#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
99pub enum Type {
100    #[serde(rename = "individual")]
101    Individual,
102    #[serde(rename = "group")]
103    Group,
104}
105
106impl Default for Type {
107    fn default() -> Type {
108        Self::Individual
109    }
110}
111