github.com/keybase/client/go@v0.0.0-20240520164431-4f512a4c85a3/protocol/keybase1/avatars.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/avatars.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 AvatarUrl string 13 14 func (o AvatarUrl) DeepCopy() AvatarUrl { 15 return o 16 } 17 18 type AvatarFormat string 19 20 func (o AvatarFormat) DeepCopy() AvatarFormat { 21 return o 22 } 23 24 type LoadAvatarsRes struct { 25 Picmap map[string]map[AvatarFormat]AvatarUrl `codec:"picmap" json:"picmap"` 26 } 27 28 func (o LoadAvatarsRes) DeepCopy() LoadAvatarsRes { 29 return LoadAvatarsRes{ 30 Picmap: (func(x map[string]map[AvatarFormat]AvatarUrl) map[string]map[AvatarFormat]AvatarUrl { 31 if x == nil { 32 return nil 33 } 34 ret := make(map[string]map[AvatarFormat]AvatarUrl, len(x)) 35 for k, v := range x { 36 kCopy := k 37 vCopy := (func(x map[AvatarFormat]AvatarUrl) map[AvatarFormat]AvatarUrl { 38 if x == nil { 39 return nil 40 } 41 ret := make(map[AvatarFormat]AvatarUrl, len(x)) 42 for k, v := range x { 43 kCopy := k.DeepCopy() 44 vCopy := v.DeepCopy() 45 ret[kCopy] = vCopy 46 } 47 return ret 48 })(v) 49 ret[kCopy] = vCopy 50 } 51 return ret 52 })(o.Picmap), 53 } 54 } 55 56 type AvatarClearCacheMsg struct { 57 Name string `codec:"name" json:"name"` 58 Formats []AvatarFormat `codec:"formats" json:"formats"` 59 Typ AvatarUpdateType `codec:"typ" json:"typ"` 60 } 61 62 func (o AvatarClearCacheMsg) DeepCopy() AvatarClearCacheMsg { 63 return AvatarClearCacheMsg{ 64 Name: o.Name, 65 Formats: (func(x []AvatarFormat) []AvatarFormat { 66 if x == nil { 67 return nil 68 } 69 ret := make([]AvatarFormat, len(x)) 70 for i, v := range x { 71 vCopy := v.DeepCopy() 72 ret[i] = vCopy 73 } 74 return ret 75 })(o.Formats), 76 Typ: o.Typ.DeepCopy(), 77 } 78 } 79 80 type LoadUserAvatarsArg struct { 81 Names []string `codec:"names" json:"names"` 82 Formats []AvatarFormat `codec:"formats" json:"formats"` 83 } 84 85 type LoadTeamAvatarsArg struct { 86 Names []string `codec:"names" json:"names"` 87 Formats []AvatarFormat `codec:"formats" json:"formats"` 88 } 89 90 type AvatarsInterface interface { 91 LoadUserAvatars(context.Context, LoadUserAvatarsArg) (LoadAvatarsRes, error) 92 LoadTeamAvatars(context.Context, LoadTeamAvatarsArg) (LoadAvatarsRes, error) 93 } 94 95 func AvatarsProtocol(i AvatarsInterface) rpc.Protocol { 96 return rpc.Protocol{ 97 Name: "keybase.1.avatars", 98 Methods: map[string]rpc.ServeHandlerDescription{ 99 "loadUserAvatars": { 100 MakeArg: func() interface{} { 101 var ret [1]LoadUserAvatarsArg 102 return &ret 103 }, 104 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 105 typedArgs, ok := args.(*[1]LoadUserAvatarsArg) 106 if !ok { 107 err = rpc.NewTypeError((*[1]LoadUserAvatarsArg)(nil), args) 108 return 109 } 110 ret, err = i.LoadUserAvatars(ctx, typedArgs[0]) 111 return 112 }, 113 }, 114 "loadTeamAvatars": { 115 MakeArg: func() interface{} { 116 var ret [1]LoadTeamAvatarsArg 117 return &ret 118 }, 119 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 120 typedArgs, ok := args.(*[1]LoadTeamAvatarsArg) 121 if !ok { 122 err = rpc.NewTypeError((*[1]LoadTeamAvatarsArg)(nil), args) 123 return 124 } 125 ret, err = i.LoadTeamAvatars(ctx, typedArgs[0]) 126 return 127 }, 128 }, 129 }, 130 } 131 } 132 133 type AvatarsClient struct { 134 Cli rpc.GenericClient 135 } 136 137 func (c AvatarsClient) LoadUserAvatars(ctx context.Context, __arg LoadUserAvatarsArg) (res LoadAvatarsRes, err error) { 138 err = c.Cli.Call(ctx, "keybase.1.avatars.loadUserAvatars", []interface{}{__arg}, &res, 0*time.Millisecond) 139 return 140 } 141 142 func (c AvatarsClient) LoadTeamAvatars(ctx context.Context, __arg LoadTeamAvatarsArg) (res LoadAvatarsRes, err error) { 143 err = c.Cli.Call(ctx, "keybase.1.avatars.loadTeamAvatars", []interface{}{__arg}, &res, 0*time.Millisecond) 144 return 145 }