diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-07 13:09:58 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-07 13:09:58 -0400 |
| commit | ace7694bad5752aa38fec3a13c071cf7b2bebfce (patch) | |
| tree | 2f391107b6aa7bce7b0a028aff8f7c5b32839852 /lulu.go | |
| parent | b57f03381e4bccba2963cebabe51a9cf32bd96dd (diff) | |
| download | lulu-ace7694bad5752aa38fec3a13c071cf7b2bebfce.zip | |
implement GET /validate-cover
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 { |