github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/notify_team.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_team.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 TeamChangeSet struct { 14 MembershipChanged bool `codec:"membershipChanged" json:"membershipChanged"` 15 KeyRotated bool `codec:"keyRotated" json:"keyRotated"` 16 Renamed bool `codec:"renamed" json:"renamed"` 17 Misc bool `codec:"misc" json:"misc"` 18 } 19 20 func (o TeamChangeSet) DeepCopy() TeamChangeSet { 21 return TeamChangeSet{ 22 MembershipChanged: o.MembershipChanged, 23 KeyRotated: o.KeyRotated, 24 Renamed: o.Renamed, 25 Misc: o.Misc, 26 } 27 } 28 29 type TeamChangedSource int 30 31 const ( 32 TeamChangedSource_SERVER TeamChangedSource = 0 33 TeamChangedSource_LOCAL TeamChangedSource = 1 34 TeamChangedSource_LOCAL_RENAME TeamChangedSource = 2 35 ) 36 37 func (o TeamChangedSource) DeepCopy() TeamChangedSource { return o } 38 39 var TeamChangedSourceMap = map[string]TeamChangedSource{ 40 "SERVER": 0, 41 "LOCAL": 1, 42 "LOCAL_RENAME": 2, 43 } 44 45 var TeamChangedSourceRevMap = map[TeamChangedSource]string{ 46 0: "SERVER", 47 1: "LOCAL", 48 2: "LOCAL_RENAME", 49 } 50 51 func (e TeamChangedSource) String() string { 52 if v, ok := TeamChangedSourceRevMap[e]; ok { 53 return v 54 } 55 return fmt.Sprintf("%v", int(e)) 56 } 57 58 type AvatarUpdateType int 59 60 const ( 61 AvatarUpdateType_NONE AvatarUpdateType = 0 62 AvatarUpdateType_USER AvatarUpdateType = 1 63 AvatarUpdateType_TEAM AvatarUpdateType = 2 64 ) 65 66 func (o AvatarUpdateType) DeepCopy() AvatarUpdateType { return o } 67 68 var AvatarUpdateTypeMap = map[string]AvatarUpdateType{ 69 "NONE": 0, 70 "USER": 1, 71 "TEAM": 2, 72 } 73 74 var AvatarUpdateTypeRevMap = map[AvatarUpdateType]string{ 75 0: "NONE", 76 1: "USER", 77 2: "TEAM", 78 } 79 80 func (e AvatarUpdateType) String() string { 81 if v, ok := AvatarUpdateTypeRevMap[e]; ok { 82 return v 83 } 84 return fmt.Sprintf("%v", int(e)) 85 } 86 87 type TeamChangedByIDArg struct { 88 TeamID TeamID `codec:"teamID" json:"teamID"` 89 LatestSeqno Seqno `codec:"latestSeqno" json:"latestSeqno"` 90 ImplicitTeam bool `codec:"implicitTeam" json:"implicitTeam"` 91 Changes TeamChangeSet `codec:"changes" json:"changes"` 92 LatestHiddenSeqno Seqno `codec:"latestHiddenSeqno" json:"latestHiddenSeqno"` 93 LatestOffchainSeqno Seqno `codec:"latestOffchainSeqno" json:"latestOffchainSeqno"` 94 Source TeamChangedSource `codec:"source" json:"source"` 95 } 96 97 type TeamChangedByNameArg struct { 98 TeamName string `codec:"teamName" json:"teamName"` 99 LatestSeqno Seqno `codec:"latestSeqno" json:"latestSeqno"` 100 ImplicitTeam bool `codec:"implicitTeam" json:"implicitTeam"` 101 Changes TeamChangeSet `codec:"changes" json:"changes"` 102 LatestHiddenSeqno Seqno `codec:"latestHiddenSeqno" json:"latestHiddenSeqno"` 103 LatestOffchainSeqno Seqno `codec:"latestOffchainSeqno" json:"latestOffchainSeqno"` 104 Source TeamChangedSource `codec:"source" json:"source"` 105 } 106 107 type TeamDeletedArg struct { 108 TeamID TeamID `codec:"teamID" json:"teamID"` 109 } 110 111 type TeamAbandonedArg struct { 112 TeamID TeamID `codec:"teamID" json:"teamID"` 113 } 114 115 type TeamExitArg struct { 116 TeamID TeamID `codec:"teamID" json:"teamID"` 117 } 118 119 type NewlyAddedToTeamArg struct { 120 TeamID TeamID `codec:"teamID" json:"teamID"` 121 } 122 123 type TeamRoleMapChangedArg struct { 124 NewVersion UserTeamVersion `codec:"newVersion" json:"newVersion"` 125 } 126 127 type AvatarUpdatedArg struct { 128 Name string `codec:"name" json:"name"` 129 Formats []AvatarFormat `codec:"formats" json:"formats"` 130 Typ AvatarUpdateType `codec:"typ" json:"typ"` 131 } 132 133 type TeamMetadataUpdateArg struct { 134 } 135 136 type TeamTreeMembershipsPartialArg struct { 137 Membership TeamTreeMembership `codec:"membership" json:"membership"` 138 } 139 140 type TeamTreeMembershipsDoneArg struct { 141 Result TeamTreeMembershipsDoneResult `codec:"result" json:"result"` 142 } 143 144 type NotifyTeamInterface interface { 145 TeamChangedByID(context.Context, TeamChangedByIDArg) error 146 TeamChangedByName(context.Context, TeamChangedByNameArg) error 147 TeamDeleted(context.Context, TeamID) error 148 TeamAbandoned(context.Context, TeamID) error 149 TeamExit(context.Context, TeamID) error 150 NewlyAddedToTeam(context.Context, TeamID) error 151 TeamRoleMapChanged(context.Context, UserTeamVersion) error 152 AvatarUpdated(context.Context, AvatarUpdatedArg) error 153 TeamMetadataUpdate(context.Context) error 154 TeamTreeMembershipsPartial(context.Context, TeamTreeMembership) error 155 TeamTreeMembershipsDone(context.Context, TeamTreeMembershipsDoneResult) error 156 } 157 158 func NotifyTeamProtocol(i NotifyTeamInterface) rpc.Protocol { 159 return rpc.Protocol{ 160 Name: "keybase.1.NotifyTeam", 161 Methods: map[string]rpc.ServeHandlerDescription{ 162 "teamChangedByID": { 163 MakeArg: func() interface{} { 164 var ret [1]TeamChangedByIDArg 165 return &ret 166 }, 167 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 168 typedArgs, ok := args.(*[1]TeamChangedByIDArg) 169 if !ok { 170 err = rpc.NewTypeError((*[1]TeamChangedByIDArg)(nil), args) 171 return 172 } 173 err = i.TeamChangedByID(ctx, typedArgs[0]) 174 return 175 }, 176 }, 177 "teamChangedByName": { 178 MakeArg: func() interface{} { 179 var ret [1]TeamChangedByNameArg 180 return &ret 181 }, 182 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 183 typedArgs, ok := args.(*[1]TeamChangedByNameArg) 184 if !ok { 185 err = rpc.NewTypeError((*[1]TeamChangedByNameArg)(nil), args) 186 return 187 } 188 err = i.TeamChangedByName(ctx, typedArgs[0]) 189 return 190 }, 191 }, 192 "teamDeleted": { 193 MakeArg: func() interface{} { 194 var ret [1]TeamDeletedArg 195 return &ret 196 }, 197 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 198 typedArgs, ok := args.(*[1]TeamDeletedArg) 199 if !ok { 200 err = rpc.NewTypeError((*[1]TeamDeletedArg)(nil), args) 201 return 202 } 203 err = i.TeamDeleted(ctx, typedArgs[0].TeamID) 204 return 205 }, 206 }, 207 "teamAbandoned": { 208 MakeArg: func() interface{} { 209 var ret [1]TeamAbandonedArg 210 return &ret 211 }, 212 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 213 typedArgs, ok := args.(*[1]TeamAbandonedArg) 214 if !ok { 215 err = rpc.NewTypeError((*[1]TeamAbandonedArg)(nil), args) 216 return 217 } 218 err = i.TeamAbandoned(ctx, typedArgs[0].TeamID) 219 return 220 }, 221 }, 222 "teamExit": { 223 MakeArg: func() interface{} { 224 var ret [1]TeamExitArg 225 return &ret 226 }, 227 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 228 typedArgs, ok := args.(*[1]TeamExitArg) 229 if !ok { 230 err = rpc.NewTypeError((*[1]TeamExitArg)(nil), args) 231 return 232 } 233 err = i.TeamExit(ctx, typedArgs[0].TeamID) 234 return 235 }, 236 }, 237 "newlyAddedToTeam": { 238 MakeArg: func() interface{} { 239 var ret [1]NewlyAddedToTeamArg 240 return &ret 241 }, 242 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 243 typedArgs, ok := args.(*[1]NewlyAddedToTeamArg) 244 if !ok { 245 err = rpc.NewTypeError((*[1]NewlyAddedToTeamArg)(nil), args) 246 return 247 } 248 err = i.NewlyAddedToTeam(ctx, typedArgs[0].TeamID) 249 return 250 }, 251 }, 252 "teamRoleMapChanged": { 253 MakeArg: func() interface{} { 254 var ret [1]TeamRoleMapChangedArg 255 return &ret 256 }, 257 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 258 typedArgs, ok := args.(*[1]TeamRoleMapChangedArg) 259 if !ok { 260 err = rpc.NewTypeError((*[1]TeamRoleMapChangedArg)(nil), args) 261 return 262 } 263 err = i.TeamRoleMapChanged(ctx, typedArgs[0].NewVersion) 264 return 265 }, 266 }, 267 "avatarUpdated": { 268 MakeArg: func() interface{} { 269 var ret [1]AvatarUpdatedArg 270 return &ret 271 }, 272 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 273 typedArgs, ok := args.(*[1]AvatarUpdatedArg) 274 if !ok { 275 err = rpc.NewTypeError((*[1]AvatarUpdatedArg)(nil), args) 276 return 277 } 278 err = i.AvatarUpdated(ctx, typedArgs[0]) 279 return 280 }, 281 }, 282 "teamMetadataUpdate": { 283 MakeArg: func() interface{} { 284 var ret [1]TeamMetadataUpdateArg 285 return &ret 286 }, 287 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 288 err = i.TeamMetadataUpdate(ctx) 289 return 290 }, 291 }, 292 "teamTreeMembershipsPartial": { 293 MakeArg: func() interface{} { 294 var ret [1]TeamTreeMembershipsPartialArg 295 return &ret 296 }, 297 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 298 typedArgs, ok := args.(*[1]TeamTreeMembershipsPartialArg) 299 if !ok { 300 err = rpc.NewTypeError((*[1]TeamTreeMembershipsPartialArg)(nil), args) 301 return 302 } 303 err = i.TeamTreeMembershipsPartial(ctx, typedArgs[0].Membership) 304 return 305 }, 306 }, 307 "teamTreeMembershipsDone": { 308 MakeArg: func() interface{} { 309 var ret [1]TeamTreeMembershipsDoneArg 310 return &ret 311 }, 312 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 313 typedArgs, ok := args.(*[1]TeamTreeMembershipsDoneArg) 314 if !ok { 315 err = rpc.NewTypeError((*[1]TeamTreeMembershipsDoneArg)(nil), args) 316 return 317 } 318 err = i.TeamTreeMembershipsDone(ctx, typedArgs[0].Result) 319 return 320 }, 321 }, 322 }, 323 } 324 } 325 326 type NotifyTeamClient struct { 327 Cli rpc.GenericClient 328 } 329 330 func (c NotifyTeamClient) TeamChangedByID(ctx context.Context, __arg TeamChangedByIDArg) (err error) { 331 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamChangedByID", []interface{}{__arg}, 0*time.Millisecond) 332 return 333 } 334 335 func (c NotifyTeamClient) TeamChangedByName(ctx context.Context, __arg TeamChangedByNameArg) (err error) { 336 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamChangedByName", []interface{}{__arg}, 0*time.Millisecond) 337 return 338 } 339 340 func (c NotifyTeamClient) TeamDeleted(ctx context.Context, teamID TeamID) (err error) { 341 __arg := TeamDeletedArg{TeamID: teamID} 342 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamDeleted", []interface{}{__arg}, 0*time.Millisecond) 343 return 344 } 345 346 func (c NotifyTeamClient) TeamAbandoned(ctx context.Context, teamID TeamID) (err error) { 347 __arg := TeamAbandonedArg{TeamID: teamID} 348 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamAbandoned", []interface{}{__arg}, 0*time.Millisecond) 349 return 350 } 351 352 func (c NotifyTeamClient) TeamExit(ctx context.Context, teamID TeamID) (err error) { 353 __arg := TeamExitArg{TeamID: teamID} 354 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamExit", []interface{}{__arg}, 0*time.Millisecond) 355 return 356 } 357 358 func (c NotifyTeamClient) NewlyAddedToTeam(ctx context.Context, teamID TeamID) (err error) { 359 __arg := NewlyAddedToTeamArg{TeamID: teamID} 360 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.newlyAddedToTeam", []interface{}{__arg}, 0*time.Millisecond) 361 return 362 } 363 364 func (c NotifyTeamClient) TeamRoleMapChanged(ctx context.Context, newVersion UserTeamVersion) (err error) { 365 __arg := TeamRoleMapChangedArg{NewVersion: newVersion} 366 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamRoleMapChanged", []interface{}{__arg}, 0*time.Millisecond) 367 return 368 } 369 370 func (c NotifyTeamClient) AvatarUpdated(ctx context.Context, __arg AvatarUpdatedArg) (err error) { 371 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.avatarUpdated", []interface{}{__arg}, 0*time.Millisecond) 372 return 373 } 374 375 func (c NotifyTeamClient) TeamMetadataUpdate(ctx context.Context) (err error) { 376 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamMetadataUpdate", []interface{}{TeamMetadataUpdateArg{}}, 0*time.Millisecond) 377 return 378 } 379 380 func (c NotifyTeamClient) TeamTreeMembershipsPartial(ctx context.Context, membership TeamTreeMembership) (err error) { 381 __arg := TeamTreeMembershipsPartialArg{Membership: membership} 382 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamTreeMembershipsPartial", []interface{}{__arg}, 0*time.Millisecond) 383 return 384 } 385 386 func (c NotifyTeamClient) TeamTreeMembershipsDone(ctx context.Context, result TeamTreeMembershipsDoneResult) (err error) { 387 __arg := TeamTreeMembershipsDoneArg{Result: result} 388 err = c.Cli.Notify(ctx, "keybase.1.NotifyTeam.teamTreeMembershipsDone", []interface{}{__arg}, 0*time.Millisecond) 389 return 390 }