github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchIterationFields

func FetchIterationFields(projectID string) (*[]ProjectV2IterationFieldWithoutConfiguration, error)

func FetchProjectFields

func FetchProjectFields(projectID string) (*[]ProjectV2FieldConfiguration, error)

func FetchProjectItems

func FetchProjectItems(projectID string) (*[]ProjectItem, error)

func UpdateIterationField

func UpdateIterationField(projectID string, fieldID string, itemID string, iterationID string) (string, error)

Types

type DraftIssue

type DraftIssue struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

https://docs.github.com/ja/graphql/reference/objects#draftissue

type FieldValue

type FieldValue struct {
	ProjectV2ItemFieldValueCommon struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldValueCommon"`
	ProjectV2ItemFieldDateValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldDateValue"`
	ProjectV2ItemFieldIterationValue struct {
		Field       ProjectV2FieldConfiguration `json:"field"`
		IterationID string                      `json:"iterationId"`
		StartDate   string                      `json:"startDate"`
		Duration    graphql.Int                 `json:"duration"`
		Title       string                      `json:"title"`
		TitleHTML   string                      `graphql:"titleHTML" json:"titleHtml"`
	} `graphql:"... on ProjectV2ItemFieldIterationValue"`
	ProjectV2ItemFieldLabelValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldLabelValue"`
	ProjectV2ItemFieldMilestoneValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldMilestoneValue"`
	ProjectV2ItemFieldNumberValue struct {
		Field  ProjectV2FieldConfiguration `json:"field"`
		Number graphql.Float               `json:"number"`
	} `graphql:"... on ProjectV2ItemFieldNumberValue"`
	ProjectV2ItemFieldPullRequestValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldPullRequestValue"`
	ProjectV2ItemFieldRepositoryValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldRepositoryValue"`
	ProjectV2ItemFieldReviewerValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldReviewerValue"`
	ProjectV2ItemFieldSingleSelectValue struct {
		Field    ProjectV2FieldConfiguration `json:"field"`
		Name     string                      `json:"name"`
		OptionID string                      `json:"optionId"`
	} `graphql:"... on ProjectV2ItemFieldSingleSelectValue"`
	ProjectV2ItemFieldTextValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldTextValue"`
	ProjectV2ItemFieldUserValue struct {
		Field ProjectV2FieldConfiguration `json:"field"`
	} `graphql:"... on ProjectV2ItemFieldUserValue"`
}

type Issue

type Issue struct {
	ID          string     `json:"id"`
	Number      int        `json:"number"`
	Title       string     `json:"title"`
	Closed      bool       `json:"closed"`
	Repository  Repository `json:"repository"`
	State       string     `json:"state"`       // CLOSED, OPEN
	StateReason string     `json:"stateReason"` // COMPLETED, NOT_PLANNED, REOPENED
}

https://docs.github.com/ja/graphql/reference/objects#issue

type Organization

type Organization struct {
	ID    string `json:"id"`
	Login string `json:"login"`
	Name  string `json:"name"`
}

Organization https://docs.github.com/ja/graphql/reference/objects#organization

func FetchOrganizationByLogin

func FetchOrganizationByLogin(login string) (*Organization, error)

type Owner

type Owner struct {
	ID    string    `json:"id"`
	Login string    `json:"login"`
	Name  string    `json:"name"`
	Type  OwnerType `json:"type"`
}

func FetchOwnerByLogin

func FetchOwnerByLogin(login string) (*Owner, error)

type OwnerType

type OwnerType int
const (
	OwnerTypeUser OwnerType = 1 << iota
	OwnerTypeOrganization
)

type Project

type Project struct {
	ID     string `json:"id"`
	Number int    `json:"number"`
	Title  string `json:"title"`
}

Project https://docs.github.com/en/graphql/reference/objects#projectv2

func FetchProjectByID

func FetchProjectByID(projectID string) (*Project, error)

func FetchProjectByNumber

func FetchProjectByNumber(number int, ownerID string) (*Project, error)

type ProjectItem

type ProjectItem struct {
	Content     ProjectItemContent `json:"content"`
	ID          string             `json:"id"`
	FieldValues struct {
		Nodes []FieldValue `json:"nodes"`
	} `json:"fieldValues" graphql:"fieldValues(first: 100)"`
	IsArchived bool    `json:"isArchived"`
	Type       string  `json:"type"` // DRAFT_ISSUE, ISSUE, PULL_REQUEST, REDACTED
	Project    Project `json:"project"`
}

ProjectV2Item https://docs.github.com/ja/graphql/reference/objects#projectv2item

func FetchProjectItem

func FetchProjectItem(itemID string) (*ProjectItem, error)

type ProjectItemContent

type ProjectItemContent struct {
	DraftIssue  DraftIssue  `graphql:"...on DraftIssue"  json:"draftIssue"`
	Issue       Issue       `graphql:"...on Issue"       json:"issue"`
	PullRequest PullRequest `graphql:"...on PullRequest" json:"pullRequest"`
}

https://docs.github.com/ja/graphql/reference/unions#projectv2itemcontent

type ProjectV2FieldConfiguration

type ProjectV2FieldConfiguration struct {
	ProjectV2FieldCommon struct {
		Name     string
		DataType string
	} `graphql:"... on ProjectV2FieldCommon"`
}

type ProjectV2IterationField

type ProjectV2IterationField struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Configuration struct {
		CompletedIterations []ProjectV2IterationFieldIteration `json:"completedIterations"`
		Iterations          []ProjectV2IterationFieldIteration `json:"iterations"`
	} `json:"configuration"`
}

ProjectV2IterationField https://docs.github.com/en/graphql/reference/objects#projectv2iterationfield

func FetchIterationFieldByID

func FetchIterationFieldByID(fieldID string) (*ProjectV2IterationField, error)

func FetchIterationFieldByName

func FetchIterationFieldByName(projectID string, fieldName string) (*ProjectV2IterationField, error)

type ProjectV2IterationFieldIteration

type ProjectV2IterationFieldIteration struct {
	Duration  int    `json:"duration"`
	ID        string `json:"id"`
	StartDate string `json:"startDate"`
	Title     string `json:"title"`
}

ProjectV2IterationFieldIteration https://docs.github.com/en/graphql/reference/objects#projectv2iterationfielditeration

type ProjectV2IterationFieldWithoutConfiguration

type ProjectV2IterationFieldWithoutConfiguration struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type PullRequest

type PullRequest struct {
	ID         string     `json:"id"`
	Number     int        `json:"number"`
	Title      string     `json:"title"`
	Closed     bool       `json:"closed"`
	IsDraft    bool       `json:"isDraft"`
	Merged     bool       `json:"merged"`
	Repository Repository `json:"repository"`
	State      string     `json:"state"` // CLOSED, MERGED, OPEN
}

https://docs.github.com/ja/graphql/reference/objects#pullrequest

type Repository

type Repository struct {
	Name          string `json:"name"`
	NameWithOwner string `json:"nameWithOwner"`
}

https://docs.github.com/ja/graphql/reference/objects#repository

type User

type User struct {
	ID    string `json:"id"`
	Login string `json:"login"`
	Name  string `json:"name"`
}

User https://docs.github.com/ja/graphql/reference/objects#user

func FetchUserByLogin

func FetchUserByLogin(login string) (*User, error)

func FetchUserByViewer

func FetchUserByViewer() (*User, error)

Jump to

Keyboard shortcuts

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