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

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/featured_bot.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  type FeaturedBot struct {
    13  	BotAlias               string  `codec:"botAlias" json:"botAlias"`
    14  	Description            string  `codec:"description" json:"description"`
    15  	ExtendedDescription    string  `codec:"extendedDescription" json:"extendedDescription"`
    16  	ExtendedDescriptionRaw string  `codec:"extendedDescriptionRaw" json:"extendedDescriptionRaw"`
    17  	BotUsername            string  `codec:"botUsername" json:"botUsername"`
    18  	OwnerTeam              *string `codec:"ownerTeam,omitempty" json:"ownerTeam,omitempty"`
    19  	OwnerUser              *string `codec:"ownerUser,omitempty" json:"ownerUser,omitempty"`
    20  	Rank                   int     `codec:"rank" json:"rank"`
    21  	IsPromoted             bool    `codec:"isPromoted" json:"isPromoted"`
    22  }
    23  
    24  func (o FeaturedBot) DeepCopy() FeaturedBot {
    25  	return FeaturedBot{
    26  		BotAlias:               o.BotAlias,
    27  		Description:            o.Description,
    28  		ExtendedDescription:    o.ExtendedDescription,
    29  		ExtendedDescriptionRaw: o.ExtendedDescriptionRaw,
    30  		BotUsername:            o.BotUsername,
    31  		OwnerTeam: (func(x *string) *string {
    32  			if x == nil {
    33  				return nil
    34  			}
    35  			tmp := (*x)
    36  			return &tmp
    37  		})(o.OwnerTeam),
    38  		OwnerUser: (func(x *string) *string {
    39  			if x == nil {
    40  				return nil
    41  			}
    42  			tmp := (*x)
    43  			return &tmp
    44  		})(o.OwnerUser),
    45  		Rank:       o.Rank,
    46  		IsPromoted: o.IsPromoted,
    47  	}
    48  }
    49  
    50  type FeaturedBotsRes struct {
    51  	Bots       []FeaturedBot `codec:"bots" json:"bots"`
    52  	IsLastPage bool          `codec:"isLastPage" json:"isLastPage"`
    53  }
    54  
    55  func (o FeaturedBotsRes) DeepCopy() FeaturedBotsRes {
    56  	return FeaturedBotsRes{
    57  		Bots: (func(x []FeaturedBot) []FeaturedBot {
    58  			if x == nil {
    59  				return nil
    60  			}
    61  			ret := make([]FeaturedBot, len(x))
    62  			for i, v := range x {
    63  				vCopy := v.DeepCopy()
    64  				ret[i] = vCopy
    65  			}
    66  			return ret
    67  		})(o.Bots),
    68  		IsLastPage: o.IsLastPage,
    69  	}
    70  }
    71  
    72  type SearchRes struct {
    73  	Bots       []FeaturedBot `codec:"bots" json:"bots"`
    74  	IsLastPage bool          `codec:"isLastPage" json:"isLastPage"`
    75  }
    76  
    77  func (o SearchRes) DeepCopy() SearchRes {
    78  	return SearchRes{
    79  		Bots: (func(x []FeaturedBot) []FeaturedBot {
    80  			if x == nil {
    81  				return nil
    82  			}
    83  			ret := make([]FeaturedBot, len(x))
    84  			for i, v := range x {
    85  				vCopy := v.DeepCopy()
    86  				ret[i] = vCopy
    87  			}
    88  			return ret
    89  		})(o.Bots),
    90  		IsLastPage: o.IsLastPage,
    91  	}
    92  }
    93  
    94  type FeaturedBotsArg struct {
    95  	Limit     int  `codec:"limit" json:"limit"`
    96  	Offset    int  `codec:"offset" json:"offset"`
    97  	SkipCache bool `codec:"skipCache" json:"skipCache"`
    98  }
    99  
   100  type SearchArg struct {
   101  	Query  string `codec:"query" json:"query"`
   102  	Limit  int    `codec:"limit" json:"limit"`
   103  	Offset int    `codec:"offset" json:"offset"`
   104  }
   105  
   106  type SearchLocalArg struct {
   107  	Query     string `codec:"query" json:"query"`
   108  	Limit     int    `codec:"limit" json:"limit"`
   109  	SkipCache bool   `codec:"skipCache" json:"skipCache"`
   110  }
   111  
   112  type FeaturedBotInterface interface {
   113  	FeaturedBots(context.Context, FeaturedBotsArg) (FeaturedBotsRes, error)
   114  	Search(context.Context, SearchArg) (SearchRes, error)
   115  	SearchLocal(context.Context, SearchLocalArg) (SearchRes, error)
   116  }
   117  
   118  func FeaturedBotProtocol(i FeaturedBotInterface) rpc.Protocol {
   119  	return rpc.Protocol{
   120  		Name: "keybase.1.featuredBot",
   121  		Methods: map[string]rpc.ServeHandlerDescription{
   122  			"featuredBots": {
   123  				MakeArg: func() interface{} {
   124  					var ret [1]FeaturedBotsArg
   125  					return &ret
   126  				},
   127  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   128  					typedArgs, ok := args.(*[1]FeaturedBotsArg)
   129  					if !ok {
   130  						err = rpc.NewTypeError((*[1]FeaturedBotsArg)(nil), args)
   131  						return
   132  					}
   133  					ret, err = i.FeaturedBots(ctx, typedArgs[0])
   134  					return
   135  				},
   136  			},
   137  			"search": {
   138  				MakeArg: func() interface{} {
   139  					var ret [1]SearchArg
   140  					return &ret
   141  				},
   142  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   143  					typedArgs, ok := args.(*[1]SearchArg)
   144  					if !ok {
   145  						err = rpc.NewTypeError((*[1]SearchArg)(nil), args)
   146  						return
   147  					}
   148  					ret, err = i.Search(ctx, typedArgs[0])
   149  					return
   150  				},
   151  			},
   152  			"searchLocal": {
   153  				MakeArg: func() interface{} {
   154  					var ret [1]SearchLocalArg
   155  					return &ret
   156  				},
   157  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   158  					typedArgs, ok := args.(*[1]SearchLocalArg)
   159  					if !ok {
   160  						err = rpc.NewTypeError((*[1]SearchLocalArg)(nil), args)
   161  						return
   162  					}
   163  					ret, err = i.SearchLocal(ctx, typedArgs[0])
   164  					return
   165  				},
   166  			},
   167  		},
   168  	}
   169  }
   170  
   171  type FeaturedBotClient struct {
   172  	Cli rpc.GenericClient
   173  }
   174  
   175  func (c FeaturedBotClient) FeaturedBots(ctx context.Context, __arg FeaturedBotsArg) (res FeaturedBotsRes, err error) {
   176  	err = c.Cli.Call(ctx, "keybase.1.featuredBot.featuredBots", []interface{}{__arg}, &res, 0*time.Millisecond)
   177  	return
   178  }
   179  
   180  func (c FeaturedBotClient) Search(ctx context.Context, __arg SearchArg) (res SearchRes, err error) {
   181  	err = c.Cli.Call(ctx, "keybase.1.featuredBot.search", []interface{}{__arg}, &res, 0*time.Millisecond)
   182  	return
   183  }
   184  
   185  func (c FeaturedBotClient) SearchLocal(ctx context.Context, __arg SearchLocalArg) (res SearchRes, err error) {
   186  	err = c.Cli.Call(ctx, "keybase.1.featuredBot.searchLocal", []interface{}{__arg}, &res, 0*time.Millisecond)
   187  	return
   188  }