Last active
August 29, 2015 13:56
-
-
Save quexy/9183880 to your computer and use it in GitHub Desktop.
TechTalk.JiraRestClient sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using TechTalk.JiraRestClient; | |
namespace JiraClientTest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var clientX = new JiraClient<MyIssueFields>("http://localhost:8080/", "admin", "test"); | |
var issueX = clientX.CreateIssue("TEST", "Story", "sub"); | |
issueX.fields = new MyIssueFields { labels = { "lbl1", "lbl2" }, timetracking = new Timetracking { originalEstimateDays = 2.8m }, description = "detailed description", summary = "summary", customfield_10010 = "custom" }; | |
issueX = clientX.UpdateIssue(issueX); | |
var client = new JiraClient("http://localhost:8080", "test", "test"); | |
var issue = client.LoadIssue(issueX); | |
var link1 = client.CreateRemoteLink(issueX, new RemoteLink { title = "SpecLog", summary = "link", url = "http://speclog.net/" }); | |
var link2 = client.CreateRemoteLink(issue, new RemoteLink { title = "SpecRun", summary = "link", url = "http://specrun.net/" }); | |
link1.summary = "speclog link"; | |
client.UpdateRemoteLink(issue, link1); | |
foreach (var link in client.GetRemoteLinks(issue)) | |
Console.WriteLine("link: {0} ({1}): {2}", link.title, link.summary, link.url); | |
client.DeleteRemoteLink(issueX, link2); | |
foreach (var comment in clientX.GetComments(issue)) | |
Console.WriteLine("cmmt: {0}", comment.body); | |
var close = clientX.GetTransitions(issue).Single(t => t.name.Contains("Close")); | |
close.fields = new { resolution = new { name = "Won't Fix" } }; | |
client.TransitionIssue(issueX, close); | |
clientX.DeleteIssue(issue); | |
} | |
} | |
class MyIssueFields : IssueFields | |
{ | |
public string customfield_10010 { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment