using System.Collections.Generic; using System.Threading.Tasks; namespace Octokit { /// /// A client for GitHub's Issue Timeline API. /// /// /// See the Issue Timeline API documentation for more information. /// public class IssueTimelineClient : ApiClient, IIssueTimelineClient { public IssueTimelineClient(IApiConnection apiConnection) : base(apiConnection) { } /// /// Gets all the various events that have occurred around an issue or pull request. /// /// /// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue /// /// The owner of the repository /// The name of the repository /// The issue number [ManualRoute("GET", "/repos/{owner}/{repo}/issues/{issue_number}/timeline")] public Task> GetAllForIssue(string owner, string repo, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(repo, nameof(repo)); return GetAllForIssue(owner, repo, number, ApiOptions.None); } /// /// Gets all the various events that have occurred around an issue or pull request. /// /// /// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue /// /// The owner of the repository /// The name of the repository /// The issue number /// Options for changing the API repsonse [Preview("mockingbird")] [Preview("starfox")] [ManualRoute("GET", "/repos/{owner}/{repo}/issues/{issue_number}/timeline")] public Task> GetAllForIssue(string owner, string repo, int number, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(repo, nameof(repo)); Ensure.ArgumentNotNull(options, nameof(options)); return ApiConnection.GetAll(ApiUrls.IssueTimeline(owner, repo, number), null, AcceptHeaders.Concat(AcceptHeaders.IssueTimelineApiPreview, AcceptHeaders.IssueEventsApiPreview), options); } /// /// Gets all the various events that have occurred around an issue or pull request. /// /// /// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue /// /// The Id of the repository /// The issue number [ManualRoute("GET", "/repositories/{id}/issues/{number}/timeline")] public Task> GetAllForIssue(long repositoryId, int number) { return GetAllForIssue(repositoryId, number, ApiOptions.None); } /// /// Gets all the various events that have occurred around an issue or pull request. /// /// /// https://developer.github.com/v3/issues/timeline/#list-events-for-an-issue /// /// The Id of the repository /// The issue number /// Options for changing the API response [Preview("mockingbird")] [Preview("starfox")] [ManualRoute("GET", "/repositories/{id}/issues/{number}/timeline")] public Task> GetAllForIssue(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); return ApiConnection.GetAll(ApiUrls.IssueTimeline(repositoryId, number), null, AcceptHeaders.Concat(AcceptHeaders.IssueTimelineApiPreview, AcceptHeaders.IssueEventsApiPreview), options); } } }