| 215 | } |
| 216 | |
| 217 | func GraphQLMutation(body string, cb func(map[string]interface{})) Responder { |
| 218 | return func(req *http.Request) (*http.Response, error) { |
| 219 | var bodyData struct { |
| 220 | Variables struct { |
| 221 | Input map[string]interface{} |
| 222 | } |
| 223 | } |
| 224 | err := decodeJSONBody(req, &bodyData) |
| 225 | if err != nil { |
| 226 | return nil, err |
| 227 | } |
| 228 | cb(bodyData.Variables.Input) |
| 229 | |
| 230 | return httpResponse(200, req, bytes.NewBufferString(body)), nil |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | func GraphQLQuery(body string, cb func(string, map[string]interface{})) Responder { |
| 235 | return func(req *http.Request) (*http.Response, error) { |