github

package
v0.0.0-...-94c99f4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

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

PullRequestsURL is the Github API URL

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Ref string
}

Base is the branch this PR's branch is from

type Comment

type Comment struct {
	ID        int
	User      User
	UpdatedAt time.Time `json:"updated_at"`
	Body      string
}

Comment from a PR

func ListPullRequestComments

func ListPullRequestComments(repo string, number int) ([]*Comment, error)

ListPullRequestComments returns comments dfor a particular pull request

type Commit

type Commit struct {
	SHA           string
	Author        User
	CommitDetails `json:"commit"`
	UpdatedAt     string `json:"updated_at"`
}

Commit from a PR

func ListPullRequestCommits

func ListPullRequestCommits(repo string, number int) ([]*Commit, error)

ListPullRequestCommits returns commits for a particular pull request

type CommitDetails

type CommitDetails struct {
	Message string
}

CommitDetails are extra details for the commit

type Commits

type Commits []Commit

Commits is a collection of `Commit`s (obvs)

type Error

type Error struct {
	Message string
	Errors  []*ErrorMessage
}

Error shows feedback from the API

type ErrorMessage

type ErrorMessage struct {
	Message string
}

ErrorMessage is used in an `Error`

type Head struct {
	Ref string
}

Head is the branch the PR is on

type MergeStatus

type MergeStatus struct {
	SHA     string `json:"sha"`
	Merged  bool   `json:"merged"`
	Message string `json:"message"`
}

MergeStatus shows the status of a merge request

func MergePullRequest

func MergePullRequest(repo string, number int, title, message, method string) (*MergeStatus, error)

MergePullRequest will merge an existing pull request

type NewPullRequest

type NewPullRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
	Head  string `json:"head"`
	Base  string `json:"base"`
}

NewPullRequest is used when opening a new pull request

type PatchPullRequest

type PatchPullRequest struct {
	Title string `json:"title"`
	Body  string `json:"body"`
	State string `json:"state"`
	Base  string `json:"base"`
}

PatchPullRequest is used to update a PR

type PullRequest

type PullRequest struct {
	Number             int
	State              string
	Locked             bool
	Title              string
	Body               string
	StatusesURL        string `json:"statuses_url"`
	HTMLUrl            string `json:"html_url"`
	User               User
	CreatedAt          time.Time `json:"created_at"`
	MergedAt           time.Time `json:"merged_at"`
	MergeCommitSha     string    `json:"merge_commit_sha"`
	Head               Head
	Base               Base
	RequestedReviewers Users `json:"requested_reviewers"`
	Mergeable          bool
	Rebaseable         bool
	MergeableState     string `json:"mergeable_state"`
	MergedBy           User   `json:"merged_by"`
	Commits            int
	Additions          int
	Deletions          int
	ChangedFiles       int `json:"changed_files"`
}

PullRequest represents a single pull request

func CreatePullRequest

func CreatePullRequest(repo, title, body, head, base string) (*PullRequest, error)

CreatePullRequest opens a new pull request

func GetPullRequest

func GetPullRequest(repo string, number int) (*PullRequest, error)

GetPullRequest returns a single pull request given a repo and a number

func UpdatePullRequest

func UpdatePullRequest(repo string, number int, title, body, state, base string) (*PullRequest, error)

UpdatePullRequest updates an existing pull request

type PullRequestsResult

type PullRequestsResult struct {
	PullRequests []*PullRequest
}

PullRequestsResult represents a collection of PullRequests

func ListPullRequests

func ListPullRequests(repo string, allIssues bool) (*PullRequestsResult, error)

ListPullRequests returns all pull requests for a repo https://developer.github.com/v3/pulls/#list-pull-requests

type Status

type Status struct {
	ID          int
	State       string
	Description string
	TargetURL   string    `json:"target_url"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Status from a PR

func ListPullRequestStatuses

func ListPullRequestStatuses(reqURL string) ([]*Status, error)

ListPullRequestStatuses returns the statuses from a pull request

type User

type User struct {
	Login string
}

User represents a GitHub user

type Users

type Users []User

Users is collection of `User`s

Jump to

Keyboard shortcuts

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