internal static JsonObject Generate(WorklogInput worklogInput) { var json = new JsonObject { { "self", worklogInput.Self.ToString() }, { "comment", worklogInput.Comment }, //{ "started", worklogInput.StartDate.ToRestString() }, { "timeSpent", worklogInput.MinutesSpent.ToString() } }; if (worklogInput.Visibility != null) { json.Add("visibility", VisibilityJsonGenerator.Generate(worklogInput.Visibility).ToJson()); } if (worklogInput.Author != null) { json.Add("author", BasicUserJsonGenerator.Generate(worklogInput.Author).ToJson()); } if (worklogInput.UpdateAuthor != null) { //json.Add("updateAuthor", BasicUserJsonGenerator.Generate(worklogInput.UpdateAuthor).ToString()); json.Add("updateAuthor", worklogInput.UpdateAuthor.ToJson()); } return(json); }
/// <summary> /// Adds a new work log entry to issue. /// </summary> /// <param name="worklogUri">The URI for the work log resource for the selected issue.</param> /// <param name="worklogInput">The work log information to add to the issue.</param> /// <exception cref="WebServiceException">If the issue does not exist, or the the calling user does not have permission to add work log information to the issue.</exception> public void AddWorklog(Uri worklogUri, WorklogInput worklogInput) { var qb = new UriBuilder(worklogUri); qb.AppendQuery("adjustEstimate", worklogInput.AdjustEstimate.ToString().ToLower()); switch (worklogInput.AdjustEstimate) { case WorklogInput.AdjustmentEstimate.New: qb.AppendQuery("newEstimate", worklogInput.AdjustEstimateValue); break; case WorklogInput.AdjustmentEstimate.Manual: qb.AppendQuery("reduceBy", worklogInput.AdjustEstimateValue); break; } client.Post <JsonObject>(qb.Uri.ToString(), WorklogInputJsonGenerator.Generate(worklogInput)); }