This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
e621-sdk-go/pkg/e621/endpoints/favorite.go

23 lines
824 B
Go
Raw Normal View History

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
}