Documentation ¶
Index ¶
- type GiteaApiFunc
- type GiteaApiResponse
- type GiteaTokenClient
- func (g *GiteaTokenClient) ApiGiteaDelete(httpPath string, header http.Header, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaGet(httpPath string, header http.Header, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaPatch(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaPatchJson(httpPath string, header http.Header, body interface{}, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaPost(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaPostJson(httpPath string, header http.Header, body interface{}, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaPut(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaPutJson(httpPath string, header http.Header, body io.Reader, response interface{}) (*GiteaApiResponse, error)
- func (g *GiteaTokenClient) ApiGiteaStatusCode(method, path string, header http.Header, body io.Reader) (int, error)
- func (g *GiteaTokenClient) GetBaseUrl() string
- func (g *GiteaTokenClient) GetContext() context.Context
- func (g *GiteaTokenClient) GetUsername() string
- func (g *GiteaTokenClient) GiteaClient() *gitea.Client
- func (g *GiteaTokenClient) IsDebug() bool
- func (g *GiteaTokenClient) NewClient(url, accessToken string, httpClient *http.Client) error
- func (g *GiteaTokenClient) NewClientWithHttpTimeout(url, accessToken string, timeoutSecond uint, insecure bool) error
- func (g *GiteaTokenClient) SetBasicAuth(username, password string)
- func (g *GiteaTokenClient) SetDebug(debug bool)
- func (g *GiteaTokenClient) SetOTP(otp string)
- func (g *GiteaTokenClient) SetSudo(sudo string)
- type GiteaTokenClientFunc
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
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 }