Documentation
¶
Overview ¶
Package iterationdata contains shared GitLab iteration conversion helpers.
Index ¶
- Constants
- func FormatCardMarkdown(output Output) string
- func FormatListMarkdown(title, emptyText string, iterations []Output, ...) string
- func FormatOutputMarkdown(output Output, hints ...string) string
- func NewGroupListOptions(page, perPage int, state, search string, includeAncestors bool) *gl.ListGroupIterationsOptions
- func NewProjectListOptions(page, perPage int, state, search string, includeAncestors bool) *gl.ListProjectIterationsOptions
- func StateName(state int64) string
- type Output
Constants ¶
const ( ActionListGroup = "issue.iteration_list_group" ActionListProject = "issue.iteration_list_project" )
The two list actions an iteration card points to, as canonical action IDs every surface resolves. The group and project iteration packages each test that the one they register is spelled here.
Variables ¶
This section is empty.
Functions ¶
func FormatCardMarkdown ¶ added in v3.3.0
FormatCardMarkdown renders one iteration as the card the registry serves for every iteration a group or project action answers with: the card of FormatOutputMarkdown with both list actions as its next steps, in one order, since an iteration belongs to a group whichever scope listed it.
It is registered here and only here because the group and project iteration packages answer with this package's Output itself, and the registry, keyed by type, keeps the first of two registrations of one type (issue 1291). Each of those packages used to register its own card for it.
func FormatListMarkdown ¶
func FormatListMarkdown(title, emptyText string, iterations []Output, pagination toolutil.PaginationOutput, hints ...string) string
FormatListMarkdown renders a page of iterations as a Markdown table: a collection of objects that share columns. The title and the empty-list sentence come from the scope, since a group iteration list and a project one differ in nothing else.
The hints were written before the table and the summary line after its last row, which put a guidance section where no reader looks for one and made the header lazily continue the paragraph above it, so no table rendered at all. Heading, summary, table, pagination and hints now run in that order, which is what toolutil.WriteListHeading and toolutil.WriteListFooter exist for.
func FormatOutputMarkdown ¶
FormatOutputMarkdown renders one iteration as the card of one object, with the caller's hints last.
It used to open a "| Property | Value |" table and then write list rows into it (the ID row, the URL row, the created row), which ended the table with no body and left every later "| State | … |" on the page as literal pipes. A card row is a complete block wherever it lands, which is why this is a card.
func NewGroupListOptions ¶
func NewGroupListOptions(page, perPage int, state, search string, includeAncestors bool) *gl.ListGroupIterationsOptions
NewGroupListOptions builds GitLab options for listing group iterations.
func NewProjectListOptions ¶
func NewProjectListOptions(page, perPage int, state, search string, includeAncestors bool) *gl.ListProjectIterationsOptions
NewProjectListOptions builds GitLab options for listing project iterations.
func StateName ¶
StateName names a GitLab iteration state as GitLab's own enum spells it: upcoming, current, closed.
It used to map 1 to "opened", which is not a state GitLab stores at all — it is a list filter meaning upcoming plus current — and that shifted every later value by one, so a current iteration read as upcoming and a closed one as current.
Types ¶
type Output ¶
type Output struct {
ID int64 `json:"id"`
IID int64 `json:"iid"`
Sequence int64 `json:"sequence"`
GroupID int64 `json:"group_id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
State int64 `json:"state"`
WebURL string `json:"web_url,omitempty"`
StartDate string `json:"start_date,omitempty"`
DueDate string `json:"due_date,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
}
Output represents a GitLab iteration shared by project and group tools.
func GroupOutput ¶
func GroupOutput(it *gl.GroupIteration) Output
GroupOutput converts a GitLab group iteration to shared output fields.
func ProjectOutput ¶
func ProjectOutput(it *gl.ProjectIteration) Output
ProjectOutput converts a GitLab project iteration to shared output fields.