github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/notify_email.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/notify_email.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 EmailAddressVerifiedArg struct {
    13  	EmailAddress EmailAddress `codec:"emailAddress" json:"emailAddress"`
    14  }
    15  
    16  type EmailsChangedArg struct {
    17  	List     []Email      `codec:"list" json:"list"`
    18  	Category string       `codec:"category" json:"category"`
    19  	Email    EmailAddress `codec:"email" json:"email"`
    20  }
    21  
    22  type NotifyEmailAddressInterface interface {
    23  	EmailAddressVerified(context.Context, EmailAddress) error
    24  	EmailsChanged(context.Context, EmailsChangedArg) error
    25  }
    26  
    27  func NotifyEmailAddressProtocol(i NotifyEmailAddressInterface) rpc.Protocol {
    28  	return rpc.Protocol{
    29  		Name: "keybase.1.NotifyEmailAddress",
    30  		Methods: map[string]rpc.ServeHandlerDescription{
    31  			"emailAddressVerified": {
    32  				MakeArg: func() interface{} {
    33  					var ret [1]EmailAddressVerifiedArg
    34  					return &ret
    35  				},
    36  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    37  					typedArgs, ok := args.(*[1]EmailAddressVerifiedArg)
    38  					if !ok {
    39  						err = rpc.NewTypeError((*[1]EmailAddressVerifiedArg)(nil), args)
    40  						return
    41  					}
    42  					err = i.EmailAddressVerified(ctx, typedArgs[0].EmailAddress)
    43  					return
    44  				},
    45  			},
    46  			"emailsChanged": {
    47  				MakeArg: func() interface{} {
    48  					var ret [1]EmailsChangedArg
    49  					return &ret
    50  				},
    51  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    52  					typedArgs, ok := args.(*[1]EmailsChangedArg)
    53  					if !ok {
    54  						err = rpc.NewTypeError((*[1]EmailsChangedArg)(nil), args)
    55  						return
    56  					}
    57  					err = i.EmailsChanged(ctx, typedArgs[0])
    58  					return
    59  				},
    60  			},
    61  		},
    62  	}
    63  }
    64  
    65  type NotifyEmailAddressClient struct {
    66  	Cli rpc.GenericClient
    67  }
    68  
    69  func (c NotifyEmailAddressClient) EmailAddressVerified(ctx context.Context, emailAddress EmailAddress) (err error) {
    70  	__arg := EmailAddressVerifiedArg{EmailAddress: emailAddress}
    71  	err = c.Cli.Notify(ctx, "keybase.1.NotifyEmailAddress.emailAddressVerified", []interface{}{__arg}, 0*time.Millisecond)
    72  	return
    73  }
    74  
    75  func (c NotifyEmailAddressClient) EmailsChanged(ctx context.Context, __arg EmailsChangedArg) (err error) {
    76  	err = c.Cli.Notify(ctx, "keybase.1.NotifyEmailAddress.emailsChanged", []interface{}{__arg}, 0*time.Millisecond)
    77  	return
    78  }