Go wrapper for the LuckPerms REST API
// Creating a client
config := golucky.Config{
RestIp: "http://127.0.0.1:8080",
}
client := golucky.New(config)
// Creating a client with authentication
config := golucky.Config{
RestIp: "http://127.0.0.1:8080",
AuthKey: "myverysecurekey",
}
client := golucky.New(config)
// Permission check
ctx := context.Background()
permCheck, err := client.UserHasPermission(ctx, "7bd5b459-1e6b-4753-8274-1fbd2fe9a4d5", "cool.permission")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(permCheck.Result) // One of [ true, false, undefined ]
// Add user to group
ctx := context.Background()
nodes, err := client.AddUserNode(ctx, "7bd5b459-1e6b-4753-8274-1fbd2fe9a4d5", golucky.NewNode{
Key: "group.cool",
Value: true,
})
if err != nil {
fmt.Println(err)
return
}
fmt.Println(nodes)