package main import ( "git.dragse.it/anthrove/e621-sdk-go/pkg/e621" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" _ "github.com/joho/godotenv/autoload" "log" "os" ) func main() { client := e621.NewClient(os.Getenv("API_USER"), os.Getenv("API_KEY")) { username := "selloo" favoritesBuilder := client.NewFavoritesBuilder().FromUsername(username) posts, err := favoritesBuilder.Execute() if err != nil { log.Panic(err) } log.Printf("URL of favorite post 0 for user with name %s is: %s", username, posts[0].File.URL) } { userID := 123456 favoritesBuilder := client.NewFavoritesBuilder().FromUserID(model.UserID(userID)) posts, err := favoritesBuilder.Execute() if err != nil { log.Panic(err) } log.Printf("URL of favorite post 0 for user with id %d is: %s", userID, posts[0].File.URL) } { username := "selloo" tags := []string{"fennec", "male", "solo"} favoritesBuilder := client.NewFavoritesBuilder().FromUsername(username).WithTags(tags) posts, err := favoritesBuilder.Execute() if err != nil { log.Panic(err) } log.Printf("Found %d favorites in %s users favorites", len(posts), username) } { userID := 123456 tags := []string{"fennec", "male", "solo"} limit := 5 favoritesBuilder := client.NewFavoritesBuilder().FromUserID(model.UserID(userID)).WithTags(tags).Limit(limit) posts, err := favoritesBuilder.Execute() if err != nil { log.Panic(err) } log.Printf("returning %d posts with tags %s for user with id %d", len(posts), tags, userID) } }