github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/teamsearch.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/teamsearch.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 TeamSearchItem struct {
    13  	Id          TeamID  `codec:"id" json:"id"`
    14  	Name        string  `codec:"name" json:"name"`
    15  	Description *string `codec:"description,omitempty" json:"description,omitempty"`
    16  	MemberCount int     `codec:"memberCount" json:"memberCount"`
    17  	LastActive  Time    `codec:"lastActive" json:"lastActive"`
    18  	IsDemoted   bool    `codec:"isDemoted" json:"isDemoted"`
    19  	InTeam      bool    `codec:"inTeam" json:"inTeam"`
    20  }
    21  
    22  func (o TeamSearchItem) DeepCopy() TeamSearchItem {
    23  	return TeamSearchItem{
    24  		Id:   o.Id.DeepCopy(),
    25  		Name: o.Name,
    26  		Description: (func(x *string) *string {
    27  			if x == nil {
    28  				return nil
    29  			}
    30  			tmp := (*x)
    31  			return &tmp
    32  		})(o.Description),
    33  		MemberCount: o.MemberCount,
    34  		LastActive:  o.LastActive.DeepCopy(),
    35  		IsDemoted:   o.IsDemoted,
    36  		InTeam:      o.InTeam,
    37  	}
    38  }
    39  
    40  type TeamSearchExport struct {
    41  	Items     map[TeamID]TeamSearchItem `codec:"items" json:"items"`
    42  	Suggested []TeamID                  `codec:"suggested" json:"suggested"`
    43  }
    44  
    45  func (o TeamSearchExport) DeepCopy() TeamSearchExport {
    46  	return TeamSearchExport{
    47  		Items: (func(x map[TeamID]TeamSearchItem) map[TeamID]TeamSearchItem {
    48  			if x == nil {
    49  				return nil
    50  			}
    51  			ret := make(map[TeamID]TeamSearchItem, len(x))
    52  			for k, v := range x {
    53  				kCopy := k.DeepCopy()
    54  				vCopy := v.DeepCopy()
    55  				ret[kCopy] = vCopy
    56  			}
    57  			return ret
    58  		})(o.Items),
    59  		Suggested: (func(x []TeamID) []TeamID {
    60  			if x == nil {
    61  				return nil
    62  			}
    63  			ret := make([]TeamID, len(x))
    64  			for i, v := range x {
    65  				vCopy := v.DeepCopy()
    66  				ret[i] = vCopy
    67  			}
    68  			return ret
    69  		})(o.Suggested),
    70  	}
    71  }
    72  
    73  type TeamSearchRes struct {
    74  	Results []TeamSearchItem `codec:"results" json:"results"`
    75  }
    76  
    77  func (o TeamSearchRes) DeepCopy() TeamSearchRes {
    78  	return TeamSearchRes{
    79  		Results: (func(x []TeamSearchItem) []TeamSearchItem {
    80  			if x == nil {
    81  				return nil
    82  			}
    83  			ret := make([]TeamSearchItem, len(x))
    84  			for i, v := range x {
    85  				vCopy := v.DeepCopy()
    86  				ret[i] = vCopy
    87  			}
    88  			return ret
    89  		})(o.Results),
    90  	}
    91  }
    92  
    93  type TeamSearchArg struct {
    94  	Uid       *UID   `codec:"uid,omitempty" json:"uid,omitempty"`
    95  	Query     string `codec:"query" json:"query"`
    96  	Limit     int    `codec:"limit" json:"limit"`
    97  	UseRemote bool   `codec:"useRemote" json:"useRemote"`
    98  }
    99  
   100  type TeamSearchInterface interface {
   101  	TeamSearch(context.Context, TeamSearchArg) (TeamSearchRes, error)
   102  }
   103  
   104  func TeamSearchProtocol(i TeamSearchInterface) rpc.Protocol {
   105  	return rpc.Protocol{
   106  		Name: "keybase.1.teamSearch",
   107  		Methods: map[string]rpc.ServeHandlerDescription{
   108  			"teamSearch": {
   109  				MakeArg: func() interface{} {
   110  					var ret [1]TeamSearchArg
   111  					return &ret
   112  				},
   113  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   114  					typedArgs, ok := args.(*[1]TeamSearchArg)
   115  					if !ok {
   116  						err = rpc.NewTypeError((*[1]TeamSearchArg)(nil), args)
   117  						return
   118  					}
   119  					ret, err = i.TeamSearch(ctx, typedArgs[0])
   120  					return
   121  				},
   122  			},
   123  		},
   124  	}
   125  }
   126  
   127  type TeamSearchClient struct {
   128  	Cli rpc.GenericClient
   129  }
   130  
   131  func (c TeamSearchClient) TeamSearch(ctx context.Context, __arg TeamSearchArg) (res TeamSearchRes, err error) {
   132  	err = c.Cli.Call(ctx, "keybase.1.teamSearch.teamSearch", []interface{}{__arg}, &res, 0*time.Millisecond)
   133  	return
   134  }