32 lines
702 B
Go
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)
|
||
|
|
||
|
}
|