Documentation ¶
Index ¶
- func NewClient(host url.URL, opts ClientOptions) (trn.Client, error)
- func NewServer(opts ServerOptions) (trn.Server, error)
- type Client
- func (c *Client) Auth(sessionKey string) (*gqlmod.Session, error)
- func (c *Client) Query(query string, result interface{}) error
- func (c *Client) QueryVar(query string, vars map[string]interface{}, result interface{}) error
- func (c *Client) SignIn(email, password string) (*gqlmod.Session, error)
- func (c *Client) SignInDebug(username, password string) error
- type ClientOptions
- type GraphResponse
- type GraphResponseError
- type Server
- func (t *Server) Addr() url.URL
- func (t *Server) Init(onGraphQuery trn.OnGraphQuery, onAuth trn.OnAuth, onDebugAuth trn.OnDebugAuth, ...) error
- func (t *Server) Options() ServerOptions
- func (t *Server) Run() error
- func (t *Server) ServeHTTP(resp http.ResponseWriter, req *http.Request)
- func (t *Server) Shutdown(ctx context.Context) error
- type ServerOptions
- type ServerTLS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an HTTP client implementation
func (*Client) SignInDebug ¶
SignInDebug implements the transport.Client interface
type ClientOptions ¶
ClientOptions defines the HTTP client transport layer options
func (*ClientOptions) SetDefaults ¶
func (opts *ClientOptions) SetDefaults()
SetDefaults sets the default options
type GraphResponse ¶
type GraphResponse struct { Data interface{} `json:"d,omitempty"` Error *GraphResponseError `json:"e,omitempty"` }
GraphResponse represents a response object
type GraphResponseError ¶
type GraphResponseError struct { Code string `json:"c,omitempty"` Message string `json:"m,omitempty"` }
GraphResponseError represents a response error object
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an HTTP based server transport implementation
func (*Server) Addr ¶
Addr returns the host address URL. Blocks until the listener is initialized and the actual address is known
func (*Server) Init ¶
func (t *Server) Init( onGraphQuery trn.OnGraphQuery, onAuth trn.OnAuth, onDebugAuth trn.OnDebugAuth, onDebugSess trn.OnDebugSess, debugLog *log.Logger, errorLog *log.Logger, ) error
Init implements the transport.Transport interface
func (*Server) Options ¶
func (t *Server) Options() ServerOptions
Options returns the active configuration
type ServerOptions ¶
type ServerOptions struct { Host string KeepAliveDuration time.Duration TLS *ServerTLS Playground bool }
ServerOptions defines the HTTP server transport layer options
func (*ServerOptions) Prepare ¶
func (opts *ServerOptions) Prepare() error
Prepare sets defaults and validates the options