-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelivery_slot.go
More file actions
39 lines (36 loc) · 1.39 KB
/
delivery_slot.go
File metadata and controls
39 lines (36 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package picnic
type DeliverySlot struct {
SlotId string `json:"slot_id"`
HubId string `json:"hub_id"`
FcId string `json:"fc_id"`
WindowStart string `json:"window_start"`
WindowEnd string `json:"window_end"`
CutOffTime string `json:"cut_off_time"`
IsAvailable bool `json:"is_available"`
Icon Icon `json:"icon"`
Selected bool `json:"selected"`
Reserved bool `json:"reserved"`
MinimumOrderValue int `json:"minimum_order_value"`
UnavailabilityReason string `json:"unavailability_reason"`
WindowPresentationColor string `json:"window_presentation_color"`
}
type DeliverySlots struct {
DeliverySlots []DeliverySlot `json:"delivery_slots"`
SelectedSlot SelectedSlot `json:"selected_slot"`
}
// GetDeliverySlots Retrieves all slots for the next 7 days for the authenticated user
// A more direct alternative to using GetCart and accessing the data from the Order.
//
// Method requires client to be authenticated
func (c *Client) GetDeliverySlots() (*DeliverySlots, error) {
if !c.IsAuthenticated() {
return nil, authenticationError()
}
searchUrl := c.baseURL + "/cart/delivery_slots"
var deliverySlots DeliverySlots
err := c.get(searchUrl, &deliverySlots)
if err != nil {
return nil, err
}
return &deliverySlots, nil
}