Post-Migrator/services/wordpress/create-user.go

26 lines
669 B
Go
Raw Normal View History

2024-05-07 22:03:15 +00:00
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
}