api

package
v6.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Index

Constants

View Source
const (
	CacheControlHeader  = "Cache-Control"
	CacheControlNoCache = "no-cache"
)

Cache control header constants

View Source
const (
	// Unknown format
	Unknown = iota
	// Csv format
	Csv
)

Variables

This section is empty.

Functions

func AddMetadataToHeaders

func AddMetadataToHeaders(metadata dtos.Metadata, extraHeaders map[string]string, clientKey *string) map[string]string

AddMetadataToHeaders adds metadata in headers

func NewHTTPLargeSegmentFetcher added in v6.0.2

func NewHTTPLargeSegmentFetcher(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface, metadata dtos.Metadata) service.LargeSegmentFetcher

NewHTTPLargeSegmentsFetcher

func NewHTTPSegmentFetcher

func NewHTTPSegmentFetcher(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface, metadata dtos.Metadata) service.SegmentFetcher

NewHTTPSegmentFetcher instantiates and returns a new HTTPSegmentFetcher.

func NewHTTPSplitFetcher

func NewHTTPSplitFetcher(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface, metadata dtos.Metadata) service.SplitFetcher

NewHTTPSplitFetcher instantiates and return an HTTPSplitFetcher

Types

type AuthAPIClient

type AuthAPIClient struct {
	// contains filtered or unexported fields
}

AuthAPIClient struct is responsible for authenticating client for push services

func NewAuthAPIClient

func NewAuthAPIClient(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface, metadata dtos.Metadata) *AuthAPIClient

NewAuthAPIClient instantiates and return an AuthAPIClient

func (*AuthAPIClient) Authenticate

func (a *AuthAPIClient) Authenticate() (*dtos.Token, error)

Authenticate performs authentication for push services

type Client

type Client interface {
	Get(endpoint string, fetchOptions service.RequestParams) ([]byte, error)
	Post(endpoint string, body []byte, headers map[string]string) error
}

Client interface for HTTPClient

func NewHTTPClient

func NewHTTPClient(
	apikey string,
	cfg conf.AdvancedConfig,
	endpoint string,
	logger logging.LoggerInterface,
	metadata dtos.Metadata,
) Client

NewHTTPClient instance of HttpClient

type HTTPClient

type HTTPClient struct {
	// contains filtered or unexported fields
}

HTTPClient structure to wrap up the net/http.Client

func (*HTTPClient) Get

func (c *HTTPClient) Get(endpoint string, fetchOptions service.RequestParams) ([]byte, error)

Get method is a get call to an url

func (*HTTPClient) Post

func (c *HTTPClient) Post(endpoint string, body []byte, headers map[string]string) error

Post performs a HTTP POST request

type HTTPEventsRecorder

type HTTPEventsRecorder struct {
	// contains filtered or unexported fields
}

HTTPEventsRecorder is a struct responsible for submitting events bulks to the backend

func NewHTTPEventsRecorder

func NewHTTPEventsRecorder(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface) *HTTPEventsRecorder

NewHTTPEventsRecorder instantiates an HTTPEventsRecorder

func (*HTTPEventsRecorder) Record

func (i *HTTPEventsRecorder) Record(events []dtos.EventDTO, metadata dtos.Metadata) error

Record sends an array (or slice) of dtos.EventDTO to the backend

func (*HTTPEventsRecorder) RecordRaw

func (h *HTTPEventsRecorder) RecordRaw(url string, data []byte, metadata dtos.Metadata, extraHeaders map[string]string) error

RecordRaw records raw data

type HTTPImpressionRecorder

type HTTPImpressionRecorder struct {
	// contains filtered or unexported fields
}

HTTPImpressionRecorder is a struct responsible for submitting impression bulks to the backend

func NewHTTPImpressionRecorder

func NewHTTPImpressionRecorder(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface) *HTTPImpressionRecorder

NewHTTPImpressionRecorder instantiates an HTTPImpressionRecorder

func (*HTTPImpressionRecorder) Record

func (i *HTTPImpressionRecorder) Record(impressions []dtos.ImpressionsDTO, metadata dtos.Metadata, extraHeaders map[string]string) error

Record sends an array (or slice) of impressionsRecord to the backend

