Versions in this module Expand all Collapse all v0 v0.0.1 Apr 26, 2026 Changes in this version + func IsNetworkError(err error) bool + func IsNotFoundError(err error) bool + func IsUnauthorizedError(err error) bool + type APIError struct + Code int + Message string + func (e *APIError) Error() string + type AnswerService struct + func NewAnswerService(client *Client) *AnswerService + func (s *AnswerService) Accept(ctx context.Context, questionID, answerID string) error + func (s *AnswerService) Add(ctx context.Context, req *models.AnswerAddReq) (*models.AnswerInfo, error) + func (s *AnswerService) Delete(ctx context.Context, id string) error + func (s *AnswerService) Get(ctx context.Context, id string) (*models.AnswerInfo, error) + func (s *AnswerService) Page(ctx context.Context, req *models.AnswerListReq) (*models.AnswerListResp, error) + func (s *AnswerService) Update(ctx context.Context, req *models.AnswerUpdateReq) error + type AuthService struct + func NewAuthService(client *Client) *AuthService + func (s *AuthService) GetCurrentUser(ctx context.Context) (*models.UserInfoResp, error) + func (s *AuthService) IsAuthenticated() bool + func (s *AuthService) Login(ctx context.Context, email, pass string) (*models.LoginResponse, error) + func (s *AuthService) Logout(ctx context.Context) error + type Client struct + Answer *AnswerService + Comment *CommentService + Notification *NotificationService + Question *QuestionService + Search *SearchService + Tag *TagService + User *UserService + Vote *VoteService + func NewClient(cfg *Config) *Client + func (c *Client) DeleteJSON(ctx context.Context, path string, body interface{}) error + func (c *Client) GetJSON(ctx context.Context, path string, params map[string]string, result interface{}) error + func (c *Client) GetToken() string + func (c *Client) PostJSON(ctx context.Context, path string, body interface{}, result interface{}) error + func (c *Client) PutJSON(ctx context.Context, path string, body interface{}, result interface{}) error + func (c *Client) SetToken(token string) + type CommentService struct + func NewCommentService(client *Client) *CommentService + func (s *CommentService) Add(ctx context.Context, req *models.CommentAddReq) (*models.CommentInfo, error) + func (s *CommentService) Delete(ctx context.Context, id string) error + func (s *CommentService) Get(ctx context.Context, id string) (*models.CommentInfo, error) + func (s *CommentService) Page(ctx context.Context, req *models.CommentListReq) (*models.CommentListResp, error) + func (s *CommentService) Update(ctx context.Context, req *models.CommentUpdateReq) error + type Config struct + BaseURL string + Timeout time.Duration + Token string + type NotificationService struct + func NewNotificationService(client *Client) *NotificationService + func (s *NotificationService) ClearAll(ctx context.Context, nType string) error + func (s *NotificationService) ClearID(ctx context.Context, id string) error + func (s *NotificationService) Page(ctx context.Context, req *models.NotificationListReq) (*models.NotificationListResp, error) + func (s *NotificationService) Status(ctx context.Context) (*models.NotificationStatusResp, error) + type QuestionService struct + func NewQuestionService(client *Client) *QuestionService + func (s *QuestionService) Add(ctx context.Context, req *models.QuestionAddReq) (*models.QuestionInfoResp, error) + func (s *QuestionService) Close(ctx context.Context, id string, closeType int, closeMsg string) error + func (s *QuestionService) Delete(ctx context.Context, id string) error + func (s *QuestionService) Get(ctx context.Context, id string) (*models.QuestionInfoResp, error) + func (s *QuestionService) Page(ctx context.Context, req *models.QuestionListReq) (*models.QuestionPageResp, error) + func (s *QuestionService) Reopen(ctx context.Context, id string) error + func (s *QuestionService) Update(ctx context.Context, req *models.QuestionUpdateReq) error + type RespBody struct + Code int + Data json.RawMessage + Message string + Reason string + type SearchService struct + func NewSearchService(client *Client) *SearchService + func (s *SearchService) Search(ctx context.Context, req *models.SearchReq) (*models.SearchResp, error) + type TagService struct + func NewTagService(client *Client) *TagService + func (s *TagService) Add(ctx context.Context, req *models.TagAddReq) (*models.TagDetail, error) + func (s *TagService) Delete(ctx context.Context, slugName string) error + func (s *TagService) Get(ctx context.Context, slugName string) (*models.TagDetail, error) + func (s *TagService) Page(ctx context.Context, req *models.TagListReq) (*models.TagListResp, error) + func (s *TagService) Search(ctx context.Context, prefix string) ([]*models.TagItem, error) + func (s *TagService) Update(ctx context.Context, req *models.TagUpdateReq) error + type UserService struct + func NewUserService(client *Client) *UserService + func (s *UserService) GetByUsername(ctx context.Context) (*models.UserBasicInfo, error) + func (s *UserService) SearchUsers(ctx context.Context, query string) ([]*models.UserBasicInfo, error) + type VoteService struct + func NewVoteService(client *Client) *VoteService + func (s *VoteService) VoteDown(ctx context.Context, objectID string) error + func (s *VoteService) VoteUp(ctx context.Context, objectID string) error