Skip to content

Commit 0475f08

Browse files
Add missing properties for meta and app payloads (#2625)
* Add missing properties for meta and app payloads * Update test with actual value instead of null Co-authored-by: Keegan Campbell <[email protected]>
1 parent 64614ce commit 0475f08

File tree

5 files changed

+203
-45
lines changed

5 files changed

+203
-45
lines changed

Octokit.Tests/Clients/MetaClientTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public async Task RequestsTheMetadataEndpoint()
2323
new[] { "1.1.6.1/24", "1.1.6.2/24" },
2424
new[] { "1.1.7.1", "1.1.7.2" },
2525
new[] { "1.1.8.1/24", "1.1.8.2/24" },
26-
new[] { "1.1.9.1", "1.1.9.2" }
26+
new[] { "1.1.9.1", "1.1.9.2" },
27+
"3.7.0"
2728
);
2829

2930

Octokit.Tests/Clients/MiscellaneousClientTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ public async Task RequestsTheMetadataEndpoint()
156156
new[] { "1.1.6.1/24", "1.1.6.2/24" },
157157
new[] { "1.1.7.1", "1.1.7.2" },
158158
new[] { "1.1.8.1/24", "1.1.8.2/24" },
159-
new[] { "1.1.9.1", "1.1.9.2" }
159+
new[] { "1.1.9.1", "1.1.9.2" },
160+
"3.7.0"
160161
);
161162

162163
var apiConnection = Substitute.For<IApiConnection>();

Octokit/Models/Response/GitHubApp.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Diagnostics;
34
using System.Globalization;
45

