mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-25 23:49:09 +00:00
72e30a7f90
* add reactions to issue response payload * add reactions to commit comment payload * add reactions to review comment payload * create tests for issue client * tests for commitcomment client * tests for pull request review comment * change observable tests * simplify strings * remove unnecessary clients * change integration tests to retrieve all reaction types * create integration test for issue comment client * fix merge conflicts * fix merge conflicts * gets tests passing again * fix some reaction integration tests * Fixup unit tests wth preview accepts header Also applied preview header to a couple of repositoryId based calls that were added by another PR * Fixup unit tests wth preview accepts header Also applied preview header to a couple of repositoryId based calls that were added by another PR * Rework reaction payload tests for IssueComments to handle Get, GetAllForIssue and GetAllForRepository calls * [WIP] reaction payload tests * Rework reaction payload tests for IssueComments to handle Get, GetAllForIssue and GetAllForRepository calls * Rework reaction payload tests for Issues client * Rework reaction payload tests for PullRequestReviews client * Rework reaction payload tests for CommitComments client * Revert "[WIP] reaction payload tests" This reverts commit a6179b0f21a3ddfe36bfd3ae5eafae0e69b52252.
172 lines
5.0 KiB
C#
172 lines
5.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Globalization;
|
|
|
|
namespace Octokit
|
|
{
|
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
|
public class Issue
|
|
{
|
|
public Issue() { }
|
|
|
|
public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, ItemState state, string title, string body, User closedBy, User user, IReadOnlyList<Label> labels, User assignee, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt, int id, bool locked, Repository repository)
|
|
{
|
|
Id = id;
|
|
Url = url;
|
|
HtmlUrl = htmlUrl;
|
|
CommentsUrl = commentsUrl;
|
|
EventsUrl = eventsUrl;
|
|
Number = number;
|
|
State = state;
|
|
Title = title;
|
|
Body = body;
|
|
ClosedBy = closedBy;
|
|
User = user;
|
|
Labels = labels;
|
|
Assignee = assignee;
|
|
Milestone = milestone;
|
|
Comments = comments;
|
|
PullRequest = pullRequest;
|
|
ClosedAt = closedAt;
|
|
CreatedAt = createdAt;
|
|
UpdatedAt = updatedAt;
|
|
Locked = locked;
|
|
Repository = repository;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The Id for this issue
|
|
/// </summary>
|
|
public int Id { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The URL for this issue.
|
|
/// </summary>
|
|
public Uri Url { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The URL for the HTML view of this issue.
|
|
/// </summary>
|
|
public Uri HtmlUrl { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The Comments URL of this issue.
|
|
/// </summary>
|
|
public Uri CommentsUrl { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The Events URL of this issue.
|
|
/// </summary>
|
|
public Uri EventsUrl { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The issue number.
|
|
/// </summary>
|
|
public int Number { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Whether the issue is open or closed.
|
|
/// </summary>
|
|
public ItemState State { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Title of the issue
|
|
/// </summary>
|
|
public string Title { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Details about the issue.
|
|
/// </summary>
|
|
public string Body { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Details about the user who has closed this issue.
|
|
/// </summary>
|
|
public User ClosedBy { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The user that created the issue.
|
|
/// </summary>
|
|
public User User { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The set of labels applied to the issue
|
|
/// </summary>
|
|
public IReadOnlyList<Label> Labels { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The user this issue is assigned to.
|
|
/// </summary>
|
|
public User Assignee { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The milestone, if any, that this issue is assigned to.
|
|
/// </summary>
|
|
public Milestone Milestone { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The number of comments on the issue.
|
|
/// </summary>
|
|
public int Comments { get; protected set; }
|
|
|
|
public PullRequest PullRequest { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The date the issue was closed if closed.
|
|
/// </summary>
|
|
public DateTimeOffset? ClosedAt { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The date the issue was created.
|
|
/// </summary>
|
|
public DateTimeOffset CreatedAt { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The date the issue was last updated.
|
|
/// </summary>
|
|
public DateTimeOffset? UpdatedAt { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// If the issue is locked or not.
|
|
/// </summary>
|
|
public bool Locked { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// The repository the issue comes from.
|
|
/// </summary>
|
|
public Repository Repository { get; protected set; }
|
|
|
|
public ReactionSummary Reactions { get; protected set; }
|
|
|
|
internal string DebuggerDisplay
|
|
{
|
|
get
|
|
{
|
|
return string.Format(CultureInfo.InvariantCulture, "Number: {0} State: {1}", Number, State);
|
|
}
|
|
}
|
|
|
|
public IssueUpdate ToUpdate()
|
|
{
|
|
var milestoneId = Milestone == null
|
|
? new int?()
|
|
: Milestone.Number;
|
|
|
|
var assignee = Assignee == null
|
|
? null
|
|
: Assignee.Login;
|
|
|
|
var issueUpdate = new IssueUpdate
|
|
{
|
|
Assignee = assignee,
|
|
Body = Body,
|
|
Milestone = milestoneId,
|
|
State = State,
|
|
Title = Title
|
|
};
|
|
|
|
return issueUpdate;
|
|
}
|
|
}
|
|
} |