github

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(dstaskRepo string, cfg config.Config) error

Do runs the Github import if the user requested it

Types

type Author

type Author struct {
	Name string `graphql:"login"`
}

type Github

type Github struct {
	// contains filtered or unexported fields
}

Github is a client to process multiple repos with a given template

func NewClient

func NewClient(cfg config.Github) (*Github, error)

NewClient creates a new Github client

func (*Github) Run

func (gh *Github) Run(dstaskRepo string) error

Run processes the issues from all requested repositories

type Issue

type Issue struct {
	ID        string    `graphql:"id"`
	Number    int       `graphql:"number"`
	Body      string    `graphql:"body"`
	Title     string    `graphql:"title"`
	Author    Author    `graphql:"author"`
	URL       string    `graphql:"url"`
	CreatedAt time.Time `graphql:"createdAt"`
	Milestone Milestone `graphql:"milestone"`
	State     string    `graphql:"state"`
	Closed    bool      `graphql:"closed"`
	ClosedAt  time.Time `graphql:"closedAt"`
}

type IssueConnection

type IssueConnection struct {
	Edges    []IssueEdge `graphql:"edges"`
	PageInfo PageInfo    `graphql:"pageInfo"`
}

type IssueData

type IssueData struct {
	UUID string

	// populated from our scraping config
	RepoOwner string
	RepoName  string

	// populated from the data GitHub returned to us
	Author    string
	Body      string
	ClosedAt  time.Time
	Closed    bool
	CreatedAt time.Time
	Milestone string
	Number    int
	State     string
	Title     string
	URL       string
	// contains filtered or unexported fields
}

IssueData is a compact way to represent an issue so that templates can be expanded simply (without nested properties)

func NewIssueData

func NewIssueData() *IssueData

func (*IssueData) Init

func (id *IssueData) Init(repoOwner, repoName string, i Issue)

Init sets all properties to match the given repo owner, name and Github data

func (*IssueData) ToTask

func (id *IssueData) ToTask(templates Templates) (dstask.Task, error)

ToTask generates a Task based on the issue data

type IssueEdge

type IssueEdge struct {
	Cursor string `graphql:"cursor"`
	Node   Issue  `graphql:"node"`
}

type Milestone

type Milestone struct {
	Description string
	Number      int
	Title       string
}

type MilestoneConnection

type MilestoneConnection struct {
	Edges    []MilestoneEdge `graphql:"edges"`
	PageInfo PageInfo        `graphql:"pageInfo"`
}

type MilestoneEdge

type MilestoneEdge struct {
	Cursor string    `graphql:"cursor"`
	Node   Milestone `graphql:"node"`
}

type MilestoneQuery

type MilestoneQuery struct {
	Repository struct {
		Milestones MilestoneConnection `graphql:"milestones(first: 100, query: $query)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type PageInfo

type PageInfo struct {
	EndCursor   githubv4.String
	HasNextPage bool
}

PageInfo helps with the paging large query responses

type Query

type Query struct {
	Repository struct {
		IssueConnection IssueConnection `graphql:"issues(first: $count, after: $issueCursor, filterBy: $filterBy)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type QueryWithMilestone

type QueryWithMilestone struct {
	Repository struct {
		Milestone struct {
			IssueConnection IssueConnection `graphql:"issues(first: $count, after: $issueCursor, filterBy: $filterBy)"`
		} `graphql:"milestone(number: $milestone)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type RepoIter

type RepoIter struct {
	// contains filtered or unexported fields
}

RepoIter iterates all the desired issues from a given repo

func NewRepoIter

func NewRepoIter(cfg config.Github, repo string, templates Templates, client *githubv4.Client) (*RepoIter, error)

func (*RepoIter) Next

func (ri *RepoIter) Next() ([]dstask.Task, error)

Next returns the next batch of tasks, if there are any

type Templates

type Templates struct {
	Summary  *template.Template
	Project  *template.Template
	Priority *template.Template
	Notes    *template.Template
	Tags     []*template.Template
}

func ParseTemplates

func ParseTemplates(task dstask.Task) Templates

Jump to

Keyboard shortcuts

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