git

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 9 Imported by: 0

README

git

Go Quality Report GoDoc

Library to manage Google go-github with more simplicity

Getting started

  • API documentation is available via godoc.

Installation

To install Git package, you need to install Go and set your Go workspace first.

1 - The first need Go installed (version 1.13+ is required). Then you can use the below Go command to install Git

$ go get -u github.com/dotWicho/git

And then Import it in your code:

package main

import "github.com/dotWicho/git"

Or

2 - Use as module in you project (go.mod file):

module myclient

go 1.13

require (
	github.com/dotWicho/git v1.0.0
)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Organization string
	AllPages     bool
	// contains filtered or unexported fields
}

Client encapsulate in a more simply implementation the Google's go-github

func New

func New(token string) *Client

New creates a github Client with a provided token

func (*Client) AssignReviewers

func (c *Client) AssignReviewers(id int, repoName string, reviewers []string) *github.PullRequest

AssignReviewers permits assign Reviewers to an one PullRequest

func (*Client) Branch

func (c *Client) Branch(repoName, branchName string) *github.Branch

Branch returns an Object branch based on repoName and branchName

func (*Client) Branches

func (c *Client) Branches(repoName string) []*github.Branch

Branches returns all branches for a repoName

func (*Client) Commit

func (c *Client) Commit(repoName, commitSHA string) *github.Commit

Commit returns an Object Commit based on repoName and commitSHA

func (*Client) Compare added in v1.0.3

func (c *Client) Compare(repoName, base, head string) *github.CommitsComparison

Compare returns an Object Commit based on repoName and commitSHA

func (*Client) CreatePullRequest

func (c *Client) CreatePullRequest(repoName, srcBranch, dstBranch, subject, description string) *github.PullRequest

CreatePullRequest permits create an PullRequest into repoName using source and destiny branches

func (*Client) CreateRefs

func (c *Client) CreateRefs(repoName, branchName, SHARef string) *github.Reference

CreateRefs permits create an Object Reference based on repoName, branchName and SHAReference

func (*Client) Download

func (c *Client) Download(repoName, refName, filePath string) (body io.ReadCloser, err error)

Download returns body response of GET DownloadURL corresponding to filePath

func (*Client) Merge added in v1.0.4

func (c *Client) Merge(repoName, base, head, message string) *github.RepositoryCommit

Merge returns an Object Commit based on merge to repoName:head into repoName:base

func (*Client) ReferenceByBranch

func (c *Client) ReferenceByBranch(repoName, branchName string) *github.Reference

ReferenceByBranch returns an Object Reference based in repoName and branchName

func (*Client) ReferenceByHeads

func (c *Client) ReferenceByHeads(repoName, branchName string) *github.Reference

ReferenceByHeads returns an Object Reference based in repoName and branchName from heads

func (*Client) ReferenceByTag

func (c *Client) ReferenceByTag(repoName, tagName string) *github.Reference

ReferenceByTag returns an Object Reference based in repoName and tagName

func (*Client) Repositories

func (c *Client) Repositories(repoType, repoSort string) []*github.Repository

Repositories list all Organization repositories

func (*Client) Repository

func (c *Client) Repository(repoName string) *github.Repository

Repository return a repo selected by name

func (*Client) TagByName

func (c *Client) TagByName(repoName, tagName string) *github.RepositoryTag

TagByName returns an Object Tag based in repoName and tagName

func (*Client) Tags

func (c *Client) Tags(repoName string) []*github.RepositoryTag

Tags returns all tags for a repoName

func (*Client) Tree

func (c *Client) Tree(repoName, sourceFiles string, reference *github.Reference) *github.Tree

Tree permits create an Object Tree given a fileName list

func (*Client) User

func (c *Client) User(userName string) *github.User

User returns an Object User by its userName

func (*Client) Users

func (c *Client) Users() []*github.User

Users returns all Users in an Organization

type Operations

type Operations interface {
	Commit(repoName, commitSHA string) *github.Commit
	Compare(repoName, base, head string) *github.CommitsComparison
	Merge(repoName, base, head, message string) *github.RepositoryCommit
	Repositories(repoType, repoSort string) []*github.Repository
	Repository(repoName string) *github.Repository
	Branches(repoName string) []*github.Branch
	Branch(repoName, branchName string) *github.Branch
	Tags(repoName string) []*github.RepositoryTag
	TagByName(repoName, tagName string) *github.RepositoryTag
	ReferenceByBranch(repoName, branchName string) *github.Reference
	ReferenceByHeads(repoName, branchName string) *github.Reference
	ReferenceByTag(repoName, tagName string) *github.Reference
	CreateRefs(repoName, branchName, SHARef string) *github.Reference
	Tree(repoName, sourceFiles string, reference *github.Reference) *github.Tree
	Users() []*github.User
	User(userName string) *github.User
	CreatePullRequest(repoName, srcBranch, dstBranch, subject, description string) *github.PullRequest
	AssignReviewers(id int, repoName string, reviewers []string) *github.PullRequest
	Download(repoName, refName, filePath string) (body io.ReadCloser, err error)
	// contains filtered or unexported methods
}

Operations interface

Jump to

Keyboard shortcuts

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