Documentation
¶
Index ¶
- Variables
- func GetAccessToken() string
- func GetApiBase() string
- func GetPortFromAddr(addr string) (string, error)
- func GetRandomStr(e int) string
- func IsAPIError(err error) bool
- func IsAuthError(err error) bool
- func IsNetworkError(err error) bool
- func NewAPIError(statusCode int, body []byte) error
- func NewAuthError() error
- func NewInternalError(err error) error
- func NewNetworkError(err error) error
- func SetAccessToken(token string)
- func SetHost(host string)
- type ErrMsg
- type Option
- type PanelClient
- func (p *PanelClient) Do() (*PanelClient, error)
- func (p *PanelClient) GetRespBody() ([]byte, error)
- func (p *PanelClient) IsFail() bool
- func (p *PanelClient) IsSuccess() bool
- func (p *PanelClient) ParseJSON(v interface{}) error
- func (p *PanelClient) Request(object any) (*mcp.CallToolResult, error)
- func (p *PanelClient) SetHeaders(headers map[string]string) *PanelClient
- type PanelError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Version = "0.0.1" ApiBase = "/api/v1" )
Functions ¶
func GetAccessToken ¶
func GetAccessToken() string
func GetApiBase ¶
func GetApiBase() string
func GetPortFromAddr ¶
func GetRandomStr ¶
func IsAPIError ¶
func IsAuthError ¶
func IsNetworkError ¶
func NewAPIError ¶
func NewAuthError ¶
func NewAuthError() error
func NewInternalError ¶
func NewNetworkError ¶
func SetAccessToken ¶
func SetAccessToken(token string)
Types ¶
type Option ¶
type Option func(client *PanelClient)
func WithHeaders ¶
func WithPayload ¶
func WithPayload(payload interface{}) Option
type PanelClient ¶
type PanelClient struct { Url string Method string Payload interface{} Headers map[string]string Response *http.Response Query map[string]string // contains filtered or unexported fields }
func NewPanelClient ¶
func NewPanelClient(method, urlPath string, opts ...Option) *PanelClient
func (*PanelClient) Do ¶
func (p *PanelClient) Do() (*PanelClient, error)
func (*PanelClient) GetRespBody ¶
func (p *PanelClient) GetRespBody() ([]byte, error)
func (*PanelClient) IsFail ¶
func (p *PanelClient) IsFail() bool
func (*PanelClient) IsSuccess ¶
func (p *PanelClient) IsSuccess() bool
func (*PanelClient) ParseJSON ¶
func (p *PanelClient) ParseJSON(v interface{}) error
func (*PanelClient) Request ¶
func (p *PanelClient) Request(object any) (*mcp.CallToolResult, error)
func (*PanelClient) SetHeaders ¶
func (p *PanelClient) SetHeaders(headers map[string]string) *PanelClient
type PanelError ¶
func NewPanelError ¶
func NewPanelError(code int, message, details string) *PanelError
func (*PanelError) Error ¶
func (e *PanelError) Error() string
Click to show internal directories.
Click to hide internal directories.