aboutsummaryrefslogtreecommitdiffstats
path: root/lulu.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-12 15:35:06 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-12 15:37:29 -0400
commit9010ebe8a581fb9db7bc6e97d40ff062fb18495f (patch)
tree4301a455762a59d4951507c8a8781e99c6f91c6d /lulu.go
parent329257be8d9fb05d3dcea49823acea0f878ed52c (diff)
downloadlulu-9010ebe8a581fb9db7bc6e97d40ff062fb18495f.zip
unmarshal GET /print-jobs response
Diffstat (limited to 'lulu.go')
-rw-r--r--lulu.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/lulu.go b/lulu.go
index 302bfc5..a7a6cdd 100644
--- a/lulu.go
+++ b/lulu.go
@@ -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.