github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/featured_bot.go (about)

     1  package service
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/keybase/client/go/libkb"
     7  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     8  	"github.com/keybase/client/go/teambot"
     9  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    10  	"golang.org/x/net/context"
    11  )
    12  
    13  type FeaturedBotHandler struct {
    14  	*BaseHandler
    15  	libkb.Contextified
    16  }
    17  
    18  func NewFeaturedBotHandler(xp rpc.Transporter, g *libkb.GlobalContext) *FeaturedBotHandler {
    19  	return &FeaturedBotHandler{
    20  		BaseHandler:  NewBaseHandler(g, xp),
    21  		Contextified: libkb.NewContextified(g),
    22  	}
    23  }
    24  
    25  func (h *FeaturedBotHandler) FeaturedBots(ctx context.Context, arg keybase1.FeaturedBotsArg) (res keybase1.FeaturedBotsRes, err error) {
    26  	mctx := libkb.NewMetaContext(ctx, h.G())
    27  	defer mctx.Trace(fmt.Sprintf("FeaturedBots: %+v", arg), &err)()
    28  	return teambot.NewFeaturedBotLoader(h.G()).FeaturedBots(mctx, arg)
    29  }
    30  
    31  func (h *FeaturedBotHandler) Search(ctx context.Context, arg keybase1.SearchArg) (res keybase1.SearchRes, err error) {
    32  	mctx := libkb.NewMetaContext(ctx, h.G())
    33  	defer mctx.Trace(fmt.Sprintf("Search: %s", arg), &err)()
    34  	return teambot.NewFeaturedBotLoader(h.G()).Search(mctx, arg)
    35  }
    36  
    37  func (h *FeaturedBotHandler) SearchLocal(ctx context.Context, arg keybase1.SearchLocalArg) (res keybase1.SearchRes, err error) {
    38  	mctx := libkb.NewMetaContext(ctx, h.G())
    39  	defer mctx.Trace(fmt.Sprintf("SearchLocal: %s", arg), &err)()
    40  	return teambot.NewFeaturedBotLoader(h.G()).SearchLocal(mctx, arg)
    41  }