mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
Implement Enterprise Search Indexing Client and unit/integration tests
This commit is contained in:
committed by
Ryan Gribble
parent
d7d79076bf
commit
b50b2c737f
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
using Octokit.Tests.Integration.Helpers;
|
||||
using Xunit;
|
||||
|
||||
public class EnterpriseSearchIndexingClientTests
|
||||
{
|
||||
readonly IGitHubClient _github;
|
||||
|
||||
public EnterpriseSearchIndexingClientTests()
|
||||
{
|
||||
_github = EnterpriseHelper.GetAuthenticatedClient();
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueOwner()
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.Queue(EnterpriseHelper.UserName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("was added to the indexing queue")));
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueRepository()
|
||||
{
|
||||
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"));
|
||||
using (var context = await _github.CreateRepositoryContext(newRepository))
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.Queue(EnterpriseHelper.UserName, context.RepositoryName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("was added to the indexing queue")));
|
||||
}
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueAll()
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.QueueAll(EnterpriseHelper.UserName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("was added to the indexing queue")));
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueAllCodeOwner()
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.QueueAllCode(EnterpriseHelper.UserName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("was added to the indexing queue")));
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueAllCodeRepository()
|
||||
{
|
||||
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"));
|
||||
using (var context = await _github.CreateRepositoryContext(newRepository))
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.QueueAllCode(EnterpriseHelper.UserName, context.RepositoryName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("was added to the indexing queue")));
|
||||
}
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueAllIssuesOwner()
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.QueueAllIssues(EnterpriseHelper.UserName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("were added to the indexing queue")));
|
||||
}
|
||||
|
||||
[GitHubEnterpriseTest]
|
||||
public async Task CanQueueAllIssuesRepository()
|
||||
{
|
||||
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"));
|
||||
using (var context = await _github.CreateRepositoryContext(newRepository))
|
||||
{
|
||||
var response = await
|
||||
_github.Enterprise.SearchIndexing.QueueAllIssues(EnterpriseHelper.UserName, context.RepositoryName);
|
||||
|
||||
Assert.NotNull(response);
|
||||
Assert.NotNull(response.Message);
|
||||
Assert.True(response.Message.All(m => m.Contains("were added to the indexing queue")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,6 +79,7 @@
|
||||
<Compile Include="Clients\BranchesClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseLicenseClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseAdminStatsClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseOrganizationClientTests.cs" />
|
||||
<Compile Include="Clients\GitHubClientTests.cs" />
|
||||
<Compile Include="Clients\MergingClientTests.cs" />
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Clients
|
||||
{
|
||||
public class EnterpriseSearchIndexingClientTests
|
||||
{
|
||||
public class TheQueueMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
string expectedUri = "staff/indexing_jobs";
|
||||
|
||||
client.Queue("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
|
||||
client.Queue("org", "repo");
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PassesRequestObject()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
client.Queue("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org"
|
||||
));
|
||||
|
||||
client.Queue("org", "repo");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org/repo"
|
||||
));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Queue(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Queue("org", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Queue(null, "repo"));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheQueueAllMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
string expectedUri = "staff/indexing_jobs";
|
||||
client.QueueAll("org");
|
||||
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PassesRequestObject()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
client.QueueAll("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org/*"
|
||||
));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAll(null));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheQueueAllCodeMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
string expectedUri = "staff/indexing_jobs";
|
||||
|
||||
client.QueueAllCode("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
|
||||
client.QueueAllCode("org", "repo");
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PassesRequestObject()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
client.QueueAllCode("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org/*/code"
|
||||
));
|
||||
|
||||
client.QueueAllCode("org", "repo");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org/repo/code"
|
||||
));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAllCode(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAllCode("org", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAllCode(null, "repo"));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheQueueAllIssuesMethod
|
||||
{
|
||||
[Fact]
|
||||
public void RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
string expectedUri = "staff/indexing_jobs";
|
||||
|
||||
client.QueueAllIssues("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
|
||||
client.QueueAllIssues("org", "repo");
|
||||
connection.Received().Post<SearchIndexingResponse>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PassesRequestObject()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
client.QueueAllIssues("org");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org/*/issues"
|
||||
));
|
||||
|
||||
client.QueueAllIssues("org", "repo");
|
||||
connection.Received().Post<SearchIndexingResponse>(
|
||||
Arg.Any<Uri>(),
|
||||
Arg.Is<SearchIndexTarget>(t =>
|
||||
t.Target == "org/repo/issues"
|
||||
));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new EnterpriseSearchIndexingClient(connection);
|
||||
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAllIssues(null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAllIssues("org", null));
|
||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.QueueAllIssues(null, "repo"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,7 @@
|
||||
<Compile Include="Clients\Enterprise\EnterpriseAdminStatsClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseOrganizationClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseLicenseClientTests.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClientTests.cs" />
|
||||
<Compile Include="Clients\MergingClientTests.cs" />
|
||||
<Compile Include="Clients\OauthClientTests.cs" />
|
||||
<Compile Include="Clients\RepositoryCommentsClientTests.cs" />
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
AdminStats = new EnterpriseAdminStatsClient(apiConnection);
|
||||
License = new EnterpriseLicenseClient(apiConnection);
|
||||
Organization = new EnterpriseOrganizationClient(apiConnection);
|
||||
SearchIndexing = new EnterpriseSearchIndexingClient(apiConnection);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,5 +43,13 @@
|
||||
/// See the <a href="https://developer.github.com/v3/enterprise/orgs/">Enterprise Organization API documentation</a> for more information.
|
||||
///</remarks>
|
||||
public IEnterpriseOrganizationClient Organization { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// A client for GitHub's Enterprise Search Indexing API
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/enterprise/search_indexing/">Enterprise Search Indexing API documentation</a> for more information.
|
||||
///</remarks>
|
||||
public IEnterpriseSearchIndexingClient SearchIndexing { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
157
Octokit/Clients/Enterprise/EnterpriseSearchIndexingClient.cs
Normal file
157
Octokit/Clients/Enterprise/EnterpriseSearchIndexingClient.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Enterprise Search Indexing API
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/enterprise/search_indexing/">Enterprise Search Indexing API documentation</a> for more information.
|
||||
///</remarks>
|
||||
public class EnterpriseSearchIndexingClient : ApiClient, IEnterpriseSearchIndexingClient
|
||||
{
|
||||
public EnterpriseSearchIndexingClient(IApiConnection apiConnection)
|
||||
: base(apiConnection)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for a user or organization account (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> Queue(string owner)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}", owner));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for a repository (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <param name="repository">A repository</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> Queue(string owner, string repository)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
Ensure.ArgumentNotNull(repository, "repository");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", owner, repository));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all of a user or organization's repositories (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> QueueAll(string owner)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/*", owner));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the issues in a repository (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <param name="repository">A repository</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> QueueAllIssues(string owner, string repository)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
Ensure.ArgumentNotNull(repository, "repository");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/{1}/issues", owner, repository));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the issues in all of a user or organization's repositories (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> QueueAllIssues(string owner)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/*/issues", owner));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the source code in a repository (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <param name="repository">A repository</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> QueueAllCode(string owner, string repository)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
Ensure.ArgumentNotNull(repository, "repository");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/{1}/code", owner, repository));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the source code in all of a user or organization's repositories (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
public async Task<SearchIndexingResponse> QueueAllCode(string owner)
|
||||
{
|
||||
Ensure.ArgumentNotNull(owner, "owner");
|
||||
|
||||
var endpoint = ApiUrls.EnterpriseSearchIndexing();
|
||||
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/*/code", owner));
|
||||
|
||||
return await ApiConnection.Post<SearchIndexingResponse>(endpoint, target)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,5 +31,13 @@
|
||||
/// See the <a href="https://developer.github.com/v3/enterprise/orgs/">Enterprise Organization API documentation</a> for more information.
|
||||
///</remarks>
|
||||
IEnterpriseOrganizationClient Organization { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A client for GitHub's Enterprise Search Indexing API
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/enterprise/search_indexing/">Enterprise Search Indexing API documentation</a> for more information.
|
||||
///</remarks>
|
||||
IEnterpriseSearchIndexingClient SearchIndexing { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
/// <summary>
|
||||
/// A client for GitHub's Enterprise Search Indexing API
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// See the <a href="https://developer.github.com/v3/enterprise/search_indexing/">Enterprise Search Indexing API documentation</a> for more information.
|
||||
///</remarks>
|
||||
public interface IEnterpriseSearchIndexingClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Queue an indexing job for a user or organization account (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> Queue(string owner);
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for a repository (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <param name="repository">A repository</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> Queue(string owner, string repository);
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all of a user or organization's repositories (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> QueueAll(string owner);
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the issues in a repository (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <param name="repository">A repository</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> QueueAllIssues(string owner, string repository);
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the issues in all of a user or organization's repositories (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> QueueAllIssues(string owner);
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the source code in a repository (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <param name="repository">A repository</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> QueueAllCode(string owner, string repository);
|
||||
|
||||
/// <summary>
|
||||
/// Queue an indexing job for all the source code in all of a user or organization's repositories (must be Site Admin user).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.github.com/v3/enterprise/search_indexing/#queue-an-indexing-job
|
||||
/// </remarks>
|
||||
/// <param name="owner">A user or organization account</param>
|
||||
/// <returns>The <see cref="SearchIndexingResponse"/> message.</returns>
|
||||
Task<SearchIndexingResponse> QueueAllCode(string owner);
|
||||
}
|
||||
}
|
||||
@@ -1674,6 +1674,11 @@ namespace Octokit
|
||||
return "admin/organizations".FormatUri();
|
||||
}
|
||||
|
||||
public static Uri EnterpriseSearchIndexing()
|
||||
{
|
||||
return "staff/indexing_jobs".FormatUri();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the relative <see cref="Uri"/> for altering administration status of a user.
|
||||
/// </summary>
|
||||
|
||||
12
Octokit/Models/Request/Enterprise/SearchIndexingTarget.cs
Normal file
12
Octokit/Models/Request/Enterprise/SearchIndexingTarget.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Octokit
|
||||
{
|
||||
public class SearchIndexTarget
|
||||
{
|
||||
public SearchIndexTarget(string target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public string Target { get; protected set; }
|
||||
}
|
||||
}
|
||||
33
Octokit/Models/Response/Enterprise/SearchIndexingResponse.cs
Normal file
33
Octokit/Models/Response/Enterprise/SearchIndexingResponse.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace Octokit
|
||||
{
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class SearchIndexingResponse
|
||||
{
|
||||
public SearchIndexingResponse() { }
|
||||
|
||||
public SearchIndexingResponse(IReadOnlyList<string> message)
|
||||
{
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public IReadOnlyList<string> Message
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
return String.Format(CultureInfo.InvariantCulture, "Message: {0}", string.Join("\r\n", Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -442,7 +442,11 @@
|
||||
<Compile Include="Models\Response\Enterprise\LicenseInfo.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Models\Request\NewOrganization.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\SearchIndexingTarget.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\SearchIndexingResponse.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -450,6 +450,11 @@
|
||||
<Compile Include="Models\Request\NewOrganization.cs" />
|
||||
<Compile Include="Clients\IUserAdministrationClient.cs" />
|
||||
<Compile Include="Clients\UserAdministrationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\SearchIndexingTarget.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\SearchIndexingResponse.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -446,6 +446,11 @@
|
||||
<Compile Include="Models\Request\NewOrganization.cs" />
|
||||
<Compile Include="Clients\IUserAdministrationClient.cs" />
|
||||
<Compile Include="Clients\UserAdministrationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\SearchIndexingTarget.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\SearchIndexingResponse.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -439,7 +439,11 @@
|
||||
<Compile Include="Models\Response\Enterprise\LicenseInfo.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Models\Request\NewOrganization.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\SearchIndexingTarget.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\SearchIndexingResponse.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -446,7 +446,11 @@
|
||||
<Compile Include="Models\Response\Enterprise\LicenseInfo.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Models\Request\NewOrganization.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\SearchIndexingTarget.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\SearchIndexingResponse.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||
|
||||
@@ -62,10 +62,12 @@
|
||||
<Compile Include="Clients\Enterprise\EnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseLicenseClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\EnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseOrganizationClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseLicenseClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseAdminStatsClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseClient.cs" />
|
||||
<Compile Include="Clients\Enterprise\IEnterpriseSearchIndexingClient.cs" />
|
||||
<Compile Include="Clients\IMergingClient.cs" />
|
||||
<Compile Include="Clients\IOAuthClient.cs" />
|
||||
<Compile Include="Clients\IRepositoryCommitsClient.cs" />
|
||||
@@ -110,13 +112,14 @@
|
||||
<Compile Include="Models\Request\BranchUpdate.cs" />
|
||||
<Compile Include="Models\Request\GistFileUpdate.cs" />
|
||||
<Compile Include="Models\Request\NewArbitraryMarkDown.cs" />
|
||||
<Compile Include="Models\Request\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\NewOrganization.cs" />
|
||||
<Compile Include="Models\Request\NewMerge.cs" />
|
||||
<Compile Include="Models\Request\NewRepositoryWebHook.cs" />
|
||||
<Compile Include="Models\Request\PublicRepositoryRequest.cs" />
|
||||
<Compile Include="Models\Request\ReleaseAssetUpload.cs" />
|
||||
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
||||
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
||||
<Compile Include="Models\Request\Enterprise\SearchIndexingTarget.cs" />
|
||||
<Compile Include="Models\Request\Signature.cs" />
|
||||
<Compile Include="Models\Request\CreateFileRequest.cs" />
|
||||
<Compile Include="Http\Response.cs" />
|
||||
@@ -147,6 +150,7 @@
|
||||
<Compile Include="Models\Response\Enterprise\AdminStatsPages.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\AdminStatsPulls.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\AdminStatsRepos.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\SearchIndexingResponse.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\LicenseInfo.cs" />
|
||||
<Compile Include="Models\Response\Enterprise\AdminStatsUsers.cs" />
|
||||
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||
|
||||
Reference in New Issue
Block a user