forked from linksports/kevel-decision-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserdbclient.go
More file actions
67 lines (51 loc) · 2.32 KB
/
Copy pathuserdbclient.go
File metadata and controls
67 lines (51 loc) · 2.32 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
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
package kevel
import "github.com/linksports/kevel-decision-sdk-go/model"
type UserDbClient struct {
networkId int
apiClient ApiClient
}
func NewUserDbClient(networkId int, path, apiKey string) UserDbClient {
return UserDbClient{
networkId,
NewApiClient(path, apiKey),
}
}
func (c *UserDbClient) SetCustomProperties(userKey string, props map[string]interface{}, networkIds ...int) error {
return c.apiClient.SetCustomProperties(c.NetworkId(networkIds...), userKey, props)
}
func (c *UserDbClient) AddInterest(userKey string, interest string, networkIds ...int) error {
return c.apiClient.AddInterest(c.NetworkId(networkIds...), userKey, interest)
}
func (c *UserDbClient) AddInterests(userKey string, interests []string, networkIds ...int) error {
return c.apiClient.AddInterests(c.NetworkId(networkIds...), userKey, interests)
}
func (c *UserDbClient) RemoveInterests(userKey string, interests []string, networkIds ...int) error {
return c.apiClient.RemoveInterests(c.NetworkId(networkIds...), userKey, interests)
}
func (c *UserDbClient) AddRetargetingSegment(userKey string, advertiserId, retargetingSegmentId int, networkIds ...int) error {
return c.apiClient.AddRetargetingSegment(c.NetworkId(networkIds...), userKey, advertiserId, retargetingSegmentId)
}
func (c *UserDbClient) Forget(userKey string, networkIds ...int) error {
return c.apiClient.Forget(c.NetworkId(networkIds...), userKey)
}
func (c *UserDbClient) GdprConsent(consentRequest model.ConsentRequest, networkIds ...int) error {
return c.apiClient.GdprConsent(c.NetworkId(networkIds...), consentRequest)
}
func (c *UserDbClient) IpOverride(userKey, ip string, networkIds ...int) error {
return c.apiClient.IpOverride(c.NetworkId(networkIds...), userKey, ip)
}
func (c *UserDbClient) MatchUser(userKey string, partnerId, userId int, networkIds ...int) error {
return c.apiClient.MatchUser(c.NetworkId(networkIds...), userKey, partnerId, userId)
}
func (c *UserDbClient) OptOut(userKey string, networkIds ...int) error {
return c.apiClient.OptOut(c.NetworkId(networkIds...), userKey)
}
func (c *UserDbClient) Read(userKey string, networkIds ...int) (model.UserRecord, error) {
return c.apiClient.ReadUser(c.NetworkId(networkIds...), userKey)
}
func (c *UserDbClient) NetworkId(networkIds ...int) int {
if len(networkIds) > 0 {
return networkIds[0]
}
return c.networkId
}