github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/emails.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/emails.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 EmailLookupResult struct {
    13  	Email EmailAddress `codec:"email" json:"email"`
    14  	Uid   *UID         `codec:"uid,omitempty" json:"uid,omitempty"`
    15  }
    16  
    17  func (o EmailLookupResult) DeepCopy() EmailLookupResult {
    18  	return EmailLookupResult{
    19  		Email: o.Email.DeepCopy(),
    20  		Uid: (func(x *UID) *UID {
    21  			if x == nil {
    22  				return nil
    23  			}
    24  			tmp := (*x).DeepCopy()
    25  			return &tmp
    26  		})(o.Uid),
    27  	}
    28  }
    29  
    30  type EmailAddressVerifiedMsg struct {
    31  	Email EmailAddress `codec:"email" json:"email"`
    32  }
    33  
    34  func (o EmailAddressVerifiedMsg) DeepCopy() EmailAddressVerifiedMsg {
    35  	return EmailAddressVerifiedMsg{
    36  		Email: o.Email.DeepCopy(),
    37  	}
    38  }
    39  
    40  type EmailAddressChangedMsg struct {
    41  	Email EmailAddress `codec:"email" json:"email"`
    42  }
    43  
    44  func (o EmailAddressChangedMsg) DeepCopy() EmailAddressChangedMsg {
    45  	return EmailAddressChangedMsg{
    46  		Email: o.Email.DeepCopy(),
    47  	}
    48  }
    49  
    50  type AddEmailArg struct {
    51  	SessionID  int                `codec:"sessionID" json:"sessionID"`
    52  	Email      EmailAddress       `codec:"email" json:"email"`
    53  	Visibility IdentityVisibility `codec:"visibility" json:"visibility"`
    54  }
    55  
    56  type DeleteEmailArg struct {
    57  	SessionID int          `codec:"sessionID" json:"sessionID"`
    58  	Email     EmailAddress `codec:"email" json:"email"`
    59  }
    60  
    61  type EditEmailArg struct {
    62  	SessionID  int                `codec:"sessionID" json:"sessionID"`
    63  	OldEmail   EmailAddress       `codec:"oldEmail" json:"oldEmail"`
    64  	Email      EmailAddress       `codec:"email" json:"email"`
    65  	Visibility IdentityVisibility `codec:"visibility" json:"visibility"`
    66  }
    67  
    68  type SetPrimaryEmailArg struct {
    69  	SessionID int          `codec:"sessionID" json:"sessionID"`
    70  	Email     EmailAddress `codec:"email" json:"email"`
    71  }
    72  
    73  type SendVerificationEmailArg struct {
    74  	SessionID int          `codec:"sessionID" json:"sessionID"`
    75  	Email     EmailAddress `codec:"email" json:"email"`
    76  }
    77  
    78  type SetVisibilityEmailArg struct {
    79  	SessionID  int                `codec:"sessionID" json:"sessionID"`
    80  	Email      EmailAddress       `codec:"email" json:"email"`
    81  	Visibility IdentityVisibility `codec:"visibility" json:"visibility"`
    82  }
    83  
    84  type SetVisibilityAllEmailArg struct {
    85  	SessionID  int                `codec:"sessionID" json:"sessionID"`
    86  	Visibility IdentityVisibility `codec:"visibility" json:"visibility"`
    87  }
    88  
    89  type GetEmailsArg struct {
    90  	SessionID int `codec:"sessionID" json:"sessionID"`
    91  }
    92  
    93  type EmailsInterface interface {
    94  	AddEmail(context.Context, AddEmailArg) error
    95  	DeleteEmail(context.Context, DeleteEmailArg) error
    96  	EditEmail(context.Context, EditEmailArg) error
    97  	SetPrimaryEmail(context.Context, SetPrimaryEmailArg) error
    98  	SendVerificationEmail(context.Context, SendVerificationEmailArg) error
    99  	SetVisibilityEmail(context.Context, SetVisibilityEmailArg) error
   100  	SetVisibilityAllEmail(context.Context, SetVisibilityAllEmailArg) error
   101  	GetEmails(context.Context, int) ([]Email, error)
   102  }
   103  
   104  func EmailsProtocol(i EmailsInterface) rpc.Protocol {
   105  	return rpc.Protocol{
   106  		Name: "keybase.1.emails",
   107  		Methods: map[string]rpc.ServeHandlerDescription{
   108  			"addEmail": {
   109  				MakeArg: func() interface{} {
   110  					var ret [1]AddEmailArg
   111  					return &ret
   112  				},
   113  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   114  					typedArgs, ok := args.(*[1]AddEmailArg)
   115  					if !ok {
   116  						err = rpc.NewTypeError((*[1]AddEmailArg)(nil), args)
   117  						return
   118  					}
   119  					err = i.AddEmail(ctx, typedArgs[0])
   120  					return
   121  				},
   122  			},
   123  			"deleteEmail": {
   124  				MakeArg: func() interface{} {
   125  					var ret [1]DeleteEmailArg
   126  					return &ret
   127  				},
   128  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   129  					typedArgs, ok := args.(*[1]DeleteEmailArg)
   130  					if !ok {
   131  						err = rpc.NewTypeError((*[1]DeleteEmailArg)(nil), args)
   132  						return
   133  					}
   134  					err = i.DeleteEmail(ctx, typedArgs[0])
   135  					return
   136  				},
   137  			},
   138  			"editEmail": {
   139  				MakeArg: func() interface{} {
   140  					var ret [1]EditEmailArg
   141  					return &ret
   142  				},
   143  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   144  					typedArgs, ok := args.(*[1]EditEmailArg)
   145  					if !ok {
   146  						err = rpc.NewTypeError((*[1]EditEmailArg)(nil), args)
   147  						return
   148  					}
   149  					err = i.EditEmail(ctx, typedArgs[0])
   150  					return
   151  				},
   152  			},
   153  			"setPrimaryEmail": {
   154  				MakeArg: func() interface{} {
   155  					var ret [1]SetPrimaryEmailArg
   156  					return &ret
   157  				},
   158  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   159  					typedArgs, ok := args.(*[1]SetPrimaryEmailArg)
   160  					if !ok {
   161  						err = rpc.NewTypeError((*[1]SetPrimaryEmailArg)(nil), args)
   162  						return
   163  					}
   164  					err = i.SetPrimaryEmail(ctx, typedArgs[0])
   165  					return
   166  				},
   167  			},
   168  			"sendVerificationEmail": {
   169  				MakeArg: func() interface{} {
   170  					var ret [1]SendVerificationEmailArg
   171  					return &ret
   172  				},
   173  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   174  					typedArgs, ok := args.(*[1]SendVerificationEmailArg)
   175  					if !ok {
   176  						err = rpc.NewTypeError((*[1]SendVerificationEmailArg)(nil), args)
   177  						return
   178  					}
   179  					err = i.SendVerificationEmail(ctx, typedArgs[0])
   180  					return
   181  				},
   182  			},
   183  			"setVisibilityEmail": {
   184  				MakeArg: func() interface{} {
   185  					var ret [1]SetVisibilityEmailArg
   186  					return &ret
   187  				},
   188  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   189  					typedArgs, ok := args.(*[1]SetVisibilityEmailArg)
   190  					if !ok {
   191  						err = rpc.NewTypeError((*[1]SetVisibilityEmailArg)(nil), args)
   192  						return
   193  					}
   194  					err = i.SetVisibilityEmail(ctx, typedArgs[0])
   195  					return
   196  				},
   197  			},
   198  			"setVisibilityAllEmail": {
   199  				MakeArg: func() interface{} {
   200  					var ret [1]SetVisibilityAllEmailArg
   201  					return &ret
   202  				},
   203  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   204  					typedArgs, ok := args.(*[1]SetVisibilityAllEmailArg)
   205  					if !ok {
   206  						err = rpc.NewTypeError((*[1]SetVisibilityAllEmailArg)(nil), args)
   207  						return
   208  					}
   209  					err = i.SetVisibilityAllEmail(ctx, typedArgs[0])
   210  					return
   211  				},
   212  			},
   213  			"getEmails": {
   214  				MakeArg: func() interface{} {
   215  					var ret [1]GetEmailsArg
   216  					return &ret
   217  				},
   218  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   219  					typedArgs, ok := args.(*[1]GetEmailsArg)
   220  					if !ok {
   221  						err = rpc.NewTypeError((*[1]GetEmailsArg)(nil), args)
   222  						return
   223  					}
   224  					ret, err = i.GetEmails(ctx, typedArgs[0].SessionID)
   225  					return
   226  				},
   227  			},
   228  		},
   229  	}
   230  }
   231  
   232  type EmailsClient struct {
   233  	Cli rpc.GenericClient
   234  }
   235  
   236  func (c EmailsClient) AddEmail(ctx context.Context, __arg AddEmailArg) (err error) {
   237  	err = c.Cli.Call(ctx, "keybase.1.emails.addEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   238  	return
   239  }
   240  
   241  func (c EmailsClient) DeleteEmail(ctx context.Context, __arg DeleteEmailArg) (err error) {
   242  	err = c.Cli.Call(ctx, "keybase.1.emails.deleteEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   243  	return
   244  }
   245  
   246  func (c EmailsClient) EditEmail(ctx context.Context, __arg EditEmailArg) (err error) {
   247  	err = c.Cli.Call(ctx, "keybase.1.emails.editEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   248  	return
   249  }
   250  
   251  func (c EmailsClient) SetPrimaryEmail(ctx context.Context, __arg SetPrimaryEmailArg) (err error) {
   252  	err = c.Cli.Call(ctx, "keybase.1.emails.setPrimaryEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   253  	return
   254  }
   255  
   256  func (c EmailsClient) SendVerificationEmail(ctx context.Context, __arg SendVerificationEmailArg) (err error) {
   257  	err = c.Cli.Call(ctx, "keybase.1.emails.sendVerificationEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   258  	return
   259  }
   260  
   261  func (c EmailsClient) SetVisibilityEmail(ctx context.Context, __arg SetVisibilityEmailArg) (err error) {
   262  	err = c.Cli.Call(ctx, "keybase.1.emails.setVisibilityEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   263  	return
   264  }
   265  
   266  func (c EmailsClient) SetVisibilityAllEmail(ctx context.Context, __arg SetVisibilityAllEmailArg) (err error) {
   267  	err = c.Cli.Call(ctx, "keybase.1.emails.setVisibilityAllEmail", []interface{}{__arg}, nil, 0*time.Millisecond)
   268  	return
   269  }
   270  
   271  func (c EmailsClient) GetEmails(ctx context.Context, sessionID int) (res []Email, err error) {
   272  	__arg := GetEmailsArg{SessionID: sessionID}
   273  	err = c.Cli.Call(ctx, "keybase.1.emails.getEmails", []interface{}{__arg}, &res, 0*time.Millisecond)
   274  	return
   275  }