Fix comment response parsing

This commit is contained in:
ekzyis 2024-07-03 09:30:15 +02:00
parent 049ea1f1c0
commit f911f10822
1 changed files with 4 additions and 4 deletions

View File

@ -77,10 +77,10 @@ type UpsertLinkResponse struct {
} `json:"data"`
}
type CreateCommentsResponse struct {
type UpsertCommentResponse struct {
Errors []GqlError `json:"errors"`
Data struct {
CreateComment ItemPaidAction `json:"createComment"`
UpsertComment ItemPaidAction `json:"upsertComment"`
} `json:"data"`
}
@ -360,7 +360,7 @@ func (c *Client) CreateComment(parentId int, text string) (int, error) {
}
defer resp.Body.Close()
var respBody CreateCommentsResponse
var respBody UpsertCommentResponse
err = json.NewDecoder(resp.Body).Decode(&respBody)
if err != nil {
err = fmt.Errorf("error decoding upsertComment: %w", err)
@ -372,7 +372,7 @@ func (c *Client) CreateComment(parentId int, text string) (int, error) {
return -1, err
}
return respBody.Data.CreateComment.Result.Id, nil
return respBody.Data.UpsertComment.Result.Id, nil
}
func (c *Client) Dupes(url string) (*[]Dupe, error) {