github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/apiserver.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/apiserver.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 APIRes struct { 13 Status string `codec:"status" json:"status"` 14 Body string `codec:"body" json:"body"` 15 HttpStatus int `codec:"httpStatus" json:"httpStatus"` 16 AppStatus string `codec:"appStatus" json:"appStatus"` 17 } 18 19 func (o APIRes) DeepCopy() APIRes { 20 return APIRes{ 21 Status: o.Status, 22 Body: o.Body, 23 HttpStatus: o.HttpStatus, 24 AppStatus: o.AppStatus, 25 } 26 } 27 28 type GetArg struct { 29 Endpoint string `codec:"endpoint" json:"endpoint"` 30 Args []StringKVPair `codec:"args" json:"args"` 31 HttpStatus []int `codec:"httpStatus" json:"httpStatus"` 32 AppStatusCode []int `codec:"appStatusCode" json:"appStatusCode"` 33 } 34 35 type DeleteArg struct { 36 Endpoint string `codec:"endpoint" json:"endpoint"` 37 Args []StringKVPair `codec:"args" json:"args"` 38 HttpStatus []int `codec:"httpStatus" json:"httpStatus"` 39 AppStatusCode []int `codec:"appStatusCode" json:"appStatusCode"` 40 } 41 42 type GetWithSessionArg struct { 43 Endpoint string `codec:"endpoint" json:"endpoint"` 44 Args []StringKVPair `codec:"args" json:"args"` 45 HttpStatus []int `codec:"httpStatus" json:"httpStatus"` 46 AppStatusCode []int `codec:"appStatusCode" json:"appStatusCode"` 47 UseText *bool `codec:"useText,omitempty" json:"useText,omitempty"` 48 } 49 50 type PostArg struct { 51 Endpoint string `codec:"endpoint" json:"endpoint"` 52 Args []StringKVPair `codec:"args" json:"args"` 53 HttpStatus []int `codec:"httpStatus" json:"httpStatus"` 54 AppStatusCode []int `codec:"appStatusCode" json:"appStatusCode"` 55 } 56 57 type PostJSONArg struct { 58 Endpoint string `codec:"endpoint" json:"endpoint"` 59 Args []StringKVPair `codec:"args" json:"args"` 60 JSONPayload []StringKVPair `codec:"JSONPayload" json:"JSONPayload"` 61 HttpStatus []int `codec:"httpStatus" json:"httpStatus"` 62 AppStatusCode []int `codec:"appStatusCode" json:"appStatusCode"` 63 } 64 65 type ApiserverInterface interface { 66 Get(context.Context, GetArg) (APIRes, error) 67 Delete(context.Context, DeleteArg) (APIRes, error) 68 GetWithSession(context.Context, GetWithSessionArg) (APIRes, error) 69 Post(context.Context, PostArg) (APIRes, error) 70 PostJSON(context.Context, PostJSONArg) (APIRes, error) 71 } 72 73 func ApiserverProtocol(i ApiserverInterface) rpc.Protocol { 74 return rpc.Protocol{ 75 Name: "keybase.1.apiserver", 76 Methods: map[string]rpc.ServeHandlerDescription{ 77 "Get": { 78 MakeArg: func() interface{} { 79 var ret [1]GetArg 80 return &ret 81 }, 82 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 83 typedArgs, ok := args.(*[1]GetArg) 84 if !ok { 85 err = rpc.NewTypeError((*[1]GetArg)(nil), args) 86 return 87 } 88 ret, err = i.Get(ctx, typedArgs[0]) 89 return 90 }, 91 }, 92 "Delete": { 93 MakeArg: func() interface{} { 94 var ret [1]DeleteArg 95 return &ret 96 }, 97 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 98 typedArgs, ok := args.(*[1]DeleteArg) 99 if !ok { 100 err = rpc.NewTypeError((*[1]DeleteArg)(nil), args) 101 return 102 } 103 ret, err = i.Delete(ctx, typedArgs[0]) 104 return 105 }, 106 }, 107 "GetWithSession": { 108 MakeArg: func() interface{} { 109 var ret [1]GetWithSessionArg 110 return &ret 111 }, 112 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 113 typedArgs, ok := args.(*[1]GetWithSessionArg) 114 if !ok { 115 err = rpc.NewTypeError((*[1]GetWithSessionArg)(nil), args) 116 return 117 } 118 ret, err = i.GetWithSession(ctx, typedArgs[0]) 119 return 120 }, 121 }, 122 "Post": { 123 MakeArg: func() interface{} { 124 var ret [1]PostArg 125 return &ret 126 }, 127 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 128 typedArgs, ok := args.(*[1]PostArg) 129 if !ok { 130 err = rpc.NewTypeError((*[1]PostArg)(nil), args) 131 return 132 } 133 ret, err = i.Post(ctx, typedArgs[0]) 134 return 135 }, 136 }, 137 "PostJSON": { 138 MakeArg: func() interface{} { 139 var ret [1]PostJSONArg 140 return &ret 141 }, 142 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 143 typedArgs, ok := args.(*[1]PostJSONArg) 144 if !ok { 145 err = rpc.NewTypeError((*[1]PostJSONArg)(nil), args) 146 return 147 } 148 ret, err = i.PostJSON(ctx, typedArgs[0]) 149 return 150 }, 151 }, 152 }, 153 } 154 } 155 156 type ApiserverClient struct { 157 Cli rpc.GenericClient 158 } 159 160 func (c ApiserverClient) Get(ctx context.Context, __arg GetArg) (res APIRes, err error) { 161 err = c.Cli.Call(ctx, "keybase.1.apiserver.Get", []interface{}{__arg}, &res, 0*time.Millisecond) 162 return 163 } 164 165 func (c ApiserverClient) Delete(ctx context.Context, __arg DeleteArg) (res APIRes, err error) { 166 err = c.Cli.Call(ctx, "keybase.1.apiserver.Delete", []interface{}{__arg}, &res, 0*time.Millisecond) 167 return 168 } 169 170 func (c ApiserverClient) GetWithSession(ctx context.Context, __arg GetWithSessionArg) (res APIRes, err error) { 171 err = c.Cli.Call(ctx, "keybase.1.apiserver.GetWithSession", []interface{}{__arg}, &res, 0*time.Millisecond) 172 return 173 } 174 175 func (c ApiserverClient) Post(ctx context.Context, __arg PostArg) (res APIRes, err error) { 176 err = c.Cli.Call(ctx, "keybase.1.apiserver.Post", []interface{}{__arg}, &res, 0*time.Millisecond) 177 return 178 } 179 180 func (c ApiserverClient) PostJSON(ctx context.Context, __arg PostJSONArg) (res APIRes, err error) { 181 err = c.Cli.Call(ctx, "keybase.1.apiserver.PostJSON", []interface{}{__arg}, &res, 0*time.Millisecond) 182 return 183 }