Documentation
¶
Index ¶
- Constants
- Variables
- func CheckRequired(params map[string]interface{}, required ...string) (*mcp.CallToolResult, error)
- func CombineOptions(options ...[]mcp.ToolOption) []mcp.ToolOption
- func ConvertArgumentsToMap(arguments any) (map[string]interface{}, error)
- func GetApiBase() string
- func GetGiteeAccessToken() string
- func IsAPIError(err error) bool
- func IsAuthError(err error) bool
- func IsNetworkError(err error) bool
- func IsParamError(err error) bool
- func SafelyConvertToInt(value interface{}) (int, error)
- func SetApiBase(url string)
- func SetGiteeAccessToken(token string)
- type ErrMsgV5
- type ErrorType
- type GiteeClient
- func (g *GiteeClient) Do() (*GiteeClient, error)
- func (g *GiteeClient) GetRespBody() ([]byte, error)
- func (g *GiteeClient) HandleMCPResult(object any) (*mcp.CallToolResult, error)
- func (g *GiteeClient) IsFail() bool
- func (g *GiteeClient) IsSuccess() bool
- func (g *GiteeClient) SetHeaders(headers map[string]string) *GiteeClient
- type GiteeError
- type Option
Constants ¶
View Source
const (
DefaultApiBase = "https://gitee.com/api/v5"
)
Variables ¶
View Source
var (
// Version gitee mcp server version
Version = "0.1.11"
)
Functions ¶
func CheckRequired ¶
func CheckRequired(params map[string]interface{}, required ...string) (*mcp.CallToolResult, error)
func CombineOptions ¶
func CombineOptions(options ...[]mcp.ToolOption) []mcp.ToolOption
func ConvertArgumentsToMap ¶
ConvertArgumentsToMap 将 any 类型的参数安全转换为 map[string]interface{}
func GetApiBase ¶
func GetApiBase() string
func GetGiteeAccessToken ¶
func GetGiteeAccessToken() string
func IsAPIError ¶
func IsAuthError ¶
func IsNetworkError ¶
func IsParamError ¶
func SafelyConvertToInt ¶
SafelyConvertToInt 尝试将各种类型安全地转换为 int 支持 int, int32, int64, float32, float64, string 类型的转换 对于浮点数,要求必须是整数值(如 1.0),不接受带小数部分的值 对于字符串,尝试解析为整数或浮点数(浮点数必须是整数值)
func SetApiBase ¶
func SetApiBase(url string)
func SetGiteeAccessToken ¶
func SetGiteeAccessToken(token string)
Types ¶
type ErrorType ¶
type ErrorType string
const ( // ErrorTypeNetwork Network error ErrorTypeNetwork ErrorType = "network_error" // ErrorTypeAPI API error ErrorTypeAPI ErrorType = "api_error" // ErrorTypeAuth Auth error ErrorTypeAuth ErrorType = "auth_error" // ErrorTypeParam param error ErrorTypeParam ErrorType = "param_error" // ErrorTypeInternal Internal error ErrorTypeInternal ErrorType = "internal_error" )
type GiteeClient ¶
type GiteeClient struct { Url string Method string Payload interface{} Headers map[string]string Response *http.Response Query map[string]string SkipAuth bool Ctx context.Context // contains filtered or unexported fields }
func NewGiteeClient ¶
func NewGiteeClient(method, urlString string, opts ...Option) *GiteeClient
func (*GiteeClient) Do ¶
func (g *GiteeClient) Do() (*GiteeClient, error)
func (*GiteeClient) GetRespBody ¶
func (g *GiteeClient) GetRespBody() ([]byte, error)
func (*GiteeClient) HandleMCPResult ¶
func (g *GiteeClient) HandleMCPResult(object any) (*mcp.CallToolResult, error)
func (*GiteeClient) IsFail ¶
func (g *GiteeClient) IsFail() bool
func (*GiteeClient) IsSuccess ¶
func (g *GiteeClient) IsSuccess() bool
func (*GiteeClient) SetHeaders ¶
func (g *GiteeClient) SetHeaders(headers map[string]string) *GiteeClient
type GiteeError ¶
type GiteeError struct { Type ErrorType `json:"type"` Message string `json:"message"` Code int `json:"code,omitempty"` Details string `json:"details,omitempty"` }
func NewAPIError ¶
func NewAPIError(statusCode int, body []byte) *GiteeError
func NewAuthError ¶
func NewAuthError() *GiteeError
func NewInternalError ¶
func NewInternalError(err error) *GiteeError
func NewNetworkError ¶
func NewNetworkError(err error) *GiteeError
func NewParamError ¶
func NewParamError(param string, details string) *GiteeError
func (*GiteeError) Error ¶
func (e *GiteeError) Error() string
type Option ¶
type Option func(client *GiteeClient)
func WithContext ¶
func WithHeaders ¶
func WithPayload ¶
func WithPayload(payload interface{}) Option
func WithSkipAuth ¶
func WithSkipAuth() Option
Click to show internal directories.
Click to hide internal directories.