66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||
|
"log"
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
requestContext := model.RequestContext{
|
||
|
Host: "https://e621.net",
|
||
|
UserAgent: "Go-e621-SDK (selloo)",
|
||
|
Username: "selloo",
|
||
|
APIKey: "XTkB5doD22vmMXr3yoNurQGH",
|
||
|
}
|
||
|
|
||
|
log.Println("Getting single tag: ")
|
||
|
client := http.Client{}
|
||
|
tag, err := endpoints.GetTag(client, requestContext, "1530")
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
}
|
||
|
log.Println(tag.Name)
|
||
|
log.Println("----------")
|
||
|
|
||
|
log.Println("Getting list of tags: ")
|
||
|
query := map[string]string{
|
||
|
"limit": "5",
|
||
|
}
|
||
|
|
||
|
tagList, err := endpoints.GetTags(client, requestContext, query)
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
}
|
||
|
log.Println(len(tagList))
|
||
|
log.Println("----------")
|
||
|
|
||
|
log.Println("seach for tags containing cat: ")
|
||
|
query = map[string]string{
|
||
|
"limit": "5",
|
||
|
"search[name_matches]": "cat*",
|
||
|
}
|
||
|
|
||
|
tagList, err = endpoints.GetTags(client, requestContext, query)
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
}
|
||
|
log.Println(tagList)
|
||
|
log.Println("----------")
|
||
|
|
||
|
log.Println("seach for tags with the category artist: ")
|
||
|
query = map[string]string{
|
||
|
"limit": "5",
|
||
|
"search[category]": "1",
|
||
|
}
|
||
|
|
||
|
tagList, err = endpoints.GetTags(client, requestContext, query)
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
}
|
||
|
log.Println(tagList)
|
||
|
log.Println("----------")
|
||
|
|
||
|
}
|