Documentation
¶
Index ¶
- type Client
- func (c *Client) Call(ctx context.Context, method string, params any, out any) error
- func (c *Client) Close() error
- func (c *Client) HandleRequest(method string, fn func(ctx context.Context, req Request) (any, *RPCError))
- func (c *Client) Initialize(ctx context.Context, info ClientInfo, experimental bool) (string, error)
- func (c *Client) Notify(ctx context.Context, method string, params any) error
- func (c *Client) OnNotification(fn func(method string, params json.RawMessage))
- type ClientInfo
- type InitializeCapabilities
- type Notification
- type ProcessConfig
- type RPCError
- type Request
- type Response
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 StartProcess ¶
func StartProcess(ctx context.Context, cfg ProcessConfig) (*Client, error)
func (*Client) HandleRequest ¶
func (*Client) Initialize ¶
func (*Client) OnNotification ¶
func (c *Client) OnNotification(fn func(method string, params json.RawMessage))
type ClientInfo ¶
type InitializeCapabilities ¶
type InitializeCapabilities struct {
ExperimentalAPI bool `json:"experimentalApi,omitempty"`
}
type Notification ¶
type Notification struct {
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
type ProcessConfig ¶
type ProcessConfig struct {
Command string
Args []string
Env []string
// OnStderr is called for each line of stderr output from the process.
// If nil, stderr is silently discarded.
OnStderr func(line string)
// OnProcessExit is called when the process exits with its exit error (nil if exit code 0).
OnProcessExit func(err error)
}
type RPCError ¶
type RPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
type Request ¶
type Request struct {
ID json.RawMessage `json:"id,omitempty"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
type Response ¶
type Response struct {
ID json.RawMessage `json:"id"`
Result json.RawMessage `json:"result,omitempty"`
Error *RPCError `json:"error,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.