Documentation ¶
Index ¶
- type Channel
- type Chat
- func (c Chat) Listen(ctx context.Context, channels []ChatChannel, opts *ChatListenOpts) (*ChatListenStream, error)
- func (c Chat) React(ctx context.Context, channel Channel, msgID chat1.MessageID, reaction string) (*chat1.SendRes, error)
- func (c Chat) Send(ctx context.Context, channel Channel, msg string, opts *SendOpts) (*chat1.SendRes, error)
- type ChatChannel
- type ChatListenOpts
- type ChatListenStream
- type Client
- func (c *Client) Exec(ctx context.Context, args ...interface{}) (*Result, error)
- func (c *Client) ExecWithInput(ctx context.Context, body io.Reader, args ...interface{}) (*Result, error)
- func (c *Client) Oneshot(ctx context.Context, username string, paperkey string) error
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Stop(ctx context.Context) error
- func (c *Client) Wait(ctx context.Context) error
- func (c *Client) Whoami(ctx context.Context) (*WhoamiResult, error)
- type ClientOption
- type ConversationID
- type Result
- type SendOpts
- type StreamedResult
- type WhoamiResult
- type WhoamiUserResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel interface {
// contains filtered or unexported methods
}
Either ChatChannel or ConversationID.
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
func (Chat) Listen ¶
func (c Chat) Listen(ctx context.Context, channels []ChatChannel, opts *ChatListenOpts) (*ChatListenStream, error)
Subscribes to new chat API notifications. Pass channels to enable filtering, pass options to customize parameters such as enabling wallet / local notifications.
type ChatListenOpts ¶
type ChatListenStream ¶
type ChatListenStream struct {
// contains filtered or unexported fields
}
func (*ChatListenStream) Close ¶
func (c *ChatListenStream) Close() error
Closes the stream, killing the client process.
func (*ChatListenStream) Err ¶
func (c *ChatListenStream) Err() error
If any error occured during reading / decoding, it's returned here.
func (*ChatListenStream) Messages ¶
func (c *ChatListenStream) Messages() chan chat1.MsgNotification
Returns a channel populated with API notifications.
type Client ¶
type Client struct { Chat Chat // contains filtered or unexported fields }
func New ¶
func New(opts ...ClientOption) (*Client, error)
Creates a new Keybase client using the given settings
func (*Client) ExecWithInput ¶
func (c *Client) ExecWithInput(ctx context.Context, body io.Reader, args ...interface{}) (*Result, error)
Executes a Keybase CLI command with the passed stdin
func (*Client) Start ¶
Starts a library-managed Keybase service. Make sure to Stop() it to gracefully shut it down.
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
func BotLiteMode ¶
func BotLiteMode() ClientOption
Enables "bot lite mode", which turns off non-essential notifications such as typing.
func ExecutablePath ¶
func ExecutablePath(path string) ClientOption
Uses the specified executable path to run all the Keybase commands.
func HomeDir ¶
func HomeDir(path string) ClientOption
Runs the service inside of the specified home directory, useful for running multiple services at once.
func LogFilePath ¶
func LogFilePath(path string) ClientOption
If set, saves all the logs to a service-managed file if using the managed process mode
type ConversationID ¶
Random conversation ID, required to use as a restricted bot.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
func (*Result) DecodeOnce ¶
Runs the command and decodes its output.
func (*Result) Stream ¶
func (r *Result) Stream() (*StreamedResult, error)
Transforms the result into a stream, monitoring both its stdout and stderr. Required to interact with the listen APIs.
type StreamedResult ¶
func (*StreamedResult) Close ¶
func (s *StreamedResult) Close() error
Completes the streaming process, printing out stderr if it exited with an error.
func (*StreamedResult) Decode ¶
func (s *StreamedResult) Decode(input interface{}) error
Decodes the current buffer's contents into input
func (*StreamedResult) Err ¶
func (s *StreamedResult) Err() error
If any read error occured during processing, it's returned here
func (*StreamedResult) Next ¶
func (s *StreamedResult) Next() bool
Loads up the next message into StreamedResult's internal buffer