Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Body ¶
func (c *Client) Body(req *GraphRequest) *Client
func (*Client) QueryOrMutate ¶
func (c *Client) QueryOrMutate() QueryOrMutate
func (*Client) SetOperationName ¶
func (*Client) Subscription ¶
func (c *Client) Subscription() Subscription
type Event ¶
type Event interface { Message() *SubscribeMessage Error() *SubscribeError }
type GraphError ¶
type GraphError struct {
Message string `json:"message"`
}
func (GraphError) Error ¶
func (ge GraphError) Error() string
type GraphRequest ¶
type GraphRequest struct { Query string `json:"query"` Variables map[string]interface{} `json:"variables,omitempty"` // OperationName is only required if multiple operations are present in the query. OperationName string `json:"operationName,omitempty"` }
GraphRequest is a standard GraphQL POST request https://graphql.org/learn/serving-over-http/#post-request
func NewGraphRequest ¶
func NewGraphRequest(query string, variables map[string]any) *GraphRequest
type GraphResponse ¶
type GraphResponse struct { Data json.RawMessage `json:"data"` Errors []GraphError `json:"errors"` }
GraphResponse is a standard GraphQL response https://graphql.org/learn/serving-over-http/#response
func (*GraphResponse) Decode ¶
func (gr *GraphResponse) Decode(v interface{}) error
type Interface ¶
type Interface interface { QueryOrMutate() QueryOrMutate Subscription() Subscription }
type QueryOrMutate ¶
type Subscribe ¶
type Subscribe struct {
// contains filtered or unexported fields
}
func (*Subscribe) ResultChan ¶
type SubscribeError ¶
type SubscribeError struct { Code websocket.StatusCode Reason string }
func (*SubscribeError) Error ¶
func (s *SubscribeError) Error() string
type SubscribeEvent ¶
type SubscribeEvent struct {
// contains filtered or unexported fields
}
func (*SubscribeEvent) Error ¶
func (s *SubscribeEvent) Error() *SubscribeError
func (*SubscribeEvent) Message ¶
func (s *SubscribeEvent) Message() *SubscribeMessage
type SubscribeMessage ¶
type SubscribeMessage struct { ID string `json:"id,omitempty"` Type SubscribeMessageType `json:"type"` Payload json.RawMessage `json:"payload,omitempty"` }
SubscribeMessage represents a subscription operation message graphql-ws: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
func (*SubscribeMessage) Decode ¶
func (sm *SubscribeMessage) Decode(v interface{}) error
type SubscribeMessageType ¶
type SubscribeMessageType string
SubscribeMessageType represents a subscription message enum type
const ( // GQLConnectionInit Direction: Client -> Server // Indicates that the client wants to establish a connection within the existing socket. // This connection is not the actual WebSocket communication channel, but is rather a frame within it asking the server to allow future operation requests. GQLConnectionInit SubscribeMessageType = "connection_init" // GQLConnectionAck Direction: Server -> Client // Expected response to the ConnectionInit message from the client acknowledging a successful connection with the server. GQLConnectionAck SubscribeMessageType = "connection_ack" // GQLPing Direction: bidirectional // The Ping message can be sent at any time within the established socket. GQLPing SubscribeMessageType = "ping" // GQLPong Direction: bidirectional // The response to the Ping message. Must be sent as soon as the Ping message is received. GQLPong SubscribeMessageType = "pong" // GQLSubscribe Direction: Client -> Server // Requests an operation specified in the message payload. This message provides a unique ID field to connect published messages to the operation requested by this message. GQLSubscribe SubscribeMessageType = "subscribe" // GQLNext Direction: Server -> Client // Operation execution result(s) from the source stream created by the binding Subscribe message. After all results have been emitted, the Complete message will follow indicating stream completion. GQLNext SubscribeMessageType = "next" // GQLError Direction: Server -> Client // Operation execution error(s) in response to the Subscribe message. // This can occur before execution starts, usually due to validation errors, or during the execution of the request. GQLError SubscribeMessageType = "error" // GQLComplete Direction: bidirectional // indicates that the requested operation execution has completed. If the server dispatched the Error message relative to the original Subscribe message, no Complete message will be emitted. GQLComplete SubscribeMessageType = "complete" // GQLInvalidMessage Direction: bidirectional // Receiving a message of a type or format which is not specified in this document will result in an immediate socket closure with the event 4400: <error-message>. The <error-message> can be vaguely descriptive on why the received message is invalid. GQLInvalidMessage SubscribeMessageType = "invalid message" )
type Subscription ¶
Click to show internal directories.
Click to hide internal directories.