Documentation ¶
Index ¶
- func NewClient(host url.URL, conf ClientConfig) (trn.Client, error)
- func NewServer(conf ServerConfig) (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 ClientConfig
- type GraphResponse
- type GraphResponseError
- type Server
- func (t *Server) Addr() url.URL
- func (t *Server) Config() ServerConfig
- func (t *Server) Init(onGraphQuery trn.OnGraphQuery, onAuth trn.OnAuth, onDebugAuth trn.OnDebugAuth, ...) error
- func (t *Server) Run() error
- func (t *Server) ServeHTTP(resp http.ResponseWriter, req *http.Request)
- func (t *Server) Shutdown(ctx context.Context) error
- type ServerConfig
- type ServerTLS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
NewClient creates a new API client instance
func NewServer ¶
func NewServer(conf ServerConfig) (trn.Server, error)
NewServer creates a new unencrypted JSON based HTTP transport. Use NewSecure to enable encryption instead
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an HTTP client implementation
func (*Client) Auth ¶
Auth implements the transport.Client interface
func (*Client) Query ¶
Query implements the transport.Client interface
func (*Client) QueryVar ¶
QueryVar implements the transport.Client interface
func (*Client) SignIn ¶
SignIn implements the transport.Client interface
type ClientConfig ¶ added in v1.2.0
ClientConfig defines the HTTP client transport layer configuration
func (*ClientConfig) SetDefaults ¶ added in v1.2.0
func (conf *ClientConfig) SetDefaults()
SetDefaults sets the default configuration
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) Config ¶ added in v1.2.0
func (t *Server) Config() ServerConfig
Config returns the active configuration
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
type ServerConfig ¶ added in v1.2.0
type ServerConfig struct { Host string KeepAliveDuration time.Duration TLS *ServerTLS Playground bool }
ServerConfig defines the HTTP server transport layer configurations
func (*ServerConfig) Prepare ¶ added in v1.2.0
func (conf *ServerConfig) Prepare() error
Prepare sets defaults and validates the configurations