big refactor to put the codegen onto methods of an object

This commit is contained in:
Ben Kraft
2020-04-10 15:21:23 -07:00
parent dfea9bf128
commit b600df7877
5 changed files with 78 additions and 59 deletions
+6 -6
View File
@@ -14,6 +14,12 @@ type getViewerResponse struct {
} `json:"viewer"`
}
type getUserResponse struct {
User *struct {
TheirName *string `json:"theirName"`
} `json:"user"`
}
func getViewer(ctx context.Context, client *graphql.Client) (*getViewerResponse, error) {
var retval getViewerResponse
err := client.MakeRequest(ctx, `
@@ -26,12 +32,6 @@ query getViewer {
return &retval, err
}
type getUserResponse struct {
User *struct {
TheirName *string `json:"theirName"`
} `json:"user"`
}
// getUser gets the given user's name from their username.
func getUser(ctx context.Context, client *graphql.Client, login string) (*getUserResponse, error) {
variables := map[string]interface{}{