github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/gregor_ui.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/gregor_ui.avdl 3 4 package keybase1 5 6 import ( 7 "fmt" 8 gregor1 "github.com/keybase/client/go/protocol/gregor1" 9 "github.com/keybase/go-framed-msgpack-rpc/rpc" 10 context "golang.org/x/net/context" 11 "time" 12 ) 13 14 type PushReason int 15 16 const ( 17 PushReason_NONE PushReason = 0 18 PushReason_RECONNECTED PushReason = 1 19 PushReason_NEW_DATA PushReason = 2 20 ) 21 22 func (o PushReason) DeepCopy() PushReason { return o } 23 24 var PushReasonMap = map[string]PushReason{ 25 "NONE": 0, 26 "RECONNECTED": 1, 27 "NEW_DATA": 2, 28 } 29 30 var PushReasonRevMap = map[PushReason]string{ 31 0: "NONE", 32 1: "RECONNECTED", 33 2: "NEW_DATA", 34 } 35 36 func (e PushReason) String() string { 37 if v, ok := PushReasonRevMap[e]; ok { 38 return v 39 } 40 return fmt.Sprintf("%v", int(e)) 41 } 42 43 type PushStateArg struct { 44 State gregor1.State `codec:"state" json:"state"` 45 Reason PushReason `codec:"reason" json:"reason"` 46 } 47 48 type PushOutOfBandMessagesArg struct { 49 Oobm []gregor1.OutOfBandMessage `codec:"oobm" json:"oobm"` 50 } 51 52 type GregorUIInterface interface { 53 PushState(context.Context, PushStateArg) error 54 PushOutOfBandMessages(context.Context, []gregor1.OutOfBandMessage) error 55 } 56 57 func GregorUIProtocol(i GregorUIInterface) rpc.Protocol { 58 return rpc.Protocol{ 59 Name: "keybase.1.gregorUI", 60 Methods: map[string]rpc.ServeHandlerDescription{ 61 "pushState": { 62 MakeArg: func() interface{} { 63 var ret [1]PushStateArg 64 return &ret 65 }, 66 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 67 typedArgs, ok := args.(*[1]PushStateArg) 68 if !ok { 69 err = rpc.NewTypeError((*[1]PushStateArg)(nil), args) 70 return 71 } 72 err = i.PushState(ctx, typedArgs[0]) 73 return 74 }, 75 }, 76 "pushOutOfBandMessages": { 77 MakeArg: func() interface{} { 78 var ret [1]PushOutOfBandMessagesArg 79 return &ret 80 }, 81 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 82 typedArgs, ok := args.(*[1]PushOutOfBandMessagesArg) 83 if !ok { 84 err = rpc.NewTypeError((*[1]PushOutOfBandMessagesArg)(nil), args) 85 return 86 } 87 err = i.PushOutOfBandMessages(ctx, typedArgs[0].Oobm) 88 return 89 }, 90 }, 91 }, 92 } 93 } 94 95 type GregorUIClient struct { 96 Cli rpc.GenericClient 97 } 98 99 func (c GregorUIClient) PushState(ctx context.Context, __arg PushStateArg) (err error) { 100 err = c.Cli.Notify(ctx, "keybase.1.gregorUI.pushState", []interface{}{__arg}, 0*time.Millisecond) 101 return 102 } 103 104 func (c GregorUIClient) PushOutOfBandMessages(ctx context.Context, oobm []gregor1.OutOfBandMessage) (err error) { 105 __arg := PushOutOfBandMessagesArg{Oobm: oobm} 106 err = c.Cli.Notify(ctx, "keybase.1.gregorUI.pushOutOfBandMessages", []interface{}{__arg}, 0*time.Millisecond) 107 return 108 }