in apps.go [213:238]
func (c *Client) CreateAppTag(appID string, tag string) (*AppTag, error) {
type appTag struct {
Tag string `json:"tag"`
}
tagJSON, err := json.Marshal(appTag{Tag: tag})
if err != nil {
return nil, err
}
resp, err := c.request(http.MethodPost, fmt.Sprintf("/apps/%s/tags", url.PathEscape(tag)), "application/json", bytes.NewBuffer(tagJSON))
if err != nil {
return nil, err
}
defer resp.Close()
// theresponse format is different than the one in get API.
var tmp appTag
decoder := json.NewDecoder(resp)
if err := decoder.Decode(&tmp); err != nil {
return nil, err
}
return &AppTag{Name: tmp.Tag}, nil
}