github

package
v0.0.0-...-1e56917 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GraphQLAPI = "https://api.github.com/graphql"

GraphQLAPI is the location of the GraphQL Endpoint

View Source
const RepoQueryFormat = `` /* 677-byte string literal not displayed */

RepoQueryFormat is the text format for the necessary GraphQL query

View Source
const (
	// SourceFormat is the format string for Github release tarballs
	SourceFormat = "https://github.com/%s/archive/%s.tar.gz"
)

Variables

View Source
var (
	// SourceRegex is the regex for Github sources
	SourceRegex = regexp.MustCompile("github.com/([^/]+/[^/.]+)")
	// VersionRegex is used to parse Github version numbers
	VersionRegex = regexp.MustCompile("(?:\\d+\\.)*\\d+\\w*")
)

Functions

This section is empty.

Types

type Provider

type Provider struct{}

Provider is the upstream provider interface for github

func (Provider) GetReleases

func (c Provider) GetReleases(name string, max int) (rs *results.ResultSet, err error)

GetReleases gets a number of releases for a given repo

func (Provider) Latest

func (c Provider) Latest(params []string) (r *results.Result, err error)

Latest finds the newest release for a github package

func (Provider) Match

func (c Provider) Match(query string) (params []string)

Match checks to see if this provider can handle this kind of query

func (Provider) Releases

func (c Provider) Releases(params []string) (rs *results.ResultSet, err error)

Releases finds all matching releases for a github package

func (Provider) String

func (c Provider) String() string

String gives the name of this provider

type RepoQuery

type RepoQuery struct {
	Query string `json:"query"`
}

RepoQuery is the JSON payload for this request

type RepoQueryResult

type RepoQueryResult struct {
	Data struct {
		Repository struct {
			Releases struct {
				Nodes []struct {
					Name         string `json:"name"`
					PublishedAt  string `json:"publishedAt"`
					IsPrerelease bool   `json:"isPrerelease"`
					Tag          struct {
						Name string `json:"name"`
					} `json:"tag"`
				} `json:"nodes"`
			} `json:"releases"`
			Refs struct {
				Nodes []struct {
					Name   string `json:"name"`
					Target struct {
						Date   string `json:"committedDate"`
						Tagger struct {
							Date string `json:"date"`
						} `json:"tagger"`
					} `json:"target"`
				} `json:"nodes"`
			} `json:"refs"`
		} `json:"repository"`
	} `json:"data"`
}

RepoQueryResult is the JSON payload of the response

func (RepoQueryResult) Convert

func (rqr RepoQueryResult) Convert(name string) (rs *results.ResultSet)

Convert turns a RepoQueryResult into a Cuppa ResultSet

Jump to

Keyboard shortcuts

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