Skip to content

Commit a85d4a8

Browse files
committed
Merge branch 'jbialobr/mabako_master'
2 parents 7cb46f1 + 159db75 commit a85d4a8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Git.hub/Repository.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,34 @@ public PullRequest CreatePullRequest(string headBranch, string baseBranch, strin
157157
return pullrequest;
158158
}
159159

160+
/// <summary>
161+
/// Creates a new issue
162+
/// </summary>
163+
/// <param name="title">title</param>
164+
/// <param name="body">body</param>
165+
/// <returns>the issue if successful, null otherwise</returns>
166+
public Issue CreateIssue(string title, string body)
167+
{
168+
var request = new RestRequest("/repos/{owner}/{repo}/issues");
169+
request.AddUrlSegment("owner", Owner.Login);
170+
request.AddUrlSegment("repo", Name);
171+
172+
request.RequestFormat = DataFormat.Json;
173+
request.AddBody(new
174+
{
175+
title = title,
176+
body = body
177+
});
178+
179+
var issue = _client.Post<Issue>(request).Data;
180+
if (issue == null)
181+
return null;
182+
183+
issue._client = _client;
184+
issue.Repository = this;
185+
return issue;
186+
}
187+
160188
public override bool Equals(object obj)
161189
{
162190
return obj is Repository && GetHashCode() == obj.GetHashCode();

0 commit comments

Comments
 (0)