Files
octokit.net/Octokit/Models/Response/Team.cs
notauserx 891015c39f update models with updated permission enum (#2633)
* update models with updated permission enum

* add suppress message attribute

* update integration tests

* refactor: new and legacy update teams endpint

* refactor: add new delete team endpoint

* use TeamPermission on NewTeam

* use updated delete on team context dispose

* add permission enum for team response object

* refactor: remove legacy suffix from method names

* introduce permissions object on Team

* refactor: rename enum to TeamRepositoryPermission

* fix formatting

* change Permission to string to match api specs

* add TeamRepository

* add CheckTeamPermission endpoint support

* fix convention tests

* update comments on TeamRepository props

* add two new endpoints in TeamsClient

* refactor: rename ApiUrl for TeamPermission

* fix test

* implement methods for new endpoints

* add the integration tests

* fix spelling

* update comments

* refactor: rename method name

* fix: add end tag for remarks

* refactor: remove unused method param

* fix docstring comment

* the unit tests are in finally

* add docs for teams api

* split CheckTeamPermissions into two methods

* Update ObservableTeamsClientTests.cs based on review

Co-authored-by: Keegan Campbell <me@kfcampbell.com>

* add cref to legacy update and delete endpoints

* remove editorconfig file

* Update Octokit.Tests/Clients/TeamsClientTests.cs

Co-authored-by: Keegan Campbell <me@kfcampbell.com>

* remove unused line

* rename variable based on review

* rename prop to match constructor param

* add comment to explain TeamPermission enum values on update

Co-authored-by: notauserx <notauserx@users.noreply.github.com>
Co-authored-by: Keegan Campbell <me@kfcampbell.com>
2023-01-20 10:48:00 -08:00

134 lines
3.8 KiB
C#

using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
/// <summary>
/// organization teams
/// </summary>
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class Team
{
public Team() { }
public Team(string url, string htmlUrl, int id, string nodeId, string slug, string name, string description, TeamPrivacy privacy, string permission, TeamRepositoryPermissions teamRepositoryPermissions, int membersCount, int reposCount, Organization organization, Team parent, string ldapDistinguishedName)
{
Url = url;
HtmlUrl = htmlUrl;
Id = id;
NodeId = nodeId;
Slug = slug;
Name = name;
Description = description;
Privacy = privacy;
Permission = permission;
TeamRepositoryPermissions = teamRepositoryPermissions;
MembersCount = membersCount;
ReposCount = reposCount;
Organization = organization;
Parent = parent;
LdapDistinguishedName = ldapDistinguishedName;
}
/// <summary>
/// url for this team
/// </summary>
public string Url { get; private set; }
/// <summary>
/// The HTML URL for this team.
/// </summary>
public string HtmlUrl { get; private set; }
/// <summary>
/// team id
/// </summary>
public int Id { get; private set; }
/// <summary>
/// GraphQL Node Id
/// </summary>
public string NodeId { get; private set; }
/// <summary>
/// team slug
/// </summary>
public string Slug { get; private set; }
/// <summary>
/// team name
/// </summary>
public string Name { get; private set; }
/// <summary>
/// team description
/// </summary>
public string Description { get; private set; }
/// <summary>
/// team privacy
/// </summary>
public StringEnum<TeamPrivacy> Privacy { get; private set; }
/// <summary>
/// Deprecated. The permission that new repositories will be added to the team with when none is specified
/// </summary>
public string Permission { get; private set; }
/// <summary>
///
/// </summary>
public TeamRepositoryPermissions TeamRepositoryPermissions { get; private set; }
/// <summary>
/// how many members in this team
/// </summary>
public int MembersCount { get; private set; }
/// <summary>
/// how many repo this team has access to
/// </summary>
public int ReposCount { get; private set; }
/// <summary>
/// who this team belongs to
/// </summary>
public Organization Organization { get; private set; }
/// <summary>
/// The parent team
/// </summary>
public Team Parent { get; private set; }
/// <summary>
/// LDAP Binding (GitHub Enterprise only)
/// </summary>
[Parameter(Key = "ldap_dn")]
public string LdapDistinguishedName { get; private set; }
internal string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Name: {0} ", Name); }
}
}
/// <summary>
/// Used to describe a team's privacy level.
/// </summary>
public enum TeamPrivacy
{
/// <summary>
/// Only visible to organization owners and members of the team.
/// </summary>
[Parameter(Value = "secret")]
Secret,
/// <summary>
/// Visible to all members of the organization.
/// </summary>
[Parameter(Value = "closed")]
Closed
}
}