func (*HTTPImpressionRecorder) RecordImpressionsCount

func (i *HTTPImpressionRecorder) RecordImpressionsCount(pf dtos.ImpressionsCountDTO, metadata dtos.Metadata) error

RecordImpressionsCount sens impressionsCount

func (*HTTPImpressionRecorder) RecordRaw

func (h *HTTPImpressionRecorder) RecordRaw(url string, data []byte, metadata dtos.Metadata, extraHeaders map[string]string) error

RecordRaw records raw data

type HTTPLargeSegmentFetcher added in v6.0.2

type HTTPLargeSegmentFetcher struct {
	// contains filtered or unexported fields
}

func (*HTTPLargeSegmentFetcher) DownloadFile added in v6.0.2

func (f *HTTPLargeSegmentFetcher) DownloadFile(name string, rfdResponseDTO *dtos.LargeSegmentRFDResponseDTO) (*dtos.LargeSegment, error)

func (*HTTPLargeSegmentFetcher) Fetch added in v6.0.2

type HTTPSegmentFetcher

type HTTPSegmentFetcher struct {
	// contains filtered or unexported fields
}

HTTPSegmentFetcher struct is responsible for fetching segment by name from the API via HTTP method

func (*HTTPSegmentFetcher) Fetch

func (f *HTTPSegmentFetcher) Fetch(segmentName string, fetchOptions *service.SegmentRequestParams) (*dtos.SegmentChangesDTO, error)

Fetch issues a GET request to the split backend and returns the contents of a particular segment

type HTTPSplitFetcher

type HTTPSplitFetcher struct {
	// contains filtered or unexported fields
}

HTTPSplitFetcher struct is responsible for fetching splits from the backend via HTTP protocol

func (*HTTPSplitFetcher) Fetch

Fetch makes an http call to the split backend and returns the list of updated splits

type HTTPTelemetryRecorder

type HTTPTelemetryRecorder struct {
	// contains filtered or unexported fields
}

HTTPTelemetryRecorder is a struct responsible for submitting telemetry to the backend

func NewHTTPTelemetryRecorder

func NewHTTPTelemetryRecorder(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface) *HTTPTelemetryRecorder

NewHTTPTelemetryRecorder instantiates an HTTPTelemetryRecorder

func (*HTTPTelemetryRecorder) RecordConfig

func (m *HTTPTelemetryRecorder) RecordConfig(config dtos.Config, metadata dtos.Metadata) error

RecordConfig method submits config

func (*HTTPTelemetryRecorder) RecordRaw

func (h *HTTPTelemetryRecorder) RecordRaw(url string, data []byte, metadata dtos.Metadata, extraHeaders map[string]string) error

RecordRaw records raw data

func (*HTTPTelemetryRecorder) RecordStats

func (m *HTTPTelemetryRecorder) RecordStats(stats dtos.Stats, metadata dtos.Metadata) error

RecordStats method submits stats

func (*HTTPTelemetryRecorder) RecordUniqueKeys

func (m *HTTPTelemetryRecorder) RecordUniqueKeys(uniques dtos.Uniques, metadata dtos.Metadata) error

RecordUniqueKeys method submits unique keys

type LargeSegmentFetcher added in v6.0.2

type LargeSegmentFetcher interface {
	Fetch(name string, fetchOptions *service.SegmentRequestParams) (*dtos.LargeSegment, error)
}

type SplitAPI

type SplitAPI struct {
	AuthClient          service.AuthClient
	SplitFetcher        service.SplitFetcher
	SegmentFetcher      service.SegmentFetcher
	ImpressionRecorder  service.ImpressionsRecorder
	EventRecorder       service.EventsRecorder
	TelemetryRecorder   service.TelemetryRecorder
	LargeSegmentFetcher service.LargeSegmentFetcher
}

SplitAPI struct for fetchers and recorders

func NewSplitAPI

func NewSplitAPI(
	apikey string,
	conf conf.AdvancedConfig,
	logger logging.LoggerInterface,
	metadata dtos.Metadata,
) *SplitAPI

NewSplitAPI creates new splitAPI

Directories

Path Synopsis
sse

Jump to

Keyboard shortcuts

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