Files
octokit.net/Octokit/Models/Response/InstallationPermissions.cs
Ryan Gribble 4df21a61de Implement Check Suites API (#1846)
* Check run request models

* Check Run response models

* Check run clients

* Check run ApiUrls and AcceptHeaders

* Pack it all together for now

* Add missing accept headers to connection calls

* Standardize class definitions

* Standardize function names

* Merge ICheckRunAnnotationsClient into ICheckRunsClient

* Properly organize clients

* Cleanup CheckRun response model

* Fix slug check run urls

* Add checks installation permission

* Use StringEnums where appropriate

* Cleanup check run output models

* Flesh out CheckSuite model

* Delete CheckRunsList

* Remove a sealed, fix some line endings

* Adding check suite models

* Skeleton check suite client implementation

* Add check suite ApiUrls

* Flesh out check suites client

* Add parameterless CheckRun constructor

* Add DebuggerDisplay to checks models

* Add observable checks interfaces

* Add return values to POST and PATCH check clients

* Fix some check suite client return values

* Skeleton reactive checks implementation

* Implement observable checks clients

* Remove rogue tabs

* Add CheckSuiteEventPayload

* Add CheckRunEventPayload

* Add DebuggerDisplay attributes to checks API payloads

* Properly nullables check suite/run conclusion

* Add CheckSuiteEventTests

* Fix checks client accessor naming issues

* Add missing Text field to CheckRunOutput

* Marks CheckRunUpdate's conclusion as nullable

* Fix reactive checks client naming

* Today I learned DateTimeOffset is a struct

Makes CheckRunUpdate's DateTimeOffsets nullable

* Modify check clients to put slug version before repo id version

* Add nullable to CheckRun.CompletedAt

* Implement parameterless ICheckRunsClient.GetAllForReference and GetAllForCheckSuite

* Add missing RequestParameters base to CheckSuiteRequest

* Implement checks API GetAll methods

* Bring parity to Reactive checks clients

* fix project settings to get GitHubApp helper working again

* remove un-needed InstallationId setting - provide helper method to find installation based on owner

* fix up request object ctors based on required/optional parameters

* fix up request object ctors based on required/optional parameters

* add some initial integration tests for CheckSuites and CheckRuns including some helper methods

* Add test for Request CheckSuite
Fix Request CheckSuite to use correct Uri
Fix Request CheckSuite return type as it doesnt return an object
Fix CheckSuiteTriggerRequest ctor to make required fields mandatory

* simplify Get CheckSuite test to not require as much data setup

* Add test for CheckSuite GetAllForReference

* Add test for CheckSuite UpdatePreferences

* rename response models

* rename CheckSuitesList to CheckSuitesResponse and use as response to the GetAll calls

* Fix tests

* Fix observable

* fix model convention tests

* remove CheckRuns so we can focus only on CheckSuites for now

* naming things is hard

* oh so many unit tests for CheckSuites methods

* make client mockable

* Fix issue with .Max() when no results returned

* fix request parameter names

* add Xml doc comments

* Add XmlDoc comments to request/common model objects

* rename class to match usage

* tidy ups

* xmldoc for observable clients

* fix method order

* add observable unit tests and get them passing

* Add Observable unit tests and get them passing

* add observable integration tests

* tidy up ApiUrl method name

* whitespace/using tidy ups

* Ensure CheckSuiteEventPayload class is handled in deserializer and add to activity test

* add response model XmlDoc comments

* missed one xmldoc

* add xmldoc to NewCheckSuite request and remove HeadBranch property as it doesnt exist anymore

* add some extra check suites integration tests
2018-07-14 20:01:41 +10:00

128 lines
5.0 KiB
C#

using System.Diagnostics;
using System.Globalization;
using Octokit.Internal;
namespace Octokit
{
[DebuggerDisplay("{DebuggerDisplay,nq}")]
public class InstallationPermissions
{
public InstallationPermissions() { }
public InstallationPermissions(InstallationPermissionLevel? metadata, InstallationPermissionLevel? administration, InstallationPermissionLevel? statuses, InstallationPermissionLevel? deployments, InstallationPermissionLevel? issues, InstallationPermissionLevel? pages, InstallationPermissionLevel? pullRequests, InstallationPermissionLevel? contents, InstallationPermissionLevel? singleFile, InstallationPermissionLevel? repositoryProjects, InstallationPermissionLevel? members, InstallationPermissionLevel? organizationProjects, InstallationPermissionLevel? teamDiscussions, InstallationPermissionLevel? checks)
{
Metadata = metadata;
Administration = administration;
Statuses = statuses;
Deployments = deployments;
Issues = issues;
Pages = pages;
PullRequests = pullRequests;
Contents = contents;
SingleFile = singleFile;
RepositoryProjects = repositoryProjects;
Members = members;
OrganizationProjects = organizationProjects;
TeamDiscussions = teamDiscussions;
Checks = checks;
}
/// <summary>
/// Repository metadata
/// Search repositories, list collaborators, and access repository metadata.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Metadata { get; protected set; }
/// <summary>
/// Repository administration
/// Repository creation, deletion, settings, teams, and collaborators.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Administration { get; protected set; }
/// <summary>
/// Commit statuses
/// Commit statuses.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Statuses { get; protected set; }
/// <summary>
/// Deployments
/// Deployments and deployment statuses.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Deployments { get; protected set; }
/// <summary>
/// Issues
/// Issues and related comments, assignees, labels, and milestones.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Issues { get; protected set; }
/// <summary>
/// Pages
/// Retrieve Pages statuses, configuration, and builds, as well as create new builds.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Pages { get; protected set; }
/// <summary>
/// Pull requests
/// Pull requests and related comments, assignees, labels, milestones, and merges.
/// </summary>
public StringEnum<InstallationPermissionLevel>? PullRequests { get; protected set; }
/// <summary>
/// Repository contents
/// Repository contents, commits, branches, downloads, releases, and merges.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Contents { get; protected set; }
/// <summary>
/// Single file
/// Manage just a single file.
/// </summary>
public StringEnum<InstallationPermissionLevel>? SingleFile { get; protected set; }
/// <summary>
/// Repository projects
/// Manage repository projects, columns, and cards.
/// </summary>
public StringEnum<InstallationPermissionLevel>? RepositoryProjects { get; protected set; }
/// <summary>
/// Checks
/// Detailed information about CI checks
/// </summary>
public StringEnum<InstallationPermissionLevel>? Checks { get; protected set; }
/// <summary>
/// Organization members (only applicable when installed for an Organization )
/// Organization members and teams.
/// </summary>
public StringEnum<InstallationPermissionLevel>? Members { get; protected set; }
/// <summary>
/// Organization projects (only applicable when installed for an Organization )
/// Manage organization projects, columns, and cards.
/// </summary>
public StringEnum<InstallationPermissionLevel>? OrganizationProjects { get; protected set; }
/// <summary>
/// Team discussions (only applicable when installed for an Organization )
/// Team discussions.
/// </summary>
public StringEnum<InstallationPermissionLevel>? TeamDiscussions { get; protected set; }
internal string DebuggerDisplay
{
get { return string.Format(CultureInfo.InvariantCulture, "Metadata: {0}, Contents: {1}, Issues: {2}, Single File: {3}", Metadata, Contents, Issues, SingleFile); }
}
}
public enum InstallationPermissionLevel
{
[Parameter(Value = "read")]
Read,
[Parameter(Value = "write")]
Write
}
}