31 lines
805 B
Cheetah
31 lines
805 B
Cheetah
package {{.Config.Package}}
|
|
|
|
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
|
|
|
import (
|
|
"context"
|
|
{{- if .ImportJSON -}}
|
|
"encoding/json"
|
|
{{end}}
|
|
|
|
"github.com/Khan/genql/graphql"
|
|
)
|
|
|
|
{{.Types}}
|
|
|
|
{{range .Operations}}
|
|
{{.Doc}}
|
|
func {{.Name}}({{if $.Config.UseContext}}ctx context.Context, {{end}}client *graphql.Client{{range .Args}}, {{.GoName}} {{.GoType}}{{end}}) (*{{.ResponseName}}, error) {
|
|
{{- if .Args -}}
|
|
variables := map[string]interface{}{
|
|
{{range .Args -}}
|
|
"{{.GraphQLName}}": {{.GoName}},
|
|
{{end}}
|
|
}
|
|
{{end}}
|
|
var retval {{.ResponseName}}
|
|
err := client.MakeRequest({{if $.Config.UseContext}}ctx{{else}}context.Background(){{end}}, `{{.Body}}`, &retval, {{if .Args}}variables{{else}}nil{{end}})
|
|
return &retval, err
|
|
}
|
|
{{end}}
|