models

package
v0.8.15 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryParamOutputAdapters = config.ParamNameAdapters
	QueryParamInputType      = config.ParamNameInputType
	QueryParamOutputFormat   = config.ParamNameOutputFormat
	QueryParamOutputType     = config.ParamNameOutputType
	QueryParamOutputURL      = config.ParamNameOutputURL
	QueryParamToken          = config.ParamNameToken

	ParamPayload = "payload"
)

Variables

This section is empty.

Functions

func BodyToMessageBytesAnyHTTP

func BodyToMessageBytesAnyHTTP(bodyType MessageBodyType, aReq anyhttp.Request) []byte

func BodyToMessageBytesFastHTTP

func BodyToMessageBytesFastHTTP(bodyType MessageBodyType, ctx *fasthttp.RequestCtx) []byte

func BodyToMessageBytesNetHTTP

func BodyToMessageBytesNetHTTP(bodyType MessageBodyType, req *http.Request) []byte

func BuildAwsAPIGatewayProxyResponse

func BuildAwsAPIGatewayProxyResponse(hookData HookData, errs ...ErrorInfo) (events.APIGatewayProxyResponse, error)

func GetMapString2Simple

func GetMapString2Simple(mapSS map[string]string, key string) string

func GetMaxStatusCode

func GetMaxStatusCode(errs ...ErrorInfo) int

Types

type AwsAPIGatewayProxyOutput

type AwsAPIGatewayProxyOutput struct {
	IsBase64Encoded bool              `json:"isBase64Encoded"`
	StatusCode      int               `json:"statusCode"`
	Body            string            `json:"body"`
	Headers         map[string]string `json:"headers"`
}

type ErrorInfo

type ErrorInfo struct {
	StatusCode int
	Body       []byte
}

func ErrorsInfoToResponseInfoOld

func ErrorsInfoToResponseInfoOld(errs ...ErrorInfo) ErrorInfo

type HookData

type HookData struct {
	InputType         string             `json:"inputType,omitempty"`
	InputBody         []byte             `json:"inputBody,omitempty"`
	OutputFormat      string             `json:"outputFormat,omitempty"`
	OutputType        string             `json:"outputType,omitempty"`
	OutputURL         string             `json:"outputURL,omitempty"`
	OutputNames       []string           `json:"outputNames,omitempty"`
	Token             string             `json:"token,omitempty"`
	InputMessage      []byte             `json:"inputMessage,omitempty"`
	CustomQueryParams url.Values         `json:"customParams,omitempty"`
	CanonicalMessage  commonchat.Message `json:"canonicalMessage,omitempty"`
}

func HookDataFromAnyHTTPReq

func HookDataFromAnyHTTPReq(bodyType MessageBodyType, aReq anyhttp.Request) HookData

func HookDataFromAwsLambdaEvent

func HookDataFromAwsLambdaEvent(bodyType MessageBodyType, awsReq events.APIGatewayProxyRequest, messageBodyType MessageBodyType) HookData

HookDataFromAwsLambdaEvent converts a Lambda event to generic HookData.

func HookDataFromFastHTTPReqCtx

func HookDataFromFastHTTPReqCtx(bodyType MessageBodyType, ctx *fasthttp.RequestCtx) HookData

func HookDataFromNetHTTPReq

func HookDataFromNetHTTPReq(bodyType MessageBodyType, req *http.Request) HookData

type MessageBodyType

type MessageBodyType int
const (
	JSON MessageBodyType = iota
	URLEncoded
	URLEncodedJSONPayload
	URLEncodedJSONPayloadOrJSON
	URLEncodedRails
)

type RequestParams

type RequestParams struct {
	InputType  string `url:"inputType"`
	OutputType string `url:"outputType"`
	Token      string `url:"token"`
	URL        string `url:"outputURL"`
}

type ResponseInfo

type ResponseInfo struct {
	HookData   HookData    `json:"hookData,omitempty"`
	Responses  []ErrorInfo `json:"responses,omitempty"`
	StatusCode int         `json:"statusCode,omitempty"`
}

func (*ResponseInfo) ToAPIGatewayProxyResponse

func (ri *ResponseInfo) ToAPIGatewayProxyResponse() (events.APIGatewayProxyResponse, error)

Jump to

Keyboard shortcuts

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