client

package
v0.0.0-...-c024317 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFoundError

func IsNotFoundError(err error) bool

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(cookies map[string]string) *Client

func NewWithHTTP

func NewWithHTTP(cookies map[string]string, httpClient *http.Client, endpoints Endpoints) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) CreateArticle

func (c *Client) CreateArticle(ctx context.Context, title, content string, topicIDs []string, imageInfos []map[string]any) (map[string]any, error)

func (*Client) CreateComment

func (c *Client) CreateComment(ctx context.Context, resourceType, resourceID, content string) (map[string]any, error)

func (*Client) CreatePin

func (c *Client) CreatePin(ctx context.Context, title, content string, imageInfos []map[string]any) (map[string]any, error)

func (*Client) CreateQuestion

func (c *Client) CreateQuestion(ctx context.Context, title, detail string, topicIDs []string, imageInfos []map[string]any) (map[string]any, error)

func (*Client) DeleteArticle

func (c *Client) DeleteArticle(ctx context.Context, articleID string) (bool, error)

func (*Client) DeleteComment

func (c *Client) DeleteComment(ctx context.Context, commentID string) (bool, error)

func (*Client) DeletePin

func (c *Client) DeletePin(ctx context.Context, pinID string) (bool, error)

func (*Client) DeleteQuestion

func (c *Client) DeleteQuestion(ctx context.Context, questionID string) (bool, error)

func (*Client) FollowQuestion

func (c *Client) FollowQuestion(ctx context.Context, questionID string) (bool, error)

func (*Client) GetAnswer

func (c *Client) GetAnswer(ctx context.Context, answerID string) (map[string]any, error)

func (*Client) GetAnswerComments

func (c *Client) GetAnswerComments(ctx context.Context, answerID string, offset, limit int, order string) (map[string]any, error)

func (*Client) GetArticle

func (c *Client) GetArticle(ctx context.Context, articleID string) (map[string]any, error)

func (*Client) GetChildCommentsPage

func (c *Client) GetChildCommentsPage(ctx context.Context, commentID, cursor string, limit int) (map[string]any, error)

func (*Client) GetCollections

func (c *Client) GetCollections(ctx context.Context, offset, limit int) (map[string]any, error)

func (*Client) GetComment

func (c *Client) GetComment(ctx context.Context, commentID string) (map[string]any, error)

func (*Client) GetComments

func (c *Client) GetComments(ctx context.Context, resourceType, resourceID string, offset, limit int, order string) (map[string]any, error)

func (*Client) GetCommentsPage

func (c *Client) GetCommentsPage(ctx context.Context, resourceType, resourceID, cursor string, limit int, order string) (map[string]any, error)

func (*Client) GetFeed

func (c *Client) GetFeed(ctx context.Context, limit int) (map[string]any, error)

func (*Client) GetFollowers

func (c *Client) GetFollowers(ctx context.Context, urlToken string, offset, limit int) (map[string]any, error)

func (*Client) GetFollowing

func (c *Client) GetFollowing(ctx context.Context, urlToken string, offset, limit int) (map[string]any, error)

func (*Client) GetFollowingFeed

func (c *Client) GetFollowingFeed(ctx context.Context, nextURL string, limit int) (map[string]any, error)

GetFollowingFeed returns one page from the feed made up of activity from people, questions, topics, and columns the current user follows. Pass the paging.next URL from the previous response to load another page.

func (*Client) GetHotList

func (c *Client) GetHotList(ctx context.Context, limit int) (map[string]any, error)

func (*Client) GetNotifications

func (c *Client) GetNotifications(ctx context.Context, limit, offset int, entryName string) (map[string]any, error)

func (*Client) GetPin

func (c *Client) GetPin(ctx context.Context, pinID string) (map[string]any, error)

func (*Client) GetQuestion

func (c *Client) GetQuestion(ctx context.Context, questionID string) (map[string]any, error)

func (*Client) GetQuestionAnswers

func (c *Client) GetQuestionAnswers(ctx context.Context, questionID string, offset, limit int, sortBy string) (map[string]any, error)

func (*Client) GetSelfInfo

func (c *Client) GetSelfInfo(ctx context.Context) (map[string]any, error)

func (*Client) GetUserAnswers

func (c *Client) GetUserAnswers(ctx context.Context, urlToken string, offset, limit int, sortBy string) (map[string]any, error)

func (*Client) GetUserArticles

func (c *Client) GetUserArticles(ctx context.Context, urlToken string, offset, limit int, sortBy string) (map[string]any, error)

func (*Client) GetUserProfile

func (c *Client) GetUserProfile(ctx context.Context, urlToken string) (map[string]any, error)

func (*Client) LikeComment

func (c *Client) LikeComment(ctx context.Context, commentID string) (bool, error)

func (*Client) MarkAllNotificationsRead

func (c *Client) MarkAllNotificationsRead(ctx context.Context) error

func (*Client) MarkNotificationsRead

func (c *Client) MarkNotificationsRead(ctx context.Context, tab string) error

func (*Client) ReplyComment

func (c *Client) ReplyComment(ctx context.Context, commentID, content string) (map[string]any, error)

func (*Client) ReplyCommentToResource

func (c *Client) ReplyCommentToResource(ctx context.Context, resourceType, resourceID, commentID, content string) (map[string]any, error)

func (*Client) Search

func (c *Client) Search(ctx context.Context, keyword, searchType string, offset, limit int) (map[string]any, error)

func (*Client) SetContentVote

func (c *Client) SetContentVote(ctx context.Context, contentType, contentID string, voted bool) (bool, error)

func (*Client) UnfollowQuestion

func (c *Client) UnfollowQuestion(ctx context.Context, questionID string) (bool, error)

func (*Client) UnlikeComment

func (c *Client) UnlikeComment(ctx context.Context, commentID string) (bool, error)

func (*Client) UploadImage

func (c *Client) UploadImage(ctx context.Context, filePath, source string) (map[string]any, error)

func (*Client) VoteNeutral

func (c *Client) VoteNeutral(ctx context.Context, answerID string) (bool, error)

func (*Client) VoteUp

func (c *Client) VoteUp(ctx context.Context, answerID string) (bool, error)

type DataFetchError

type DataFetchError struct {
	Message    string
	StatusCode int
}

func (DataFetchError) Error

func (e DataFetchError) Error() string

type Endpoints

type Endpoints struct {
	APIV4             string
	APIV3             string
	ZhuanlanAPI       string
	ImageAPI          string
	OSSUploadURL      string
	ContentPublishURL string
	ContentDraftsURL  string
}

func DefaultEndpoints

func DefaultEndpoints() Endpoints

type LoginError

type LoginError struct {
	Message string
}

func (LoginError) Error

func (e LoginError) Error() string

Jump to

Keyboard shortcuts

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