add user create and list

This commit is contained in:
Anish Mukherjee
2022-11-27 11:47:30 +05:30
parent 7004c8dd3e
commit b58040b9b8
8 changed files with 182 additions and 0 deletions

19
cli/functions/user.go Normal file
View File

@@ -0,0 +1,19 @@
package functions
import (
"net/http"
"github.com/gravitl/netmaker/models"
)
func HasAdmin() *bool {
return request[bool](http.MethodGet, "/api/users/adm/hasadmin", nil)
}
func CreateUser(payload *models.User) *models.User {
return request[models.User](http.MethodPost, "/api/users/"+payload.UserName, payload)
}
func ListUsers() *[]models.ReturnUser {
return request[[]models.ReturnUser](http.MethodGet, "/api/users", nil)
}