Fix comment response parsing
This commit is contained in:
parent
049ea1f1c0
commit
f911f10822
8
items.go
8
items.go
|
@ -77,10 +77,10 @@ type UpsertLinkResponse struct {
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateCommentsResponse struct {
|
type UpsertCommentResponse struct {
|
||||||
Errors []GqlError `json:"errors"`
|
Errors []GqlError `json:"errors"`
|
||||||
Data struct {
|
Data struct {
|
||||||
CreateComment ItemPaidAction `json:"createComment"`
|
UpsertComment ItemPaidAction `json:"upsertComment"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ func (c *Client) CreateComment(parentId int, text string) (int, error) {
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
var respBody CreateCommentsResponse
|
var respBody UpsertCommentResponse
|
||||||
err = json.NewDecoder(resp.Body).Decode(&respBody)
|
err = json.NewDecoder(resp.Body).Decode(&respBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("error decoding upsertComment: %w", err)
|
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 -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return respBody.Data.CreateComment.Result.Id, nil
|
return respBody.Data.UpsertComment.Result.Id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Dupes(url string) (*[]Dupe, error) {
|
func (c *Client) Dupes(url string) (*[]Dupe, error) {
|
||||||
|
|
Loading…
Reference in New Issue