github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/signup.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/signup.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 SignupRes struct {
    13  	PassphraseOk bool   `codec:"passphraseOk" json:"passphraseOk"`
    14  	PostOk       bool   `codec:"postOk" json:"postOk"`
    15  	WriteOk      bool   `codec:"writeOk" json:"writeOk"`
    16  	PaperKey     string `codec:"paperKey" json:"paperKey"`
    17  }
    18  
    19  func (o SignupRes) DeepCopy() SignupRes {
    20  	return SignupRes{
    21  		PassphraseOk: o.PassphraseOk,
    22  		PostOk:       o.PostOk,
    23  		WriteOk:      o.WriteOk,
    24  		PaperKey:     o.PaperKey,
    25  	}
    26  }
    27  
    28  type CheckUsernameAvailableArg struct {
    29  	SessionID int    `codec:"sessionID" json:"sessionID"`
    30  	Username  string `codec:"username" json:"username"`
    31  }
    32  
    33  type SignupArg struct {
    34  	SessionID   int        `codec:"sessionID" json:"sessionID"`
    35  	Email       string     `codec:"email" json:"email"`
    36  	InviteCode  string     `codec:"inviteCode" json:"inviteCode"`
    37  	Passphrase  string     `codec:"passphrase" json:"passphrase"`
    38  	Username    string     `codec:"username" json:"username"`
    39  	DeviceName  string     `codec:"deviceName" json:"deviceName"`
    40  	DeviceType  DeviceType `codec:"deviceType" json:"deviceType"`
    41  	StoreSecret bool       `codec:"storeSecret" json:"storeSecret"`
    42  	SkipMail    bool       `codec:"skipMail" json:"skipMail"`
    43  	GenPGPBatch bool       `codec:"genPGPBatch" json:"genPGPBatch"`
    44  	GenPaper    bool       `codec:"genPaper" json:"genPaper"`
    45  	RandomPw    bool       `codec:"randomPw" json:"randomPw"`
    46  	VerifyEmail bool       `codec:"verifyEmail" json:"verifyEmail"`
    47  	BotToken    BotToken   `codec:"botToken" json:"botToken"`
    48  	SkipGPG     bool       `codec:"skipGPG" json:"skipGPG"`
    49  }
    50  
    51  type InviteRequestArg struct {
    52  	SessionID int    `codec:"sessionID" json:"sessionID"`
    53  	Email     string `codec:"email" json:"email"`
    54  	Fullname  string `codec:"fullname" json:"fullname"`
    55  	Notes     string `codec:"notes" json:"notes"`
    56  }
    57  
    58  type CheckInvitationCodeArg struct {
    59  	SessionID      int    `codec:"sessionID" json:"sessionID"`
    60  	InvitationCode string `codec:"invitationCode" json:"invitationCode"`
    61  }
    62  
    63  type GetInvitationCodeArg struct {
    64  	SessionID int `codec:"sessionID" json:"sessionID"`
    65  }
    66  
    67  type SignupInterface interface {
    68  	CheckUsernameAvailable(context.Context, CheckUsernameAvailableArg) error
    69  	Signup(context.Context, SignupArg) (SignupRes, error)
    70  	InviteRequest(context.Context, InviteRequestArg) error
    71  	CheckInvitationCode(context.Context, CheckInvitationCodeArg) error
    72  	GetInvitationCode(context.Context, int) (string, error)
    73  }
    74  
    75  func SignupProtocol(i SignupInterface) rpc.Protocol {
    76  	return rpc.Protocol{
    77  		Name: "keybase.1.signup",
    78  		Methods: map[string]rpc.ServeHandlerDescription{
    79  			"checkUsernameAvailable": {
    80  				MakeArg: func() interface{} {
    81  					var ret [1]CheckUsernameAvailableArg
    82  					return &ret
    83  				},
    84  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    85  					typedArgs, ok := args.(*[1]CheckUsernameAvailableArg)
    86  					if !ok {
    87  						err = rpc.NewTypeError((*[1]CheckUsernameAvailableArg)(nil), args)
    88  						return
    89  					}
    90  					err = i.CheckUsernameAvailable(ctx, typedArgs[0])
    91  					return
    92  				},
    93  			},
    94  			"signup": {
    95  				MakeArg: func() interface{} {
    96  					var ret [1]SignupArg
    97  					return &ret
    98  				},
    99  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   100  					typedArgs, ok := args.(*[1]SignupArg)
   101  					if !ok {
   102  						err = rpc.NewTypeError((*[1]SignupArg)(nil), args)
   103  						return
   104  					}
   105  					ret, err = i.Signup(ctx, typedArgs[0])
   106  					return
   107  				},
   108  			},
   109  			"inviteRequest": {
   110  				MakeArg: func() interface{} {
   111  					var ret [1]InviteRequestArg
   112  					return &ret
   113  				},
   114  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   115  					typedArgs, ok := args.(*[1]InviteRequestArg)
   116  					if !ok {
   117  						err = rpc.NewTypeError((*[1]InviteRequestArg)(nil), args)
   118  						return
   119  					}
   120  					err = i.InviteRequest(ctx, typedArgs[0])
   121  					return
   122  				},
   123  			},
   124  			"checkInvitationCode": {
   125  				MakeArg: func() interface{} {
   126  					var ret [1]CheckInvitationCodeArg
   127  					return &ret
   128  				},
   129  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   130  					typedArgs, ok := args.(*[1]CheckInvitationCodeArg)
   131  					if !ok {
   132  						err = rpc.NewTypeError((*[1]CheckInvitationCodeArg)(nil), args)
   133  						return
   134  					}
   135  					err = i.CheckInvitationCode(ctx, typedArgs[0])
   136  					return
   137  				},
   138  			},
   139  			"getInvitationCode": {
   140  				MakeArg: func() interface{} {
   141  					var ret [1]GetInvitationCodeArg
   142  					return &ret
   143  				},
   144  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   145  					typedArgs, ok := args.(*[1]GetInvitationCodeArg)
   146  					if !ok {
   147  						err = rpc.NewTypeError((*[1]GetInvitationCodeArg)(nil), args)
   148  						return
   149  					}
   150  					ret, err = i.GetInvitationCode(ctx, typedArgs[0].SessionID)
   151  					return
   152  				},
   153  			},
   154  		},
   155  	}
   156  }
   157  
   158  type SignupClient struct {
   159  	Cli rpc.GenericClient
   160  }
   161  
   162  func (c SignupClient) CheckUsernameAvailable(ctx context.Context, __arg CheckUsernameAvailableArg) (err error) {
   163  	err = c.Cli.Call(ctx, "keybase.1.signup.checkUsernameAvailable", []interface{}{__arg}, nil, 0*time.Millisecond)
   164  	return
   165  }
   166  
   167  func (c SignupClient) Signup(ctx context.Context, __arg SignupArg) (res SignupRes, err error) {
   168  	err = c.Cli.Call(ctx, "keybase.1.signup.signup", []interface{}{__arg}, &res, 0*time.Millisecond)
   169  	return
   170  }
   171  
   172  func (c SignupClient) InviteRequest(ctx context.Context, __arg InviteRequestArg) (err error) {
   173  	err = c.Cli.Call(ctx, "keybase.1.signup.inviteRequest", []interface{}{__arg}, nil, 0*time.Millisecond)
   174  	return
   175  }
   176  
   177  func (c SignupClient) CheckInvitationCode(ctx context.Context, __arg CheckInvitationCodeArg) (err error) {
   178  	err = c.Cli.Call(ctx, "keybase.1.signup.checkInvitationCode", []interface{}{__arg}, nil, 0*time.Millisecond)
   179  	return
   180  }
   181  
   182  func (c SignupClient) GetInvitationCode(ctx context.Context, sessionID int) (res string, err error) {
   183  	__arg := GetInvitationCodeArg{SessionID: sessionID}
   184  	err = c.Cli.Call(ctx, "keybase.1.signup.getInvitationCode", []interface{}{__arg}, &res, 0*time.Millisecond)
   185  	return
   186  }