github

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 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 = `` /* 391-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 = regexp.MustCompile("github.com/([^/]+/[^/.]+)")

SourceRegex is the regex for Github sources

View Source
var VersionRegex = regexp.MustCompile("(?:\\d+\\.)*\\d+\\w*")

VersionRegex is used to parse Github version numbers

Functions

This section is empty.

Types

type Provider

type Provider struct{}

Provider is the upstream provider interface for github

func (Provider) GetReleases added in v1.1.0

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

GetReleases gets a number of releases for a given repo

func (Provider) Latest

func (c Provider) Latest(name string) (r *results.Result, s results.Status)

Latest finds the newest release for a github package

func (Provider) Match

func (c Provider) Match(query string) string

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

func (Provider) Name

func (c Provider) Name() string

Name gives the name of this provider

func (Provider) Releases

func (c Provider) Releases(name string) (rs *results.ResultSet, s results.Status)

Releases finds all matching releases for a github package

type RepoQuery added in v1.1.0

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

RepoQuery is the JSON payload for this request

type RepoQueryResult added in v1.1.0

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"`
				} `json:"nodes"`
			} `json:"refs"`
		} `json:"repository"`
	} `json:"data"`
}

RepoQueryResult is the JSON payload of the response

func (RepoQueryResult) Convert added in v1.1.0

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