github

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(client *http.Client, url string) (out []byte, err error)

Get:

func GetOauthInfo

func GetOauthInfo(client *http.Client) (out []byte, err error)

GetOauthInfo: get info like scopes for a client's token

func JsonToMap

func JsonToMap(body io.ReadCloser) (outStr string, err error)

func JsonToStruct

func JsonToStruct(data []byte) (out string, err error)

JsonToStruct: convert json to go structure.

func Post

func Post(client *http.Client, url string, jsonBytes []byte) (out []byte, err error)

Post:

func SaveJsonToStruct

func SaveJsonToStruct(body io.ReadCloser) (err error)

func WriteRawFile

func WriteRawFile(resp *http.Response) (err error)

writeRawFile: record to file row information recieved from GET command used in developpment to get json data and convert to go struct

Types

type BranchHead

type BranchHead []struct {
	NodeID string `json:"node_id"`
	Object struct {
		Sha  string `json:"sha"`
		Type string `json:"type"`
		URL  string `json:"url"`
	} `json:"object"`
	Ref string `json:"ref"`
	URL string `json:"url"`
}

BranchHead: Used to retrieve "head branch" when using https://api.github.com/repos/USER/REPO/git/refs/heads

type BranchNew

type BranchNew struct {
	Ref string `json:"ref"`
	Sha string `json:"sha"`
}

type GitBranches

type GitBranches struct {
	Data  *branchesData
	Login string
	// contains filtered or unexported fields
}

https://developer.github.com/v3/repos/branches/

func (*GitBranches) List

func (g *GitBranches) List(login, repos string) (err error)

GetBranches: GET /repos/:owner/:repo/branches

func (*GitBranches) NewFromMaster

func (g *GitBranches) NewFromMaster(user, repos, newBranch string) (out []byte, err error)

NewFromMaster: create new branch

func (*GitBranches) Read

func (g *GitBranches) Read(filename string) (err error)

func (*GitBranches) Write

func (g *GitBranches) Write(filename string) (err error)

type GitMainStruct

type GitMainStruct struct {
	Login               string
	Oauth2Client        *http.Client
	PersonalAccessToken string
	GoStruct            bool

	// Structures
	Branches *GitBranches
	Releases *GitReleases
	Search   *GitSearch
	Repos    *GitUsersRepos
}

func (*GitMainStruct) GitMainStructInit

func (g *GitMainStruct) GitMainStructInit(login, token string)

type GitReleases

type GitReleases struct {
	Data  *releasesData
	Login string
	// contains filtered or unexported fields
}

GitReleases: https://developer.github.com/v3/repos/releases/

func (*GitReleases) List

func (g *GitReleases) List(login, repos string) (err error)

GetReleases: Information about published releases, https://developer.github.com/v3/repos/releases/

func (*GitReleases) Read

func (g *GitReleases) Read(filename string) (err error)

func (*GitReleases) Write

func (g *GitReleases) Write(filename string) (err error)

type GitSearch

type GitSearch struct {
	Data   *searchData
	Status string
	Login  string
	// contains filtered or unexported fields
}

GitSearch: https://developer.github.com/v3/search/

func (*GitSearch) For

func (g *GitSearch) For(target, query string) (err error)

For: execute a search command. https://developer.github.com/v3/search/ - for a complete list of available qualifiers. https://help.github.com/en/articles/searching-on-github - how to use operators to match specific quantities, dates, or to exclude. https://help.github.com/articles/understanding-the-search-syntax/

func (*GitSearch) Read

func (g *GitSearch) Read(filename string) (err error)

func (*GitSearch) Write

func (g *GitSearch) Write(filename string) (err error)

type GitUsersRepos

type GitUsersRepos struct {
	Data  *usersReposData
	Login string
	// contains filtered or unexported fields
}

GitUserRepos: https://developer.github.com/v3/search/

func (*GitUsersRepos) List

func (g *GitUsersRepos) List(login string) (err error)

List: public repositories for the specified user. user repos: GET /users/:username/repos https://developer.github.com/v3/repos/#list-user-repositories

func (*GitUsersRepos) Read

func (g *GitUsersRepos) Read(filename string) (err error)

func (*GitUsersRepos) ReposNew

func (g *GitUsersRepos) ReposNew(newRepos *UserReposNew) (out []byte, err error)

NewRepository: create new repository, "POST /user/repos" UserReposNew need to be initialised with default values before use. https://developer.github.com/v3/repos/#create

func (*GitUsersRepos) ReposRemove

func (g *GitUsersRepos) ReposRemove(repos string) (out []byte, err error)

RemoveRepostory:

func (*GitUsersRepos) Write

func (g *GitUsersRepos) Write(filename string) (err error)

type UserReposNew

type UserReposNew struct {
	AllowMergeCommit bool   `json:"allow_merge_commit"`
	AllowRebaseMerge bool   `json:"allow_rebase_merge"`
	AllowSquashMerge bool   `json:"allow_squash_merge"`
	AutoInit         bool   `json:"auto_init"`
	Description      string `json:"description"`
	HasIssues        bool   `json:"has_issues"`
	HasProjects      bool   `json:"has_projects"`
	HasWiki          bool   `json:"has_wiki"`
	Homepage         string `json:"homepage"`
	IsTemplate       bool   `json:"is_template"`
	Name             string `json:"name"`
	Private          bool   `json:"private"`
}

func (*UserReposNew) InitDefault

func (r *UserReposNew) InitDefault(reposName, description string)

Jump to

Keyboard shortcuts

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