openapi_github/models/teams_create_request.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct TeamsCreateRequest {
16 /// The name of the team.
17 #[serde(rename = "name")]
18 pub name: String,
19 /// The description of the team.
20 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
21 pub description: Option<String>,
22 /// List GitHub IDs for organization members who will become team maintainers.
23 #[serde(rename = "maintainers", skip_serializing_if = "Option::is_none")]
24 pub maintainers: Option<Vec<String>>,
25 /// The full name (e.g., \"organization-name/repository-name\") of repositories to add the team to.
26 #[serde(rename = "repo_names", skip_serializing_if = "Option::is_none")]
27 pub repo_names: Option<Vec<String>>,
28 /// The level of privacy this team should have. The options are: **For a non-nested team:** * `secret` - only visible to organization owners and members of this team. * `closed` - visible to all members of this organization. Default: `secret` **For a parent or child team:** * `closed` - visible to all members of this organization. Default for child team: `closed`
29 #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")]
30 pub privacy: Option<Privacy>,
31 /// The notification setting the team has chosen. The options are: * `notifications_enabled` - team members receive notifications when the team is @mentioned. * `notifications_disabled` - no one receives notifications. Default: `notifications_enabled`
32 #[serde(rename = "notification_setting", skip_serializing_if = "Option::is_none")]
33 pub notification_setting: Option<NotificationSetting>,
34 /// **Deprecated**. The permission that new repositories will be added to the team with when none is specified.
35 #[serde(rename = "permission", skip_serializing_if = "Option::is_none")]
36 pub permission: Option<Permission>,
37 /// The ID of a team to set as the parent team.
38 #[serde(rename = "parent_team_id", skip_serializing_if = "Option::is_none")]
39 pub parent_team_id: Option<i32>,
40}
41
42impl TeamsCreateRequest {
43 pub fn new(name: String) -> TeamsCreateRequest {
44 TeamsCreateRequest {
45 name,
46 description: None,
47 maintainers: None,
48 repo_names: None,
49 privacy: None,
50 notification_setting: None,
51 permission: None,
52 parent_team_id: None,
53 }
54 }
55}
56/// The level of privacy this team should have. The options are: **For a non-nested team:** * `secret` - only visible to organization owners and members of this team. * `closed` - visible to all members of this organization. Default: `secret` **For a parent or child team:** * `closed` - visible to all members of this organization. Default for child team: `closed`
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Privacy {
59 #[serde(rename = "secret")]
60 Secret,
61 #[serde(rename = "closed")]
62 Closed,
63}
64
65impl Default for Privacy {
66 fn default() -> Privacy {
67 Self::Secret
68 }
69}
70/// The notification setting the team has chosen. The options are: * `notifications_enabled` - team members receive notifications when the team is @mentioned. * `notifications_disabled` - no one receives notifications. Default: `notifications_enabled`
71#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
72pub enum NotificationSetting {
73 #[serde(rename = "notifications_enabled")]
74 Enabled,
75 #[serde(rename = "notifications_disabled")]
76 Disabled,
77}
78
79impl Default for NotificationSetting {
80 fn default() -> NotificationSetting {
81 Self::Enabled
82 }
83}
84/// **Deprecated**. The permission that new repositories will be added to the team with when none is specified.
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum Permission {
87 #[serde(rename = "pull")]
88 Pull,
89 #[serde(rename = "push")]
90 Push,
91}
92
93impl Default for Permission {
94 fn default() -> Permission {
95 Self::Pull
96 }
97}
98