techtalk / JiraRestClient

A simple client for Atlassian JIRA service REST API
Other
65 stars 80 forks source link

Attachments in fields in the Issue constructor #2

Closed nlarson closed 10 years ago

nlarson commented 10 years ago

Attachments in fields at create of an issue not saved.

quexy commented 10 years ago

What about it?

nlarson commented 10 years ago

First, Thanks first for the api, it saved me lots of time. Nicely done.

I did run into a surprise in the CreateIssue method.

var client = new JiraClient("https://coinstarx.atlassian.net", JiraLogin, JiraPassword); var fields = new IssueFields(); fields.description = IssueDescription; fields.summary = IssueSummary; fields.attachment.Add(new Attachment() { filename = ScreenShotPath, content="ScreenShot.png" }); var issue = client.CreateIssue("PEN", "Bug", fields);

A quick read of the source seems to confirm that CreateIssue with the above signature does not do anything with the fields that are attachments. The work around is to add the attachments after creating the issue. It may also be that I just didn't set it up properly. This is how I'm using it now.

var client = new JiraClient("https://coinstarx.atlassian.net", JiraLogin, JiraPassword); var fields = new IssueFields(); fields.description = IssueDescription; fields.summary = IssueSummary; // create then attach. Attachments set in fields before create wont work. var issue = client.CreateIssue("PEN", "Bug", fields); using(FileStream ss = new FileStream(ScreenShotPath, FileMode.Open)) { client.CreateAttachment(issue, ss, string.Format("{0}_ScreenShot.{1}", issue.key, Path.GetExtension(ScreenShotPath))); }

Anyway, I thought you might be interested.

Next, I need to figure out how to set the Issues priority.

Neil

On Mon, Oct 14, 2013 at 1:54 PM, quexy notifications@github.com wrote:

What about it?

— Reply to this email directly or view it on GitHubhttps://github.com/techtalk/JiraRestClient/issues/2#issuecomment-26283702 .

quexy commented 10 years ago

Since the REST API (to the best of my knowledge) does not support your scenario, and the project is intended to provide a simple .NET layer over JIRA, I don't see the reason why should we support this behaviour, even so that it takes only one more step to achieve your goal.