diff options
Diffstat (limited to 'lulu.go')
| -rw-r--r-- | lulu.go | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -24,6 +24,7 @@ const ( coverDimensionsPath = "/cover-dimensions" validateCoverPath = "/validate-cover" printJobCostPath = "/print-job-cost-calculations" + printJobPath = " /print-jobs" ) // ApiUrl is the location of the API server. It is set to the sandbox @@ -155,7 +156,7 @@ func (c *Client) GetCoverValidation(id uint) (CoverValidationRecord, error) { // actually creating a print job. // // https://api.lulu.com/docs/#tag/Print-Job-Cost-Calculations/operation/Print-Job-cost-calculations_create -func (c *Client) PrintJobCost(items []PrintJobCostLineItem, addr ShippingAddress, shipOpt ShippingLevel) (PrintJobCost, error) { +func (c *Client) PrintJobCost(items []PrintJobCostLineItem, addr ShippingAddress, shipOpt ShippingLevel) (PrintJobCost, ShippingAddressValidation, error) { reqAddr := printJobCostReqShipAddr{ City: addr.City, Country: addr.Country, @@ -165,12 +166,25 @@ func (c *Client) PrintJobCost(items []PrintJobCostLineItem, addr ShippingAddress Phone: addr.Phone, } payload := printJobCostReq{items, reqAddr, shipOpt} - var cost PrintJobCost - err := c.postDecode(printJobCostPath, payload, http.StatusCreated, &cost) + + var resp printJobCostResp + err := c.postDecode(printJobCostPath, payload, http.StatusCreated, &resp) if err != nil { - return cost, pkgErr(err) + return PrintJobCost{}, ShippingAddressValidation{}, pkgErr(err) } - return cost, nil + return resp.cost(), resp.AddressValidation, nil +} + +// PrintJobs retrieves a list of all print jobs that have been created, +// filtered by a set of optional query parameters. +// +// https://api.lulu.com/docs/#tag/Print-Jobs/operation/Print-Jobs_list +func (c *Client) PrintJobs(queries ...PrintJobQuery) ([]PrintJob, error) { + //q := parsePrintJobQueries(queries) + //page := 1 + + // TODO + return nil, fmt.Errorf("not implemented") } // getDecode sends a GET request and unmarshals the response. |