@@ -12,7 +13,7 @@ public class GitHubApp
1213
{
1314
public GitHubApp() { }
1415

15-
public GitHubApp(long id, string slug, string name, User owner, string description, string externalUrl, string htmlUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt)
16+
public GitHubApp(long id, string slug, string name, User owner, string description, string externalUrl, string htmlUrl, DateTimeOffset createdAt, DateTimeOffset updatedAt, InstallationPermissions permissions, IReadOnlyList<string> events)
1617
{
1718
Id = id;
1819
Slug = slug;
@@ -23,6 +24,8 @@ public GitHubApp(long id, string slug, string name, User owner, string descripti
2324
HtmlUrl = htmlUrl;
2425
CreatedAt = createdAt;
2526
UpdatedAt = updatedAt;
27+
Permissions = permissions;
28+
Events = events;
2629
}
2730

2831
/// <summary>
@@ -70,6 +73,16 @@ public GitHubApp(long id, string slug, string name, User owner, string descripti
7073
/// </summary>
7174
public DateTimeOffset UpdatedAt { get; private set; }
7275

76+
/// <summary>
77+
/// The Permissions granted to the Installation
78+
/// </summary>
79+
public InstallationPermissions Permissions { get; private set; }
80+
81+
/// <summary>
82+
/// The Events subscribed to by the Installation
83+
/// </summary>
84+
public IReadOnlyList<string> Events { get; private set; }
85+
7386
internal string DebuggerDisplay
7487
{
7588
get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} Name: {1}", Id, Name); }

Octokit/Models/Response/InstallationPermissions.cs

Lines changed: 175 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,111 +9,246 @@ public class InstallationPermissions
99
{
1010
public InstallationPermissions() { }
1111

12-
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)
12+
public InstallationPermissions
13+
(
14+
InstallationPermissionLevel? actions,
15+
InstallationPermissionLevel? administration,
16+
InstallationPermissionLevel? checks,
17+
InstallationPermissionLevel? contents,
18+
InstallationPermissionLevel? deployments,
19+
InstallationPermissionLevel? environments,
20+
InstallationPermissionLevel? issues,
21+
InstallationPermissionLevel? metadata,
22+
InstallationPermissionLevel? packages,
23+
InstallationPermissionLevel? pages,
24+
InstallationPermissionLevel? pullRequests,
25+
InstallationPermissionLevel? repositoryAnnouncementBanners,
26+
InstallationPermissionLevel? repositoryHooks,
27+
InstallationPermissionLevel? repositoryProjects,
28+
InstallationPermissionLevel? secretScanningAlerts,
29+
InstallationPermissionLevel? secrets,
30+
InstallationPermissionLevel? securityEvents,
31+
InstallationPermissionLevel? singleFile,
32+
InstallationPermissionLevel? statuses,
33+
InstallationPermissionLevel? vulnerabilityAlerts,
34+
InstallationPermissionLevel? workflows,
35+
InstallationPermissionLevel? members,
36+
InstallationPermissionLevel? organizationAdministration,
37+
InstallationPermissionLevel? organizationCustomRoles,
38+
InstallationPermissionLevel? organizationAnnouncementBanners,
39+
InstallationPermissionLevel? organizationHooks,
40+
InstallationPermissionLevel? organizationPlan,
41+
InstallationPermissionLevel? organizationProjects,
42+
InstallationPermissionLevel? organizationPackages,
43+
InstallationPermissionLevel? organizationSecrets,
44+
InstallationPermissionLevel? organizationSelfHostedRunners,
45+
InstallationPermissionLevel? organizationUserBlocking,
46+
InstallationPermissionLevel? teamDiscussions
47+
)
1348
{
14-
Metadata = metadata;
49+
Actions = actions;
1550
Administration = administration;
16-
Statuses = statuses;
51+
Checks = checks;
52+
Contents = contents;
1753
Deployments = deployments;
54+
Environments = environments;
1855
Issues = issues;
56+
Metadata = metadata;
57+
Packages = packages;
1958
Pages = pages;
2059
PullRequests = pullRequests;
21-
Contents = contents;
22-
SingleFile = singleFile;
60+
RepositoryAnnouncementBanners = repositoryAnnouncementBanners;
61+
RepositoryHooks = repositoryHooks;
2362
RepositoryProjects = repositoryProjects;
63+
SecretScanningAlerts = secretScanningAlerts;
64+
Secrets = secrets;
65+
SecurityEvents = securityEvents;
66+
SingleFile = singleFile;
67+
Statuses = statuses;
68+
VulnerabilityAlerts = vulnerabilityAlerts;
69+
Workflows = workflows;
2470
Members = members;
71+
OrganizationAdministration = organizationAdministration;
72+
OrganizationCustomRoles = organizationCustomRoles;
73+
OrganizationAnnouncementBanners = organizationAnnouncementBanners;
74+
OrganizationHooks = organizationHooks;
75+
OrganizationPlan = organizationPlan;
2576
OrganizationProjects = organizationProjects;
77+
OrganizationPackages = organizationPackages;
78+
OrganizationSecrets = organizationSecrets;
79+
OrganizationSelfHostedRunners = organizationSelfHostedRunners;
80+
OrganizationUserBlocking = organizationUserBlocking;
2681
TeamDiscussions = teamDiscussions;
27-
Checks = checks;
2882
}
2983

3084
/// <summary>
31-
/// Repository metadata
32-
/// Search repositories, list collaborators, and access repository metadata.
85+
/// The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts.
3386
/// </summary>
34-
public StringEnum<InstallationPermissionLevel>? Metadata { get; private set; }
87+
public StringEnum<InstallationPermissionLevel>? Actions { get; private set; }
3588

3689
/// <summary>
37-
/// Repository administration
38-
/// Repository creation, deletion, settings, teams, and collaborators.
90+
/// The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation.
3991
/// </summary>
4092
public StringEnum<InstallationPermissionLevel>? Administration { get; private set; }
4193

4294
/// <summary>
43-
/// Commit statuses
44-
/// Commit statuses.
95+
/// The level of permission to grant the access token for checks on code.
4596
/// </summary>
46-
public StringEnum<InstallationPermissionLevel>? Statuses { get; private set; }
97+
public StringEnum<InstallationPermissionLevel>? Checks { get; private set; }
98+
99+
/// <summary>
100+
/// The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges.
101+
/// </summary>
102+
public StringEnum<InstallationPermissionLevel>? Contents { get; private set; }
47103

48104
/// <summary>
49-
/// Deployments
50-
/// Deployments and deployment statuses.
105+
/// The level of permission to grant the access token for deployments and deployment statuses.
51106
/// </summary>
52107
public StringEnum<InstallationPermissionLevel>? Deployments { get; private set; }
53108

54109
/// <summary>
55-
/// Issues
56-
/// Issues and related comments, assignees, labels, and milestones.
110+
/// The level of permission to grant the access token for managing repository environments.
111+
/// </summary>
112+
public StringEnum<InstallationPermissionLevel>? Environments { get; private set; }
113+
114+
/// <summary>
115+
/// The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones.
57116
/// </summary>
58117
public StringEnum<InstallationPermissionLevel>? Issues { get; private set; }
59118

60119
/// <summary>
61-
/// Pages
62-
/// Retrieve Pages statuses, configuration, and builds, as well as create new builds.
120+
/// The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.
121+
/// </summary>
122+
public StringEnum<InstallationPermissionLevel>? Metadata { get; private set; }
123+
124+
/// <summary>
125+
/// The level of permission to grant the access token for packages published to GitHub Packages.
126+
/// </summary>
127+
public StringEnum<InstallationPermissionLevel>? Packages { get; private set; }
128+
129+
/// <summary>
130+
/// The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds.
63131
/// </summary>
64132
public StringEnum<InstallationPermissionLevel>? Pages { get; private set; }
65133

66134
/// <summary>
67-
/// Pull requests
68-
/// Pull requests and related comments, assignees, labels, milestones, and merges.
135+
/// The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges.
69136
/// </summary>
70137
public StringEnum<InstallationPermissionLevel>? PullRequests { get; private set; }
71138

72139
/// <summary>
73-
/// Repository contents
74-
/// Repository contents, commits, branches, downloads, releases, and merges.
140+
/// The level of permission to grant the access token to view and manage announcement banners for a repository.
75141
/// </summary>
76-
public StringEnum<InstallationPermissionLevel>? Contents { get; private set; }
142+
public StringEnum<InstallationPermissionLevel>? RepositoryAnnouncementBanners { get; private set; }
77143

78144
/// <summary>
79-
/// Single file
80-
/// Manage just a single file.
145+
/// The level of permission to grant the access token to manage the post-receive hooks for a repository.
81146
/// </summary>
82-
public StringEnum<InstallationPermissionLevel>? SingleFile { get; private set; }
147+
public StringEnum<InstallationPermissionLevel>? RepositoryHooks { get; private set; }
83148

84149
/// <summary>
85-
/// Repository projects
86-
/// Manage repository projects, columns, and cards.
150+
/// The level of permission to grant the access token to manage repository projects, columns, and cards.
87151
/// </summary>
88152
public StringEnum<InstallationPermissionLevel>? RepositoryProjects { get; private set; }
89153

90154
/// <summary>
91-
/// Checks
92-
/// Detailed information about CI checks
155+
/// The level of permission to grant the access token to view and manage secret scanning alerts.
93156
/// </summary>
94-
public StringEnum<InstallationPermissionLevel>? Checks { get; private set; }
157+
public StringEnum<InstallationPermissionLevel>? SecretScanningAlerts { get; private set; }
95158

96159
/// <summary>
97-
/// Organization members (only applicable when installed for an Organization )
98-
/// Organization members and teams.
160+
/// The level of permission to grant the access token to manage repository secrets.
161+
/// </summary>
162+
public StringEnum<InstallationPermissionLevel>? Secrets { get; private set; }
163+
164+
/// <summary>
165+
/// The level of permission to grant the access token to view and manage security events like code scanning alerts.
166+
/// </summary>
167+
public StringEnum<InstallationPermissionLevel>? SecurityEvents { get; private set; }
168+
169+
/// <summary>
170+
/// The level of permission to grant the access token to manage just a single file.
171+
/// </summary>
172+
public StringEnum<InstallationPermissionLevel>? SingleFile { get; private set; }
173+
174+
/// <summary>
175+
/// The level of permission to grant the access token for commit statuses.
176+
/// </summary>
177+
public StringEnum<InstallationPermissionLevel>? Statuses { get; private set; }
178+
179+
/// <summary>
180+
/// The level of permission to grant the access token to manage Dependabot alerts.
181+
/// </summary>
182+
public StringEnum<InstallationPermissionLevel>? VulnerabilityAlerts { get; private set; }
183+
184+
/// <summary>
185+
/// The level of permission to grant the access token to update GitHub Actions workflow files.
186+
/// </summary>
187+
public StringEnum<InstallationPermissionLevel>? Workflows { get; private set; }
188+
189+
/// <summary>
190+
/// The level of permission to grant the access token for organization teams and members.
99191
/// </summary>
100192
public StringEnum<InstallationPermissionLevel>? Members { get; private set; }
101193

102194
/// <summary>
103-
/// Organization projects (only applicable when installed for an Organization )
104-
/// Manage organization projects, columns, and cards.
195+
/// The level of permission to grant the access token to manage access to an organization.
196+
/// </summary>
197+
public StringEnum<InstallationPermissionLevel>? OrganizationAdministration { get; private set; }
198+
199+
/// <summary>
200+
/// The level of permission to grant the access token for custom roles management. This property is in beta and is subject to change.
201+
/// </summary>
202+
public StringEnum<InstallationPermissionLevel>? OrganizationCustomRoles { get; private set; }
203+
204+
/// <summary>
205+
/// The level of permission to grant the access token to view and manage announcement banners for an organization.
206+
/// </summary>
207+
public StringEnum<InstallationPermissionLevel>? OrganizationAnnouncementBanners { get; private set; }
208+
209+
/// <summary>
210+
/// The level of permission to grant the access token to manage the post-receive hooks for an organization.
211+
/// </summary>
212+
public StringEnum<InstallationPermissionLevel>? OrganizationHooks { get; private set; }
213+
214+
/// <summary>
215+
/// The level of permission to grant the access token for viewing an organization's plan.
216+
/// </summary>
217+
public StringEnum<InstallationPermissionLevel>? OrganizationPlan { get; private set; }
218+
219+
/// <summary>
220+
/// The level of permission to grant the access token to manage organization projects and projects beta (where available).
105221
/// </summary>
106222
public StringEnum<InstallationPermissionLevel>? OrganizationProjects { get; private set; }
107223

108224
/// <summary>
109-
/// Team discussions (only applicable when installed for an Organization )
110-
/// Team discussions.
225+
/// The level of permission to grant the access token for organization packages published to GitHub Packages.
226+
/// </summary>
227+
public StringEnum<InstallationPermissionLevel>? OrganizationPackages { get; private set; }
228+
229+
/// <summary>
230+
/// The level of permission to grant the access token to manage organization secrets.
231+
/// </summary>
232+
public StringEnum<InstallationPermissionLevel>? OrganizationSecrets { get; private set; }
233+
234+
/// <summary>
235+
/// The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization.
236+
/// </summary>
237+
public StringEnum<InstallationPermissionLevel>? OrganizationSelfHostedRunners { get; private set; }
238+
239+
/// <summary>
240+
/// The level of permission to grant the access token to view and manage users blocked by the organization.
241+
/// </summary>
242+
public StringEnum<InstallationPermissionLevel>? OrganizationUserBlocking { get; private set; }
243+
244+
/// <summary>
245+
/// The level of permission to grant the access token to manage team discussions and related comments.
111246
/// </summary>
112247
public StringEnum<InstallationPermissionLevel>? TeamDiscussions { get; private set; }
113248

114249
internal string DebuggerDisplay
115250
{
116-
get { return string.Format(CultureInfo.InvariantCulture, "Metadata: {0}, Contents: {1}, Issues: {2}, Single File: {3}", Metadata, Contents, Issues, SingleFile); }
251+
get => $"Actions: {Actions}, Administration: {Administration}, Checks: {Checks}, Contents: {Contents}, Deployments: {Deployments}, Environments: {Environments}, Issues: {Issues}, Metadata: {Metadata}, Packages: {Packages}, Pages: {Pages}, PullRequests: {PullRequests}, RepositoryAnnouncementBanners: {RepositoryAnnouncementBanners}, RepositoryHooks: {RepositoryHooks}, RepositoryProjects: {RepositoryProjects}, SecretScanningAlerts: {SecretScanningAlerts}, Secrets: {Secrets}, SecurityEvents: {SecurityEvents}, SingleFile: {SingleFile}, Statuses: {Statuses}, VulnerabilityAlerts: {VulnerabilityAlerts}, Workflows: {Workflows}, Members: {Members}, OrganizationAdministration: {OrganizationAdministration}, OrganizationCustomRoles: {OrganizationCustomRoles}, OrganizationAnnouncementBanners: {OrganizationAnnouncementBanners}, OrganizationHooks: {OrganizationHooks}, OrganizationPlan: {OrganizationPlan}, OrganizationProjects: {OrganizationProjects}, OrganizationPackages: {OrganizationPackages}, OrganizationSecrets: {OrganizationSecrets}, OrganizationSelfHostedRunners: {OrganizationSelfHostedRunners}, OrganizationUserBlocking: {OrganizationUserBlocking}, TeamDiscussions: {TeamDiscussions}";
117252
}
118253
}
119254

0 commit comments

Comments
 (0)