api

package
v3.1.1-0...-90097f9 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 13 Imported by: 7

Documentation

Index

Constants

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

Cache control header constants

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 NewHTTPEventsRecorder

func NewHTTPEventsRecorder(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface) service.EventsRecorder

NewHTTPEventsRecorder instantiates an HTTPEventsRecorder

func NewHTTPImpressionRecorder

func NewHTTPImpressionRecorder(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface) service.ImpressionsRecorder

NewHTTPImpressionRecorder instantiates an HTTPImpressionRecorder

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

func NewHTTPTelemetryRecorder

func NewHTTPTelemetryRecorder(apikey string, cfg conf.AdvancedConfig, logger logging.LoggerInterface) service.TelemetryRecorder

NewHTTPTelemetryRecorder instantiates an HTTPTelemetryRecorder

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(service string, headers map[string]string) ([]byte, error)
	Post(service 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(service string, headers map[string]string) ([]byte, error)

Get method is a get call to an url

func (*HTTPClient) Post

func (c *HTTPClient) Post(service 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 (*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 (*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 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, since int64, requestNoCache bool) (*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

func (f *HTTPSplitFetcher) Fetch(since int64, requestNoCache bool) (*dtos.SplitChangesDTO, error)

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 (*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

type SplitAPI

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

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