setiteration

package
v0.0.0-...-57f3878 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IterationMatchTypeStartDateExactly = IterationMatchType("startDateExactly")
	IterationMatchTypeContains         = IterationMatchType("contains")
)
View Source
var (
	ContentStateAll    = ContentState("all")
	ContentStateOpen   = ContentState("open")
	ContentStateClosed = ContentState("closed")
)
View Source
var ErrSkipped = fmt.Errorf("skipped")

Functions

func ExtractDate

func ExtractDate(title string) (string, error)

func Run

func Run(
	gql api.GQLClient,
	projectUrl string,
	issueOrPullRequestUrl string,
	iterationFieldName string,
	contentState ContentState,
	offsetDays int,
	iterationMatchType IterationMatchType,
	dryRun bool,
	writer io.Writer,
) error

func ShiftDate

func ShiftDate(date string, offsetDays int) (string, error)

func UpdateIteration

func UpdateIteration(
	gql api.GQLClient,
	projectId string,
	projectItemId string,
	fieldId string,
	iterationId string,
	dryRun bool,
) error

Types

type Content

type Content struct {
	ID     string
	Title  string
	Closed bool
}

func GetIssueOrPullRequest

func GetIssueOrPullRequest(
	gql api.GQLClient,
	descriptor IssueOrPullRequestDescriptor,
) (*Content, error)

type ContentState

type ContentState string

type DummyContent

type DummyContent = Content

type GetIssueOrPullRequestQuery

type GetIssueOrPullRequestQuery struct {
	Repository struct {
		IssueOrPullRequest IssueOrPullRequest `graphql:"issueOrPullRequest(number: $issueOrPullRequestNumber)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type GetOrganizationProjectQuery

type GetOrganizationProjectQuery struct {
	Organization GetProjectQuery `graphql:"organization(login: $owner)"`
}

type GetProjectQuery

type GetProjectQuery struct {
	ProjectV2 `graphql:"projectV2(number: $projectNumber)"`
}

type GetUserProjectQuery

type GetUserProjectQuery struct {
	User GetProjectQuery `graphql:"user(login: $owner)"`
}

type IssueOrPullRequest

type IssueOrPullRequest struct {
	Content      `graphql:"... on Issue"`
	DummyContent `graphql:"... on PullRequest"` // dummy to avoid `Content redeclared`
}

type IssueOrPullRequestDescriptor

type IssueOrPullRequestDescriptor struct {
	Repository Repository
	Number     int
}

func GetIssueOrPullRequestDescriptor

func GetIssueOrPullRequestDescriptor(
	issueOrPullRequestUrl string,
) (*IssueOrPullRequestDescriptor, error)

type Iteration

type Iteration struct {
	ID        string
	Title     string
	StartDate string
	Duration  int
}

func (*Iteration) Contains

func (iteration *Iteration) Contains(date string) (bool, error)

type IterationMatchType

type IterationMatchType string

type ProjectDescriptor

type ProjectDescriptor struct {
	OwnerIsOrganization bool
	Owner               string
	Number              int
}

func GetProjectDescriptor

func GetProjectDescriptor(
	projectUrl string,
) (*ProjectDescriptor, error)

type ProjectItem

type ProjectItem struct {
	ID      string
	Content IssueOrPullRequest
}

type ProjectV2

type ProjectV2 struct {
	ID    string
	Field struct {
		ProjectV2IterationField `graphql:"... on ProjectV2IterationField"`
	} `graphql:"field(name: $fieldName)"`
	Items struct {
		// TODO: pagenation ?
		Nodes []ProjectItem
	} `graphql:"items(last: 100)"`
}

func GetProject

func GetProject(
	gql api.GQLClient,
	descriptor ProjectDescriptor,
	iterationFieldName string,
) (*ProjectV2, error)

func (*ProjectV2) SelectItem

func (f *ProjectV2) SelectItem(contentID string) *ProjectItem

type ProjectV2IterationField

type ProjectV2IterationField struct {
	ID            string
	Name          string
	Configuration struct {
		Iterations          []Iteration
		CompletedIterations []Iteration
	}
}

func (*ProjectV2IterationField) SelectIteration

func (f *ProjectV2IterationField) SelectIteration(
	targetDate string,
	matchType IterationMatchType,
) (*Iteration, error)

type Repository

type Repository struct {
	Owner string
	Name  string
}

type UpdateIterationMutation

type UpdateIterationMutation struct {
	UpdateProjectV2ItemFieldValue struct {
		ClientMutationId string
	} `` /* 144-byte string literal not displayed */
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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