-
Notifications
You must be signed in to change notification settings - Fork 0
/
recommendation_item_segments.go
77 lines (70 loc) · 2.41 KB
/
recommendation_item_segments.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package recombee
import (
"fmt"
"net/http"
)
// RecommendItemSegmentsToUser recommends the top Segments from a Segmentation
// for a particular user, based on the user’s past interactions.
//
// Based on the used Segmentation, this endpoint can be used for example for:
// - Recommending the top categories for the user
// - Recommending the top genres for the user
// - Recommending the top brands for the user
// - Recommending the top artists for the user
func RecommendItemSegmentsToUser(userId string, count int, opts ...RequestOption) Request {
params := make(map[string]interface{})
params["count"] = count
for _, o := range opts {
o(params)
}
return Request{
Path: fmt.Sprintf("/recomms/users/%s/item-segments/", userId),
Method: http.MethodGet,
Params: params,
}
}
// RecommendItemSegmentsToItem recommends Segments from a Segmentation that are the most relevant to a particular item.
//
// Based on the used Segmentation, this endpoint can be used for example for:
// - Recommending the related categories
// - Recommending the related genres
// - Recommending the related brands
// - Recommending the related artists
func RecommendItemSegmentsToItem(itemId string, targetUserId string, count int, opts ...RequestOption) Request {
params := make(map[string]interface{})
params["count"] = count
params["targetUserId"] = targetUserId
for _, o := range opts {
o(params)
}
return Request{
Path: fmt.Sprintf("/recomms/items/%s/item-segments/", itemId),
Method: http.MethodGet,
Params: params,
}
}
// RecommendItemSegmentsToItemSegment recommends Segments from a result Segmentation that are the most relevant to a particular Segment from a context Segmentation.
//
// Based on the used Segmentations, this endpoint can be used for example for:
// - Recommending the related brands to particular brand
// - Recommending the related brands to particular category
// - Recommending the related artists to a particular genre (assuming songs are the Items)
func RecommendItemSegmentsToItemSegment(
contextSegmentId string,
targetUserId string,
count int,
opts ...RequestOption,
) Request {
params := make(map[string]interface{})
params["count"] = count
params["targetUserId"] = targetUserId
params["contextSegmentId"] = contextSegmentId
for _, o := range opts {
o(params)
}
return Request{
Path: "/recomms/item-segments/item-segments/",
Method: http.MethodGet,
Params: params,
}
}