package main import ( "encoding/json" "fmt" "log" "git.bullercodeworks.com/brian/openstates" ) func main() { //req := graphql.NewRequest(`query Reps($lat:Float,$long:Float){people(latitude:$lat,longitude:$long,first:100){edges{node{id name sortName familyName givenName image birthDate deathDate createdAt updatedAt extras links}}}}`) //req.Var("lat", 37.700824) //req.Var("long") var res response o := openstates.NewOpenStatesApi(ApiKey) o.SetLogger(func(s string) { log.Println(s) }) props := make(map[string]interface{}) props["lat"] = 37.700824 props["long"] = -97.352906 o.MakeRequest(&res, props) //o.MakeRequest(req, &res) //fmt.Println("= Fields =") //for _, v := range res.People.Edges { // v.Node.GetFields() // break //} fmt.Println("= Result =") j, _ := json.Marshal(res) fmt.Println(string(j)) } type response struct { People people } type people struct { Edges []edge } type edge struct { Node openstates.PersonNode } type node struct { Name string }