github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/service/remote_chat_ui.go (about)

     1  package service
     2  
     3  import (
     4  	"golang.org/x/net/context"
     5  
     6  	"github.com/keybase/client/go/protocol/chat1"
     7  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     8  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     9  )
    10  
    11  type RemoteChatUI struct {
    12  	sessionID int
    13  	cli       chat1.ChatUiClient
    14  }
    15  
    16  func NewRemoteChatUI(sessionID int, c *rpc.Client) *RemoteChatUI {
    17  	return &RemoteChatUI{
    18  		sessionID: sessionID,
    19  		cli:       chat1.ChatUiClient{Cli: c},
    20  	}
    21  }
    22  
    23  func (r *RemoteChatUI) ChatInboxConversation(ctx context.Context, arg chat1.ChatInboxConversationArg) error {
    24  	return r.cli.ChatInboxConversation(ctx, arg)
    25  }
    26  
    27  func (r *RemoteChatUI) ChatInboxLayout(ctx context.Context, layout string) error {
    28  	return r.cli.ChatInboxLayout(ctx, chat1.ChatInboxLayoutArg{
    29  		SessionID: r.sessionID,
    30  		Layout:    layout,
    31  	})
    32  }
    33  
    34  func (r *RemoteChatUI) ChatInboxFailed(ctx context.Context, arg chat1.ChatInboxFailedArg) error {
    35  	return r.cli.ChatInboxFailed(ctx, arg)
    36  }
    37  
    38  func (r *RemoteChatUI) ChatInboxUnverified(ctx context.Context, arg chat1.ChatInboxUnverifiedArg) error {
    39  	return r.cli.ChatInboxUnverified(ctx, arg)
    40  }
    41  
    42  func (r *RemoteChatUI) ChatThreadCached(ctx context.Context, arg *string) error {
    43  	return r.cli.ChatThreadCached(ctx, chat1.ChatThreadCachedArg{
    44  		SessionID: r.sessionID,
    45  		Thread:    arg,
    46  	})
    47  }
    48  
    49  func (r *RemoteChatUI) ChatThreadFull(ctx context.Context, arg string) error {
    50  	return r.cli.ChatThreadFull(ctx, chat1.ChatThreadFullArg{
    51  		SessionID: r.sessionID,
    52  		Thread:    arg,
    53  	})
    54  }
    55  
    56  func (r *RemoteChatUI) ChatThreadStatus(ctx context.Context, status chat1.UIChatThreadStatus) error {
    57  	return r.cli.ChatThreadStatus(ctx, chat1.ChatThreadStatusArg{
    58  		SessionID: r.sessionID,
    59  		Status:    status,
    60  	})
    61  }
    62  
    63  func (r *RemoteChatUI) ChatConfirmChannelDelete(ctx context.Context, arg chat1.ChatConfirmChannelDeleteArg) (bool, error) {
    64  	return r.cli.ChatConfirmChannelDelete(ctx, arg)
    65  }
    66  
    67  func (r *RemoteChatUI) ChatSearchHit(ctx context.Context, arg chat1.ChatSearchHitArg) error {
    68  	arg.SessionID = r.sessionID
    69  	return r.cli.ChatSearchHit(ctx, arg)
    70  }
    71  
    72  func (r *RemoteChatUI) ChatSearchDone(ctx context.Context, arg chat1.ChatSearchDoneArg) error {
    73  	arg.SessionID = r.sessionID
    74  	return r.cli.ChatSearchDone(ctx, arg)
    75  }
    76  
    77  func (r *RemoteChatUI) ChatSearchInboxStart(ctx context.Context) error {
    78  	return r.cli.ChatSearchInboxStart(ctx, r.sessionID)
    79  }
    80  
    81  func (r *RemoteChatUI) ChatSearchInboxHit(ctx context.Context, arg chat1.ChatSearchInboxHitArg) error {
    82  	arg.SessionID = r.sessionID
    83  	return r.cli.ChatSearchInboxHit(ctx, arg)
    84  }
    85  
    86  func (r *RemoteChatUI) ChatSearchInboxDone(ctx context.Context, arg chat1.ChatSearchInboxDoneArg) error {
    87  	arg.SessionID = r.sessionID
    88  	return r.cli.ChatSearchInboxDone(ctx, arg)
    89  }
    90  
    91  func (r *RemoteChatUI) ChatSearchIndexStatus(ctx context.Context, arg chat1.ChatSearchIndexStatusArg) error {
    92  	arg.SessionID = r.sessionID
    93  	return r.cli.ChatSearchIndexStatus(ctx, arg)
    94  }
    95  
    96  func (r *RemoteChatUI) ChatSearchConvHits(ctx context.Context, arg chat1.UIChatSearchConvHits) error {
    97  	return r.cli.ChatSearchConvHits(ctx, chat1.ChatSearchConvHitsArg{
    98  		SessionID: r.sessionID,
    99  		Hits:      arg,
   100  	})
   101  }
   102  
   103  func (r *RemoteChatUI) ChatSearchTeamHits(ctx context.Context, arg chat1.UIChatSearchTeamHits) error {
   104  	return r.cli.ChatSearchTeamHits(ctx, chat1.ChatSearchTeamHitsArg{
   105  		SessionID: r.sessionID,
   106  		Hits:      arg,
   107  	})
   108  }
   109  
   110  func (r *RemoteChatUI) ChatSearchBotHits(ctx context.Context, arg chat1.UIChatSearchBotHits) error {
   111  	return r.cli.ChatSearchBotHits(ctx, chat1.ChatSearchBotHitsArg{
   112  		SessionID: r.sessionID,
   113  		Hits:      arg,
   114  	})
   115  }
   116  
   117  func (r *RemoteChatUI) ChatStellarDataConfirm(ctx context.Context, summary chat1.UIChatPaymentSummary) (bool, error) {
   118  	return r.cli.ChatStellarDataConfirm(ctx, chat1.ChatStellarDataConfirmArg{
   119  		SessionID: r.sessionID,
   120  		Summary:   summary,
   121  	})
   122  }
   123  
   124  func (r *RemoteChatUI) ChatStellarShowConfirm(ctx context.Context) error {
   125  	return r.cli.ChatStellarShowConfirm(ctx, r.sessionID)
   126  }
   127  
   128  func (r *RemoteChatUI) ChatStellarDataError(ctx context.Context, err keybase1.Status) (bool, error) {
   129  	return r.cli.ChatStellarDataError(ctx, chat1.ChatStellarDataErrorArg{
   130  		SessionID: r.sessionID,
   131  		Error:     err,
   132  	})
   133  }
   134  
   135  func (r *RemoteChatUI) ChatStellarDone(ctx context.Context, canceled bool) error {
   136  	return r.cli.ChatStellarDone(ctx, chat1.ChatStellarDoneArg{
   137  		SessionID: r.sessionID,
   138  		Canceled:  canceled,
   139  	})
   140  }
   141  
   142  func (r *RemoteChatUI) ChatGiphySearchResults(ctx context.Context, convID chat1.ConversationID,
   143  	results chat1.GiphySearchResults) error {
   144  	return r.cli.ChatGiphySearchResults(ctx, chat1.ChatGiphySearchResultsArg{
   145  		SessionID: r.sessionID,
   146  		ConvID:    convID.ConvIDStr(),
   147  		Results:   results,
   148  	})
   149  }
   150  
   151  func (r *RemoteChatUI) ChatGiphyToggleResultWindow(ctx context.Context, convID chat1.ConversationID,
   152  	show, clearInput bool) error {
   153  	return r.cli.ChatGiphyToggleResultWindow(ctx, chat1.ChatGiphyToggleResultWindowArg{
   154  		SessionID:  r.sessionID,
   155  		ConvID:     convID.ConvIDStr(),
   156  		Show:       show,
   157  		ClearInput: clearInput,
   158  	})
   159  }
   160  
   161  func (r *RemoteChatUI) ChatShowManageChannels(ctx context.Context, teamname string) error {
   162  	return r.cli.ChatShowManageChannels(ctx, chat1.ChatShowManageChannelsArg{
   163  		SessionID: r.sessionID,
   164  		Teamname:  teamname,
   165  	})
   166  }
   167  
   168  func (r *RemoteChatUI) ChatCoinFlipStatus(ctx context.Context, statuses []chat1.UICoinFlipStatus) error {
   169  	return r.cli.ChatCoinFlipStatus(ctx, chat1.ChatCoinFlipStatusArg{
   170  		SessionID: r.sessionID,
   171  		Statuses:  statuses,
   172  	})
   173  }
   174  
   175  func (r *RemoteChatUI) ChatCommandMarkdown(ctx context.Context, convID chat1.ConversationID,
   176  	md *chat1.UICommandMarkdown) error {
   177  	return r.cli.ChatCommandMarkdown(ctx, chat1.ChatCommandMarkdownArg{
   178  		SessionID: r.sessionID,
   179  		ConvID:    convID.ConvIDStr(),
   180  		Md:        md,
   181  	})
   182  }
   183  
   184  func (r *RemoteChatUI) ChatMaybeMentionUpdate(ctx context.Context, teamName, channel string,
   185  	info chat1.UIMaybeMentionInfo) error {
   186  	return r.cli.ChatMaybeMentionUpdate(ctx, chat1.ChatMaybeMentionUpdateArg{
   187  		SessionID: r.sessionID,
   188  		TeamName:  teamName,
   189  		Channel:   channel,
   190  		Info:      info,
   191  	})
   192  }
   193  
   194  func (r *RemoteChatUI) ChatLoadGalleryHit(ctx context.Context, msg chat1.UIMessage) error {
   195  	return r.cli.ChatLoadGalleryHit(ctx, chat1.ChatLoadGalleryHitArg{
   196  		SessionID: r.sessionID,
   197  		Message:   msg,
   198  	})
   199  }
   200  
   201  func (r *RemoteChatUI) ChatWatchPosition(ctx context.Context, convID chat1.ConversationID,
   202  	perm chat1.UIWatchPositionPerm) (chat1.LocationWatchID, error) {
   203  	return r.cli.ChatWatchPosition(ctx, chat1.ChatWatchPositionArg{
   204  		SessionID: r.sessionID,
   205  		ConvID:    convID,
   206  		Perm:      perm,
   207  	})
   208  }
   209  
   210  func (r *RemoteChatUI) ChatClearWatch(ctx context.Context, watchID chat1.LocationWatchID) error {
   211  	return r.cli.ChatClearWatch(ctx, chat1.ChatClearWatchArg{
   212  		SessionID: r.sessionID,
   213  		Id:        watchID,
   214  	})
   215  }
   216  
   217  func (r *RemoteChatUI) ChatCommandStatus(ctx context.Context, convID chat1.ConversationID, displayText string,
   218  	typ chat1.UICommandStatusDisplayTyp, actions []chat1.UICommandStatusActionTyp) error {
   219  	return r.cli.ChatCommandStatus(ctx, chat1.ChatCommandStatusArg{
   220  		SessionID:   r.sessionID,
   221  		ConvID:      convID.ConvIDStr(),
   222  		DisplayText: displayText,
   223  		Typ:         typ,
   224  		Actions:     actions,
   225  	})
   226  }
   227  
   228  func (r *RemoteChatUI) ChatBotCommandsUpdateStatus(ctx context.Context, convID chat1.ConversationID,
   229  	status chat1.UIBotCommandsUpdateStatus) error {
   230  	return r.cli.ChatBotCommandsUpdateStatus(ctx, chat1.ChatBotCommandsUpdateStatusArg{
   231  		SessionID: r.sessionID,
   232  		ConvID:    convID.ConvIDStr(),
   233  		Status:    status,
   234  	})
   235  }
   236  
   237  func (r *RemoteChatUI) TriggerContactSync(ctx context.Context) error {
   238  	return r.cli.TriggerContactSync(ctx, r.sessionID)
   239  }