endpoint

package
v0.0.0-...-3e353e7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2025 License: Apache-2.0 Imports: 28 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequestByContext

func NewRequestByContext(ctx context.Context, ectx *fasthttp.RequestCtx) (adtype.BidRequester, error)

NewRequestByContext from request

func NewRequestFor

func NewRequestFor(
	ctx context.Context,
	app *admodels.Application,
	target adtype.Target,
	person personification.Person,
	opt *RequestOptions,
	formatAccessor types.FormatsAccessor,
) adtype.BidRequester

NewRequestFor specific person

Types

type Endpoint

type Endpoint interface {
	// Codename of the endpoint
	Codename() string

	// Handle request and process response
	Handle(source Source, bidRequest adtype.BidRequester) adtype.Response
}

Endpoint implementation

type Extension

type Extension struct {

	// URL query pattern like `/b/{endpoint}/{zone}` by default
	URLQueryPattern string
	// contains filtered or unexported fields
}

Extension of the server

func NewExtension

func NewExtension(opts ...Option) *Extension

NewExtension with options

func (*Extension) InitRouter

func (ext *Extension) InitRouter(ctx context.Context, router *router.Router, tracer opentracing.Tracer)

InitRouter of the HTTP server

type Option

type Option func(ext *Extension)

Option type

func WithAdvertisementSource

func WithAdvertisementSource(source Source) Option

WithAdvertisementSource accessor

func WithAppAccessor

func WithAppAccessor(appAccessor appAccessor) Option

WithAppAccessor setter

func WithFormatAccessor

func WithFormatAccessor(formatAccessor types.FormatsAccessor) Option

WithFormatAccessor setter

func WithHTTPHandlerWrapper

func WithHTTPHandlerWrapper(handlerWrapper *httphandler.HTTPHandlerWrapper) Option

WithHTTPHandlerWrapper setter

func WithSendpoints

func WithSendpoints(endpoints ...Endpoint) Option

WithSendpoints setter

func WithSpy

func WithSpy(spy middleware.Spy) Option

WithSpy setter

func WithURLQueryPattern

func WithURLQueryPattern(pattern string) Option

WithURLQueryPattern setter

func WithZoneAccessor

func WithZoneAccessor(zoneAccessor zoneAccessor) Option

WithZoneAccessor setter

type RequestOptions

type RequestOptions struct {
	Debug       bool
	Request     *fasthttp.RequestCtx
	Count       int
	X, Y        int
	Width       int
	WidthMax    int
	Height      int
	HeightMax   int
	Page        string
	Keywords    string
	FormatCodes []string
	FormatTypes []string
	SubID1      string
	SubID2      string
	SubID3      string
	SubID4      string
	SubID5      string
}

RequestOptions prepare

func NewDirectRequestOptions

func NewDirectRequestOptions(ctx *fasthttp.RequestCtx) *RequestOptions

NewDirectRequestOptions prepare

func NewRequestOptions

func NewRequestOptions(ctx *fasthttp.RequestCtx) *RequestOptions

NewRequestOptions prepare

func (*RequestOptions) GetFormatTypes

func (opt *RequestOptions) GetFormatTypes() types.FormatTypeBitset

GetFormatTypes prepare by request codes

type Source

type Source interface {
	// Bid request for standart system filter
	Bid(request adtype.BidRequester) adtype.Response

	// ProcessResponse when need to fix the result and process all counters
	ProcessResponse(response adtype.Response)
}

Source of advertisement

Jump to

Keyboard shortcuts

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