github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/track.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/track.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 TrackArg struct { 13 SessionID int `codec:"sessionID" json:"sessionID"` 14 UserAssertion string `codec:"userAssertion" json:"userAssertion"` 15 Options TrackOptions `codec:"options" json:"options"` 16 ForceRemoteCheck bool `codec:"forceRemoteCheck" json:"forceRemoteCheck"` 17 } 18 19 type TrackWithTokenArg struct { 20 SessionID int `codec:"sessionID" json:"sessionID"` 21 TrackToken TrackToken `codec:"trackToken" json:"trackToken"` 22 Options TrackOptions `codec:"options" json:"options"` 23 } 24 25 type DismissWithTokenArg struct { 26 SessionID int `codec:"sessionID" json:"sessionID"` 27 TrackToken TrackToken `codec:"trackToken" json:"trackToken"` 28 } 29 30 type UntrackArg struct { 31 SessionID int `codec:"sessionID" json:"sessionID"` 32 Username string `codec:"username" json:"username"` 33 } 34 35 type CheckTrackingArg struct { 36 SessionID int `codec:"sessionID" json:"sessionID"` 37 } 38 39 type FakeTrackingChangedArg struct { 40 SessionID int `codec:"sessionID" json:"sessionID"` 41 Username string `codec:"username" json:"username"` 42 IsTracking bool `codec:"isTracking" json:"isTracking"` 43 } 44 45 type TrackInterface interface { 46 // This will perform identify and track. 47 // If forceRemoteCheck is true, we force all remote proofs to be checked 48 // (otherwise a cache is used). 49 Track(context.Context, TrackArg) (ConfirmResult, error) 50 // Track with token returned from identify. 51 TrackWithToken(context.Context, TrackWithTokenArg) error 52 // Called by the UI when the user decides *not* to track, to e.g. dismiss gregor items. 53 DismissWithToken(context.Context, DismissWithTokenArg) error 54 Untrack(context.Context, UntrackArg) error 55 CheckTracking(context.Context, int) error 56 FakeTrackingChanged(context.Context, FakeTrackingChangedArg) error 57 } 58 59 func TrackProtocol(i TrackInterface) rpc.Protocol { 60 return rpc.Protocol{ 61 Name: "keybase.1.track", 62 Methods: map[string]rpc.ServeHandlerDescription{ 63 "track": { 64 MakeArg: func() interface{} { 65 var ret [1]TrackArg 66 return &ret 67 }, 68 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 69 typedArgs, ok := args.(*[1]TrackArg) 70 if !ok { 71 err = rpc.NewTypeError((*[1]TrackArg)(nil), args) 72 return 73 } 74 ret, err = i.Track(ctx, typedArgs[0]) 75 return 76 }, 77 }, 78 "trackWithToken": { 79 MakeArg: func() interface{} { 80 var ret [1]TrackWithTokenArg 81 return &ret 82 }, 83 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 84 typedArgs, ok := args.(*[1]TrackWithTokenArg) 85 if !ok { 86 err = rpc.NewTypeError((*[1]TrackWithTokenArg)(nil), args) 87 return 88 } 89 err = i.TrackWithToken(ctx, typedArgs[0]) 90 return 91 }, 92 }, 93 "dismissWithToken": { 94 MakeArg: func() interface{} { 95 var ret [1]DismissWithTokenArg 96 return &ret 97 }, 98 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 99 typedArgs, ok := args.(*[1]DismissWithTokenArg) 100 if !ok { 101 err = rpc.NewTypeError((*[1]DismissWithTokenArg)(nil), args) 102 return 103 } 104 err = i.DismissWithToken(ctx, typedArgs[0]) 105 return 106 }, 107 }, 108 "untrack": { 109 MakeArg: func() interface{} { 110 var ret [1]UntrackArg 111 return &ret 112 }, 113 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 114 typedArgs, ok := args.(*[1]UntrackArg) 115 if !ok { 116 err = rpc.NewTypeError((*[1]UntrackArg)(nil), args) 117 return 118 } 119 err = i.Untrack(ctx, typedArgs[0]) 120 return 121 }, 122 }, 123 "checkTracking": { 124 MakeArg: func() interface{} { 125 var ret [1]CheckTrackingArg 126 return &ret 127 }, 128 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 129 typedArgs, ok := args.(*[1]CheckTrackingArg) 130 if !ok { 131 err = rpc.NewTypeError((*[1]CheckTrackingArg)(nil), args) 132 return 133 } 134 err = i.CheckTracking(ctx, typedArgs[0].SessionID) 135 return 136 }, 137 }, 138 "fakeTrackingChanged": { 139 MakeArg: func() interface{} { 140 var ret [1]FakeTrackingChangedArg 141 return &ret 142 }, 143 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 144 typedArgs, ok := args.(*[1]FakeTrackingChangedArg) 145 if !ok { 146 err = rpc.NewTypeError((*[1]FakeTrackingChangedArg)(nil), args) 147 return 148 } 149 err = i.FakeTrackingChanged(ctx, typedArgs[0]) 150 return 151 }, 152 }, 153 }, 154 } 155 } 156 157 type TrackClient struct { 158 Cli rpc.GenericClient 159 } 160 161 // This will perform identify and track. 162 // If forceRemoteCheck is true, we force all remote proofs to be checked 163 // (otherwise a cache is used). 164 func (c TrackClient) Track(ctx context.Context, __arg TrackArg) (res ConfirmResult, err error) { 165 err = c.Cli.Call(ctx, "keybase.1.track.track", []interface{}{__arg}, &res, 0*time.Millisecond) 166 return 167 } 168 169 // Track with token returned from identify. 170 func (c TrackClient) TrackWithToken(ctx context.Context, __arg TrackWithTokenArg) (err error) { 171 err = c.Cli.Call(ctx, "keybase.1.track.trackWithToken", []interface{}{__arg}, nil, 0*time.Millisecond) 172 return 173 } 174 175 // Called by the UI when the user decides *not* to track, to e.g. dismiss gregor items. 176 func (c TrackClient) DismissWithToken(ctx context.Context, __arg DismissWithTokenArg) (err error) { 177 err = c.Cli.Call(ctx, "keybase.1.track.dismissWithToken", []interface{}{__arg}, nil, 0*time.Millisecond) 178 return 179 } 180 181 func (c TrackClient) Untrack(ctx context.Context, __arg UntrackArg) (err error) { 182 err = c.Cli.Call(ctx, "keybase.1.track.untrack", []interface{}{__arg}, nil, 0*time.Millisecond) 183 return 184 } 185 186 func (c TrackClient) CheckTracking(ctx context.Context, sessionID int) (err error) { 187 __arg := CheckTrackingArg{SessionID: sessionID} 188 err = c.Cli.Call(ctx, "keybase.1.track.checkTracking", []interface{}{__arg}, nil, 0*time.Millisecond) 189 return 190 } 191 192 func (c TrackClient) FakeTrackingChanged(ctx context.Context, __arg FakeTrackingChangedArg) (err error) { 193 err = c.Cli.Call(ctx, "keybase.1.track.fakeTrackingChanged", []interface{}{__arg}, nil, 0*time.Millisecond) 194 return 195 }