39 lines
830 B
Go
39 lines
830 B
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: "zt7XAaewLqP4AWvQi5WrLNwN",
|
|
}
|
|
|
|
log.Println("Getting single post: ")
|
|
client := http.Client{}
|
|
post, err := endpoints.GetPost(client, requestContext, "4353480")
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
log.Println(post.File.URL)
|
|
log.Println("----------")
|
|
|
|
log.Println("Getting list of posts: ")
|
|
query := map[string]string{
|
|
"limit": "5",
|
|
}
|
|
|
|
postList, err := endpoints.GetPosts(client, requestContext, query)
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
log.Println(len(postList))
|
|
log.Println("----------")
|
|
}
|