gitea_token_client

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GiteaApiFunc added in v1.1.0

type GiteaApiFunc interface {
	ApiGiteaStatusCode(method, path string, header http.Header, body io.Reader) (int, error)

	ApiGiteaGet(httpPath string, header http.Header, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaPostJson(httpPath string, header http.Header, body interface{}, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaPost(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaPatchJson(httpPath string, header http.Header, body interface{}, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaPatch(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaPutJson(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaPut(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

	ApiGiteaDelete(httpPath string, header http.Header, response interface{}) (*GiteaApiResponse, error)
}

type GiteaApiResponse added in v1.1.0

type GiteaApiResponse struct {
	*http.Response
}

GiteaApiResponse represents the gitea response

type GiteaTokenClient

type GiteaTokenClient struct {
	GiteaTokenClientFunc GiteaTokenClientFunc `json:"-"`
	GiteaApiFunc         GiteaApiFunc         `json:"-"`
	// contains filtered or unexported fields
}

func (*GiteaTokenClient) ApiGiteaDelete added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaDelete(httpPath string, header http.Header, response interface{}) (*GiteaApiResponse, error)

ApiGiteaDelete sends a DELETE request to the Gitea API and returns the response

func (*GiteaTokenClient) ApiGiteaGet added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaGet(httpPath string, header http.Header, response interface{}) (*GiteaApiResponse, error)

ApiGiteaGet sends a GET request to the Gitea API and returns the response

func (*GiteaTokenClient) ApiGiteaPatch added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaPatch(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

ApiGiteaPatch sends a PATCH request to the Gitea API and returns the response

func (*GiteaTokenClient) ApiGiteaPatchJson added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaPatchJson(httpPath string, header http.Header, body interface{}, response interface{}) (*GiteaApiResponse, error)

ApiGiteaPatchJson sends a PATCH request to the Gitea API with a JSON body and returns the response

func (*GiteaTokenClient) ApiGiteaPost added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaPost(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

ApiGiteaPost sends a POST request to the Gitea API and returns the response

func (*GiteaTokenClient) ApiGiteaPostJson added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaPostJson(httpPath string, header http.Header, body interface{}, response interface{}) (*GiteaApiResponse, error)

ApiGiteaPostJson sends a POST request to the Gitea API with a JSON body and returns the response

func (*GiteaTokenClient) ApiGiteaPut added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaPut(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

ApiGiteaPut sends a PUT request to the Gitea API and returns the response

func (*GiteaTokenClient) ApiGiteaPutJson added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaPutJson(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)

ApiGiteaPutJson sends a PUT request to the Gitea API with a JSON body and returns the response

func (*GiteaTokenClient) ApiGiteaStatusCode added in v1.1.0

func (g *GiteaTokenClient) ApiGiteaStatusCode(method, path string, header http.Header, body io.Reader) (int, error)

ApiGiteaStatusCode sends a request to the Gitea API and returns the status code

func (*GiteaTokenClient) GetBaseUrl

func (g *GiteaTokenClient) GetBaseUrl() string

GetBaseUrl returns the base URL of the Gitea instance

func (*GiteaTokenClient) GetContext added in v1.1.0

func (g *GiteaTokenClient) GetContext() context.Context

func (*GiteaTokenClient) GetUsername

func (g *GiteaTokenClient) GetUsername() string

GetUsername returns the username by SetBasicAuth

func (*GiteaTokenClient) GiteaClient

func (g *GiteaTokenClient) GiteaClient() *gitea.Client

GiteaClient returns the gitea.Client

func (*GiteaTokenClient) IsDebug

func (g *GiteaTokenClient) IsDebug() bool

IsDebug returns the debug status

func (*GiteaTokenClient) NewClient

func (g *GiteaTokenClient) NewClient(url, accessToken string, httpClient *http.Client) error

NewClient creates a new Gitea client This function is a wrapper around gitea.NewClient

func (*GiteaTokenClient) NewClientWithHttpTimeout

func (g *GiteaTokenClient) NewClientWithHttpTimeout(url, accessToken string, timeoutSecond uint, insecure bool) error

NewClientWithHttpTimeout creates a new Gitea client with a timeout for the http client The timeout is in seconds, and the minimum is 30 seconds If insecure is true, the client will skip SSL verification This function is a wrapper around gitea.NewClient

func (*GiteaTokenClient) SetBasicAuth

func (g *GiteaTokenClient) SetBasicAuth(username, password string)

SetBasicAuth sets the basic auth for the client from gitea.Client

func (*GiteaTokenClient) SetDebug

func (g *GiteaTokenClient) SetDebug(debug bool)

SetDebug sets the debug status for the client from gitea.Client

func (*GiteaTokenClient) SetOTP

func (g *GiteaTokenClient) SetOTP(otp string)

SetOTP sets the otp for the client from gitea.Client

func (*GiteaTokenClient) SetSudo

func (g *GiteaTokenClient) SetSudo(sudo string)

SetSudo sets the sudo for the client from gitea.Client

type GiteaTokenClientFunc

type GiteaTokenClientFunc interface {
	NewClientWithHttpTimeout(url, accessToken string, timeoutSecond uint, insecure bool) error

	NewClient(url, accessToken string, httpClient *http.Client) error

	SetDebug(debug bool)

	IsDebug() bool

	GetContext() context.Context

	SetOTP(otp string)

	SetSudo(sudo string)

	SetBasicAuth(username, password string)

	GiteaClient() *gitea.Client

	GetBaseUrl() string

	GetUsername() string
}

Jump to

Keyboard shortcuts

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