github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/notify_service.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_service.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 HttpSrvInfo struct { 13 Address string `codec:"address" json:"address"` 14 Token string `codec:"token" json:"token"` 15 } 16 17 func (o HttpSrvInfo) DeepCopy() HttpSrvInfo { 18 return HttpSrvInfo{ 19 Address: o.Address, 20 Token: o.Token, 21 } 22 } 23 24 type HTTPSrvInfoUpdateArg struct { 25 Info HttpSrvInfo `codec:"info" json:"info"` 26 } 27 28 type HandleKeybaseLinkArg struct { 29 Link string `codec:"link" json:"link"` 30 Deferred bool `codec:"deferred" json:"deferred"` 31 } 32 33 type ShutdownArg struct { 34 Code int `codec:"code" json:"code"` 35 } 36 37 type NotifyServiceInterface interface { 38 HTTPSrvInfoUpdate(context.Context, HttpSrvInfo) error 39 HandleKeybaseLink(context.Context, HandleKeybaseLinkArg) error 40 Shutdown(context.Context, int) error 41 } 42 43 func NotifyServiceProtocol(i NotifyServiceInterface) rpc.Protocol { 44 return rpc.Protocol{ 45 Name: "keybase.1.NotifyService", 46 Methods: map[string]rpc.ServeHandlerDescription{ 47 "HTTPSrvInfoUpdate": { 48 MakeArg: func() interface{} { 49 var ret [1]HTTPSrvInfoUpdateArg 50 return &ret 51 }, 52 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 53 typedArgs, ok := args.(*[1]HTTPSrvInfoUpdateArg) 54 if !ok { 55 err = rpc.NewTypeError((*[1]HTTPSrvInfoUpdateArg)(nil), args) 56 return 57 } 58 err = i.HTTPSrvInfoUpdate(ctx, typedArgs[0].Info) 59 return 60 }, 61 }, 62 "handleKeybaseLink": { 63 MakeArg: func() interface{} { 64 var ret [1]HandleKeybaseLinkArg 65 return &ret 66 }, 67 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 68 typedArgs, ok := args.(*[1]HandleKeybaseLinkArg) 69 if !ok { 70 err = rpc.NewTypeError((*[1]HandleKeybaseLinkArg)(nil), args) 71 return 72 } 73 err = i.HandleKeybaseLink(ctx, typedArgs[0]) 74 return 75 }, 76 }, 77 "shutdown": { 78 MakeArg: func() interface{} { 79 var ret [1]ShutdownArg 80 return &ret 81 }, 82 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 83 typedArgs, ok := args.(*[1]ShutdownArg) 84 if !ok { 85 err = rpc.NewTypeError((*[1]ShutdownArg)(nil), args) 86 return 87 } 88 err = i.Shutdown(ctx, typedArgs[0].Code) 89 return 90 }, 91 }, 92 }, 93 } 94 } 95 96 type NotifyServiceClient struct { 97 Cli rpc.GenericClient 98 } 99 100 func (c NotifyServiceClient) HTTPSrvInfoUpdate(ctx context.Context, info HttpSrvInfo) (err error) { 101 __arg := HTTPSrvInfoUpdateArg{Info: info} 102 err = c.Cli.Notify(ctx, "keybase.1.NotifyService.HTTPSrvInfoUpdate", []interface{}{__arg}, 0*time.Millisecond) 103 return 104 } 105 106 func (c NotifyServiceClient) HandleKeybaseLink(ctx context.Context, __arg HandleKeybaseLinkArg) (err error) { 107 err = c.Cli.Notify(ctx, "keybase.1.NotifyService.handleKeybaseLink", []interface{}{__arg}, 0*time.Millisecond) 108 return 109 } 110 111 func (c NotifyServiceClient) Shutdown(ctx context.Context, code int) (err error) { 112 __arg := ShutdownArg{Code: code} 113 err = c.Cli.Call(ctx, "keybase.1.NotifyService.shutdown", []interface{}{__arg}, nil, 0*time.Millisecond) 114 return 115 }