openapi_github/models/
org_membership.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/// OrgMembership : Org Membership
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct OrgMembership {
17    #[serde(rename = "url")]
18    pub url: String,
19    /// The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation.
20    #[serde(rename = "state")]
21    pub state: State,
22    /// The user's membership type in the organization.
23    #[serde(rename = "role")]
24    pub role: Role,
25    #[serde(rename = "organization_url")]
26    pub organization_url: String,
27    #[serde(rename = "organization")]
28    pub organization: Box<models::OrganizationSimple>,
29    #[serde(rename = "user", deserialize_with = "Option::deserialize")]
30    pub user: Option<Box<models::NullableSimpleUser>>,
31    #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")]
32    pub permissions: Option<Box<models::OrgMembershipPermissions>>,
33}
34
35impl OrgMembership {
36    /// Org Membership
37    pub fn new(url: String, state: State, role: Role, organization_url: String, organization: models::OrganizationSimple, user: Option<models::NullableSimpleUser>) -> OrgMembership {
38        OrgMembership {
39            url,
40            state,
41            role,
42            organization_url,
43            organization: Box::new(organization),
44            user: user.map(Box::new),
45            permissions: None,
46        }
47    }
48}
49/// The state of the member in the organization. The `pending` state indicates the user has not yet accepted an invitation.
50#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
51pub enum State {
52    #[serde(rename = "active")]
53    Active,
54    #[serde(rename = "pending")]
55    Pending,
56}
57
58impl Default for State {
59    fn default() -> State {
60        Self::Active
61    }
62}
63/// The user's membership type in the organization.
64#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
65pub enum Role {
66    #[serde(rename = "admin")]
67    Admin,
68    #[serde(rename = "member")]
69    Member,
70    #[serde(rename = "billing_manager")]
71    BillingManager,
72}
73
74impl Default for Role {
75    fn default() -> Role {
76        Self::Admin
77    }
78}
79