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

24 lines
518 B
Go
Raw Normal View History

package main
import (
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621"
_ "github.com/joho/godotenv/autoload"
"log"
"os"
)
func main() {
client := e621.NewClient(os.Getenv("API_USER"), os.Getenv("API_KEY"))
user, err := client.GetUserByName("selloo").Execute()
if err != nil {
log.Panic(err)
}
log.Printf("User ID of user %s: %d ", user.Name, user.ID)
user, err = client.GetUserByID(1337).Execute()
if err != nil {
log.Panic(err)
}
log.Printf("User Name of user with ID %d: %s ", user.ID, user.Name)
}