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/example/highlevel/favorites.go

30 lines
687 B
Go
Raw Normal View History

package main
import (
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621"
_ "github.com/joho/godotenv/autoload"
"log"
"os"
)
func main() {
client := e621.NewE621Client(os.Getenv("API_USER"), os.Getenv("API_KEY"))
favorites, err := client.GetFavoritesForUser("selloo")
if err != nil {
log.Panic(err)
}
posts, err := favorites.Execute()
if err != nil {
log.Panic(err)
}
log.Printf("URL of favorite post 0 is: %s", posts[0].File.URL)
favoritesWithTags := client.GetFavoritesForUserWithTags("selloo", "fennec male solo")
posts, err = favoritesWithTags.Execute()
if err != nil {
log.Panic(err)
}
log.Printf("URL of favorite post 0 with tags is: %s", posts[0].File.URL)
}