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/lowlevel/user.go

40 lines
797 B
Go
Raw Normal View History

2023-10-16 13:56:00 +00:00
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 (@username)",
Username: "",
APIKey: "",
}
log.Println("Getting single user: ")
client := http.Client{}
user, err := endpoints.GetUser(client, requestContext, "selloo")
if err != nil {
log.Println(err)
}
log.Println(user.ID)
log.Println("----------")
log.Println("Getting list of users: ")
query := map[string]string{
"limit": "5",
}
userList, err := endpoints.GetUsers(client, requestContext, query)
if err != nil {
log.Println(err)
}
log.Println(len(userList))
log.Println("----------")
}