Loading
refactor(workitems): hide WorkItemsRESTService from the client
What does this MR do?
Hides the experimental WorkItemsRESTService (added in !3078 (merged)) from the client, without removing its code:
- Comments out
Client.WorkItemsREST, its initialization inNewClient, andWorkItemsRESTServiceInterface, so the service no longer appears when typingclient.. - Unexports the service struct as
workItemsRESTService. The generated service map and mocks are built from exported…Servicestructs, so this keeps generation working, and nobody outside the package could construct the service anyway. - Regenerates the testing package, which removes
MockWorkItemsRESTandMockWorkItemsRESTServiceInterface. - Keeps
GetWorkItem, its types and its tests. The tests call the unexported service directly.
Why
Work on using the work items REST API in glab is on hold: the REST API isn't available on GitLab Self-Managed yet, so the team is dogfooding it in other ways first. Rather than reverting !3078 (merged), this keeps the code so it's easy to restore later, but stops offering an API that nothing should use for now.
To restore it: uncomment the lines marked in gitlab.go and workitems_rest.go, rename workItemsRESTService back to WorkItemsRESTService, and run make generate.
Notes for reviewers
- Removed public names:
Client.WorkItemsREST,WorkItemsRESTServiceInterface,WorkItemsRESTService,testing.MockWorkItemsRESTandtesting.MockWorkItemsRESTServiceInterface. The service was marked experimental ("may introduce breaking changes even between minor versions"), so this doesn't need a major release. glab'smainbranch doesn't use it. - Still exported: the response and option types (
WorkItemREST,GetWorkItemRESTOptions, the field and feature constants,AllWorkItemFields(),AllWorkItemFeatures()). Hiding those too would mean commenting out most of the file.
How to test
make generate
make lint
make testmake generate produces no changes, and lint and tests pass.