projects

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const PageNumberLimit = 2

PageNumberLimit is the limit on the number of pages that will be traversed

Variables

This section is empty.

Functions

func ProjectNumber

func ProjectNumber(val any) int

ProjectNumber ...

Types

type Assignees

type Assignees struct {
	PageInfo   models.PageInfo
	TotalCount int64
	Nodes      []models.User
}

Assignees to the ProjectItem

type CommonField

type CommonField struct {
	Common ProjectV2FieldCommon `graphql:"... on ProjectV2FieldCommon"`
}

CommonField ...

type Content

type Content struct {
	Title     *string
	Body      *string
	CreatedAt *githubv4.DateTime
	Assignees *Assignees `graphql:"assignees(first: 10)"`
}

Content of the ProjectItem

type Field

type Field struct {
	Common ProjectV2FieldCommon `graphql:"... on ProjectV2FieldCommon"`
}

Field is a field on a ProjectItem

type FieldValue

type FieldValue struct {
	DateValue      ProjectV2ItemFieldDateValue         `graphql:"... on ProjectV2ItemFieldDateValue"`
	TextValue      ProjectV2ItemFieldTextValue         `graphql:"... on ProjectV2ItemFieldTextValue"`
	SelectValue    ProjectV2ItemFieldSingleSelectValue `graphql:"... on ProjectV2ItemFieldSingleSelectValue"`
	IterationValue ProjectV2ItemFieldIterationValue    `graphql:"... on ProjectV2ItemFieldIterationValue"`
	LabelsValue    ProjectV2ItemFieldLabelValue        `graphql:"... on ProjectV2ItemFieldLabelValue"`
	NumberValue    ProjectV2ItemFieldNumberValue       `graphql:"... on ProjectV2ItemFieldNumberValue"`
	ReviewerValue  ProjectV2ItemFieldReviewerValue     `graphql:"... on ProjectV2ItemFieldReviewerValue"`
	RepoValue      ProjectV2ItemFieldRepositoryValue   `graphql:"... on ProjectV2ItemFieldRepositoryValue"`
}

FieldValue is a value for a Field

type FieldValues

type FieldValues struct {
	PageInfo   models.PageInfo
	TotalCount int64
	Nodes      []FieldValue
}

FieldValues are the values of each Field of a ProjectItem

type IssueContent

type IssueContent struct {
	Title     *string
	Body      *string
	CreatedAt *githubv4.DateTime
	Assignees *Assignees `graphql:"assignees(first: 10)"`
	Milestone *models.Milestone
	ClosedAt  *githubv4.DateTime
}

IssueContent of the ProjectItem

type Project

type Project struct {
	Number           int64
	Title            string
	URL              string
	Closed           bool
	Public           bool
	ClosedAt         githubv4.DateTime
	CreatedAt        githubv4.DateTime
	UpdatedAt        githubv4.DateTime
	ShortDescription string
}

Project is a GitHub project

type ProjectItem

type ProjectItem struct {
	Content     ProjectV2ItemContent
	FieldValues FieldValues `graphql:"fieldValues(first: 100)"`
	ID          string
	IsArchived  bool
	Type        string
	CreatedAt   githubv4.DateTime
	UpdatedAt   githubv4.DateTime
}

ProjectItem is a GitHub project item

type ProjectItemsWithFields

type ProjectItemsWithFields struct {
	Items   []ProjectItem
	Fields  []Field
	Filters []models.Filter
}

ProjectItemsWithFields ...

func GetAllProjectItems

func GetAllProjectItems(ctx context.Context, client models.Client, opts models.ProjectOptions) (*ProjectItemsWithFields, error)

GetAllProjectItems uses the graphql endpoint API to list all project items in the repository

func GetProjectsItemsInRange

func GetProjectsItemsInRange(ctx context.Context, client models.Client, opts models.ProjectOptions, from time.Time, to time.Time) (*ProjectItemsWithFields, error)

GetProjectsItemsInRange retrieves every project from the org and then returns the ones that fall within the given time range.

func (ProjectItemsWithFields) Frames

func (p ProjectItemsWithFields) Frames() data.Frames

Frames converts the list of Projects to a Grafana DataFrame

type ProjectLabel

type ProjectLabel struct {
	Name string
}

ProjectLabel ...

type ProjectLabels

type ProjectLabels struct {
	Nodes []ProjectLabel
}

ProjectLabels ...

type ProjectV2FieldCommon

type ProjectV2FieldCommon struct {
	Name     string
	DataType string
}

ProjectV2FieldCommon is common to fields

type ProjectV2ItemContent

type ProjectV2ItemContent struct {
	DraftIssue  Content      `graphql:"... on DraftIssue"`
	Issue       IssueContent `graphql:"... on Issue"`
	PullRequest IssueContent `graphql:"... on PullRequest"`
}

ProjectV2ItemContent contains Content for a ProjectItem

type ProjectV2ItemFieldDateValue

