26 lines
669 B
Go
26 lines
669 B
Go
package wordpress
|
|
|
|
import (
|
|
"encoding/json"
|
|
"federated.computer/wp-sync-slowtwitch/utilities"
|
|
)
|
|
|
|
type CreateUser struct {
|
|
Username string `json:"username"`
|
|
FirstName string `json:"first_name"`
|
|
LastName string `json:"last_name"`
|
|
Name string `json:"name"`
|
|
Email string `json:"email"`
|
|
Roles string `json:"roles"`
|
|
Password string `json:"password"`
|
|
}
|
|
|
|
func (parameters *CreateUser) Execute(baseUrl, user, pass string) UserData {
|
|
endpoint := baseUrl + "users"
|
|
body := utilities.PostHttpRequestToWordpress(endpoint, user, pass, parameters)
|
|
var userData UserData
|
|
err := json.Unmarshal(body, &userData)
|
|
utilities.CheckError(err)
|
|
return userData
|
|
}
|