func Create(opts Opts, client *http.Client) (err error) { results, err := Build(opts) if err != nil { return err } info := url.Values{ "type": {"Plugin"}, "assetid": {"0"}, "name": {opts.Name}, "description": {opts.Description}, "isPublic": {"True"}, "genreTypeId": {"1"}, "allowComments": {"True"}, } _, err = asset.Upload(client, results, info) return err }
func Update(opts Opts, client *http.Client) (err error) { results, err := Build(opts) if err != nil { return err } info := url.Values{ "type": {"Plugin"}, "assetid": {strconv.FormatInt(opts.Asset, 10)}, } _, err = asset.Upload(client, results, info) if opts.Name != "" || opts.Description != "" { params := url.Values{ "__RequestVerificationToken": {}, "Name": {}, "Description": {}, "ThumbnailYoutubeUrl": {}, } if opts.Name != "" { params.Set("Name", opts.Name) } if opts.Description != "" { params.Set("Description", opts.Description) } err = rbxweb.DoRawPost(client, `http://www.roblox.com/plugins/`+strconv.FormatInt(opts.Asset, 10)+`/update`, params) // rbxweb's error handling needs to be improved if err.Error() == "301: Moved Permanently" { return nil } return err } return err }