github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/usersearch.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/usersearch.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 APIUserServiceID string
    13  
    14  func (o APIUserServiceID) DeepCopy() APIUserServiceID {
    15  	return o
    16  }
    17  
    18  type APIUserKeybaseResult struct {
    19  	Username   string  `codec:"username" json:"username"`
    20  	Uid        UID     `codec:"uid" json:"uid"`
    21  	PictureUrl *string `codec:"pictureUrl,omitempty" json:"picture_url,omitempty"`
    22  	FullName   *string `codec:"fullName,omitempty" json:"full_name,omitempty"`
    23  	RawScore   float64 `codec:"rawScore" json:"raw_score"`
    24  	Stellar    *string `codec:"stellar,omitempty" json:"stellar,omitempty"`
    25  	IsFollowee bool    `codec:"isFollowee" json:"is_followee"`
    26  }
    27  
    28  func (o APIUserKeybaseResult) DeepCopy() APIUserKeybaseResult {
    29  	return APIUserKeybaseResult{
    30  		Username: o.Username,
    31  		Uid:      o.Uid.DeepCopy(),
    32  		PictureUrl: (func(x *string) *string {
    33  			if x == nil {
    34  				return nil
    35  			}
    36  			tmp := (*x)
    37  			return &tmp
    38  		})(o.PictureUrl),
    39  		FullName: (func(x *string) *string {
    40  			if x == nil {
    41  				return nil
    42  			}
    43  			tmp := (*x)
    44  			return &tmp
    45  		})(o.FullName),
    46  		RawScore: o.RawScore,
    47  		Stellar: (func(x *string) *string {
    48  			if x == nil {
    49  				return nil
    50  			}
    51  			tmp := (*x)
    52  			return &tmp
    53  		})(o.Stellar),
    54  		IsFollowee: o.IsFollowee,
    55  	}
    56  }
    57  
    58  type APIUserServiceResult struct {
    59  	ServiceName APIUserServiceID `codec:"serviceName" json:"service_name"`
    60  	Username    string           `codec:"username" json:"username"`
    61  	PictureUrl  string           `codec:"pictureUrl" json:"picture_url"`
    62  	Bio         string           `codec:"bio" json:"bio"`
    63  	Location    string           `codec:"location" json:"location"`
    64  	FullName    string           `codec:"fullName" json:"full_name"`
    65  	Confirmed   *bool            `codec:"confirmed,omitempty" json:"confirmed,omitempty"`
    66  }
    67  
    68  func (o APIUserServiceResult) DeepCopy() APIUserServiceResult {
    69  	return APIUserServiceResult{
    70  		ServiceName: o.ServiceName.DeepCopy(),
    71  		Username:    o.Username,
    72  		PictureUrl:  o.PictureUrl,
    73  		Bio:         o.Bio,
    74  		Location:    o.Location,
    75  		FullName:    o.FullName,
    76  		Confirmed: (func(x *bool) *bool {
    77  			if x == nil {
    78  				return nil
    79  			}
    80  			tmp := (*x)
    81  			return &tmp
    82  		})(o.Confirmed),
    83  	}
    84  }
    85  
    86  type APIUserServiceSummary struct {
    87  	ServiceName APIUserServiceID `codec:"serviceName" json:"service_name"`
    88  	Username    string           `codec:"username" json:"username"`
    89  }
    90  
    91  func (o APIUserServiceSummary) DeepCopy() APIUserServiceSummary {
    92  	return APIUserServiceSummary{
    93  		ServiceName: o.ServiceName.DeepCopy(),
    94  		Username:    o.Username,
    95  	}
    96  }
    97  
    98  type ImpTofuSearchResult struct {
    99  	Assertion       string `codec:"assertion" json:"assertion"`
   100  	AssertionValue  string `codec:"assertionValue" json:"assertionValue"`
   101  	AssertionKey    string `codec:"assertionKey" json:"assertionKey"`
   102  	Label           string `codec:"label" json:"label"`
   103  	PrettyName      string `codec:"prettyName" json:"prettyName"`
   104  	KeybaseUsername string `codec:"keybaseUsername" json:"keybaseUsername"`
   105  }
   106  
   107  func (o ImpTofuSearchResult) DeepCopy() ImpTofuSearchResult {
   108  	return ImpTofuSearchResult{
   109  		Assertion:       o.Assertion,
   110  		AssertionValue:  o.AssertionValue,
   111  		AssertionKey:    o.AssertionKey,
   112  		Label:           o.Label,
   113  		PrettyName:      o.PrettyName,
   114  		KeybaseUsername: o.KeybaseUsername,
   115  	}
   116  }
   117  
   118  type APIUserSearchResult struct {
   119  	Score           float64                                    `codec:"score" json:"score"`
   120  	Keybase         *APIUserKeybaseResult                      `codec:"keybase,omitempty" json:"keybase,omitempty"`
   121  	Service         *APIUserServiceResult                      `codec:"service,omitempty" json:"service,omitempty"`
   122  	Contact         *ProcessedContact                          `codec:"contact,omitempty" json:"contact,omitempty"`
   123  	Imptofu         *ImpTofuSearchResult                       `codec:"imptofu,omitempty" json:"imptofu,omitempty"`
   124  	ServicesSummary map[APIUserServiceID]APIUserServiceSummary `codec:"servicesSummary" json:"services_summary"`
   125  	RawScore        float64                                    `codec:"rawScore" json:"rawScore"`
   126  }
   127  
   128  func (o APIUserSearchResult) DeepCopy() APIUserSearchResult {
   129  	return APIUserSearchResult{
   130  		Score: o.Score,
   131  		Keybase: (func(x *APIUserKeybaseResult) *APIUserKeybaseResult {
   132  			if x == nil {
   133  				return nil
   134  			}
   135  			tmp := (*x).DeepCopy()
   136  			return &tmp
   137  		})(o.Keybase),
   138  		Service: (func(x *APIUserServiceResult) *APIUserServiceResult {
   139  			if x == nil {
   140  				return nil
   141  			}
   142  			tmp := (*x).DeepCopy()
   143  			return &tmp
   144  		})(o.Service),
   145  		Contact: (func(x *ProcessedContact) *ProcessedContact {
   146  			if x == nil {
   147  				return nil
   148  			}
   149  			tmp := (*x).DeepCopy()
   150  			return &tmp
   151  		})(o.Contact),
   152  		Imptofu: (func(x *ImpTofuSearchResult) *ImpTofuSearchResult {
   153  			if x == nil {
   154  				return nil
   155  			}
   156  			tmp := (*x).DeepCopy()
   157  			return &tmp
   158  		})(o.Imptofu),
   159  		ServicesSummary: (func(x map[APIUserServiceID]APIUserServiceSummary) map[APIUserServiceID]APIUserServiceSummary {
   160  			if x == nil {
   161  				return nil
   162  			}
   163  			ret := make(map[APIUserServiceID]APIUserServiceSummary, len(x))
   164  			for k, v := range x {
   165  				kCopy := k.DeepCopy()
   166  				vCopy := v.DeepCopy()
   167  				ret[kCopy] = vCopy
   168  			}
   169  			return ret
   170  		})(o.ServicesSummary),
   171  		RawScore: o.RawScore,
   172  	}
   173  }
   174  
   175  type NonUserDetails struct {
   176  	IsNonUser            bool                  `codec:"isNonUser" json:"isNonUser"`
   177  	AssertionValue       string                `codec:"assertionValue" json:"assertionValue"`
   178  	AssertionKey         string                `codec:"assertionKey" json:"assertionKey"`
   179  	Description          string                `codec:"description" json:"description"`
   180  	Contact              *ProcessedContact     `codec:"contact,omitempty" json:"contact,omitempty"`
   181  	Service              *APIUserServiceResult `codec:"service,omitempty" json:"service,omitempty"`
   182  	SiteIcon             []SizedImage          `codec:"siteIcon" json:"siteIcon"`
   183  	SiteIconDarkmode     []SizedImage          `codec:"siteIconDarkmode" json:"siteIconDarkmode"`
   184  	SiteIconFull         []SizedImage          `codec:"siteIconFull" json:"siteIconFull"`
   185  	SiteIconFullDarkmode []SizedImage          `codec:"siteIconFullDarkmode" json:"siteIconFullDarkmode"`
   186  }
   187  
   188  func (o NonUserDetails) DeepCopy() NonUserDetails {
   189  	return NonUserDetails{
   190  		IsNonUser:      o.IsNonUser,
   191  		AssertionValue: o.AssertionValue,
   192  		AssertionKey:   o.AssertionKey,
   193  		Description:    o.Description,
   194  		Contact: (func(x *ProcessedContact) *ProcessedContact {
   195  			if x == nil {
   196  				return nil
   197  			}
   198  			tmp := (*x).DeepCopy()
   199  			return &tmp
   200  		})(o.Contact),
   201  		Service: (func(x *APIUserServiceResult) *APIUserServiceResult {
   202  			if x == nil {
   203  				return nil
   204  			}
   205  			tmp := (*x).DeepCopy()
   206  			return &tmp
   207  		})(o.Service),
   208  		SiteIcon: (func(x []SizedImage) []SizedImage {
   209  			if x == nil {
   210  				return nil
   211  			}
   212  			ret := make([]SizedImage, len(x))
   213  			for i, v := range x {
   214  				vCopy := v.DeepCopy()
   215  				ret[i] = vCopy
   216  			}
   217  			return ret
   218  		})(o.SiteIcon),
   219  		SiteIconDarkmode: (func(x []SizedImage) []SizedImage {
   220  			if x == nil {
   221  				return nil
   222  			}
   223  			ret := make([]SizedImage, len(x))
   224  			for i, v := range x {
   225  				vCopy := v.DeepCopy()
   226  				ret[i] = vCopy
   227  			}
   228  			return ret
   229  		})(o.SiteIconDarkmode),
   230  		SiteIconFull: (func(x []SizedImage) []SizedImage {
   231  			if x == nil {
   232  				return nil
   233  			}
   234  			ret := make([]SizedImage, len(x))
   235  			for i, v := range x {
   236  				vCopy := v.DeepCopy()
   237  				ret[i] = vCopy
   238  			}
   239  			return ret
   240  		})(o.SiteIconFull),
   241  		SiteIconFullDarkmode: (func(x []SizedImage) []SizedImage {
   242  			if x == nil {
   243  				return nil
   244  			}
   245  			ret := make([]SizedImage, len(x))
   246  			for i, v := range x {
   247  				vCopy := v.DeepCopy()
   248  				ret[i] = vCopy
   249  			}
   250  			return ret
   251  		})(o.SiteIconFullDarkmode),
   252  	}
   253  }
   254  
   255  type EmailOrPhoneNumberSearchResult struct {
   256  	Input          string `codec:"input" json:"input"`
   257  	Assertion      string `codec:"assertion" json:"assertion"`
   258  	AssertionValue string `codec:"assertionValue" json:"assertionValue"`
   259  	AssertionKey   string `codec:"assertionKey" json:"assertionKey"`
   260  	FoundUser      bool   `codec:"foundUser" json:"foundUser"`
   261  	Username       string `codec:"username" json:"username"`
   262  	FullName       string `codec:"fullName" json:"fullName"`
   263  }
   264  
   265  func (o EmailOrPhoneNumberSearchResult) DeepCopy() EmailOrPhoneNumberSearchResult {
   266  	return EmailOrPhoneNumberSearchResult{
   267  		Input:          o.Input,
   268  		Assertion:      o.Assertion,
   269  		AssertionValue: o.AssertionValue,
   270  		AssertionKey:   o.AssertionKey,
   271  		FoundUser:      o.FoundUser,
   272  		Username:       o.Username,
   273  		FullName:       o.FullName,
   274  	}
   275  }
   276  
   277  type GetNonUserDetailsArg struct {
   278  	SessionID int    `codec:"sessionID" json:"sessionID"`
   279  	Assertion string `codec:"assertion" json:"assertion"`
   280  }
   281  
   282  type UserSearchArg struct {
   283  	Query                  string `codec:"query" json:"query"`
   284  	Service                string `codec:"service" json:"service"`
   285  	MaxResults             int    `codec:"maxResults" json:"maxResults"`
   286  	IncludeServicesSummary bool   `codec:"includeServicesSummary" json:"includeServicesSummary"`
   287  	IncludeContacts        bool   `codec:"includeContacts" json:"includeContacts"`
   288  }
   289  
   290  type BulkEmailOrPhoneSearchArg struct {
   291  	SessionID    int           `codec:"sessionID" json:"sessionID"`
   292  	Emails       string        `codec:"emails" json:"emails"`
   293  	PhoneNumbers []PhoneNumber `codec:"phoneNumbers" json:"phoneNumbers"`
   294  }
   295  
   296  type UserSearchInterface interface {
   297  	GetNonUserDetails(context.Context, GetNonUserDetailsArg) (NonUserDetails, error)
   298  	UserSearch(context.Context, UserSearchArg) ([]APIUserSearchResult, error)
   299  	BulkEmailOrPhoneSearch(context.Context, BulkEmailOrPhoneSearchArg) ([]EmailOrPhoneNumberSearchResult, error)
   300  }
   301  
   302  func UserSearchProtocol(i UserSearchInterface) rpc.Protocol {
   303  	return rpc.Protocol{
   304  		Name: "keybase.1.userSearch",
   305  		Methods: map[string]rpc.ServeHandlerDescription{
   306  			"getNonUserDetails": {
   307  				MakeArg: func() interface{} {
   308  					var ret [1]GetNonUserDetailsArg
   309  					return &ret
   310  				},
   311  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   312  					typedArgs, ok := args.(*[1]GetNonUserDetailsArg)
   313  					if !ok {
   314  						err = rpc.NewTypeError((*[1]GetNonUserDetailsArg)(nil), args)
   315  						return
   316  					}
   317  					ret, err = i.GetNonUserDetails(ctx, typedArgs[0])
   318  					return
   319  				},
   320  			},
   321  			"userSearch": {
   322  				MakeArg: func() interface{} {
   323  					var ret [1]UserSearchArg
   324  					return &ret
   325  				},
   326  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   327  					typedArgs, ok := args.(*[1]UserSearchArg)
   328  					if !ok {
   329  						err = rpc.NewTypeError((*[1]UserSearchArg)(nil), args)
   330  						return
   331  					}
   332  					ret, err = i.UserSearch(ctx, typedArgs[0])
   333  					return
   334  				},
   335  			},
   336  			"bulkEmailOrPhoneSearch": {
   337  				MakeArg: func() interface{} {
   338  					var ret [1]BulkEmailOrPhoneSearchArg
   339  					return &ret
   340  				},
   341  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   342  					typedArgs, ok := args.(*[1]BulkEmailOrPhoneSearchArg)
   343  					if !ok {
   344  						err = rpc.NewTypeError((*[1]BulkEmailOrPhoneSearchArg)(nil), args)
   345  						return
   346  					}
   347  					ret, err = i.BulkEmailOrPhoneSearch(ctx, typedArgs[0])
   348  					return
   349  				},
   350  			},
   351  		},
   352  	}
   353  }
   354  
   355  type UserSearchClient struct {
   356  	Cli rpc.GenericClient
   357  }
   358  
   359  func (c UserSearchClient) GetNonUserDetails(ctx context.Context, __arg GetNonUserDetailsArg) (res NonUserDetails, err error) {
   360  	err = c.Cli.Call(ctx, "keybase.1.userSearch.getNonUserDetails", []interface{}{__arg}, &res, 0*time.Millisecond)
   361  	return
   362  }
   363  
   364  func (c UserSearchClient) UserSearch(ctx context.Context, __arg UserSearchArg) (res []APIUserSearchResult, err error) {
   365  	err = c.Cli.Call(ctx, "keybase.1.userSearch.userSearch", []interface{}{__arg}, &res, 0*time.Millisecond)
   366  	return
   367  }
   368  
   369  func (c UserSearchClient) BulkEmailOrPhoneSearch(ctx context.Context, __arg BulkEmailOrPhoneSearchArg) (res []EmailOrPhoneNumberSearchResult, err error) {
   370  	err = c.Cli.Call(ctx, "keybase.1.userSearch.bulkEmailOrPhoneSearch", []interface{}{__arg}, &res, 0*time.Millisecond)
   371  	return
   372  }