diff options
Diffstat (limited to 'lulu.go')
| -rw-r--r-- | lulu.go | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 { |