From f911f10822bd141216a2d90d7a5e4020c78d4f22 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Wed, 3 Jul 2024 09:30:15 +0200 Subject: [PATCH] Fix comment response parsing --- items.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/items.go b/items.go index 8567320..fcfa45c 100644 --- a/items.go +++ b/items.go @@ -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) {