44 lines
912 B
Go
44 lines
912 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"os"
|
|
|
|
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/builder"
|
|
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
|
|
_ "github.com/joho/godotenv/autoload"
|
|
)
|
|
|
|
func main() {
|
|
requestContext := model.RequestContext{
|
|
Client: http.Client{},
|
|
Host: "https://e621.net",
|
|
UserAgent: "Go-e621-SDK (@username)",
|
|
Username: os.Getenv("API_USER"),
|
|
APIKey: os.Getenv("API_KEY"),
|
|
}
|
|
|
|
log.Println("Getting DMails API user: ")
|
|
|
|
getDMails := builder.NewGetDMailsBuilder(requestContext)
|
|
dMails, err := getDMails.SetLimit(5).Execute()
|
|
|
|
if err != nil {
|
|
log.Println(err)
|
|
} else {
|
|
log.Println(dMails[0].Title)
|
|
}
|
|
log.Println("----------")
|
|
|
|
log.Println("Getting DMails for user: ")
|
|
|
|
dMails, err = getDMails.SetLimit(5).ByToName("specificUser").Execute()
|
|
if err != nil {
|
|
log.Println(err)
|
|
} else {
|
|
log.Println(dMails[0].Title)
|
|
}
|
|
log.Println("----------")
|
|
}
|