From ace7694bad5752aa38fec3a13c071cf7b2bebfce Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Thu, 7 May 2026 13:09:58 -0400 Subject: implement GET /validate-cover --- lulu.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lulu.go') diff --git a/lulu.go b/lulu.go index 621cfc1..74ef526 100644 --- a/lulu.go +++ b/lulu.go @@ -165,6 +165,31 @@ func (c *Client) ValidateCover(srcUrl string, mfg PkgId, npages uint) (uint, err return rec.Id, nil } +// GetCoverValidiation retrieves information about a cover file validation job that was started by ValidiateCover(). +// +// https://api.lulu.com/docs/#tag/Files-validation/operation/Validate-Cover_read +func (c *Client) GetCoverValidation(id uint) (CoverValidationRecord, error) { + url, err := url.JoinPath(ApiUrl, validateCoverPath, fmt.Sprint(id)) + if err != nil { + return CoverValidationRecord{}, pkgErr(err) + } + resp, err := c.c.Get(url) + if err != nil { + return CoverValidationRecord{}, pkgErr(err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return CoverValidationRecord{}, pkgErr(errResp{resp}) + } + + var rec CoverValidationRecord + if err := decodeResponse(resp, &rec); err != nil { + return CoverValidationRecord{}, pkgErr(err) + } + return rec, nil +} + func (c *Client) post(path string, payload any) (*http.Response, error) { body, err := json.Marshal(payload) if err != nil { -- cgit v1.2.3