requests

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubConnectionInit      = "connection_init"
	SubConnectionAck       = "connection_ack"
	SubConnectionKeepAlive = "ka"
	SubConnectionError     = "connection_error"
	SubConnectionTerminate = "connection_terminate"
	SubStart               = "start"
	SubData                = "data"
	SubError               = "error"
	SubComplete            = "complete"
	SubStop                = "stop"
)

Variables

This section is empty.

Functions

func IsBatchMode

func IsBatchMode(body []byte) bool

Types

type ClientSubMsg added in v0.2.0

type ClientSubMsg struct {
	ID      string   `json:"id,omitempty"`
	Type    string   `json:"type"`
	Payload *Request `json:"payload,omitempty"`
}

ClientSubMsg defines possible client messages

type File

type File interface {
	io.Reader
	io.Closer
}

type ParseRequestResponse

type ParseRequestResponse struct {
	Requests    []*Request
	IsBatchMode bool
}

ParseRequestResponse is an resulting object of ParseRequestQuery. It contains requests array and indicator, if request was running in batch mode.

func Parse

func Parse(r *http.Request) (resp *ParseRequestResponse, finalErr error)

type Request

type Request struct {
	Original      *http.Request          `json:"-"`
	Query         string                 `json:"query"`
	Variables     map[string]interface{} `json:"variables"`
	OperationName *string                `json:"operationName"`
}

Request represents single request send via HTTP

type Response added in v0.2.0

type Response struct {
	Errors gqlerrors.ErrorList    `json:"errors"`
	Data   map[string]interface{} `json:"data"`
}

type Responses added in v0.2.0

type Responses []Response

type ServerSubErorrMsg added in v0.2.0

type ServerSubErorrMsg struct {
	ID      string              `json:"id,omitempty"`
	Type    string              `json:"type"`
	Payload gqlerrors.ErrorList `json:"payload,omitempty"`
}

ServerSubErrorMsg defines msg for type error

type ServerSubMsg added in v0.2.0

type ServerSubMsg struct {
	ID      string    `json:"id,omitempty"`
	Type    string    `json:"type"`
	Payload *Response `json:"payload,omitempty"`
}

ServerSubMsg defines possible server messages

type Upload

type Upload struct {
	File     File
	FileName string
}

Upload represent file and it's name

Jump to

Keyboard shortcuts

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