misc bits of documentation
This commit is contained in:
@@ -69,13 +69,13 @@ See [DESIGN.md](DESIGN.md) for documentation of major design decisions in this l
|
|||||||
(+) denotes things we further need before recommending anyone else use this in prod
|
(+) denotes things we further need before recommending anyone else use this in prod
|
||||||
|
|
||||||
Generated code:
|
Generated code:
|
||||||
- add flag(s) to make a field use a pointer (for optionality or perf)
|
- add flag(s) to make a field use a pointer (for optionality or perf; see DESIGN)
|
||||||
- redo support for interfaces, unions, fragments (see DESIGN)
|
- redo support for interfaces, unions, fragments (see DESIGN)
|
||||||
- (optional) collapsing -- should be able to have `mutation { myMutation { error { code } } }` just return `(code string, err error)`
|
- (optional) collapsing -- should be able to have `mutation { myMutation { error { code } } }` just return `(code string, err error)`
|
||||||
|
|
||||||
Config options:
|
Config options:
|
||||||
- (+) proper config/arguments setup (e.g. with [viper](https://github.com/spf13/viper))
|
- (+) proper config/arguments setup (e.g. with [viper](https://github.com/spf13/viper))
|
||||||
- make client/context wiring a bit more documented and usable by humans (and allow imports for the client-getter)
|
- (+) improve client_getter to be more usable (and document it), or flag it out for now.
|
||||||
- get schema via HTTP (perhaps even via GraphQL introspection)
|
- get schema via HTTP (perhaps even via GraphQL introspection)
|
||||||
- send hash rather than full query
|
- send hash rather than full query
|
||||||
- whether names should be exported
|
- whether names should be exported
|
||||||
|
|||||||
+5
-5
@@ -50,7 +50,7 @@ type client struct {
|
|||||||
// NewClient returns a Client which makes requests to the given endpoint,
|
// NewClient returns a Client which makes requests to the given endpoint,
|
||||||
// suitable for most users.
|
// suitable for most users.
|
||||||
//
|
//
|
||||||
// The client makes requests to the given GraphQL endpoint using standard
|
// The client makes POST requests to the given GraphQL endpoint using standard
|
||||||
// GraphQL HTTP-over-JSON transport. It will use the given http client, or
|
// GraphQL HTTP-over-JSON transport. It will use the given http client, or
|
||||||
// http.DefaultClient if a nil client is passed.
|
// http.DefaultClient if a nil client is passed.
|
||||||
//
|
//
|
||||||
@@ -73,7 +73,7 @@ type response struct {
|
|||||||
Errors gqlerror.List `json:"errors"`
|
Errors gqlerror.List `json:"errors"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *client) MakeRequest(ctx context.Context, query string, retval interface{}, variables map[string]interface{}) error {
|
func (c *client) MakeRequest(ctx context.Context, query string, retval interface{}, variables map[string]interface{}) error {
|
||||||
body, err := json.Marshal(payload{
|
body, err := json.Marshal(payload{
|
||||||
Query: query,
|
Query: query,
|
||||||
Variables: variables,
|
Variables: variables,
|
||||||
@@ -83,8 +83,8 @@ func (client *client) MakeRequest(ctx context.Context, query string, retval inte
|
|||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest(
|
req, err := http.NewRequest(
|
||||||
client.method,
|
c.method,
|
||||||
client.endpoint,
|
c.endpoint,
|
||||||
bytes.NewReader(body))
|
bytes.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -93,7 +93,7 @@ func (client *client) MakeRequest(ctx context.Context, query string, retval inte
|
|||||||
if ctx != nil {
|
if ctx != nil {
|
||||||
req = req.WithContext(ctx)
|
req = req.WithContext(ctx)
|
||||||
}
|
}
|
||||||
resp, err := client.httpClient.Do(req)
|
resp, err := c.httpClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user