github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/invite_friends.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/invite_friends.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 InviteCounts struct {
    13  	InviteCount      int     `codec:"inviteCount" json:"inviteCount"`
    14  	PercentageChange float64 `codec:"percentageChange" json:"percentageChange"`
    15  	ShowNumInvites   bool    `codec:"showNumInvites" json:"showNumInvites"`
    16  	ShowFire         bool    `codec:"showFire" json:"showFire"`
    17  	TooltipMarkdown  string  `codec:"tooltipMarkdown" json:"tooltipMarkdown"`
    18  }
    19  
    20  func (o InviteCounts) DeepCopy() InviteCounts {
    21  	return InviteCounts{
    22  		InviteCount:      o.InviteCount,
    23  		PercentageChange: o.PercentageChange,
    24  		ShowNumInvites:   o.ShowNumInvites,
    25  		ShowFire:         o.ShowFire,
    26  		TooltipMarkdown:  o.TooltipMarkdown,
    27  	}
    28  }
    29  
    30  type EmailInvites struct {
    31  	CommaSeparatedEmailsFromUser *string         `codec:"commaSeparatedEmailsFromUser,omitempty" json:"commaSeparatedEmailsFromUser,omitempty"`
    32  	EmailsFromContacts           *[]EmailAddress `codec:"emailsFromContacts,omitempty" json:"emailsFromContacts,omitempty"`
    33  }
    34  
    35  func (o EmailInvites) DeepCopy() EmailInvites {
    36  	return EmailInvites{
    37  		CommaSeparatedEmailsFromUser: (func(x *string) *string {
    38  			if x == nil {
    39  				return nil
    40  			}
    41  			tmp := (*x)
    42  			return &tmp
    43  		})(o.CommaSeparatedEmailsFromUser),
    44  		EmailsFromContacts: (func(x *[]EmailAddress) *[]EmailAddress {
    45  			if x == nil {
    46  				return nil
    47  			}
    48  			tmp := (func(x []EmailAddress) []EmailAddress {
    49  				if x == nil {
    50  					return nil
    51  				}
    52  				ret := make([]EmailAddress, len(x))
    53  				for i, v := range x {
    54  					vCopy := v.DeepCopy()
    55  					ret[i] = vCopy
    56  				}
    57  				return ret
    58  			})((*x))
    59  			return &tmp
    60  		})(o.EmailsFromContacts),
    61  	}
    62  }
    63  
    64  type InvitePeopleArg struct {
    65  	Emails EmailInvites  `codec:"emails" json:"emails"`
    66  	Phones []PhoneNumber `codec:"phones" json:"phones"`
    67  }
    68  
    69  type GetInviteCountsArg struct {
    70  }
    71  
    72  type RequestInviteCountsArg struct {
    73  }
    74  
    75  type InviteFriendsInterface interface {
    76  	InvitePeople(context.Context, InvitePeopleArg) (int, error)
    77  	GetInviteCounts(context.Context) (InviteCounts, error)
    78  	RequestInviteCounts(context.Context) error
    79  }
    80  
    81  func InviteFriendsProtocol(i InviteFriendsInterface) rpc.Protocol {
    82  	return rpc.Protocol{
    83  		Name: "keybase.1.inviteFriends",
    84  		Methods: map[string]rpc.ServeHandlerDescription{
    85  			"invitePeople": {
    86  				MakeArg: func() interface{} {
    87  					var ret [1]InvitePeopleArg
    88  					return &ret
    89  				},
    90  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    91  					typedArgs, ok := args.(*[1]InvitePeopleArg)
    92  					if !ok {
    93  						err = rpc.NewTypeError((*[1]InvitePeopleArg)(nil), args)
    94  						return
    95  					}
    96  					ret, err = i.InvitePeople(ctx, typedArgs[0])
    97  					return
    98  				},
    99  			},
   100  			"getInviteCounts": {
   101  				MakeArg: func() interface{} {
   102  					var ret [1]GetInviteCountsArg
   103  					return &ret
   104  				},
   105  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   106  					ret, err = i.GetInviteCounts(ctx)
   107  					return
   108  				},
   109  			},
   110  			"requestInviteCounts": {
   111  				MakeArg: func() interface{} {
   112  					var ret [1]RequestInviteCountsArg
   113  					return &ret
   114  				},
   115  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   116  					err = i.RequestInviteCounts(ctx)
   117  					return
   118  				},
   119  			},
   120  		},
   121  	}
   122  }
   123  
   124  type InviteFriendsClient struct {
   125  	Cli rpc.GenericClient
   126  }
   127  
   128  func (c InviteFriendsClient) InvitePeople(ctx context.Context, __arg InvitePeopleArg) (res int, err error) {
   129  	err = c.Cli.Call(ctx, "keybase.1.inviteFriends.invitePeople", []interface{}{__arg}, &res, 0*time.Millisecond)
   130  	return
   131  }
   132  
   133  func (c InviteFriendsClient) GetInviteCounts(ctx context.Context) (res InviteCounts, err error) {
   134  	err = c.Cli.Call(ctx, "keybase.1.inviteFriends.getInviteCounts", []interface{}{GetInviteCountsArg{}}, &res, 0*time.Millisecond)
   135  	return
   136  }
   137  
   138  func (c InviteFriendsClient) RequestInviteCounts(ctx context.Context) (err error) {
   139  	err = c.Cli.Call(ctx, "keybase.1.inviteFriends.requestInviteCounts", []interface{}{RequestInviteCountsArg{}}, nil, 0*time.Millisecond)
   140  	return
   141  }