Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors in ObservableEventsClient caused by incorrect return types #1490

Merged
merged 4 commits into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Octokit.Reactive/Clients/IObservableEventsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public interface IObservableEventsClient
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
IObservable<Activity> GetAllIssuesForRepository(string owner, string name);
IObservable<IssueEvent> GetAllIssuesForRepository(string owner, string name);

/// <summary>
/// Gets all the issue events for a given repository
Expand All @@ -85,7 +85,7 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
IObservable<Activity> GetAllIssuesForRepository(long repositoryId);
IObservable<IssueEvent> GetAllIssuesForRepository(long repositoryId);

/// <summary>
/// Gets all the issue events for a given repository
Expand All @@ -96,7 +96,7 @@ public interface IObservableEventsClient
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Activity> GetAllIssuesForRepository(string owner, string name, ApiOptions options);
IObservable<IssueEvent> GetAllIssuesForRepository(string owner, string name, ApiOptions options);

/// <summary>
/// Gets all the issue events for a given repository
Expand All @@ -106,7 +106,7 @@ public interface IObservableEventsClient
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="options">Options for changing the API response</param>
IObservable<Activity> GetAllIssuesForRepository(long repositoryId, ApiOptions options);
IObservable<IssueEvent> GetAllIssuesForRepository(long repositoryId, ApiOptions options);

/// <summary>
/// Gets all the events for a given repository network
Expand Down
16 changes: 8 additions & 8 deletions Octokit.Reactive/Clients/ObservableEventsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ public IObservable<Activity> GetAllForRepository(long repositoryId, ApiOptions o
}

/// <summary>
/// Gets all the events for a given repository
/// Gets all the issue events for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
public IObservable<Activity> GetAllIssuesForRepository(string owner, string name)
public IObservable<IssueEvent> GetAllIssuesForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Expand All @@ -129,27 +129,27 @@ public IObservable<Activity> GetAllIssuesForRepository(string owner, string name
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
public IObservable<Activity> GetAllIssuesForRepository(long repositoryId)
public IObservable<IssueEvent> GetAllIssuesForRepository(long repositoryId)
{
return GetAllIssuesForRepository(repositoryId, ApiOptions.None);
}

/// <summary>
/// Gets all the events for a given repository
/// Gets all the issue events for a given repository
/// </summary>
/// <remarks>
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Activity> GetAllIssuesForRepository(string owner, string name, ApiOptions options)
public IObservable<IssueEvent> GetAllIssuesForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Activity>(ApiUrls.IssuesEvents(owner, name), options);
return _connection.GetAndFlattenAllPages<IssueEvent>(ApiUrls.IssuesEvents(owner, name), options);
}

/// <summary>
Expand All @@ -160,11 +160,11 @@ public IObservable<Activity> GetAllIssuesForRepository(string owner, string name
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="options">Options for changing the API response</param>
public IObservable<Activity> GetAllIssuesForRepository(long repositoryId, ApiOptions options)
public IObservable<IssueEvent> GetAllIssuesForRepository(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");

return _connection.GetAndFlattenAllPages<Activity>(ApiUrls.IssuesEvents(repositoryId), options);
return _connection.GetAndFlattenAllPages<IssueEvent>(ApiUrls.IssuesEvents(repositoryId), options);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public TheGetAllIssuesForRepositoryMethod()
_eventsClient = new ObservableEventsClient(Helper.GetAuthenticatedClient());
}

[IntegrationTest(Skip = "These tests just don't work any more")]
[IntegrationTest]
public async Task ReturnsRepositoryEvents()
{
var options = new ApiOptions
Expand All @@ -185,7 +185,7 @@ public async Task ReturnsRepositoryEvents()
Assert.NotEmpty(repositoryEvents);
}

[IntegrationTest(Skip = "These tests just don't work any more")]
[IntegrationTest]
public async Task ReturnsCorrectCountOfRepositoryEventsWithoutStart()
{
var options = new ApiOptions
Expand All @@ -199,7 +199,7 @@ public async Task ReturnsCorrectCountOfRepositoryEventsWithoutStart()
Assert.Equal(5, repositoryEvents.Count);
}

[IntegrationTest(Skip = "These tests just don't work any more")]
[IntegrationTest]
public async Task ReturnsCorrectCountOfRepositoryEventsWithStart()
{
var options = new ApiOptions
Expand All @@ -214,7 +214,7 @@ public async Task ReturnsCorrectCountOfRepositoryEventsWithStart()
Assert.Equal(5, repositoryEvents.Count);
}

[IntegrationTest(Skip = "These tests just don't work any more")]
[IntegrationTest]
public async Task ReturnsDistinctRepositoryEventsBasedOnStartPage()
{
var startOptions = new ApiOptions
Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests/Clients/EventsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public async Task RequestsCorrectUrl()

await client.GetAllIssuesForRepository("fake", "repo");

connection.Received().GetAll<Activity>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), Args.ApiOptions);
connection.Received().GetAll<IssueEvent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), Args.ApiOptions);
}

