github.com/prebid/prebid-server/v2@v2.18.0/hooks/hookstage/invocation.go (about)

     1  package hookstage
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/prebid/prebid-server/v2/hooks/hookanalytics"
     7  )
     8  
     9  // HookResult represents the result of execution the concrete hook instance.
    10  type HookResult[T any] struct {
    11  	Reject        bool         // true value indicates rejection of the program execution at the specific stage
    12  	NbrCode       int          // hook must provide NbrCode if the field Reject set to true
    13  	Message       string       // holds arbitrary message added by hook
    14  	ChangeSet     ChangeSet[T] // set of changes the module wants to apply to hook payload in case of successful execution
    15  	Errors        []string
    16  	Warnings      []string
    17  	DebugMessages []string
    18  	AnalyticsTags hookanalytics.Analytics
    19  	ModuleContext ModuleContext // holds values that the module wants to pass to itself at later stages
    20  }
    21  
    22  // ModuleInvocationContext holds data passed to the module hook during invocation.
    23  type ModuleInvocationContext struct {
    24  	// AccountConfig represents module config rewritten at the account-level.
    25  	AccountConfig json.RawMessage
    26  	// Endpoint represents the path of the current endpoint.
    27  	Endpoint string
    28  	// ModuleContext holds values that the module passes to itself from the previous stages.
    29  	ModuleContext ModuleContext
    30  }
    31  
    32  // ModuleContext holds arbitrary data passed between module hooks at different stages.
    33  // We use interface as we do not know exactly how the modules will use their inner context.
    34  type ModuleContext map[string]interface{}