openapi_github/models/
repository_invitation.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/// RepositoryInvitation : Repository invitations let you manage who you collaborate with.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RepositoryInvitation {
17    /// Unique identifier of the repository invitation.
18    #[serde(rename = "id")]
19    pub id: i32,
20    #[serde(rename = "repository")]
21    pub repository: Box<models::MinimalRepository>,
22    #[serde(rename = "invitee", deserialize_with = "Option::deserialize")]
23    pub invitee: Option<Box<models::NullableSimpleUser>>,
24    #[serde(rename = "inviter", deserialize_with = "Option::deserialize")]
25    pub inviter: Option<Box<models::NullableSimpleUser>>,
26    /// The permission associated with the invitation.
27    #[serde(rename = "permissions")]
28    pub permissions: Permissions,
29    #[serde(rename = "created_at")]
30    pub created_at: String,
31    /// Whether or not the invitation has expired
32    #[serde(rename = "expired", skip_serializing_if = "Option::is_none")]
33    pub expired: Option<bool>,
34    /// URL for the repository invitation
35    #[serde(rename = "url")]
36    pub url: String,
37    #[serde(rename = "html_url")]
38    pub html_url: String,
39    #[serde(rename = "node_id")]
40    pub node_id: String,
41}
42
43impl RepositoryInvitation {
44    /// Repository invitations let you manage who you collaborate with.
45    pub fn new(id: i32, repository: models::MinimalRepository, invitee: Option<models::NullableSimpleUser>, inviter: Option<models::NullableSimpleUser>, permissions: Permissions, created_at: String, url: String, html_url: String, node_id: String) -> RepositoryInvitation {
46        RepositoryInvitation {
47            id,
48            repository: Box::new(repository),
49            invitee: invitee.map(Box::new),
50            inviter: inviter.map(Box::new),
51            permissions,
52            created_at,
53            expired: None,
54            url,
55            html_url,
56            node_id,
57        }
58    }
59}
60/// The permission associated with the invitation.
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
62pub enum Permissions {
63    #[serde(rename = "read")]
64    Read,
65    #[serde(rename = "write")]
66    Write,
67    #[serde(rename = "admin")]
68    Admin,
69    #[serde(rename = "triage")]
70    Triage,
71    #[serde(rename = "maintain")]
72    Maintain,
73}
74
75impl Default for Permissions {
76    fn default() -> Permissions {
77        Self::Read
78    }
79}
80