Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.127.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeTypeGroup   = "group"
	ScopeTypeProject = "project"
)

scope type constants

Variables

This section is empty.

Functions

func FetchWorkItems

func FetchWorkItems(ctx context.Context, client *gitlab.Client, scope *ScopeInfo, opts ListOptions) ([]WorkItem, *PageInfo, error)

FetchWorkItems retrieves all work items using cursor-based pagination

Types

type DateField added in v1.127.0

type DateField string

DateField is a work item date filter argument, named as in the GraphQL API.

const (
	CreatedAfter  DateField = "createdAfter"
	CreatedBefore DateField = "createdBefore"
	UpdatedAfter  DateField = "updatedAfter"
	UpdatedBefore DateField = "updatedBefore"
	ClosedAfter   DateField = "closedAfter"
	ClosedBefore  DateField = "closedBefore"
	DueAfter      DateField = "dueAfter"
	DueBefore     DateField = "dueBefore"
)

type DateFilter added in v1.127.0

type DateFilter struct {
	Absolute string
	Relative *RelativeDate
}

DateFilter holds exactly one of an absolute or a relative date. Absolute is sent as typed: the Time scalar parses it with Ruby's Time.parse, so a date without an offset is read in the system time zone of the server.

func ParseDateFilter added in v1.127.0

func ParseDateFilter(s string) (DateFilter, error)

ParseDateFilter parses an absolute date (2006-01-02 or RFC 3339) or a relative date such as -7d, 2w, -1m, or 1y.

type GroupWorkItems

type GroupWorkItems struct {
	WorkItems WorkItemsConnection `json:"workItems"`
}

helper structs for GraphQL response parsing

type ListOptions added in v1.127.0

type ListOptions struct {
	Types   []string
	State   string
	After   string
	PerPage int64
	Dates   map[DateField]DateFilter
}

ListOptions are the filters and pagination for FetchWorkItems.

type PageInfo

type PageInfo struct {
	EndCursor   string `json:"endCursor"`
	HasNextPage bool   `json:"hasNextPage"`
}

type ProjectWorkItems

type ProjectWorkItems struct {
	WorkItems WorkItemsConnection `json:"workItems"`
}

type RelativeDate added in v1.127.0

type RelativeDate struct {
	Amount int              `json:"amount"`
	Unit   RelativeDateUnit `json:"unit"`
}

RelativeDate is an offset from today. Negative amounts are in the past.

type RelativeDateUnit added in v1.127.0

type RelativeDateUnit string

RelativeDateUnit is a WorkItemRelativeDateUnit enum value.

const (
	RelativeDateUnitDay   RelativeDateUnit = "DAY"
	RelativeDateUnitWeek  RelativeDateUnit = "WEEK"
	RelativeDateUnitMonth RelativeDateUnit = "MONTH"
	RelativeDateUnitYear  RelativeDateUnit = "YEAR"
)

type ScopeInfo

type ScopeInfo struct {
	Type string
	Path string
}

ScopeInfo contains detected scope information for work items queries

type WorkItem

type WorkItem struct {
	IID          string `json:"iid"`
	Title        string `json:"title"`
	State        string `json:"state"`
	WorkItemType struct {
		Name string `json:"name"`
	} `json:"workItemType"`
	Author struct {
		Username string `json:"username"`
	} `json:"author"`
	WebURL string `json:"webUrl"`
}

WorkItem represents a work item from the GraphQL API

type WorkItemsConnection

type WorkItemsConnection struct {
	Nodes    []WorkItem `json:"nodes"`
	PageInfo PageInfo   `json:"pageInfo"`
}

type WorkItemsResponse

type WorkItemsResponse struct {
	Data struct {
		Group   *GroupWorkItems   `json:"group,omitempty"`
		Project *ProjectWorkItems `json:"project,omitempty"`
	} `json:"data"`
}

WorkItemsResponse represents the GraphQL response structure for work items queries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL