github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/notify_session.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_session.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 LoggedOutArg struct { 13 } 14 15 type LoggedInArg struct { 16 Username string `codec:"username" json:"username"` 17 SignedUp bool `codec:"signedUp" json:"signedUp"` 18 } 19 20 type ClientOutOfDateArg struct { 21 UpgradeTo string `codec:"upgradeTo" json:"upgradeTo"` 22 UpgradeURI string `codec:"upgradeURI" json:"upgradeURI"` 23 UpgradeMsg string `codec:"upgradeMsg" json:"upgradeMsg"` 24 } 25 26 type NotifySessionInterface interface { 27 LoggedOut(context.Context) error 28 LoggedIn(context.Context, LoggedInArg) error 29 ClientOutOfDate(context.Context, ClientOutOfDateArg) error 30 } 31 32 func NotifySessionProtocol(i NotifySessionInterface) rpc.Protocol { 33 return rpc.Protocol{ 34 Name: "keybase.1.NotifySession", 35 Methods: map[string]rpc.ServeHandlerDescription{ 36 "loggedOut": { 37 MakeArg: func() interface{} { 38 var ret [1]LoggedOutArg 39 return &ret 40 }, 41 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 42 err = i.LoggedOut(ctx) 43 return 44 }, 45 }, 46 "loggedIn": { 47 MakeArg: func() interface{} { 48 var ret [1]LoggedInArg 49 return &ret 50 }, 51 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 52 typedArgs, ok := args.(*[1]LoggedInArg) 53 if !ok { 54 err = rpc.NewTypeError((*[1]LoggedInArg)(nil), args) 55 return 56 } 57 err = i.LoggedIn(ctx, typedArgs[0]) 58 return 59 }, 60 }, 61 "clientOutOfDate": { 62 MakeArg: func() interface{} { 63 var ret [1]ClientOutOfDateArg 64 return &ret 65 }, 66 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 67 typedArgs, ok := args.(*[1]ClientOutOfDateArg) 68 if !ok { 69 err = rpc.NewTypeError((*[1]ClientOutOfDateArg)(nil), args) 70 return 71 } 72 err = i.ClientOutOfDate(ctx, typedArgs[0]) 73 return 74 }, 75 }, 76 }, 77 } 78 } 79 80 type NotifySessionClient struct { 81 Cli rpc.GenericClient 82 } 83 84 func (c NotifySessionClient) LoggedOut(ctx context.Context) (err error) { 85 err = c.Cli.Notify(ctx, "keybase.1.NotifySession.loggedOut", []interface{}{LoggedOutArg{}}, 0*time.Millisecond) 86 return 87 } 88 89 func (c NotifySessionClient) LoggedIn(ctx context.Context, __arg LoggedInArg) (err error) { 90 err = c.Cli.Call(ctx, "keybase.1.NotifySession.loggedIn", []interface{}{__arg}, nil, 0*time.Millisecond) 91 return 92 } 93 94 func (c NotifySessionClient) ClientOutOfDate(ctx context.Context, __arg ClientOutOfDateArg) (err error) { 95 err = c.Cli.Call(ctx, "keybase.1.NotifySession.clientOutOfDate", []interface{}{__arg}, nil, 0*time.Millisecond) 96 return 97 }