pkg

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsInSlice

func ContainsInSlice(items []string, item string) bool

ContainsInSlice 判断字符串是否在 slice 中

func GreenColor

func GreenColor(s interface{}) string

func JsonToMap

func JsonToMap(str string) map[string]interface{}

func RedColor

func RedColor(s interface{}) string

func YellowColor

func YellowColor(s interface{}) string

Types

type APIError

type APIError struct {
	Code   int         `json:"code"`
	Data   interface{} `json:"data,omitempty"`
	Msg    string      `json:"msg"`
	Errors []struct {
		Resource string `json:"resource"`
		Field    string `json:"field"`
		Code     string `json:"code"`
	} `json:"errors,omitempty"`
}

APIError represents the error message that GitHub API returns. GitHub API doc: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#client-errors

func (*APIError) Error

func (e *APIError) Error() string

Error convert APIError to a human readable error and return.

type CMClient

type CMClient struct {
	*req.Client
	// contains filtered or unexported fields
}

GithubClient is the go client for GitHub API.

func NewReqClient

func NewReqClient() *CMClient

NewGithubClient create a GitHub client.

func (*CMClient) IsLogged

func (c *CMClient) IsLogged() bool

IsLogged return true is user is logged in, otherwise false.

func (*CMClient) LoginWithToken

func (c *CMClient) LoginWithToken(BearerAuthToken string) *CMClient

LoginWithToken login with GitHub personal access token.

func (*CMClient) SetDebug

func (c *CMClient) SetDebug(enable bool) *CMClient

SetDebug enable debug if set to true, disable debug if set to false.

Jump to

Keyboard shortcuts

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