| 1181 | } |
| 1182 | |
| 1183 | func (c *Client) CreateComment(wsSlug, itemSlug string, input models.CommentCreate) (*models.Comment, error) { |
| 1184 | // BUG-4119: the shared response type retains additive item_ref; an older |
| 1185 | // server leaves it empty so callers can fall back to the input spelling. |
| 1186 | var result models.Comment |
| 1187 | path := "/workspaces/" + url.PathEscape(wsSlug) + "/items/" + url.PathEscape(itemSlug) + "/comments" |
| 1188 | err := c.post(path, input, &result) |
| 1189 | // TASK-3585: the same single keyed retry as CreateItem, behind the same |
| 1190 | // capability gate. |
| 1191 | if err != nil && input.OpKey != "" && retryableWithKey(err) && c.serverHonorsKeys() { |
| 1192 | result = models.Comment{} |
| 1193 | err = c.post(path, input, &result) |
| 1194 | } |
| 1195 | return &result, wrapItemNotFound(err, itemSlug, wsSlug) |
| 1196 | } |
| 1197 | |
| 1198 | // UpdateComment replaces a comment's body through the item-scoped route |
| 1199 | // (TASK-2695), which refuses a comment that is not on itemRef. The server's |