alice

package
v0.0.0-...-ff00275 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

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.

func (Chat) React

func (c Chat) React(ctx context.Context, channel Channel, msgID chat1.MessageID, reaction string) (*chat1.SendRes, error)

Reacts to a specified message in a channel.

func (Chat) Send

func (c Chat) Send(ctx context.Context, channel Channel, msg string, opts *SendOpts) (*chat1.SendRes, error)

Sends a message to the specified channel.

type ChatChannel

type ChatChannel chat1.ChatChannel

A specified, non-restricted chat channel.

type ChatListenOpts

type ChatListenOpts struct {
	ShowLocal         bool
	ShowExploding     bool
	SubscribeToConvs  bool
	SubscribeToDev    bool
	SubscribeToWallet bool
}

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) Exec

func (c *Client) Exec(ctx context.Context, args ...interface{}) (*Result, error)

Executes a single Keybase CLI command without any stdin

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) Oneshot

func (c *Client) Oneshot(ctx context.Context, username string, paperkey string) error

Provisions the device using oneshot mode.

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

Starts a library-managed Keybase service. Make sure to Stop() it to gracefully shut it down.

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) error

Stop kills the managed Keybase service process.

func (*Client) Wait

func (c *Client) Wait(ctx context.Context) error

Wait waits for the managed service to fully start up

func (*Client) Whoami

func (c *Client) Whoami(ctx context.Context) (*WhoamiResult, error)

Returns details about the currently logged in user / device.

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

type ConversationID chat1.ConvIDStr

Random conversation ID, required to use as a restricted bot.

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) DecodeOnce

func (r *Result) DecodeOnce(input interface{}) error

Runs the command and decodes its output.

func (*Result) RunOnce

func (r *Result) RunOnce() error

Runs the command, discarding 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 SendOpts

type SendOpts struct {
	Nonblock          bool              `json:"nonblock"`
	MembersType       string            `json:"members_type"`
	EphemeralLifetime ephemeralLifetime `json:"exploding_lifetime"`
	ConfirmLumenSend  bool              `json:"confirm_lumen_send"`
	ReplyTo           *chat1.MessageID  `json:"reply_to"`
}

type StreamedResult

type StreamedResult struct {
	Context context.Context
	// contains filtered or unexported fields
}

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

type WhoamiResult

type WhoamiResult struct {
	Configured     bool              `json:"configured"`
	Registered     bool              `json:"registered"`
	LoggedIn       bool              `json:"loggedIn"`
	SessionIsValid bool              `json:"sessionIsValid"`
	User           *WhoamiUserResult `json:"user"`
	DeviceName     string            `json:"deviceName"`
}

type WhoamiUserResult

type WhoamiUserResult struct {
	UID      keybase1.UID `json:"uid"`
	Username string       `json:"username"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL