Documentation
¶
Overview ¶
Package models contains data types that will be received in a request or data that will be sent in a response. For example, this is a good place to store the format of the datasource settings.
Index ¶
- Constants
- type CommitsQuery
- type ContributorsQuery
- type IssueTimeField
- type IssuesQuery
- type LabelsQuery
- type ListCommitsOptions
- type ListContributorsOptions
- type ListIssuesOptions
- type ListLabelsOptions
- type ListMilestonesOptions
- type ListPackagesOptions
- type ListPullRequestsOptions
- type ListReleasesOptions
- type ListRepositoriesOptions
- type ListTagsOptions
- type MilestonesQuery
- type PackagesQuery
- type PullRequestTimeField
- type PullRequestsQuery
- type Query
- type ReleasesQuery
- type RepositoriesQuery
- type Settings
- type TagsQuery
Constants ¶
const ( // QueryTypeCommits is sent by the frontend when querying commits in a GitHub repository QueryTypeCommits = "Commits" // QueryTypeIssues is used when querying issues in a GitHub repository QueryTypeIssues = "Issues" // QueryTypeContributors is used when querying contributors in a GitHub repository QueryTypeContributors = "Contributors" // QueryTypeTags is used when querying tags in a GitHub repository QueryTypeTags = "Tags" // QueryTypeReleases is used when querying releases in a GitHub repository QueryTypeReleases = "Releases" // QueryTypePullRequests is used when querying pull requests in a GitHub repository QueryTypePullRequests = "Pull_Requests" // QueryTypeLabels is used when querying labels in a GitHub repository QueryTypeLabels = "Labels" // QueryTypeRepositories is used when querying for a GitHub repository QueryTypeRepositories = "Repositories" // QueryTypeOrganizations is used when querying for GitHub organizations QueryTypeOrganizations = "Organizations" // QueryTypeGraphQL is used when sending an ad-hoc graphql query QueryTypeGraphQL = "GraphQL" // QueryTypePackages is used when querying for NPM / Docker / etc packages QueryTypePackages = "Packages" // QueryTypeMilestones is used when querying for milestones in a repository QueryTypeMilestones = "Milestones" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommitsQuery ¶
type CommitsQuery struct {
Query
Options ListCommitsOptions `json:"options"`
}
CommitsQuery is used when querying for GitHub commits
type ContributorsQuery ¶
type ContributorsQuery struct {
Query
Options ListContributorsOptions `json:"options"`
}
ContributorsQuery is used when querying for GitHub contributors
type IssueTimeField ¶
type IssueTimeField uint32
IssueTimeField defines what time field to filter issues by (closed, opened...)
const ( // IssueCreatedAt is used when filtering when an Issue was opened IssueCreatedAt IssueTimeField = iota // IssuetClosedAt is used when filtering when an Issue was closed IssuetClosedAt )
func (IssueTimeField) String ¶
func (d IssueTimeField) String() string
type IssuesQuery ¶
type IssuesQuery struct {
Query
Options ListIssuesOptions `json:"options"`
}
IssuesQuery is used when querying for GitHub issues
type LabelsQuery ¶
type LabelsQuery struct {
Query
Options ListLabelsOptions `json:"options"`
}
LabelsQuery is used when querying for GitHub issue labels
type ListCommitsOptions ¶
type ListCommitsOptions struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
Ref string `json:"gitRef"`
}
ListCommitsOptions provides options when retrieving commits
func CommitsOptionsWithRepo ¶
func CommitsOptionsWithRepo(opt ListCommitsOptions, owner string, repo string) ListCommitsOptions
CommitsOptionsWithRepo adds Owner and Repo to a ListCommitsOptions. This is just for convenience
type ListContributorsOptions ¶
type ListContributorsOptions struct {
// Repository is the name of the repository being queried (ex: grafana)
Repository string `json:"repository"`
// Owner is the owner of the repository (ex: grafana)
Owner string `json:"owner"`
Query *string `json:"query,omitempty"`
}
ListContributorsOptions are the available arguments when listing contributor
type ListIssuesOptions ¶
type ListIssuesOptions struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
Filters *githubv4.IssueFilters `json:"filters"`
Query *string `json:"query,omitempty"`
TimeField IssueTimeField `json:"timeField"`
}
ListIssuesOptions provides options when retrieving issues
func IssueOptionsWithRepo ¶
func IssueOptionsWithRepo(opt ListIssuesOptions, owner string, repo string) ListIssuesOptions
IssueOptionsWithRepo adds the Owner and Repository values to a ListIssuesOptions. This is a convience function because this is a common operation
type ListLabelsOptions ¶
type ListLabelsOptions struct {
// Repository is the name of the repository being queried (ex: grafana)
Repository string `json:"repository"`
// Owner is the owner of the repository (ex: grafana)
Owner string `json:"owner"`
// Query searches labels by name and description
Query string `json:"query"`
}
ListLabelsOptions is provided when listing Labels in a repository
type ListMilestonesOptions ¶
type ListMilestonesOptions struct {
// Repository is the name of the repository being queried (ex: grafana)
Repository string `json:"repository"`
// Owner is the owner of the repository (ex: grafana)
Owner string `json:"owner"`
// Query searches milestones by name and description
Query string `json:"query"`
}
ListMilestonesOptions is provided when listing Labels in a repository
type ListPackagesOptions ¶
type ListPackagesOptions struct {
Repository string `json:"repository"`
Owner string `json:"owner"`
Names string `json:"names"`
PackageType githubv4.PackageType `json:"packageType"`
}
ListPackagesOptions provides options when retrieving commits
func PackagesOptionsWithRepo ¶
func PackagesOptionsWithRepo(opt ListPackagesOptions, owner string, repo string) ListPackagesOptions
PackagesOptionsWithRepo adds Owner and Repo to a ListPackagesOptions. This is just for convenience
type ListPullRequestsOptions ¶
type ListPullRequestsOptions struct {
// Repository is the name of the repository being queried (ex: grafana)
Repository string `json:"repository"`
// Owner is the owner of the repository (ex: grafana)
Owner string `json:"owner"`
// TimeField defines what time field to filter by
TimeField PullRequestTimeField `json:"timeField"`
Query *string `json:"query,omitempty"`
}
ListPullRequestsOptions are the available options when listing pull requests in a time range
func PullRequestOptionsWithRepo ¶
func PullRequestOptionsWithRepo(opt ListPullRequestsOptions, owner string, repo string) ListPullRequestsOptions
PullRequestOptionsWithRepo adds the Owner and Repository options to a ListPullRequestsOptions type
type ListReleasesOptions ¶
type ListReleasesOptions struct {
// Repository is the name of the repository being queried (ex: grafana)
Repository string `json:"repository"`
// Owner is the owner of the repository (ex: grafana)
Owner string `json:"owner"`
}
ListReleasesOptions are the available options when listing releases
type ListRepositoriesOptions ¶
ListRepositoriesOptions is the options for listing repositories
type ListTagsOptions ¶
type ListTagsOptions struct {
// Repository is the name of the repository being queried (ex: grafana)
Repository string `json:"repository"`
// Owner is the owner of the repository (ex: grafana)
Owner string `json:"owner"`
}
ListTagsOptions are the available options when listing tags
type MilestonesQuery ¶
type MilestonesQuery struct {
Query
Options ListMilestonesOptions `json:"options"`
}
MilestonesQuery is used when querying for GitHub milestones
type PackagesQuery ¶
type PackagesQuery struct {
Query
Options ListPackagesOptions `json:"options"`
}
PackagesQuery is used when querying for GitHub packages, including NPM, Maven, PyPi, Rubygems, and Docker
type PullRequestTimeField ¶
type PullRequestTimeField uint32
PullRequestTimeField defines what time field to filter pull requests by (closed, opened, merged...)
const ( // PullRequestClosedAt is used when filtering when a Pull Request was closed PullRequestClosedAt PullRequestTimeField = iota // PullRequestCreatedAt is used when filtering when a Pull Request was opened PullRequestCreatedAt // PullRequestMergedAt is used when filtering when a Pull Request was merged PullRequestMergedAt // PullRequestNone is used when the results are not filtered by time. Without any other filters, using this could easily cause an access token to be rate limited PullRequestNone )
func (PullRequestTimeField) String ¶
func (d PullRequestTimeField) String() string
type PullRequestsQuery ¶
type PullRequestsQuery struct {
Query
Options ListPullRequestsOptions `json:"options"`
}
PullRequestsQuery is used when querying for GitHub Pull Requests
type Query ¶
Query refers to the structure of a query built using the QueryEditor. Every query uses this query type and has to include options for each type of query. For example, listing commits can be filtered by author, but filtering contributors by author doesn't provide much value, but is included in the query schema anyways.
type ReleasesQuery ¶
type ReleasesQuery struct {
Query
Options ListReleasesOptions `json:"options"`
}
ReleasesQuery is used when querying for GitHub issue labels
type RepositoriesQuery ¶ added in v1.0.1
type RepositoriesQuery struct {
Query
}
RepositoriesQuery is used when querying for GitHub repositories
type Settings ¶
type Settings struct {
AccessToken string `json:"accessToken"`
GithubURL string `json:"githubUrl"`
CachingEnabled bool `json:"cachingEnabled"`
}
Settings represents the Datasource options in Grafana
func LoadSettings ¶
func LoadSettings(settings backend.DataSourceInstanceSettings) (Settings, error)
LoadSettings converts the DataSourceInLoadSettings to usable Github settings
type TagsQuery ¶
type TagsQuery struct {
Query
Options ListTagsOptions `json:"options"`
}
TagsQuery is used when querying for GitHub tags