mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 03:55:55 +00:00
add RequiredApprovingReview preview functionality to branch protection calls (#1912)
This commit is contained in:
@@ -13,6 +13,8 @@ namespace Octokit
|
||||
/// </remarks>
|
||||
public class RepositoryBranchesClient : ApiClient, IRepositoryBranchesClient
|
||||
{
|
||||
private string protectedBranchesPreviewHeaders = AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.ProtectedBranchesRequiredApprovingApiPreview);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new GitHub Repository Branches API client.
|
||||
/// </summary>
|
||||
@@ -66,7 +68,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return ApiConnection.GetAll<Branch>(ApiUrls.RepoBranches(owner, name), null, AcceptHeaders.ProtectedBranchesApiPreview, options);
|
||||
return ApiConnection.GetAll<Branch>(ApiUrls.RepoBranches(owner, name), null, protectedBranchesPreviewHeaders, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +83,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return ApiConnection.GetAll<Branch>(ApiUrls.RepoBranches(repositoryId), null, AcceptHeaders.ProtectedBranchesApiPreview, options);
|
||||
return ApiConnection.GetAll<Branch>(ApiUrls.RepoBranches(repositoryId), null, protectedBranchesPreviewHeaders, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -99,7 +101,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<Branch>(ApiUrls.RepoBranch(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<Branch>(ApiUrls.RepoBranch(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -114,7 +116,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<Branch>(ApiUrls.RepoBranch(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<Branch>(ApiUrls.RepoBranch(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -132,7 +134,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,7 +149,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -167,7 +169,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(update, nameof(update));
|
||||
|
||||
return ApiConnection.Put<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(owner, name, branch), update, null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Put<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(owner, name, branch), update, null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -184,7 +186,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(update, nameof(update));
|
||||
|
||||
return ApiConnection.Put<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(repositoryId, branch), update, null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Put<BranchProtectionSettings>(ApiUrls.RepoBranchProtection(repositoryId, branch), update, null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -205,7 +207,7 @@ namespace Octokit
|
||||
var endpoint = ApiUrls.RepoBranchProtection(owner, name, branch);
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -229,7 +231,7 @@ namespace Octokit
|
||||
var endpoint = ApiUrls.RepoBranchProtection(repositoryId, branch);
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -253,7 +255,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -268,7 +270,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -288,7 +290,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(update, nameof(update));
|
||||
|
||||
return ApiConnection.Patch<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(owner, name, branch), update, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Patch<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(owner, name, branch), update, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -305,7 +307,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(update, nameof(update));
|
||||
|
||||
return ApiConnection.Patch<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(repositoryId, branch), update, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Patch<BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(repositoryId, branch), update, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -327,7 +329,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -352,7 +354,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -376,7 +378,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -391,7 +393,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -411,7 +413,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(contexts, nameof(contexts));
|
||||
|
||||
return ApiConnection.Put<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), contexts, null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Put<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), contexts, null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -428,7 +430,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(contexts, nameof(contexts));
|
||||
|
||||
return ApiConnection.Put<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), contexts, null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Put<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), contexts, null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -448,7 +450,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(contexts, nameof(contexts));
|
||||
|
||||
return ApiConnection.Post<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), contexts, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Post<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), contexts, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -465,7 +467,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(contexts, nameof(contexts));
|
||||
|
||||
return ApiConnection.Post<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), contexts, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Post<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), contexts, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -485,7 +487,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(contexts, nameof(contexts));
|
||||
|
||||
return ApiConnection.Delete<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), contexts, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Delete<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(owner, name, branch), contexts, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -502,7 +504,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(contexts, nameof(contexts));
|
||||
|
||||
return ApiConnection.Delete<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), contexts, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Delete<IReadOnlyList<string>>(ApiUrls.RepoRequiredStatusChecksContexts(repositoryId, branch), contexts, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -520,7 +522,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -535,7 +537,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -555,7 +557,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(update, nameof(update));
|
||||
|
||||
return ApiConnection.Patch<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(owner, name, branch), update, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Patch<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(owner, name, branch), update, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -572,7 +574,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(update, nameof(update));
|
||||
|
||||
return ApiConnection.Patch<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(repositoryId, branch), update, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Patch<BranchProtectionRequiredReviews>(ApiUrls.RepoProtectedBranchReviewEnforcement(repositoryId, branch), update, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -594,7 +596,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -619,7 +621,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -643,7 +645,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -658,7 +660,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -676,7 +678,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Post<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(owner, name, branch), new object(), AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Post<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(owner, name, branch), new object(), protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -691,7 +693,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Post<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(repositoryId, branch), new object(), AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Post<EnforceAdmins>(ApiUrls.RepoProtectedBranchAdminEnforcement(repositoryId, branch), new object(), protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -713,7 +715,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -738,7 +740,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -762,7 +764,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionPushRestrictions>(ApiUrls.RepoRestrictions(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionPushRestrictions>(ApiUrls.RepoRestrictions(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -777,7 +779,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<BranchProtectionPushRestrictions>(ApiUrls.RepoRestrictions(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<BranchProtectionPushRestrictions>(ApiUrls.RepoRestrictions(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -799,7 +801,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -824,7 +826,7 @@ namespace Octokit
|
||||
|
||||
try
|
||||
{
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, AcceptHeaders.ProtectedBranchesApiPreview).ConfigureAwait(false);
|
||||
var httpStatusCode = await Connection.Delete(endpoint, null, protectedBranchesPreviewHeaders).ConfigureAwait(false);
|
||||
return httpStatusCode == HttpStatusCode.NoContent;
|
||||
}
|
||||
catch (NotFoundException)
|
||||
@@ -848,7 +850,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), null, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Get<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), null, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -863,7 +865,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), null, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Get<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), null, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -883,7 +885,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(teams, nameof(teams));
|
||||
|
||||
return ApiConnection.Put<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), teams, null, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Put<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), teams, null, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -900,7 +902,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(teams, nameof(teams));
|
||||
|
||||
return ApiConnection.Put<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), teams, null, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Put<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), teams, null, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -920,7 +922,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(teams, nameof(teams));
|
||||
|
||||
return ApiConnection.Post<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), teams, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Post<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), teams, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -937,7 +939,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(teams, nameof(teams));
|
||||
|
||||
return ApiConnection.Post<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), teams, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Post<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), teams, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -957,7 +959,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(teams, nameof(teams));
|
||||
|
||||
return ApiConnection.Delete<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), teams, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Delete<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(owner, name, branch), teams, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -974,7 +976,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(teams, nameof(teams));
|
||||
|
||||
return ApiConnection.Delete<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), teams, AcceptHeaders.Concat(AcceptHeaders.ProtectedBranchesApiPreview, AcceptHeaders.NestedTeamsPreview));
|
||||
return ApiConnection.Delete<IReadOnlyList<Team>>(ApiUrls.RepoRestrictionsTeams(repositoryId, branch), teams, AcceptHeaders.Concat(protectedBranchesPreviewHeaders, AcceptHeaders.NestedTeamsPreview));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -992,7 +994,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1007,7 +1009,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
|
||||
return ApiConnection.Get<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Get<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1027,7 +1029,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(users, nameof(users));
|
||||
|
||||
return ApiConnection.Put<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), users, null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Put<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), users, null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1044,7 +1046,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(users, nameof(users));
|
||||
|
||||
return ApiConnection.Put<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), users, null, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Put<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), users, null, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1064,7 +1066,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(users, nameof(users));
|
||||
|
||||
return ApiConnection.Post<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), users, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Post<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), users, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1081,7 +1083,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(users, nameof(users));
|
||||
|
||||
return ApiConnection.Post<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), users, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Post<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), users, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1101,7 +1103,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(users, nameof(users));
|
||||
|
||||
return ApiConnection.Delete<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), users, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Delete<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(owner, name, branch), users, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1118,7 +1120,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(branch, nameof(branch));
|
||||
Ensure.ArgumentNotNull(users, nameof(users));
|
||||
|
||||
return ApiConnection.Delete<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), users, AcceptHeaders.ProtectedBranchesApiPreview);
|
||||
return ApiConnection.Delete<IReadOnlyList<User>>(ApiUrls.RepoRestrictionsUsers(repositoryId, branch), users, protectedBranchesPreviewHeaders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user