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