package wordpress import ( "encoding/json" "federated.computer/wp-sync-slowtwitch/utilities" ) type CreateCategory struct { Name string `json:"name"` Description string `json:"description"` ParentId int `json:"parent"` } func (parameters *CreateCategory) Execute(baseUrl, user, pass string) (CategoryData, error) { endpoint := baseUrl + "wp-json/wp/v2/categories" body, err := utilities.PostHttpRequestToWordpress(endpoint, user, pass, parameters) if err != nil { return CategoryData{}, err } var category CategoryData err = json.Unmarshal(body, &category) if err != nil { return CategoryData{}, err } return category, nil }