package main import ( "log" "net/http" "os" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/endpoints" "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 a DMail by ID:") dmail, err := endpoints.GetDmail(requestContext, 1) if err != nil { log.Println(err) } else { log.Println(dmail.Body) } log.Println("----------") log.Println("Deleting a DMail by ID:") err = endpoints.DeleteDmail(requestContext, 1) if err != nil { log.Println(err) } log.Println("----------") log.Println("Marking a DMail as read by ID:") err = endpoints.MarkAsReadDmail(requestContext, 1) if err != nil { log.Println(err) } log.Println("----------") log.Println("Getting all DMails:") query := map[string]string{ "limit": "5", } dmails, err := endpoints.GetAllDmails(requestContext, query) if err != nil { log.Println(err) } else { for _, dmail := range dmails { log.Println(dmail.Body) } } log.Println("----------") log.Println("Marking all DMails as read:") err = endpoints.MarkAsReadAllDmails(requestContext) if err != nil { log.Println(err) } log.Println("----------") }