| 1233 | } |
| 1234 | |
| 1235 | func (c *Client) CreateComment(wsSlug, itemSlug string, input models.CommentCreate) (*models.Comment, error) { |
| 1236 | // BUG-4119: the shared response type retains additive item_ref; an older |
| 1237 | // server leaves it empty so callers can fall back to the input spelling. |
| 1238 | var result models.Comment |
| 1239 | path := "/workspaces/" + url.PathEscape(wsSlug) + "/items/" + url.PathEscape(itemSlug) + "/comments" |
| 1240 | err := c.post(path, input, &result) |
| 1241 | // TASK-3585: the same single keyed retry as CreateItem, behind the same |
| 1242 | // capability gate. |
| 1243 | if err != nil && input.OpKey != "" && retryableWithKey(err) && c.serverHonorsKeys() { |
| 1244 | result = models.Comment{} |
| 1245 | err = c.post(path, input, &result) |
| 1246 | } |
| 1247 | return &result, wrapItemNotFound(err, itemSlug, wsSlug) |
| 1248 | } |
| 1249 | |
| 1250 | // UpdateComment replaces a comment's body through the item-scoped route |
| 1251 | // (TASK-2695), which refuses a comment that is not on itemRef. The server's |