genql: quick hack at variables

This commit is contained in:
Ben Kraft
2020-01-02 17:52:55 -08:00
parent 77670363d3
commit 9746c818fd
7 changed files with 111 additions and 30 deletions
+4 -4
View File
@@ -25,14 +25,14 @@ func NewClient(endpoint string, httpClient *http.Client) *Client {
}
type payload struct {
Query string `json:"query"`
Variables map[string]string `json:"variables"`
Query string `json:"query"`
Variables map[string]interface{} `json:"variables"`
}
func (client *Client) MakeRequest(ctx context.Context, query string, retval interface{}) error {
func (client *Client) MakeRequest(ctx context.Context, query string, retval interface{}, variables map[string]interface{}) error {
body, err := json.Marshal(payload{
Query: query,
Variables: nil, // TODO
Variables: variables,
})
if err != nil {
return err