github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/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/ui.avdl 3 4 package keybase1 5 6 import ( 7 "fmt" 8 "github.com/keybase/go-framed-msgpack-rpc/rpc" 9 context "golang.org/x/net/context" 10 "time" 11 ) 12 13 type PromptDefault int 14 15 const ( 16 PromptDefault_NONE PromptDefault = 0 17 PromptDefault_YES PromptDefault = 1 18 PromptDefault_NO PromptDefault = 2 19 ) 20 21 func (o PromptDefault) DeepCopy() PromptDefault { return o } 22 23 var PromptDefaultMap = map[string]PromptDefault{ 24 "NONE": 0, 25 "YES": 1, 26 "NO": 2, 27 } 28 29 var PromptDefaultRevMap = map[PromptDefault]string{ 30 0: "NONE", 31 1: "YES", 32 2: "NO", 33 } 34 35 func (e PromptDefault) String() string { 36 if v, ok := PromptDefaultRevMap[e]; ok { 37 return v 38 } 39 return fmt.Sprintf("%v", int(e)) 40 } 41 42 type PromptYesNoArg struct { 43 SessionID int `codec:"sessionID" json:"sessionID"` 44 Text Text `codec:"text" json:"text"` 45 PromptDefault PromptDefault `codec:"promptDefault" json:"promptDefault"` 46 } 47 48 type UiInterface interface { 49 PromptYesNo(context.Context, PromptYesNoArg) (bool, error) 50 } 51 52 func UiProtocol(i UiInterface) rpc.Protocol { 53 return rpc.Protocol{ 54 Name: "keybase.1.ui", 55 Methods: map[string]rpc.ServeHandlerDescription{ 56 "promptYesNo": { 57 MakeArg: func() interface{} { 58 var ret [1]PromptYesNoArg 59 return &ret 60 }, 61 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 62 typedArgs, ok := args.(*[1]PromptYesNoArg) 63 if !ok { 64 err = rpc.NewTypeError((*[1]PromptYesNoArg)(nil), args) 65 return 66 } 67 ret, err = i.PromptYesNo(ctx, typedArgs[0]) 68 return 69 }, 70 }, 71 }, 72 } 73 } 74 75 type UiClient struct { 76 Cli rpc.GenericClient 77 } 78 79 func (c UiClient) PromptYesNo(ctx context.Context, __arg PromptYesNoArg) (res bool, err error) { 80 err = c.Cli.Call(ctx, "keybase.1.ui.promptYesNo", []interface{}{__arg}, &res, 0*time.Millisecond) 81 return 82 }