type ProjectV2ItemFieldDateValue struct {
	CreatedAt githubv4.DateTime
	Date      *string
	UpdatedAt githubv4.DateTime
	Field     CommonField
}

ProjectV2ItemFieldDateValue is a value for a Date field

type ProjectV2ItemFieldIterationValue

type ProjectV2ItemFieldIterationValue struct {
	Title *string
	Field CommonField
}

ProjectV2ItemFieldIterationValue is a value for an Iteration field

type ProjectV2ItemFieldLabelValue

type ProjectV2ItemFieldLabelValue struct {
	ProjectLabels `graphql:"labels(first: 10)"`
	Field         CommonField
}

ProjectV2ItemFieldLabelValue is a value for a Labels field

type ProjectV2ItemFieldNumberValue

type ProjectV2ItemFieldNumberValue struct {
	Number *float64
	Field  CommonField
}

ProjectV2ItemFieldNumberValue is a value for a Number field

type ProjectV2ItemFieldRepositoryValue

type ProjectV2ItemFieldRepositoryValue struct {
	Repository models.Repository
	Field      CommonField
}

ProjectV2ItemFieldRepositoryValue ...

type ProjectV2ItemFieldReviewerValue

type ProjectV2ItemFieldReviewerValue struct {
	Reviewers `graphql:"reviewers(first: 10)"`
	Field     CommonField
}

ProjectV2ItemFieldReviewerValue ...

type ProjectV2ItemFieldSingleSelectValue

type ProjectV2ItemFieldSingleSelectValue struct {
	Name  *string
	Field CommonField
}

ProjectV2ItemFieldSingleSelectValue is a value for a SingleSelect field

type ProjectV2ItemFieldTextValue

type ProjectV2ItemFieldTextValue struct {
	Text  *string
	Field CommonField
}

ProjectV2ItemFieldTextValue is a value for a Text field

type Projects

type Projects []Project

Projects is a list of GitHub Projects

func GetAllProjects

func GetAllProjects(ctx context.Context, client models.Client, opts models.ProjectOptions) (Projects, error)

GetAllProjects uses the graphql endpoint API to list all projects in the repository

func GetProjectsInRange

func GetProjectsInRange(ctx context.Context, client models.Client, opts models.ProjectOptions, from time.Time, to time.Time) (Projects, error)

GetProjectsInRange retrieves every project from the org and then returns the ones that fall within the given time range.

func (Projects) Frames

func (p Projects) Frames() data.Frames

Frames converts the list of Projects to a Grafana DataFrame

type QueryListProjects

type QueryListProjects struct {
	Organization struct {
		ProjectsV2 struct {
			Nodes    []Project
			PageInfo models.PageInfo
		} `graphql:"projectsV2(first: 100, after: $cursor)"`
	} `graphql:"organization(login: $login)"`
}

QueryListProjects lists all projects in a repository

organization(login: "grafana") {
	projectsV2(first: 100) {
		nodes {
			id
			title
     ...
		}
	}
}

type QueryListProjectsByUser

type QueryListProjectsByUser struct {
	User struct {
		ProjectsV2 struct {
			Nodes    []Project
			PageInfo models.PageInfo
		} `graphql:"projectsV2(first: 100, after: $cursor)"`
	} `graphql:"user(login: $login)"`
}

QueryListProjectsByUser lists all projects by user

type QueryProject

type QueryProject struct {
	Organization struct {
		ProjectV2 struct {
			Fields struct {
				TotalCount int64
				Nodes      []Field
				PageInfo   models.PageInfo
			} `graphql:"fields(first: 100)"`
			Items struct {
				// Edges
				TotalCount int64
				Nodes      []ProjectItem
				PageInfo   models.PageInfo
			} `graphql:"items(first: 100, after: $cursor)"`
		} `graphql:"projectV2(number: $number)"`
	} `graphql:"organization(login: $login)"`
}

QueryProject lists project items in a project

organization(login: "grafana") {
	projectV2(number: 218) {
		items(first: 50) {
				totalCount
				nodes {
						id
						createdAt
				}
		},
		fields(first: 50) {
			totalCount
			nodes{
		 	... on ProjectV2FieldCommon {
				 name
				 dataType
		 	}
			}
		},
	}
}

type QueryProjectByUser

type QueryProjectByUser struct {
	User struct {
		ProjectV2 struct {
			Fields struct {
				TotalCount int64
				Nodes      []Field
				PageInfo   models.PageInfo
			} `graphql:"fields(first: 100)"`
			Items struct {
				// Edges
				TotalCount int64
				Nodes      []ProjectItem
				PageInfo   models.PageInfo
			} `graphql:"items(first: 100, after: $cursor)"`
		} `graphql:"projectV2(number: $number)"`
	} `graphql:"user(login: $login)"`
}

QueryProjectByUser lists Github projects by User

type Reviewer

type Reviewer struct {
	models.User `graphql:"... on User"`
}

Reviewer ...

type Reviewers

type Reviewers struct {
	Nodes []Reviewer
}

Reviewers ...

Jump to

Keyboard shortcuts

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