graphql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalV4Client *githubv4.Client

Functions

func Init

func Init()

Init githubv4 graphql client

func QueryRepoNameByOrg

func QueryRepoNameByOrg(ctx context.Context, login string) ([]string, error)

QueryRepoNameByOrg return repos of the provided org in `org/repo` format

Types

type Issue

type Issue struct {
	ID     string
	Author struct {
		Login string
		User  struct {
			ID string
		} `graphql:"... on User"`
	}
	Repository struct {
		ID            string
		NameWithOwner string
	}
	Number    int
	URL       string
	State     string
	CreatedAt time.Time
	ClosedAt  time.Time
	Assignees struct {
		Nodes []IssueAssignee
	} `graphql:"assignees(first: $assigneesFirst, after: $assigneesAfter)"`
}

func QueryIssueInfoByRepo

func QueryIssueInfoByRepo(ctx context.Context, owner, name string, lastUpdate time.Time) ([]Issue, time.Time, error)

QueryIssueInfoByRepo return issues according to the repo if lastUpdate is empty it will return the issues since last update if lastUpdate is provided including new issues and updated issues

type IssueAssignee

type IssueAssignee struct {
	ID    string
	Login string
}

type IssueInfo

type IssueInfo struct {
	Repository struct {
		Issues struct {
			PageInfo struct {
				HasNextPage bool
				EndCursor   string
			}
			Nodes []Issue
		} `graphql:"issues(first: $issuesFirst, after: $issuesAfter, filterBy: { since: $since })"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type Org

type Org struct {
	ID    string
	Login string
}

func QueryOrgInfo

func QueryOrgInfo(ctx context.Context, login string) (Org, error)

type OrgInfo

type OrgInfo struct {
	Organization Org `graphql:"organization(login: $login)"`
}

type PR

type PR struct {
	ID     string
	Author struct {
		Login string
		User  struct {
			ID string
		} `graphql:"... on User"`
	}
	Repository struct {
		ID            string
		NameWithOwner string
	}
	Number    int
	URL       string
	State     string
	CreatedAt time.Time
	MergedAt  time.Time
	ClosedAt  time.Time
	Assignees struct {
		Nodes []PRAssignee
	} `graphql:"assignees(first: $assigneesFirst, after: $assigneesAfter)"`
}

func QueryPRInfoByRepo

func QueryPRInfoByRepo(ctx context.Context, owner, name, endCursor string) ([]PR, string, error)

QueryPRInfoByRepo return pull requests according to the repo if lastUpdate is empty it will return the prs since last update if lastUpdate is provided including new prs and updated prs

func QuerySinglePR

func QuerySinglePR(ctx context.Context, id string) (PR, error)

type PRAssignee

type PRAssignee struct {
	ID    string
	Login string
}

type PRInfo

type PRInfo struct {
	Repository struct {
		PullRequests struct {
			PageInfo struct {
				HasNextPage bool
				EndCursor   string
			}
			Nodes []PR
		} `graphql:"pullRequests(first: $prFirst, after: $prAfter)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}

type Repo

type Repo struct {
	ID    string
	Owner struct {
		ID string
	}
	Issues struct {
		TotalCount int
	}
	PullRequests struct {
		TotalCount int
	}
	Stargazers struct {
		TotalCount int
	}
	Forks struct {
		TotalCount int
	}
}

func QueryRepoInfo

func QueryRepoInfo(ctx context.Context, owner, name string) (Repo, error)

QueryRepoInfo return the repo info based on the provided owner and name

type RepoInfo

type RepoInfo struct {
	Repository Repo `graphql:"repository(owner: $owner, name: $name)"`
}

type RepoName

type RepoName struct {
	Organization struct {
		Repositories struct {
			PageInfo struct {
				HasNextPage bool
				EndCursor   string
			}
			Nodes []struct {
				NameWithOwner string
			}
		} `graphql:"repositories(first: $first, after: $after)"`
	} `graphql:"organization(login: $login)"`
}

type SinglePR

type SinglePR struct {
	Node struct {
		PullRequest PR `graphql:"... on PullRequest"`
	} `graphql:"node(id: $id)"`
}

type SingleUser

type SingleUser struct {
	Node struct {
		User User `graphql:"... on User"`
	} `graphql:"node(id: $id)"`
}

type User

type User struct {
	Company  string
	Location string
}

func QuerySingleUser

func QuerySingleUser(ctx context.Context, nodeID string) (User, error)

Jump to

Keyboard shortcuts

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