Response runtime

Technical reference of Runtime de respuestas.

This API is used in Communication.


Symbols

SymbolClassDescription
WriteActionFilefuncWrite WriteActionFile.
WriteActionFilesfuncWrite WriteActionFiles.
WritePageFilefuncWrite WritePageFile.
WritePageFilesfuncWrite WritePageFiles.
FlowControlKindtypeFlowControlKind defines a public type of API.
FlowDoneWithconstFlowDoneWith defines a constant value of the API.
FlowRedirectconstFlowRedirect defines a constant value of the API.
FlowInvalidconstFlowInvalid defines a constant value of the API.
FlowControltypeFlowControl defines a public type of API.
SetRuntimeResponseStatefuncSets SetRuntimeResponseState.
RuntimeResponseStatefuncIt gets the private state of Response.
ResetRuntimeResponsefuncReboot ResetRuntimeResponse.
SetRuntimeFlowCallsiteResolverfuncSets SetRuntimeFlowCallsiteResolver.
SetRuntimeResponseMutationGuardfuncSets SetRuntimeResponseMutationGuard.
ResponseImportMapRuntimetypeResponseImportMapRuntime defines a public type of API.
ResponseImportMap.RuntimefuncHe gets the reserved view of the runtime.
ResponseImportMapRuntime.ApplyCSPfuncApply the source of the import map to the CSP policy.
ResponseImportMapRuntime.WriteCompiledfuncWrite the compiled import map.
ResponseImportMapRuntime.SecuritySourcefuncReturns the calculated CSP source.

WriteActionFile

Declaration:

gox
func WriteActionFile(ctx *Context, file File) error

Write WriteActionFile.

Parameters

ParameterTypeDescription
ctx*ContextContext of execution.
fileFileType value File required by the operation.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

WriteActionFile returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.


WriteActionFiles

Declaration:

gox
func WriteActionFiles(ctx *Context, files []File) error

Write WriteActionFiles.

Parameters

ParameterTypeDescription
ctx*ContextContext of execution.
files[]FileType value []File required by the operation.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

WriteActionFiles returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.


WritePageFile

Declaration:

gox
func WritePageFile(ctx *Context, file File) error

Write WritePageFile.

Parameters

ParameterTypeDescription
ctx*ContextContext of execution.
fileFileType value File required by the operation.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

WritePageFile returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.


WritePageFiles

Declaration:

gox
func WritePageFiles(ctx *Context, files []File) error

Write WritePageFiles.

Parameters

ParameterTypeDescription
ctx*ContextContext of execution.
files[]FileType value []File required by the operation.

Returns

ReturnTypeDescription
errerrornil if the operation ends correctly; otherwise, the error produced.

Behavior

The operation returns an error when it cannot complete the above contract.

Errors

WritePageFiles returns an error when the arguments, the status of the receiver or the underlying operation make it impossible to complete the call.


FlowControlKind

Declaration:

gox
type FlowControlKind string

FlowControlKind defines a public type of API.


FlowDoneWith

Declaration:

gox
FlowDoneWith FlowControlKind = "doneWith"

FlowDoneWith defines a constant value of the API.


FlowRedirect

Declaration:

gox
FlowRedirect FlowControlKind = "redirect"

FlowRedirect defines a constant value of the API.


FlowInvalid

Declaration:

gox
FlowInvalid  FlowControlKind = "invalid"

FlowInvalid defines a constant value of the API.


FlowControl

Declaration:

gox
type FlowControl struct {
	Kind       FlowControlKind
	StatusCode int
	Component  Component
	Location   string
	Message    string
	ErrorKind  string
	File       string
	Line       int
}

FlowControl defines a public type of API.

Fields

FieldTypeDescription
KindFlowControlKindEvent or state class.
StatusCodeintHTTP status code.
ComponentComponentComponent associated with flow control.
LocationstringDestination of a redirection.
MessagestringA descriptive message.
ErrorKindstringAssociated error.
FilestringAssociated file.
LineintAssociated code line.

SetRuntimeResponseState

Declaration:

gox
func SetRuntimeResponseState(response *Response, state any)

Sets SetRuntimeResponseState.

Parameters

ParameterTypeDescription
response*ResponseType value *Response required by the operation.
stateanyType value any required by the operation.

RuntimeResponseState

Declaration:

gox
func RuntimeResponseState(response *Response) any

It gets the private state of Response.

Parameters

ParameterTypeDescription
response*ResponseType value *Response required by the operation.

Returns

ReturnTypeDescription
valueanyType value any produced by the operation.

ResetRuntimeResponse

Declaration:

gox
func ResetRuntimeResponse(response *Response)

Reboot ResetRuntimeResponse.

Parameters

ParameterTypeDescription
response*ResponseType value *Response required by the operation.

SetRuntimeFlowCallsiteResolver

Declaration:

gox
func SetRuntimeFlowCallsiteResolver(resolver func() (file string, line int))

Sets SetRuntimeFlowCallsiteResolver.

Parameters

ParameterTypeDescription
resolver func() (file stringint)Type value int) required by the operation.
lineint)Type value int) required by the operation.

SetRuntimeResponseMutationGuard

Declaration:

gox
func SetRuntimeResponseMutationGuard(guard func(*Response) bool)

Sets SetRuntimeResponseMutationGuard.

Parameters

ParameterTypeDescription
guard func(*Response)boolType value bool required by the operation.

ResponseImportMapRuntime

Declaration:

gox
type ResponseImportMapRuntime struct {
	// contiene campos internos
}

ResponseImportMapRuntime defines a public type of API.


ResponseImportMap.Runtime

Declaration:

gox
func (m *ResponseImportMap) Runtime() ResponseImportMapRuntime

He gets the reserved view of the runtime.

Returns

ReturnTypeDescription
valueResponseImportMapRuntimeType value ResponseImportMapRuntime produced by the operation.

ResponseImportMapRuntime.ApplyCSP

Declaration:

gox
func (r ResponseImportMapRuntime) ApplyCSP(staticHash string)

Apply the source of the import map to the CSP policy.

Parameters

ParameterTypeDescription
staticHashstringType value string required by the operation.

Usage syntax

gox
responseImportMapRuntime.ApplyCSP(value)

ResponseImportMapRuntime.WriteCompiled

Declaration:

gox
func (r ResponseImportMapRuntime) WriteCompiled(w Writer, staticEntries [][2]string, staticScript []byte, staticHash string)

Write the compiled import map.

Parameters

ParameterTypeDescription
wWriterType value Writer required by the operation.
staticEntries[][2]stringType value [][2]string required by the operation.
staticScript[]byteType value []byte required by the operation.
staticHashstringType value string required by the operation.

Usage syntax

gox
responseImportMapRuntime.WriteCompiled(value, value, value, value)

ResponseImportMapRuntime.SecuritySource

Declaration:

gox
func (r ResponseImportMapRuntime) SecuritySource() string

Returns the calculated CSP source.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := responseImportMapRuntime.SecuritySource()

See also

Next step

Continue with bindings installed by the server.

Runtime bindings