Loading
Commits on Source 21
-
Ville Skyttä authored
Changelog: Improvements
-
Timo Furrer authored
refactor: migrate to math/rand/v2 See merge request !2759
-
Florian Forster authored
Introduce a new `WorkItemsService` to provide high-level API access to GitLab's work items (epics, issues, and tasks) through GraphQL. This implementation includes: - `GetWorkItem(projectPath, iid)`: Get work item by project path and IID - `GetWorkItemByID(gid)`: Get work item by global ID (string or int64) - `WorkItem` struct with common fields in idiomatic Go types - Type conversion utilities for GraphQL responses: - `gidGQL`: Parse global IDs (e.g. "gid://gitlab/WorkItem/179785913") - `iidGQL`: Convert IID strings to int64 - `userCoreGQL`: Convert GraphQL UserCore to BasicUser - `workItemGQL`: Internal GraphQL response representation with unwrap() - Comprehensive test coverage including success and error scenarios - Generated mock interfaces and client registration This addresses the current gaps in the GitLab Go client: - No API support for tasks - Deprecated REST API for epics (replaced by work items) - High friction for GraphQL usage (manual query construction, custom struct definitions, type conversions) The service follows established patterns in the Go client (service-based architecture, `RequestOptionFunc` support, `ErrNotFound` for missing resources, separate internal/public types). Issue: #2213
-
Florian Forster authored
Co-authored-by:
Timo Furrer <tfurrer@gitlab.com> -
Florian Forster authored
-
Florian Forster authored
Expand `ListWorkItemsOptions` to support most available GraphQL query parameters for work items, enabling full-featured filtering, sorting, searching, and pagination capabilities. Changes: - Add 30+ filter fields including assignees, labels, milestones, iterations, health status, CRM associations, and reactions - Add time-based filters (created, updated, closed, due dates) - Add sorting, search, and pagination parameters - Implement generic `gqlVariables()` function using reflection to extract GraphQL variable definitions from struct tags - Replace manual field mapping with struct tag annotations using format `gql:"name Type"` - Add `variablesGQL` helper type with `Definitions()` and `Arguments()` methods for template rendering The new approach uses reflection to automatically generate GraphQL query variables from struct fields, eliminating the need to maintain separate field type mappings. Each field is annotated with its GraphQL name and type via struct tags (e.g., `gql:"state IssuableState"`). This refactoring makes it trivial to add new query parameters in the future - simply add the field to the struct with appropriate tags. Technical details: - `gqlVariables()` validates struct tags and only includes non-zero fields - Template now uses `variablesGQL.Definitions()` for query signature - Template uses `variablesGQL.Arguments()` for field parameters - Comprehensive test coverage added for all new fields
-
Florian Forster authored
-
Florian Forster authored
-
Florian Forster authored
-
Florian Forster authored
-
Florian Forster authored
-
Florian Forster authored
-
Florian Forster authored
This check is _optional_ and only done when the schema file is available at `schema/gitlab.graphql`.
-
Florian Forster authored
-
Florian Forster authored
- Fix doc comment - Use `range i` syntax - Use `strings.Cut`
-
Florian Forster authored
-
Florian Forster authored
Add full pagination support to `ListWorkItems` by implementing GraphQL cursor-based pagination following the Relay specification. This allows callers to efficiently iterate through large result sets. Changes: - Add `PageInfo` type to `Response` for GraphQL cursor pagination metadata - Add `connectionGQL[T]` generic type for unmarshaling paginated responses - Replace templated queries with static query using nullable variables - Add `WithNext()` function to handle all pagination styles uniformly - Update `Scan2()` to use `WithNext()` for automatic pagination - Return `Response` with pagination info from `ListWorkItems` - Remove unused `gqlVariable` types and helper functions - Add comprehensive unit tests for pagination scenarios
-
Florian Forster authored
-
Florian Forster authored
`WithNext` previously used inline signaling by returning `nil` when no more pages were available. This required callers to check for nil, which is easy to overlook and inconsistent with Go conventions. Add a second boolean return value following the comma-ok idiom used by map accesses and type assertions. This makes pagination termination explicit and harder to miss. Update `Scan2`, `ExampleWithNext`, and all call sites accordingly.
-
Timo Furrer authored
feat(workitems): Add an initial "Work Items" service with "Get" and "List" methods. See merge request !2719
-
semantic-release-bot authored
## 1.34.0 ###
🚀 Features - feat(workitems): Add an initial "Work Items" service with "Get" and "List" methods. ([!2719](!2719)) by [Florian Forster](https://gitlab.com/fforster) ###🔄 Other Changes - refactor: migrate to math/rand/v2 ([!2759](!2759)) by [Ville Skyttä](https://gitlab.com/scop) # [1.34.0](v1.33.0...v1.34.0) (2026-02-13) ### Bug Fixes * **workitems:** Use `int64` for global work item IDs. ([f04e3d08](f04e3d08)) ### Features * **request_options:** Add boolean return value to `WithNext`. ([1cd1e1e5](1cd1e1e5)) * **workitems:** Add comprehensive filtering to `ListWorkItemsOptions` ([052a8978](052a8978)) * **workitems:** Add pagination support to `ListWorkItems`. ([cfdf5ee6](cfdf5ee6)) * **workitems:** Add WorkItems service with Get methods ([00925c26](00925c26)), closes [#2213](#2213) * **workitems:** Implement the `ListWorkItems` method. ([4f8a7092](4f8a7092))