Draft: feat(workitems): use the work items REST API in WorkItemsService
What does this MR do?
Moves WorkItemsService from GraphQL to the work items REST API. GetWorkItem, ListWorkItems, CreateWorkItem, UpdateWorkItem, and DeleteWorkItem now call the /namespaces/:id/-/work_items routes, so fullPath still accepts a project or a group.
ListWorkItemTypes stays on GraphQL, because the REST API has no endpoint for listing work item types.
The public API is unchanged: method signatures, WorkItem, the options structs, and the ID constants are the same, so the generated mocks do not change. Returned values keep their previous form (State is OPEN/CLOSED, HealthStatus is onTrack), and GraphQL-style inputs such as global IDs, Sort values like CREATED_DESC, and uppercase type names are converted to REST parameters.
It also adds NotesService.GetWorkItemNote for GET /namespaces/:id/-/work_items/:iid/notes/:note_id. It returns the existing *Note type, and fullPath accepts a project or a group, like WorkItemsService.
Related to #2213. The GitLab CLI uses this in gitlab-org/cli!3976 (closed).
Behavior changes
- Feature flag: the REST API is behind the
work_item_rest_apifeature flag (rollout: gitlab-org/gitlab#588874) and returns 404 while it is disabled. This likely needs to wait for the rollout, or land behind an opt-in. - Extra requests:
GetWorkItemreadsChildrenandLinkedItemsfrom thechildrenandlinked_itemsendpoints (three requests, up to 100 of each).CreateWorkItemandUpdateWorkItemread the result back withGetWorkItem. ListWorkItems:"hierarchy"returnsParentbut notChildren, and"linkedItems"is not supported.WorkItemDefaultListFieldsno longer includes"linkedItems".- Unsupported options return an error before any request:
BeforeandLast, more than oneIterationID,CreateSource, and linking withBLOCKSorBLOCKED_BYon create. - Offset pagination: for sorts that the REST API pages by offset,
PageInfo.EndCursorhas the formpage:N, whichListWorkItemsaccepts asAfter.
GraphQL helpers and fixtures that only the work items queries used are removed. internal/graphqlfields has no remaining users and is left for a separate cleanup.
How has this been tested?
- Unit tests are rewritten for REST (21 new test functions, using
setup/mux); theListWorkItemTypestests are unchanged.GetWorkItemNotehas its own tests, andtesting/notes_mock.gois regenerated.go test ./...,golangci-lint, andgofumptpass, and regenerating the testing client and service map produces no changes. - Against a local GDK with
work_item_rest_apienabled: create, update (title, parent, due date, assignee, close), get with children, list with a type filter and a second page, the unsupported-option error, delete followed byErrNotFound, andListWorkItemTypes. - The GitLab CLI's work items commands, built against this branch, work end to end on the same GDK.
gitlab_test/workitems_integration_test.gowas not run; it needs a licensed instance with the feature flag enabled.