feat(workitems): Implement UpdateWorkItem()
What does this MR do and why?
Implements UpdateWorkItem() on WorkItemsService, resolving #2221 (closed).
The method accepts a fullPath and iid (matching the conventions of GetWorkItem and ListWorkItems), performs an internal GID lookup via a new workItemGID() helper, and then issues a workItemUpdate GraphQL mutation.
UpdateWorkItemOptions is brought to feature parity with CreateWorkItemOptions, supporting all fields that can be set on creation:
| Option | Widget |
|---|---|
Title, StateEvent
|
top-level mutation input |
Description |
descriptionWidget |
AssigneeIDs |
assigneesWidget |
MilestoneID |
milestoneWidget |
CRMContactIDs |
crmContactsWidget (always REPLACE mode) |
ParentID |
hierarchyWidget |
AddLabelIDs, RemoveLabelIDs
|
labelsWidget |
StartDate, DueDate
|
startAndDueDateWidget |
Weight |
weightWidget |
HealthStatus |
healthStatusWidget |
IterationID |
iterationWidget |
Color |
colorWidget |
Status |
statusWidget |
Several update-specific GQL input types are introduced where the GraphQL API requires a different shape than the create path (e.g. workItemWidgetLabelsUpdateInputGQL uses addLabelIds/removeLabelIds rather than a single set).
Also adds:
-
WorkItemStatusIDtype and constants for the five system-defined statuses (ToDo,InProgress,Done,WontDo,Duplicate) -
WorkItemStateEventtype andCLOSE/REOPENconstants (previously untyped) -
gidGQL.IsZero()helper used to detect a missing work item in the ID-lookup response -
updateWorkItemTemplatefor the mutation query, following the same template-chaining pattern ascreateWorkItemTemplate - A
TestUpdateWorkItemtable-driven test covering: a simple title update, all options at once, not-found during ID lookup, null work item in mutation response, and a mutation-level error
All exported symbols carry the standard experimental API warning.
Edited by Florian Forster