23 lines
824 B
Go
23 lines
824 B
Go
package endpoints
|
|
|
|
import (
|
|
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
|
|
)
|
|
|
|
// GetFavorites retrieves a user's favorite posts from the e621 API.
|
|
//
|
|
// The user_id parameter is required to get the favorites of a user.
|
|
//
|
|
// Parameters:
|
|
// - requestContext: The context for the API request, including the host, user agent, username, and API key.
|
|
// - query: A map containing additional query parameters for the API request.
|
|
//
|
|
// Returns:
|
|
// - []model.Post: A slice of favorite posts.
|
|
// - error: An error, if any, encountered during the API request or response handling.
|
|
func GetFavorites(requestContext model.RequestContext, query map[string]string) ([]model.Post, error) {
|
|
endpoint := "favorites.json"
|
|
data, err := getRequest[model.PostResponse](requestContext, endpoint, query)
|
|
return data.Posts, err
|
|
}
|