-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteraction_cart_addition.go
57 lines (50 loc) · 1.38 KB
/
interaction_cart_addition.go
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package recombee
import (
"fmt"
"net/http"
)
// AddCartAddition adds a cart addition of the given item made by the given user.
func AddCartAddition(userId string, itemId string, opts ...RequestOption) Request {
params := map[string]interface{}{
"userId": userId,
"itemId": itemId,
}
for _, o := range opts {
o(params)
}
return Request{
Path: "/cartadditions/",
Method: http.MethodPost,
Params: params,
}
}
// DeleteCartAddition deletes an existing cart addition uniquely specified by userId, itemId, and timestamp
// or all the cart additions with the given userId and itemId if timestamp is omitted.
func DeleteCartAddition(userId string, itemId string, opts ...RequestOption) Request {
params := map[string]interface{}{
"userId": userId,
"itemId": itemId,
}
for _, o := range opts {
o(params)
}
return Request{
Path: "/cartadditions/",
Method: http.MethodDelete,
Params: params,
}
}
// ListItemCartAddition lists all the ever-made cart additions of the given item.
func ListItemCartAddition(itemId string) Request {
return Request{
Path: fmt.Sprintf("/items/%s/cartadditions/", itemId),
Method: http.MethodGet,
}
}
// ListUserCartAddition lists all the cart additions ever made by the given user.
func ListUserCartAddition(userId string) Request {
return Request{
Path: fmt.Sprintf("/users/%s/cartadditions/", userId),
Method: http.MethodGet,
}
}