Documentation
¶
Index ¶
- func CustomTimeout(timeout time.Duration) func(*API)
- func ErrToOK(err *error) string
- type API
- func (a *API) AdvertiseCommands(ad Advertisement) (SendResponse, error)
- func (a *API) Broadcast(body string, args ...any) (SendResponse, error)
- func (a *API) ClearCommands(filter *chat1.ClearCommandAPIParam) error
- func (a *API) Command(args ...string) *exec.Cmd
- func (a *API) DeleteEntry(teamName *string, namespace string, entryKey string) (result keybase1.KVDeleteEntryResult, err error)
- func (a *API) DeleteEntryWithRevision(teamName *string, namespace string, entryKey string, revision int) (result keybase1.KVDeleteEntryResult, err error)
- func (a *API) EditByConvID(convID chat1.ConvIDStr, msgID chat1.MessageID, text string) (SendResponse, error)
- func (a *API) GetConversation(convID chat1.ConvIDStr) (res chat1.ConvSummary, err error)
- func (a *API) GetConversations(unreadOnly bool) ([]chat1.ConvSummary, error)
- func (a *API) GetEntry(teamName *string, namespace string, entryKey string) (result keybase1.KVGetResult, err error)
- func (a *API) GetMessages(channel chat1.ChatChannel, msgIDs []chat1.MessageID) ([]chat1.Message, error)
- func (a *API) GetMessagesByConvID(conversationID chat1.ConvIDStr, msgIDs []chat1.MessageID) ([]chat1.Message, error)
- func (a *API) GetTextMessages(channel chat1.ChatChannel, unreadOnly bool) ([]chat1.MsgSummary, error)
- func (a *API) GetUsername() string
- func (a *API) GetWalletTxDetails(txID string) (wOut WalletOutput, err error)
- func (a *API) InChatSend(channel chat1.ChatChannel, body string, args ...any) (SendResponse, error)
- func (a *API) InChatSendByConvID(convID chat1.ConvIDStr, body string, args ...any) (SendResponse, error)
- func (a *API) InChatSendByTlfName(tlfName string, body string, args ...any) (SendResponse, error)
- func (a *API) JoinChannel(teamName string, channelName string) (chat1.EmptyRes, error)
- func (a *API) LeaveChannel(teamName string, channelName string) (chat1.EmptyRes, error)
- func (a *API) ListChannels(teamName string) ([]string, error)
- func (a *API) ListCommands(channel chat1.ChatChannel) ([]chat1.UserBotCommandOutput, error)
- func (a *API) ListCommandsByConvID(convID chat1.ConvIDStr) ([]chat1.UserBotCommandOutput, error)
- func (a *API) ListEntryKeys(teamName *string, namespace string) (result keybase1.KVListEntryResult, err error)
- func (a *API) ListMembers(channel chat1.ChatChannel) (keybase1.TeamMembersDetails, error)
- func (a *API) ListMembersByConvID(conversationID chat1.ConvIDStr) (keybase1.TeamMembersDetails, error)
- func (a *API) ListMembersOfTeam(teamName string) (res keybase1.TeamMembersDetails, err error)
- func (a *API) ListNamespaces(teamName *string) (result keybase1.KVListNamespaceResult, err error)
- func (a *API) ListUserMemberships(username string) ([]keybase1.AnnotatedMemberInfo, error)
- func (a *API) Listen(opts ListenOptions) (sub *Subscription, err error)
- func (a *API) ListenForNewTextMessages() (*Subscription, error)
- func (a *API) LogSend(feedback string) error
- func (a *API) PutEntry(teamName *string, namespace string, entryKey string, entryValue string) (result keybase1.KVPutResult, err error)
- func (a *API) PutEntryWithRevision(teamName *string, namespace string, entryKey string, entryValue string, ...) (result keybase1.KVPutResult, err error)
- func (a *API) ReactByChannel(channel chat1.ChatChannel, msgID chat1.MessageID, reaction string) (SendResponse, error)
- func (a *API) ReactByConvID(convID chat1.ConvIDStr, msgID chat1.MessageID, reaction string) (SendResponse, error)
- func (a *API) SendAttachmentByConvID(convID chat1.ConvIDStr, filename string, title string) (SendResponse, error)
- func (a *API) SendAttachmentByTeam(teamName string, inChannel *string, filename string, title string) (SendResponse, error)
- func (a *API) SendMessage(channel chat1.ChatChannel, body string, args ...any) (resp SendResponse, err error)
- func (a *API) SendMessageByConvID(convID chat1.ConvIDStr, body string, args ...any) (resp SendResponse, err error)
- func (a *API) SendMessageByTeamName(teamName string, inChannel *string, body string, args ...any) (resp SendResponse, err error)
- func (a *API) SendMessageByTlfName(tlfName string, body string, args ...any) (resp SendResponse, err error)
- func (a *API) SendReply(channel chat1.ChatChannel, replyTo *chat1.MessageID, body string, args ...any) (SendResponse, error)
- func (a *API) SendReplyByConvID(convID chat1.ConvIDStr, replyTo *chat1.MessageID, body string, args ...any) (SendResponse, error)
- func (a *API) SendReplyByTlfName(tlfName string, replyTo *chat1.MessageID, body string, args ...any) (SendResponse, error)
- func (a *API) Shutdown() (err error)
- type APIError
- type Advertisement
- type ChannelsList
- type DebugOutput
- type DeleteEntryRes
- type Error
- type ErrorCode
- type GetEntryRes
- type GetMessagesResult
- type Inbox
- type JoinChannel
- type KVStoreAPI
- type LeaveChannel
- type ListCommandsResponse
- type ListEntryKeysRes
- type ListMembersOutputMembersCategory
- type ListNamespacesRes
- type ListTeamMembers
- type ListUserMemberships
- type ListenOptions
- type OneshotOptions
- type PaymentHolder
- type PutEntryRes
- type Result
- type RunOptions
- type SendResponse
- type Subscription
- type SubscriptionConversation
- type SubscriptionMessage
- type SubscriptionWalletEvent
- type Thread
- type TypeHolder
- type UnmarshalError
- type WalletOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomTimeout ¶
Types ¶
type API ¶
type API struct {
sync.Mutex
*DebugOutput
Timeout time.Duration
LogSendBytes int
// contains filtered or unexported fields
}
API is the main object used for communicating with the Keybase JSON API
func NewAPI ¶
func NewAPI(runOpts RunOptions, opts ...func(*API)) *API
func Start ¶
func Start(runOpts RunOptions, opts ...func(*API)) (*API, error)
Start fires up the Keybase JSON API in stdin/stdout mode
func (*API) AdvertiseCommands ¶
func (a *API) AdvertiseCommands(ad Advertisement) (SendResponse, error)
func (*API) ClearCommands ¶
func (a *API) ClearCommands(filter *chat1.ClearCommandAPIParam) error
func (*API) DeleteEntry ¶
func (*API) DeleteEntryWithRevision ¶
func (*API) EditByConvID ¶
func (*API) GetConversation ¶
func (*API) GetConversations ¶
func (a *API) GetConversations(unreadOnly bool) ([]chat1.ConvSummary, error)
GetConversations reads all conversations from the current user's inbox.
func (*API) GetMessages ¶
func (*API) GetMessagesByConvID ¶
func (*API) GetTextMessages ¶
func (a *API) GetTextMessages(channel chat1.ChatChannel, unreadOnly bool) ([]chat1.MsgSummary, error)
GetTextMessages fetches all text messages from a given channel. Optionally can filter on unread status.
func (*API) GetUsername ¶
func (*API) GetWalletTxDetails ¶
func (a *API) GetWalletTxDetails(txID string) (wOut WalletOutput, err error)
func (*API) InChatSend ¶
func (a *API) InChatSend(channel chat1.ChatChannel, body string, args ...any) (SendResponse, error)
func (*API) InChatSendByConvID ¶
func (*API) InChatSendByTlfName ¶
func (*API) JoinChannel ¶
func (*API) LeaveChannel ¶
func (*API) ListCommands ¶
func (a *API) ListCommands(channel chat1.ChatChannel) ([]chat1.UserBotCommandOutput, error)
func (*API) ListCommandsByConvID ¶
func (*API) ListEntryKeys ¶
func (*API) ListMembers ¶
func (a *API) ListMembers(channel chat1.ChatChannel) (keybase1.TeamMembersDetails, error)
func (*API) ListMembersByConvID ¶
func (*API) ListMembersOfTeam ¶
func (a *API) ListMembersOfTeam(teamName string) (res keybase1.TeamMembersDetails, err error)
func (*API) ListNamespaces ¶
func (a *API) ListNamespaces(teamName *string) (result keybase1.KVListNamespaceResult, err error)
func (*API) ListUserMemberships ¶
func (a *API) ListUserMemberships(username string) ([]keybase1.AnnotatedMemberInfo, error)
func (*API) Listen ¶
func (a *API) Listen(opts ListenOptions) (sub *Subscription, err error)
Listen fires of a background loop and puts chat messages and wallet events into channels
func (*API) ListenForNewTextMessages ¶
func (a *API) ListenForNewTextMessages() (*Subscription, error)
ListenForNewTextMessages proxies to Listen without wallet events
func (*API) PutEntryWithRevision ¶
func (*API) ReactByChannel ¶
func (a *API) ReactByChannel(channel chat1.ChatChannel, msgID chat1.MessageID, reaction string) (SendResponse, error)
func (*API) ReactByConvID ¶
func (*API) SendAttachmentByConvID ¶
func (*API) SendAttachmentByTeam ¶
func (*API) SendMessage ¶
func (a *API) SendMessage(channel chat1.ChatChannel, body string, args ...any) (resp SendResponse, err error)
func (*API) SendMessageByConvID ¶
func (*API) SendMessageByTeamName ¶
func (*API) SendMessageByTlfName ¶
func (a *API) SendMessageByTlfName(tlfName string, body string, args ...any) (resp SendResponse, err error)
SendMessageByTlfName sends a message on the given TLF name
func (*API) SendReply ¶
func (a *API) SendReply(channel chat1.ChatChannel, replyTo *chat1.MessageID, body string, args ...any) (SendResponse, error)
func (*API) SendReplyByConvID ¶
func (*API) SendReplyByTlfName ¶
type Advertisement ¶
type Advertisement struct {
Alias string `json:"alias,omitempty"`
Advertisements []chat1.AdvertiseCommandAPIParam
}
type ChannelsList ¶
type DebugOutput ¶
type DebugOutput struct {
// contains filtered or unexported fields
}
func NewDebugOutput ¶
func NewDebugOutput(name string) *DebugOutput
func (*DebugOutput) Debug ¶
func (d *DebugOutput) Debug(format string, args ...any)
type DeleteEntryRes ¶
type DeleteEntryRes struct {
Result keybase1.KVDeleteEntryResult `json:"result"`
Error Error `json:"error"`
}
type GetEntryRes ¶
type GetEntryRes struct {
Result keybase1.KVGetResult `json:"result"`
Error Error `json:"error"`
}
type GetMessagesResult ¶
type JoinChannel ¶
type KVStoreAPI ¶
type KVStoreAPI interface {
PutEntry(teamName *string, namespace string, entryKey string, entryValue string) (keybase1.KVPutResult, error)
PutEntryWithRevision(teamName *string, namespace string, entryKey string, entryValue string, revision int) (keybase1.KVPutResult, error)
DeleteEntry(teamName *string, namespace string, entryKey string) (keybase1.KVDeleteEntryResult, error)
DeleteEntryWithRevision(teamName *string, namespace string, entryKey string, revision int) (keybase1.KVDeleteEntryResult, error)
GetEntry(teamName *string, namespace string, entryKey string) (keybase1.KVGetResult, error)
ListNamespaces(teamName *string) (keybase1.KVListNamespaceResult, error)
ListEntryKeys(teamName *string, namespace string) (keybase1.KVListEntryResult, error)
}
type LeaveChannel ¶
type ListCommandsResponse ¶
type ListCommandsResponse struct {
Result struct {
Commands []chat1.UserBotCommandOutput `json:"commands"`
} `json:"result"`
Error *Error `json:"error,omitempty"`
}
type ListEntryKeysRes ¶
type ListEntryKeysRes struct {
Result keybase1.KVListEntryResult `json:"result"`
Error Error `json:"error"`
}
type ListNamespacesRes ¶
type ListNamespacesRes struct {
Result keybase1.KVListNamespaceResult `json:"result"`
Error Error `json:"error"`
}
type ListTeamMembers ¶
type ListTeamMembers struct {
Result keybase1.TeamDetails `json:"result"`
Error Error `json:"error"`
}
type ListUserMemberships ¶
type ListUserMemberships struct {
Result keybase1.AnnotatedTeamList `json:"result"`
Error Error `json:"error"`
}
type ListenOptions ¶
type OneshotOptions ¶
type PaymentHolder ¶
type PaymentHolder struct {
Payment stellar1.PaymentDetailsLocal `json:"notification"`
}
type PutEntryRes ¶
type PutEntryRes struct {
Result keybase1.KVPutResult `json:"result"`
Error Error `json:"error"`
}
type Result ¶
type Result struct {
Convs []chat1.ConvSummary `json:"conversations"`
}
type RunOptions ¶
type RunOptions struct {
KeybaseLocation string
HomeDir string
Oneshot *OneshotOptions
StartService bool
// Have the bot send/receive typing notifications
EnableTyping bool
// Disable bot lite mode
DisableBotLiteMode bool
// Number of processes to spin up to connect to the keybase service
NumPipes int
// Optional, used for debugging to identify the bot.
DebugTag string
}
func (RunOptions) Location ¶
func (r RunOptions) Location() string
type SendResponse ¶
type Subscription ¶
type Subscription struct {
*DebugOutput
sync.Mutex
// contains filtered or unexported fields
}
Subscription has methods to control the background message fetcher loop
func NewSubscription ¶
func NewSubscription() *Subscription
func (*Subscription) Read ¶
func (m *Subscription) Read() (msg SubscriptionMessage, err error)
Read blocks until a new message arrives
func (*Subscription) ReadNewConvs ¶
func (m *Subscription) ReadNewConvs() (conv SubscriptionConversation, err error)
func (*Subscription) ReadWallet ¶
func (m *Subscription) ReadWallet() (msg SubscriptionWalletEvent, err error)
Read blocks until a new message arrives
func (*Subscription) Shutdown ¶
func (m *Subscription) Shutdown()
Shutdown terminates the background process
type SubscriptionConversation ¶
type SubscriptionConversation struct {
Conversation chat1.ConvSummary
}
type SubscriptionMessage ¶
type SubscriptionMessage struct {
Message chat1.MsgSummary
Conversation chat1.ConvSummary
}
SubscriptionMessage contains a message and conversation object
type SubscriptionWalletEvent ¶
type SubscriptionWalletEvent struct {
Payment stellar1.PaymentDetailsLocal
}
type TypeHolder ¶
type TypeHolder struct {
Type string `json:"type"`
}
type UnmarshalError ¶
type UnmarshalError struct {
// contains filtered or unexported fields
}
func (UnmarshalError) Error ¶
func (e UnmarshalError) Error() string
type WalletOutput ¶
type WalletOutput struct {
Result stellar1.PaymentCLILocal `json:"result"`
}