Documentation
¶
Overview ¶
Package contract checks that the Local API behaves like *core.Service: the same scenarios run against the typed service and through JSON-RPC.
Index ¶
- type API
- type Remote
- func (r *Remote) AddAccount(ctx context.Context, in core.AccountInput) (core.Account, error)
- func (r *Remote) Ask(ctx context.Context, conversationID int64, input string) (<-chan core.WitEvent, error)
- func (r *Remote) BeginOAuth(ctx context.Context, providerID, loginHint string) (string, string, error)
- func (r *Remote) CancelOAuth(flowID string)
- func (r *Remote) CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
- func (r *Remote) CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
- func (r *Remote) DetectProvider(ctx context.Context, email string) (auth.Provider, auth.Source, error)
- func (r *Remote) GetAttachment(ctx context.Context, attachmentID int64) (string, core.AttachmentInfo, error)
- func (r *Remote) GetMessage(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
- func (r *Remote) GetMessageText(ctx context.Context, id int64) (core.MessageText, error)
- func (r *Remote) GetSettings(ctx context.Context) (core.Settings, error)
- func (r *Remote) GetThread(ctx context.Context, id int64) (core.Thread, error)
- func (r *Remote) ListAccounts(ctx context.Context) ([]core.Account, error)
- func (r *Remote) ListApprovals(ctx context.Context, conversationID int64) ([]core.Approval, error)
- func (r *Remote) ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)
- func (r *Remote) ListMessages(ctx context.Context, v core.View, cursor string, limit int) (core.MessagePage, error)
- func (r *Remote) ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)
- func (r *Remote) ListThreads(ctx context.Context, v core.View, cursor string, limit int) (core.ThreadPage, error)
- func (r *Remote) NewConversation(ctx context.Context, kind string, draftID int64) (core.Conversation, error)
- func (r *Remote) NewDraft(ctx context.Context, accountID int64, mode string, sourceMessageID int64) (core.Draft, error)
- func (r *Remote) ResolveApproval(ctx context.Context, id int64, accept bool) error
- func (r *Remote) RunAction(ctx context.Context, id string, t core.Target, opts core.RunActionOptions) (core.ActionResult, error)
- func (r *Remote) RunSkill(ctx context.Context, name string, t core.Target) (<-chan ai.Event, error)
- func (r *Remote) SaveDraft(ctx context.Context, d core.Draft) (core.Draft, error)
- func (r *Remote) Search(ctx context.Context, accountID int64, query string, limit int) ([]core.MessageSummary, error)
- func (r *Remote) Send(ctx context.Context, draftID int64) error
- func (r *Remote) SendAcknowledged(ctx context.Context, draftID int64, digest string) error
- func (r *Remote) SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)
- func (r *Remote) StreamErrs() []error
- func (r *Remote) Subscribe() (<-chan events.Event, func())
- func (r *Remote) SubscribeConversation(id int64) (<-chan core.WitEvent, func())
- func (r *Remote) TrustImageSender(ctx context.Context, from string) error
- func (r *Remote) UntrustImageSender(ctx context.Context, addr string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
AddAccount(ctx context.Context, in core.AccountInput) (core.Account, error)
CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
DetectProvider(ctx context.Context, email string) (auth.Provider, auth.Source, error)
ListAccounts(ctx context.Context) ([]core.Account, error)
ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)
ListThreads(ctx context.Context, v core.View, cursor string, limit int) (core.ThreadPage, error)
GetThread(ctx context.Context, id int64) (core.Thread, error)
ListMessages(ctx context.Context, v core.View, cursor string, limit int) (core.MessagePage, error)
GetMessage(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
GetMessageText(ctx context.Context, id int64) (core.MessageText, error)
Search(ctx context.Context, accountID int64, query string, limit int) ([]core.MessageSummary, error)
GetAttachment(ctx context.Context, attachmentID int64) (string, core.AttachmentInfo, error)
NewDraft(ctx context.Context, accountID int64, mode string, sourceMessageID int64) (core.Draft, error)
SaveDraft(ctx context.Context, d core.Draft) (core.Draft, error)
Send(ctx context.Context, draftID int64) error
SendAcknowledged(ctx context.Context, draftID int64, digest string) error
ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)
GetSettings(ctx context.Context) (core.Settings, error)
SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)
TrustImageSender(ctx context.Context, from string) error
UntrustImageSender(ctx context.Context, addr string) error
CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
RunSkill(ctx context.Context, name string, t core.Target) (<-chan ai.Event, error)
NewConversation(ctx context.Context, kind string, draftID int64) (core.Conversation, error)
Ask(ctx context.Context, conversationID int64, input string) (<-chan core.WitEvent, error)
SubscribeConversation(id int64) (<-chan core.WitEvent, func())
ResolveApproval(ctx context.Context, id int64, accept bool) error
ListApprovals(ctx context.Context, conversationID int64) ([]core.Approval, error)
Subscribe() (<-chan events.Event, func())
RunAction(ctx context.Context, id string, t core.Target, opts core.RunActionOptions) (core.ActionResult, error)
BeginOAuth(ctx context.Context, providerID, loginHint string) (flowID, authURL string, err error)
CancelOAuth(flowID string)
}
API is the subset of *core.Service the contract scenarios use, with the same signatures.
type Remote ¶
Remote implements API over a Local API connection (full role). Streams that end abnormally, or carry an event that does not decode, are recorded in StreamErrs: the typed signatures have no place for them.
func (*Remote) AddAccount ¶
func (*Remote) BeginOAuth ¶
func (*Remote) CancelOAuth ¶
CancelOAuth has no result to fail with; a failed call is recorded.
func (*Remote) CheckAccount ¶
func (r *Remote) CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
func (*Remote) CheckModelService ¶
func (r *Remote) CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
func (*Remote) DetectProvider ¶
func (*Remote) GetAttachment ¶
func (*Remote) GetMessage ¶
func (*Remote) GetMessageText ¶
func (*Remote) GetSettings ¶
func (*Remote) ListAccounts ¶
func (*Remote) ListApprovals ¶
func (*Remote) ListFolders ¶
func (*Remote) ListMessages ¶
func (*Remote) ListOutbox ¶
func (*Remote) ListThreads ¶
func (*Remote) NewConversation ¶
func (*Remote) ResolveApproval ¶
func (*Remote) SendAcknowledged ¶
func (*Remote) SetSettings ¶
func (*Remote) StreamErrs ¶
StreamErrs returns every abnormal stream end so far.
func (*Remote) SubscribeConversation ¶
func (*Remote) TrustImageSender ¶
Click to show internal directories.
Click to hide internal directories.