-
Notifications
You must be signed in to change notification settings - Fork 0
/
interaction_detail_views.go
55 lines (48 loc) · 1.42 KB
/
interaction_detail_views.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
package recombee
import (
"fmt"
"net/http"
)
// AddDetailView adds a detail view of the given item made by the given user.
func AddDetailView(userId string, itemId string, opts ...RequestOption) Request {
params := make(map[string]interface{})
params["userId"] = userId
params["itemId"] = itemId
for _, o := range opts {
o(params)
}
return Request{
Path: "/detailviews/",
Method: http.MethodPost,
Params: params,
}
}
// DeleteDetailView deletes an existing detail view uniquely specified by (userId, itemId, and timestamp) or all the
// detail views with the given userId and itemId if timestamp is omitted.
func DeleteDetailView(userId string, itemId string, opts ...RequestOption) Request {
params := make(map[string]interface{})
params["userId"] = userId
params["itemId"] = itemId
for _, o := range opts {
o(params)
}
return Request{
Path: "/detailviews/",
Method: http.MethodDelete,
Params: params,
}
}
// ListItemDetailViews lists all the detail views of the given item ever made by different users.
func ListItemDetailViews(itemId string) Request {
return Request{
Path: fmt.Sprintf("/items/%s/detailviews/", itemId),
Method: http.MethodGet,
}
}
// ListUserDetailViews lists all the detail views of different items ever made by the given user.
func ListUserDetailViews(userId string) Request {
return Request{
Path: fmt.Sprintf("/users/%s/detailviews/", userId),
Method: http.MethodGet,
}
}