[Fact]
Expand All @@ -165,7 +165,7 @@ public async Task RequestsCorrectUrlWithRepositoryId()

await client.GetAllIssuesForRepository(1);

connection.Received().GetAll<Activity>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), Args.ApiOptions);
connection.Received().GetAll<IssueEvent>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), Args.ApiOptions);
}

[Fact]
Expand All @@ -183,7 +183,7 @@ public async Task RequestsCorrectUrlWithApiOptions()

await client.GetAllIssuesForRepository("fake", "repo", options);

connection.Received().GetAll<Activity>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), options);
connection.Received().GetAll<IssueEvent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), options);
}

[Fact]
Expand All @@ -201,7 +201,7 @@ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions()

await client.GetAllIssuesForRepository(1, options);

connection.Received().GetAll<Activity>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), options);
connection.Received().GetAll<IssueEvent>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), options);
}

[Fact]
Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests/Reactive/ObservableEventsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void RequestsCorrectUrl()

client.GetAllIssuesForRepository("fake", "repo");

gitHubClient.Connection.Received(1).Get<List<Activity>>(new Uri("repos/fake/repo/issues/events", UriKind.Relative),
gitHubClient.Connection.Received(1).Get<List<IssueEvent>>(new Uri("repos/fake/repo/issues/events", UriKind.Relative),
Args.EmptyDictionary, null);
}

Expand All @@ -168,7 +168,7 @@ public void RequestsCorrectUrlWithRepositoryId()

client.GetAllIssuesForRepository(1);

gitHubClient.Connection.Received(1).Get<List<Activity>>(new Uri("repositories/1/issues/events", UriKind.Relative),
gitHubClient.Connection.Received(1).Get<List<IssueEvent>>(new Uri("repositories/1/issues/events", UriKind.Relative),
Args.EmptyDictionary, null);
}

Expand All @@ -187,7 +187,7 @@ public void RequestsCorrectUrlWithApiOptions()

client.GetAllIssuesForRepository("fake", "repo", options);

gitHubClient.Connection.Received(1).Get<List<Activity>>(new Uri("repos/fake/repo/issues/events", UriKind.Relative),
gitHubClient.Connection.Received(1).Get<List<IssueEvent>>(new Uri("repos/fake/repo/issues/events", UriKind.Relative),
Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null);
}

Expand All @@ -206,7 +206,7 @@ public void RequestsCorrectUrlWithRepositoryIdWithApiOptions()

client.GetAllIssuesForRepository(1, options);

gitHubClient.Connection.Received(1).Get<List<Activity>>(new Uri("repositories/1/issues/events", UriKind.Relative),
gitHubClient.Connection.Received(1).Get<List<IssueEvent>>(new Uri("repositories/1/issues/events", UriKind.Relative),
Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null);
}

Expand Down
12 changes: 6 additions & 6 deletions Octokit/Clients/EventsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public Task<IReadOnlyList<Activity>> GetAllForRepository(long repositoryId, ApiO
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(string owner, string name)
public Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Expand All @@ -130,7 +130,7 @@ public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(string owner, str
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(long repositoryId)
public Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(long repositoryId)
{
return GetAllIssuesForRepository(repositoryId, ApiOptions.None);
}
Expand All @@ -144,13 +144,13 @@ public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(long repositoryId
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options for changing the API response</param>
public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(string owner, string name, ApiOptions options)
public Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");

return ApiConnection.GetAll<Activity>(ApiUrls.IssuesEvents(owner, name), options);
return ApiConnection.GetAll<IssueEvent>(ApiUrls.IssuesEvents(owner, name), options);
}

/// <summary>
Expand All @@ -161,11 +161,11 @@ public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(string owner, str
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="options">Options for changing the API response</param>
public Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(long repositoryId, ApiOptions options)
public Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");

return ApiConnection.GetAll<Activity>(ApiUrls.IssuesEvents(repositoryId), options);
return ApiConnection.GetAll<IssueEvent>(ApiUrls.IssuesEvents(repositoryId), options);
}

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Octokit/Clients/IEventsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public interface IEventsClient
/// </remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(string owner, string name);
Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(string owner, string name);

/// <summary>
/// Gets all the issue events for a given repository
Expand All @@ -87,7 +87,7 @@ public interface IEventsClient
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(long repositoryId);
Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(long repositoryId);

/// <summary>
/// Gets all the issue events for a given repository
Expand All @@ -98,7 +98,7 @@ public interface IEventsClient
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="options">Options for changing the API response</param>
Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(string owner, string name, ApiOptions options);
Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(string owner, string name, ApiOptions options);

/// <summary>
/// Gets all the issue events for a given repository
Expand All @@ -108,7 +108,7 @@ public interface IEventsClient
/// </remarks>
/// <param name="repositoryId">The Id of the repository</param>
/// <param name="options">Options for changing the API response</param>
Task<IReadOnlyList<Activity>> GetAllIssuesForRepository(long repositoryId, ApiOptions options);
Task<IReadOnlyList<IssueEvent>> GetAllIssuesForRepository(long repositoryId, ApiOptions options);

/// <summary>
/// Gets all the events for a given repository network
Expand Down