client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 GlobalRes

type GlobalRes struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type SrewClient

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

GithubClient is the go client for GitHub API.

func NewGithubClient

func NewGithubClient(baseurl string) *SrewClient

NewGithubClient create a GitHub client.

func (*SrewClient) CreatePlugin

func (c *SrewClient) CreatePlugin(plugin index.Plugin) (*pluginCreateData, error)

CreatePlugin /plugin/create

func (*SrewClient) DeletePlugin

func (c *SrewClient) DeletePlugin(project_name, plugin_version string) (*pluginData, error)

DeletePlugin /plugin/delete

func (*SrewClient) IsLogged

func (c *SrewClient) IsLogged() bool

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

func (*SrewClient) ListPlugin

func (c *SrewClient) ListPlugin(plugin_name, plugin_version string) (*pluginDetailData, error)

ListPlugin /plugin/list [get]

func (*SrewClient) ListPluginAllVersion

func (c *SrewClient) ListPluginAllVersion(plugin_name string) (*pluginAllData, error)

ListPluginAllVersion /plugin/listall [get]

func (*SrewClient) LoginWithToken

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

LoginWithToken login with GitHub personal access token.

func (*SrewClient) SearchPlugin

func (c *SrewClient) SearchPlugin(plugin_name, plugin_version string) (*pluginDetailData, error)

SearchPlugin /plugin/search [get]

func (*SrewClient) SearchPluginAllVersion

func (c *SrewClient) SearchPluginAllVersion(plugin_name string) (*pluginAllData, error)

SearchPluginAllVersion /plugin/searchall [get]

func (*SrewClient) SetDebug

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

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

func (*SrewClient) UpdatePlugin

func (c *SrewClient) UpdatePlugin(plugin index.Plugin) (*pluginData, error)

UpdatePlugin /plugin/update

func (*SrewClient) User_Login

func (c *SrewClient) User_Login(username, password string) (*UserData, error)

User_Login /user/login

func (*SrewClient) User_VerifyToken

func (c *SrewClient) User_VerifyToken(token string) (*UserData, error)

User_VerifyToken /user/verifyToken

type UserData

type UserData struct {
	GlobalRes
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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