api

package
v0.0.0-...-9c5e671 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstallationID

func GetInstallationID(token string) (*int64, error)

GetInstallationID grabs install_id for the user

func GetInstalledRepos

func GetInstalledRepos(token string, installID *int64) ([]*github.Repository, error)

GetInstalledRepos returns the repos the GitHub App is installed on

func GetRepos

func GetRepos(token string) ([]*github.Repository, error)

GetRepos returns list of repos for the authed user

func GetUser

func GetUser(token string) (*github.User, error)

GetUser returns GitHub user

Types

type GQLNode

type GQLNode struct {
	Name string `json:"name"`
}

GQLNode is Node object

type GQLRepo

type GQLRepo struct {
	GQLNode
	DatabaseID    int64  `json:"id"`
	NameWithOwner string `json:"nameWithOwner"`
	IsPrivate     bool   `json:"is_private"`
	IsFork        bool   `json:"is_fork"`
	Description   string `json:"description"`

	Owner struct {
		Login     string `json:"login"`
		AvatarURL string `json:"avatar_url"`
	} `json:"owner"`

	Languages struct {
		Nodes []*GQLNode `json:"nodes"`
	} `graphql:"languages(first: 4)" json:"languages"`

	Collaborators struct {
		Nodes []GQLUser `json:"nodes"`
	} `json:"collaborators"`

	DefaultBranchRef struct {
		Name   string `json:"name"`
		Target struct {
			Commit struct {
				CommittedDate string `json:"committed_date"`
				OID           string `json:"commit_sha"`
				Message       string `json:"message"`
				Author        struct {
					User struct {
						Login string `json:"login"`
						Name  string `json:"name"`
					} `json:"user"`
				} `json:"author"`
				Tree struct {
					Entries []struct {
						GQLNode
						Type string `json:"type"`
					} `json:"entries"`
				} `json:"tree"`
			} `graphql:"... on Commit" json:"commit"`
		} `json:"target"`
	} `json:"default_branch"`
}

GQLRepo is Repository object

func QueryRepoByName

func QueryRepoByName(token string, repo string) (*GQLRepo, error)

QueryRepoByName fetches repo details, for an installation the repo must be added to it

func QueryRepos

func QueryRepos(token string) ([]GQLRepo, error)

QueryRepos runs custom query for repos and their commits, collaborators, and root tree on default branch

type GQLUser

type GQLUser struct {
	DatabaseID int64  `json:"id"`
	AvatarURL  string `json:"avatar"`
	Login      string `json:"login"`
	Name       string `json:"name"`
}

GQLUser is the user object with fields we are interested in

func QueryUser

func QueryUser(token string) (*GQLUser, error)

QueryUser runs graphql query for user object

Jump to

Keyboard shortcuts

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