-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.go
40 lines (33 loc) · 1.32 KB
/
client.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
package gowebengage
import (
"context"
"github.com/go-resty/resty/v2"
)
// Webengage is the interface for the webengage client.
type Webengage interface {
CreateUser(ctx context.Context, apiKey string, licenseCode string, request UserRequest) error
CreateBulkUser(ctx context.Context, apiKey string, licenseCode string, request []UserRequest) error
UpdateUser(ctx context.Context, apiKey, licenseCode, userID string, request UserRequest) error
CreateEvent(ctx context.Context, apiKey, licenseCode, userID string, eventName string, eventTime string,
eventData map[string]interface{}) error
CreateBulkEvent(ctx context.Context, apiKey string, licenseCode string, request []EventRequest) error
CreateTransactionalCampaignMessages(ctx context.Context, apiKey, licenseCode, userID string, ttl int,
token map[string]interface{}, experimentID string) (*TransactionalCampaignMessagesResponse, error)
GetSurvey(ctx context.Context, apiKey, surveyResponseID string) (*SurveyResponse, error)
}
type webengage struct {
client *resty.Client
userAgent string
}
func NewWebengage(address string, proxy string, userAgent string) Webengage {
client := resty.New().
SetAuthScheme("Bearer").
SetBaseURL(address)
if proxy != "" {
client = client.SetProxy(proxy)
}
return &webengage{
client: client,
userAgent: userAgent,
}
}