public void GenerateWithEmptyInput() { var issueInput = new IssueInput(new Dictionary<string, FieldInput>()); var expected = JsonResource.IssueInput_Empty; var actual = IssueInputJsonGenerator.Generate(issueInput); Assert.AreEqual(expected, actual.ToJson()); }
public static IssueInput CreateWithFields(IList<FieldInput> fields) { var issue = new IssueInput(); foreach (var f in fields) { issue.Fields.Add(f.Id, f); } return issue; }
public static IssueInput CreateWithFields(IList <FieldInput> fields) { var issue = new IssueInput(); foreach (var f in fields) { issue.Fields.Add(f.Id, f); } return(issue); }
internal static JsonObject Generate(IssueInput issue) { var jsonObject = new JsonObject(); var list = new Dictionary<string, object>(); if (issue != null && issue.Fields != null) { foreach (var f in issue.Fields.Values.Where(f => f.Value != null)) { list.Add(f.Id, ComplexIssueInputFieldValueJsonGenerator.GenerateFieldValueForJson(f.Value)); } } jsonObject.Add("fields", list.ToJson()); return jsonObject; }
/// <summary> /// Creates an issue or a subtask. /// </summary> /// <param name="issue">Information about the issue to create. The fields that can be set on issue creation can be determined using the <see cref="IIssueRestClient.GetCreateIssueMetadata()"/> or <see cref="IIssueRestClient.GetCreateIssueMetadata(JIRC.Domain.Input.GetCreateIssueMetadataOptions)"/> methods. /// The <see cref="IssueInputBuilder"/> class can be used to help generate the appropriate fields.</param> /// <seealso cref="IssueInputBuilder"/> /// <returns>Details of the created issue.</returns> /// <exception cref="WebServiceException">The input is invalid (e.g. missing required fields, invalid field values, and so forth), or if the calling user does not have permission to create the issue.</exception> public BasicIssue CreateIssue(IssueInput issue) { var json = IssueInputJsonGenerator.Generate(issue); return client.Post<BasicIssue>("issue", json); }