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
SoXX 9669eb8ddf refactor: removed code duplication
Signed-off-by: SoXX <soxx@fenpa.ws>
2023-11-15 14:02:15 +01:00

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
}