githubclient

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package githubclient is responsible for interacting with the GitHub API

Index

Constants

This section is empty.

Variables

View Source
var IssueQuery struct {
	Repository struct {
		Issues struct {
			Nodes []struct {
				Number    int
				Title     string
				State     string
				CreatedAt time.Time
				UpdatedAt time.Time
				Labels    struct {
					Nodes []struct {
						Name string
					}
				} `graphql:"labels(first: 100)"`
				Author struct {
					Login string
				}
			}
			PageInfo struct {
				HasNextPage bool
				EndCursor   githubv4.String
			}
		} `graphql:"issues(first: 100, after: $cursor)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}
View Source
var OpenIssueCountQuery struct {
	Repository struct {
		Issues struct {
			TotalCount int
		} `graphql:"issues(states: OPEN)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}
View Source
var OpenPullRequestCountQuery struct {
	Repository struct {
		PullRequests struct {
			TotalCount int
		} `graphql:"pullRequests(states: OPEN)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}
View Source
var PRQuery struct {
	Repository struct {
		PullRequests struct {
			Nodes []struct {
				Number    int
				Title     string
				State     string
				CreatedAt time.Time
				UpdatedAt time.Time
				Labels    struct {
					Nodes []struct {
						Name string
					}
				} `graphql:"labels(first: 100)"`
				Author struct {
					Login string
				}
				Merged bool
			}
			PageInfo struct {
				HasNextPage bool
				EndCursor   githubv4.String
			}
		} `graphql:"pullRequests(first: 100, after: $cursor)"`
	} `graphql:"repository(owner: $owner, name: $name)"`
}
View Source
var ReleaseQuery struct {
	Repository struct {
		LatestRelease struct {
			TagName     string
			PublishedAt time.Time
		}
	} `graphql:"repository(owner: $owner, name: $name)"`
}

Functions

This section is empty.

Types

type GitHubClient

type GitHubClient interface {
	GetIssues(ctx context.Context, owner string, repo string) ([]Issue, error)
	GetOpenIssueCount(ctx context.Context, owner string, repo string) (IssueCount, error)
	GetPullRequests(ctx context.Context, owner string, repo string) ([]PullRequest, error)
	GetOpenPullRequestCount(ctx context.Context, owner string, repo string) (PullRequestCount, error)
	GetLatestRelease(ctx context.Context, owner string, repo string) ([]Release, error)
}

func NewGitHubClient

func NewGitHubClient() (GitHubClient, error)

type Issue

type Issue struct {
	Repository string    `json:"repository"`
	Number     int       `json:"number"`
	Title      string    `json:"title"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	Labels     []string  `json:"labels"`
	Author     string    `json:"author"`
	State      string    `json:"state"`
}

type IssueCount added in v0.3.0

type IssueCount struct {
	Repository string `json:"repository"`
	Count      int    `json:"count"`
}

type Label

type Label string

type PullRequest

type PullRequest struct {
	Repository string    `json:"repository"`
	Number     int       `json:"number"`
	Title      string    `json:"title"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	State      string    `json:"state"`
	Merged     bool      `json:"merged"`
	Labels     []string  `json:"labels"`
	Author     string    `json:"author"`
}

type PullRequestCount added in v0.3.0

type PullRequestCount struct {
	Repository string `json:"repository"`
	Count      int    `json:"count"`
}

type Release

type Release struct {
	Repository  string
	Name        string
	PublishedAt time.Time
}

Jump to

Keyboard shortcuts

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