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/post.go
2023-10-24 15:25:50 +02:00

32 lines
702 B
Go

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"))
posts, err := client.GetPosts().Execute()
if err != nil {
log.Panic(err)
}
log.Printf("Post 0 has following tags: %s", posts[0].Tags)
postWithTags, err := client.GetPosts().Tags("fennec male solo order:score").Execute()
if err != nil {
log.Panic(err)
}
log.Printf("Post 0 with tags has following ID: %d", postWithTags[0].ID)
post, err := client.GetPostByID(1337).Execute()
if err != nil {
log.Panic(err)
}
log.Printf("Post 1337 has following tags: %s", post.Tags)
}