utils

package
v0.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const UDC_TIMEOUT = 1000

Variables

This section is empty.

Functions

func CreateABCampaignMock

func CreateABCampaignMock(campaignID string, vgID string, targetings *targeting.Targeting, modifications *decision_response.Modifications) *common.Campaign

CreateABCampaignMock returns a mocked AB Test campaign

func CreateAllUsersTargetingMock

func CreateAllUsersTargetingMock() *targeting.Targeting

CreateAllUsersTargetingMock creates a mock targeting all users as byte

func CreateMockDecisionContext

func CreateMockDecisionContext() *connectors.DecisionContext

func CreateModification

func CreateModification(key string, value interface{}, modifType decision_response.ModificationsType) *decision_response.Modifications

CreateModification returns a single modification with key value string as byte array

func CreateTargetingWithProvider

func CreateTargetingWithProvider() *targeting.Targeting

CreateTargetingWithProvider creates a mock targeting with an integration provider

func GetDecisionRequest

func GetDecisionRequest(r *http.Request) (*decision_request.DecisionRequest, error)

GetDecisionRequest transforms http request into a DecisionRequest

func NewTracker

func NewTracker() *common.Tracker

NewTracker Creates a tracker

func SetUDCUrl

func SetUDCUrl(url string)

func WriteClientError

func WriteClientError(w http.ResponseWriter, status int, message string)

WriteClientError similarly add a helper for send responses relating to client errors.

func WriteJSONOk

func WriteJSONOk(w http.ResponseWriter, data interface{})

WriteJSONOk similarly add a helper to send json responses with status OK.

func WriteJSONStringOk

func WriteJSONStringOk(w http.ResponseWriter, data string)

WriteJSONStringOk similarly add a helper to send json stringified responses with status OK.

func WriteNoContent

func WriteNoContent(w http.ResponseWriter)

WriteNoContent similarly add a helper to send 204 responses .

func WritePanicResponse

func WritePanicResponse(w http.ResponseWriter, visitorID *wrapperspb.StringValue)

WritePanicResponse writes a response for panic mode

func WriteServerError

func WriteServerError(w http.ResponseWriter, err error)

WriteServerError returns a 500 Internal Server Error response

Types

type ClientErrorMessage

type ClientErrorMessage struct {
	Message string `json:"message"`
}

ClientErrorMessage represents a bad request response

type UDCVisitorRow

type UDCVisitorRow struct {
	Segment string `json:"segment"`
	Value   string `json:"value"`
	Partner string `json:"partner"`
}

func FetchVisitorData

func FetchVisitorData(environmentID string, visitorID string) ([]UDCVisitorRow, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL