Documentation ¶
Overview ¶
Package github contains more usable functions and types for interacting with the Githubv4 API
Index ¶
- Constants
- func GetQueryHandlers(s *QueryHandler) *datasource.QueryTypeMux
- func InterPolateMacros(query string) (string, error)
- func UnmarshalQuery(b []byte, v interface{}) *backend.DataResponse
- type CVSS
- type Commit
- type Commits
- type Datasource
- func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
- func (d *Datasource) HandleCommitsQuery(ctx context.Context, query *models.CommitsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleContributorsQuery(ctx context.Context, query *models.ContributorsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleGetLabels(w http.ResponseWriter, r *http.Request)
- func (d *Datasource) HandleGetMilestones(w http.ResponseWriter, r *http.Request)
- func (d *Datasource) HandleIssuesQuery(ctx context.Context, query *models.IssuesQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleLabelsQuery(ctx context.Context, query *models.LabelsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleMilestonesQuery(ctx context.Context, query *models.MilestonesQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandlePackagesQuery(ctx context.Context, query *models.PackagesQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleProjectsQuery(ctx context.Context, query *models.ProjectsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandlePullRequestsQuery(ctx context.Context, query *models.PullRequestsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleReleasesQuery(ctx context.Context, query *models.ReleasesQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleRepositoriesQuery(ctx context.Context, query *models.RepositoriesQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleStargazersQuery(ctx context.Context, query *models.StargazersQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleTagsQuery(ctx context.Context, query *models.TagsQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) HandleVulnerabilitiesQuery(ctx context.Context, query *models.VulnerabilityQuery, req backend.DataQuery) (dfutil.Framer, error)
- func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- type GitActor
- type GitActors
- type Issue
- type Issues
- type Label
- type Labels
- type Milestones
- type Organization
- type Organizations
- type Package
- type PackageStatistics
- type PackageVersion
- type Packages
- type PullRequest
- type PullRequestAuthor
- type PullRequests
- type QueryHandler
- func (s *QueryHandler) HandleCommits(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleContributors(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleIssues(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleLabels(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleMilestones(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandlePackages(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleProjects(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandlePullRequests(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleReleases(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleRepositories(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleStargazers(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleTags(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- func (s *QueryHandler) HandleVulnerabilities(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
- type QueryHandlerFunc
- type QueryListCommits
- type QueryListCommitsInRange
- type QueryListContributors
- type QueryListLabels
- type QueryListMilestones
- type QueryListOrganizations
- type QueryListPackages
- type QueryListPullRequests
- type QueryListReleases
- type QueryListRepositories
- type QueryListTags
- type QueryListVulnerabilities
- type QuerySearchIssues
- type QueryStargazers
- type Release
- type Releases
- type Repositories
- type Repository
- type SecurityAdvisory
- type SecurityAdvisoryPackage
- type SecurityAdvisoryPackageVersion
- type Stargazer
- type StargazerWrapper
- type StargazersWrapper
- type Tag
- type Tags
- type Users
- type Vulnerabilities
- type Vulnerability
Constants ¶
const PageNumberLimit = 2
PageNumberLimit is the limit on the number of pages that will be traversed
Variables ¶
This section is empty.
Functions ¶
func GetQueryHandlers ¶ added in v1.3.0
func GetQueryHandlers(s *QueryHandler) *datasource.QueryTypeMux
GetQueryHandlers creates the QueryTypeMux type for handling queries
func InterPolateMacros ¶ added in v1.0.14
InterPolateMacros interpolate macros on a given query string
func UnmarshalQuery ¶ added in v1.3.0
func UnmarshalQuery(b []byte, v interface{}) *backend.DataResponse
UnmarshalQuery attempts to unmarshal a query from JSON
Types ¶
type Commit ¶
type Commit struct { OID string PushedDate githubv4.DateTime AuthoredDate githubv4.DateTime CommittedDate githubv4.DateTime Message githubv4.String Author GitActor }
Commit represents a git commit from GitHub's API
type Commits ¶
type Commits []Commit
Commits is a slice of git commits
func GetAllCommits ¶
func GetAllCommits(ctx context.Context, client models.Client, opts models.ListCommitsOptions) (Commits, error)
GetAllCommits lists every commit in a project. This function is slow and very prone to rate limiting.
type Datasource ¶
type Datasource struct {
// contains filtered or unexported fields
}
Datasource handles requests to GitHub
func NewDatasource ¶
func NewDatasource(ctx context.Context, settings models.Settings) *Datasource
NewDatasource creates a new datasource for handling queries
func (*Datasource) CheckHealth ¶
func (d *Datasource) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error)
CheckHealth is the health check for GitHub
func (*Datasource) HandleCommitsQuery ¶
func (d *Datasource) HandleCommitsQuery(ctx context.Context, query *models.CommitsQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleCommitsQuery is the query handler for listing GitHub Commits
func (*Datasource) HandleContributorsQuery ¶
func (d *Datasource) HandleContributorsQuery(ctx context.Context, query *models.ContributorsQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleContributorsQuery is the query handler for listing GitHub Contributors
func (*Datasource) HandleGetLabels ¶
func (d *Datasource) HandleGetLabels(w http.ResponseWriter, r *http.Request)
HandleGetLabels is the HTTP handler for the resource call for getting GitHub labels
func (*Datasource) HandleGetMilestones ¶
func (d *Datasource) HandleGetMilestones(w http.ResponseWriter, r *http.Request)
HandleGetMilestones is the HTTP handler for the resource call for getting GitHub milestones
func (*Datasource) HandleIssuesQuery ¶
func (d *Datasource) HandleIssuesQuery(ctx context.Context, query *models.IssuesQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleIssuesQuery is the query handler for listing GitHub Issues
func (*Datasource) HandleLabelsQuery ¶
func (d *Datasource) HandleLabelsQuery(ctx context.Context, query *models.LabelsQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleLabelsQuery is the query handler for listing GitHub Labels
func (*Datasource) HandleMilestonesQuery ¶
func (d *Datasource) HandleMilestonesQuery(ctx context.Context, query *models.MilestonesQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleMilestonesQuery is the query handler for listing GitHub Milestones
func (*Datasource) HandlePackagesQuery ¶
func (d *Datasource) HandlePackagesQuery(ctx context.Context, query *models.PackagesQuery, req backend.DataQuery) (dfutil.Framer, error)
HandlePackagesQuery is the query handler for listing GitHub Packages
func (*Datasource) HandleProjectsQuery ¶ added in v1.3.0
func (d *Datasource) HandleProjectsQuery(ctx context.Context, query *models.ProjectsQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleProjectsQuery is the query handler for listing GitHub Projects
func (*Datasource) HandlePullRequestsQuery ¶
func (d *Datasource) HandlePullRequestsQuery(ctx context.Context, query *models.PullRequestsQuery, req backend.DataQuery) (dfutil.Framer, error)
HandlePullRequestsQuery is the query handler for listing GitHub PullRequests
func (*Datasource) HandleReleasesQuery ¶
func (d *Datasource) HandleReleasesQuery(ctx context.Context, query *models.ReleasesQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleReleasesQuery is the query handler for listing GitHub Releases
func (*Datasource) HandleRepositoriesQuery ¶ added in v1.0.1
func (d *Datasource) HandleRepositoriesQuery(ctx context.Context, query *models.RepositoriesQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleRepositoriesQuery is the query handler for listing GitHub Repositories
func (*Datasource) HandleStargazersQuery ¶ added in v1.4.0
func (d *Datasource) HandleStargazersQuery(ctx context.Context, query *models.StargazersQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleStargazersQuery is the query handler for listing stargazers of a GitHub repository
func (*Datasource) HandleTagsQuery ¶
func (d *Datasource) HandleTagsQuery(ctx context.Context, query *models.TagsQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleTagsQuery is the query handler for listing GitHub Tags
func (*Datasource) HandleVulnerabilitiesQuery ¶ added in v1.3.0
func (d *Datasource) HandleVulnerabilitiesQuery(ctx context.Context, query *models.VulnerabilityQuery, req backend.DataQuery) (dfutil.Framer, error)
HandleVulnerabilitiesQuery is the query handler for listing GitHub Packages
func (*Datasource) QueryData ¶ added in v1.3.0
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
QueryData runs the query
type Issue ¶
type Issue struct { Number int64 Title string ClosedAt githubv4.DateTime CreatedAt githubv4.DateTime Closed bool Author struct { models.User `graphql:"... on User"` } Repository Repository }
Issue represents a GitHub issue in a repository
type Issues ¶
type Issues []Issue
Issues is a slice of GitHub issues
type Label ¶
type Label struct { Color string `json:"color"` Name string `json:"name"` Description string `json:"description"` }
Label is a GitHub label used in Issues / Pull Requests
type Labels ¶
type Labels []Label
Labels is a list of GitHub labels
func GetAllLabels ¶
func GetAllLabels(ctx context.Context, client models.Client, opts models.ListLabelsOptions) (Labels, error)
GetAllLabels gets all labels from a GitHub repository
type Milestones ¶
Milestones is a list of GitHub milestones
func GetAllMilestones ¶
func GetAllMilestones(ctx context.Context, client models.Client, opts models.ListMilestonesOptions) (Milestones, error)
GetAllMilestones lists milestones in a repository
func (Milestones) Frames ¶
func (m Milestones) Frames() data.Frames
Frames converts the list of GitHub Milestones to a Grafana data frame
type Organization ¶
type Organization struct {
Name string
}
An Organization is a single GitHub organization
func GetAllOrganizations ¶
GetAllOrganizations lists the available organizations for the client
type Organizations ¶
type Organizations []Organization
Organizations is a slice of GitHub Organizations
func (Organizations) Frames ¶
func (c Organizations) Frames() data.Frames
Frames converts the list of Organizations to a Grafana DataFrame
type Package ¶
type Package struct { Name string PackageType githubv4.PackageType Statistics PackageStatistics Versions []PackageVersion }
Package represents a GitHub Package
type PackageStatistics ¶
type PackageStatistics struct {
DownloadsTotalCount int64
}
PackageStatistics is a common object used in package versions and packages themselves
type PackageVersion ¶
type PackageVersion struct { PreRelease bool Platform string Version string Statistics PackageStatistics }
PackageVersion is the version of a package. A package can have several versions.
type Packages ¶
type Packages []Package
Packages is a list of GitHub packages
func GetAllPackages ¶
func GetAllPackages(ctx context.Context, client models.Client, opts models.ListPackagesOptions) (Packages, error)
GetAllPackages lists packages in a repository
type PullRequest ¶
type PullRequest struct { Number int64 Title string URL string State githubv4.PullRequestState Author PullRequestAuthor Closed bool IsDraft bool Locked bool Merged bool ClosedAt githubv4.DateTime CreatedAt githubv4.DateTime UpdatedAt githubv4.DateTime MergedAt githubv4.DateTime Mergeable githubv4.MergeableState MergedBy *PullRequestAuthor Repository Repository }
PullRequest is a GitHub pull request
type PullRequestAuthor ¶
PullRequestAuthor is the structure of the Author object in a Pull Request (which requires a graphQL object expansion on `User`)
type PullRequests ¶
type PullRequests []PullRequest
PullRequests is a list of GitHub Pull Requests
func GetAllPullRequests ¶
func GetAllPullRequests(ctx context.Context, client models.Client, opts models.ListPullRequestsOptions) (PullRequests, error)
GetAllPullRequests uses the graphql search endpoint API to search all pull requests in the repository
func GetPullRequestsInRange ¶
func GetPullRequestsInRange(ctx context.Context, client models.Client, opts models.ListPullRequestsOptions, from time.Time, to time.Time) (PullRequests, error)
GetPullRequestsInRange uses the graphql search endpoint API to find pull requests in the given time range.
func (PullRequests) Frames ¶
func (p PullRequests) Frames() data.Frames
Frames converts the list of Pull Requests to a Grafana DataFrame
type QueryHandler ¶ added in v1.3.0
type QueryHandler struct {
Datasource Datasource
}
QueryHandler is the main handler for datasource queries.
func (*QueryHandler) HandleCommits ¶ added in v1.3.0
func (s *QueryHandler) HandleCommits(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleCommits handles the plugin query for github Commits
func (*QueryHandler) HandleContributors ¶ added in v1.3.0
func (s *QueryHandler) HandleContributors(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleContributors handles the plugin query for github Contributors
func (*QueryHandler) HandleIssues ¶ added in v1.3.0
func (s *QueryHandler) HandleIssues(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleIssues handles the plugin query for github Issues
func (*QueryHandler) HandleLabels ¶ added in v1.3.0
func (s *QueryHandler) HandleLabels(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleLabels handles the plugin query for github Labels
func (*QueryHandler) HandleMilestones ¶ added in v1.3.0
func (s *QueryHandler) HandleMilestones(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleMilestones handles the plugin query for github Milestones
func (*QueryHandler) HandlePackages ¶ added in v1.3.0
func (s *QueryHandler) HandlePackages(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandlePackages handles the plugin query for github Packages
func (*QueryHandler) HandleProjects ¶ added in v1.3.0
func (s *QueryHandler) HandleProjects(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleProjects handles the plugin query for github Projects
func (*QueryHandler) HandlePullRequests ¶ added in v1.3.0
func (s *QueryHandler) HandlePullRequests(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandlePullRequests handles the plugin query for github PullRequests
func (*QueryHandler) HandleReleases ¶ added in v1.3.0
func (s *QueryHandler) HandleReleases(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleReleases handles the plugin query for github Releases
func (*QueryHandler) HandleRepositories ¶ added in v1.3.0
func (s *QueryHandler) HandleRepositories(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleRepositories handles the plugin query for github tags
func (*QueryHandler) HandleStargazers ¶ added in v1.4.0
func (s *QueryHandler) HandleStargazers(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleStargazers handles the plugin query for GitHub stargazers
func (*QueryHandler) HandleTags ¶ added in v1.3.0
func (s *QueryHandler) HandleTags(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleTags handles the plugin query for github tags
func (*QueryHandler) HandleVulnerabilities ¶ added in v1.3.1
func (s *QueryHandler) HandleVulnerabilities(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error)
HandleVulnerabilities handles the plugin query for github Vulnerabilities
type QueryHandlerFunc ¶ added in v1.3.0
QueryHandlerFunc is the function signature used for mux.HandleFunc
type QueryListCommits ¶
type QueryListCommits struct { Repository struct { Object struct { Commit struct { History struct { Nodes []Commit PageInfo models.PageInfo } `graphql:"history(first: 100, after: $cursor)"` } `graphql:"... on Commit"` } `graphql:"object(expression: $ref)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListCommits is the object representation of the graphql query for retrieving a paginated list of commits for a project
query { repository(name:"$name", owner:"$owner") { object(expression: "master") { ... on Commit { history { nodes { committedDate } pageInfo{ hasNextPage hasPreviousPage } } } } } }
type QueryListCommitsInRange ¶
type QueryListCommitsInRange struct { Repository struct { Object struct { Commit struct { History struct { Nodes []Commit PageInfo models.PageInfo } `graphql:"history(first: 100, after: $cursor, since: $since, until: $until)"` } `graphql:"... on Commit"` } `graphql:"object(expression: $ref)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListCommitsInRange is the graphql query for retrieving a paginated list of commits within a time range
type QueryListContributors ¶
type QueryListContributors struct { Repository struct { Users struct { Nodes Users PageInfo models.PageInfo } `graphql:"mentionableUsers(query: $query, first: 100, after: $cursor)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListContributors is the GraphQL query for listing contributors (or rather, mentionable users in a repository)
type QueryListLabels ¶
type QueryListLabels struct { Repository struct { Labels struct { Nodes Labels PageInfo models.PageInfo } `graphql:"labels(first: 100, after: $cursor, query: $query)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListLabels lists all labels in a repository
{ repository(name: "grafana", owner: "grafana") { labels(first: 100) { nodes { color description name } } } }
type QueryListMilestones ¶
type QueryListMilestones struct { Repository struct { Milestones struct { Nodes Milestones PageInfo models.PageInfo } `graphql:"milestones(first: 100, after: $cursor, query: $query)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListMilestones lists all milestones in a repository
{ repository(name: "grafana", owner: "grafana") { milestones(first: 100) { nodes { color description name } } } }
type QueryListOrganizations ¶
type QueryListOrganizations struct { Viewer struct { Organizations struct { Nodes []Organization PageInfo models.PageInfo } `graphql:"organizations(first: 100, after: $cursor)"` } }
QueryListOrganizations is the GraphQL query for listing organizations
type QueryListPackages ¶
type QueryListPackages struct { Repository struct { Packages struct { Nodes []struct { Name string PackageType githubv4.PackageType Statistics PackageStatistics Versions struct { Nodes []PackageVersion PageInfo models.PageInfo } `graphql:"versions(first: 100, after: $versionsCursor)"` } PageInfo models.PageInfo } `graphql:"packages(names: $names, packageType: $packageType, first: 100, after: $cursor)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListPackages is the GraphQL query for listing GitHub packages
{ repository(name: "grafana", owner: "grafana") { packages(names: "", packageType: "", first: 10) { nodes { id name packageType statistics { downloadsTotalCount } versions(first: 10) { nodes { preRelease platform version statistics { downloadsTotalCount } } pageInfo { hasNextPage endCursor } } } totalCount pageInfo { endCursor hasNextPage } } } }
type QueryListPullRequests ¶
type QueryListPullRequests struct { Search struct { Nodes []struct { PullRequest PullRequest `graphql:"... on PullRequest"` } PageInfo models.PageInfo } `graphql:"search(query: $query, type: ISSUE, first: 100, after: $cursor)"` }
QueryListPullRequests lists all pull requests in a repository
{ search(query: "is:pr repo:grafana/grafana merged:2020-08-19..*", type: ISSUE, first: 100) { nodes { ... on PullRequest { id title } } }
type QueryListReleases ¶
type QueryListReleases struct { Repository struct { Releases struct { Nodes []Release PageInfo models.PageInfo } `graphql:"releases(first: 100, after: $cursor)"` } `graphql:"repository(owner: $owner, name: $name)"` }
QueryListReleases is the GraphQL query for listing GitHub releases in a repository
type QueryListRepositories ¶
type QueryListRepositories struct { Search struct { Nodes []struct { Repository Repository `graphql:"... on Repository"` } PageInfo models.PageInfo } `graphql:"search(query: $query, type: REPOSITORY, first: 100, after: $cursor)"` }
QueryListRepositories is the GraphQL query for retrieving a list of repositories for an organization
{ search(query: "is:pr repo:grafana/grafana merged:2020-08-19..*", type: ISSUE, first: 100) { nodes { ... on PullRequest { id title } } }
type QueryListTags ¶
type QueryListTags struct { Repository struct { Refs struct { Nodes []struct { Target struct { Tag Tag `graphql:"... on Tag"` } } PageInfo models.PageInfo } `graphql:"refs(refPrefix: \"refs/tags/\", orderBy: {field: TAG_COMMIT_DATE, direction: DESC}, first: 100, after: $cursor)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListTags is the GraphQL query for listing GitHub tags in a repository
repository(name: "grafana", owner: "grafana") { refs(refPrefix: "refs/tags/", orderBy: {field: TAG_COMMIT_DATE, direction: DESC}, first: 10, query: "") { nodes { target { oid ... on Tag { name tagger { date } target { oid ... on Commit { committedDate pushedDate } } } } } } } }
type QueryListVulnerabilities ¶ added in v1.3.0
type QueryListVulnerabilities struct { Repository struct { VulnerabilityAlerts struct { Nodes Vulnerabilities PageInfo models.PageInfo } `graphql:"vulnerabilityAlerts(first: 100, after: $cursor)"` } `graphql:"repository(name: $name, owner: $owner)"` }
QueryListVulnerabilities lists all labels in a repository
{ repository(name: "grafana", owner: "grafana") { labels(first: 100) { nodes { color description name } } } } { repository(name: "repo-name", owner: "repo-owner") { vulnerabilityAlerts(first: 100) { nodes { createdAt dismissedAt securityVulnerability { package { name } advisory { description } } } } } }
type QuerySearchIssues ¶
type QuerySearchIssues struct { Search struct { Nodes []struct { Issue Issue `graphql:"... on Issue"` } PageInfo models.PageInfo } `graphql:"search(query: $query, type: ISSUE, first: 100, after: $cursor)"` }
QuerySearchIssues is the object representation of the graphql query for retrieving a paginated list of issues using the search query
{ search(query: "is:issue repo:grafana/grafana opened:2020-08-19..*", type: ISSUE, first: 100) { nodes { ... on PullRequest { id title } } }
type QueryStargazers ¶ added in v1.4.0
type QueryStargazers struct { Repository struct { Stargazers struct { TotalCount int64 PageInfo models.PageInfo Edges []Stargazer } `graphql:"stargazers(first: 100, orderBy: {field: STARRED_AT, direction: DESC}, after: $cursor)"` } `graphql:"repository(owner: $owner, name: $name)"` }
QueryStargazers is the object representation of the graphql query for retrieving a paginated list of stargazers for a repository
query { repository(owner: $owner, name: $name) { stargazers(first: 100, orderBy: {field: STARRED_AT, direction: DESC}, after: $cursor) { totalCount pageInfo { hasNextPage startCursor endCursor } edges { starredAt node { id login name company email url } } } } }
type Release ¶
type Release struct { ID string Name string Author models.User IsDraft bool IsPrerelease bool CreatedAt githubv4.DateTime PublishedAt githubv4.DateTime TagName string URL string }
Release is a GitHub release. Every release has an associated tag.
type Releases ¶
type Releases []Release
Releases is a slice of GitHub releases
func GetAllReleases ¶
func GetAllReleases(ctx context.Context, client models.Client, opts models.ListReleasesOptions) (Releases, error)
GetAllReleases retrieves every release from a repository
func GetReleasesInRange ¶
func GetReleasesInRange(ctx context.Context, client models.Client, opts models.ListReleasesOptions, from time.Time, to time.Time) (Releases, error)
GetReleasesInRange retrieves every release from the repository and then returns the ones that fall within the given time range.
type Repositories ¶ added in v1.0.1
type Repositories []Repository
Repositories is a list of GitHub repositories
func GetAllRepositories ¶
func GetAllRepositories(ctx context.Context, client models.Client, opts models.ListRepositoriesOptions) (Repositories, error)
GetAllRepositories retrieves all available repositories for an organization
func (Repositories) Frames ¶ added in v1.0.1
func (r Repositories) Frames() data.Frames
Frames converts the list of GitHub repositories to a Grafana Dataframe
type Repository ¶
type Repository struct { Name string Owner struct { Login string } NameWithOwner string URL string ForkCount int64 IsFork bool IsMirror bool IsPrivate bool CreatedAt githubv4.DateTime }
Repository is a code repository
type SecurityAdvisory ¶ added in v1.3.0
type SecurityAdvisory struct { Description string Cvss CVSS Permalink string Severity githubv4.SecurityAdvisorySeverity WithdrawnAt githubv4.DateTime }
SecurityAdvisory is the main security report for a vulnerability in a repository
type SecurityAdvisoryPackage ¶ added in v1.3.0
type SecurityAdvisoryPackage struct {
Name string
}
SecurityAdvisoryPackage is an object to share the name of the package that is impacted
type SecurityAdvisoryPackageVersion ¶ added in v1.3.0
type SecurityAdvisoryPackageVersion struct {
Identifier string
}
SecurityAdvisoryPackageVersion is a struct with an identifier to identify the package
type StargazerWrapper ¶ added in v1.4.0
StargazerWrapper is a mapping of a GitHub stargazer to what the total count of stars roughly would've been when they starred the repository
type StargazersWrapper ¶ added in v1.4.0
type StargazersWrapper []StargazerWrapper
StargazersWrapper is a list of GitHub wrapped stargazers
func GetStargazers ¶ added in v1.4.0
func GetStargazers(ctx context.Context, client models.Client, opts models.ListStargazersOptions, timeRange backend.TimeRange) (StargazersWrapper, error)
GetStargazers gets all stargazers for a GitHub repository
func (StargazersWrapper) Frames ¶ added in v1.4.0
func (a StargazersWrapper) Frames() data.Frames
Frames converts the list of stargazers to a Grafana DataFrame
type Tag ¶
type Tag struct { Name string Tagger struct { Date githubv4.DateTime User models.User } Target struct { OID string Commit Commit `graphql:"... on Commit"` } }
Tag is a GitHub tag. Every tag has an associated commit
type Tags ¶
type Tags []Tag
Tags is a list of GitHub tags
func GetAllTags ¶
func GetAllTags(ctx context.Context, client models.Client, opts models.ListTagsOptions) (Tags, error)
GetAllTags retrieves every tag from a repository
type Users ¶
Users is a slice of GitHub users
func GetAllContributors ¶
func GetAllContributors(ctx context.Context, client models.Client, opts models.ListContributorsOptions) (Users, error)
GetAllContributors lists all of the git contributors in a a repository
type Vulnerabilities ¶ added in v1.3.0
type Vulnerabilities []Vulnerability
Vulnerabilities is a list of GitHub vulnerabilities
func GetAllVulnerabilities ¶ added in v1.3.0
func GetAllVulnerabilities(ctx context.Context, client models.Client, opts models.ListVulnerabilitiesOptions) (Vulnerabilities, error)
GetAllVulnerabilities gets all vulnerabilities from a GitHub repository
func (Vulnerabilities) Frames ¶ added in v1.3.0
func (a Vulnerabilities) Frames() data.Frames
Frames converts the list of vulnerabilities to a Grafana DataFrame
Source Files ¶
- commits.go
- commits_handler.go
- constants.go
- contributors.go
- contributors_handler.go
- datasource.go
- docs.go
- issues.go
- issues_handler.go
- labels.go
- labels_handler.go
- macros.go
- milestones.go
- milestones_handler.go
- organizations.go
- packages.go
- packages_handler.go
- projects_handler.go
- pull_requests.go
- pull_requests_handler.go
- query_handler.go
- releases.go
- releases_handler.go
- repositories.go
- repositories_handler.go
- resource_handlers.go
- stargazers.go
- stargazers_handler.go
- tags.go
- tags_handler.go
- vulnerabilites_handler.go
- vulnerabilities.go