github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/notify_saltpack.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_saltpack.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 SaltpackOperationType int 14 15 const ( 16 SaltpackOperationType_ENCRYPT SaltpackOperationType = 0 17 SaltpackOperationType_DECRYPT SaltpackOperationType = 1 18 SaltpackOperationType_SIGN SaltpackOperationType = 2 19 SaltpackOperationType_VERIFY SaltpackOperationType = 3 20 ) 21 22 func (o SaltpackOperationType) DeepCopy() SaltpackOperationType { return o } 23 24 var SaltpackOperationTypeMap = map[string]SaltpackOperationType{ 25 "ENCRYPT": 0, 26 "DECRYPT": 1, 27 "SIGN": 2, 28 "VERIFY": 3, 29 } 30 31 var SaltpackOperationTypeRevMap = map[SaltpackOperationType]string{ 32 0: "ENCRYPT", 33 1: "DECRYPT", 34 2: "SIGN", 35 3: "VERIFY", 36 } 37 38 func (e SaltpackOperationType) String() string { 39 if v, ok := SaltpackOperationTypeRevMap[e]; ok { 40 return v 41 } 42 return fmt.Sprintf("%v", int(e)) 43 } 44 45 type SaltpackOperationStartArg struct { 46 OpType SaltpackOperationType `codec:"opType" json:"opType"` 47 Filename string `codec:"filename" json:"filename"` 48 } 49 50 type SaltpackOperationProgressArg struct { 51 OpType SaltpackOperationType `codec:"opType" json:"opType"` 52 Filename string `codec:"filename" json:"filename"` 53 BytesComplete int64 `codec:"bytesComplete" json:"bytesComplete"` 54 BytesTotal int64 `codec:"bytesTotal" json:"bytesTotal"` 55 } 56 57 type SaltpackOperationDoneArg struct { 58 OpType SaltpackOperationType `codec:"opType" json:"opType"` 59 Filename string `codec:"filename" json:"filename"` 60 } 61 62 type NotifySaltpackInterface interface { 63 SaltpackOperationStart(context.Context, SaltpackOperationStartArg) error 64 SaltpackOperationProgress(context.Context, SaltpackOperationProgressArg) error 65 SaltpackOperationDone(context.Context, SaltpackOperationDoneArg) error 66 } 67 68 func NotifySaltpackProtocol(i NotifySaltpackInterface) rpc.Protocol { 69 return rpc.Protocol{ 70 Name: "keybase.1.NotifySaltpack", 71 Methods: map[string]rpc.ServeHandlerDescription{ 72 "saltpackOperationStart": { 73 MakeArg: func() interface{} { 74 var ret [1]SaltpackOperationStartArg 75 return &ret 76 }, 77 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 78 typedArgs, ok := args.(*[1]SaltpackOperationStartArg) 79 if !ok { 80 err = rpc.NewTypeError((*[1]SaltpackOperationStartArg)(nil), args) 81 return 82 } 83 err = i.SaltpackOperationStart(ctx, typedArgs[0]) 84 return 85 }, 86 }, 87 "saltpackOperationProgress": { 88 MakeArg: func() interface{} { 89 var ret [1]SaltpackOperationProgressArg 90 return &ret 91 }, 92 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 93 typedArgs, ok := args.(*[1]SaltpackOperationProgressArg) 94 if !ok { 95 err = rpc.NewTypeError((*[1]SaltpackOperationProgressArg)(nil), args) 96 return 97 } 98 err = i.SaltpackOperationProgress(ctx, typedArgs[0]) 99 return 100 }, 101 }, 102 "saltpackOperationDone": { 103 MakeArg: func() interface{} { 104 var ret [1]SaltpackOperationDoneArg 105 return &ret 106 }, 107 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 108 typedArgs, ok := args.(*[1]SaltpackOperationDoneArg) 109 if !ok { 110 err = rpc.NewTypeError((*[1]SaltpackOperationDoneArg)(nil), args) 111 return 112 } 113 err = i.SaltpackOperationDone(ctx, typedArgs[0]) 114 return 115 }, 116 }, 117 }, 118 } 119 } 120 121 type NotifySaltpackClient struct { 122 Cli rpc.GenericClient 123 } 124 125 func (c NotifySaltpackClient) SaltpackOperationStart(ctx context.Context, __arg SaltpackOperationStartArg) (err error) { 126 err = c.Cli.Notify(ctx, "keybase.1.NotifySaltpack.saltpackOperationStart", []interface{}{__arg}, 0*time.Millisecond) 127 return 128 } 129 130 func (c NotifySaltpackClient) SaltpackOperationProgress(ctx context.Context, __arg SaltpackOperationProgressArg) (err error) { 131 err = c.Cli.Notify(ctx, "keybase.1.NotifySaltpack.saltpackOperationProgress", []interface{}{__arg}, 0*time.Millisecond) 132 return 133 } 134 135 func (c NotifySaltpackClient) SaltpackOperationDone(ctx context.Context, __arg SaltpackOperationDoneArg) (err error) { 136 err = c.Cli.Notify(ctx, "keybase.1.NotifySaltpack.saltpackOperationDone", []interface{}{__arg}, 0*time.Millisecond) 137 return 138 }