Skip to content

Commit 0c03e08

Browse files
committed
updated examples
1 parent 1deb666 commit 0c03e08

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ Low-level GraphQL client for Go.
1111

1212
```go
1313
// create a client (safe to share across requests)
14-
ctx := context.Background()
15-
client, err := graphql.NewClient(ctx, "https://machinebox.io/graphql")
16-
if err != nil {
17-
log.Fatal(err)
18-
}
14+
client := graphql.NewClient("https://machinebox.io/graphql")
1915

2016
// make a request
2117
req := graphql.NewRequest(`
@@ -38,6 +34,8 @@ if err := client.Run(ctx, req, &respData); err != nil {
3834
}
3935
```
4036

37+
For more information, [read the godoc package documentation](http://godoc.org/github.com/machinebox/graphql).
38+
4139
## Thanks
4240

4341
Thanks to [Chris Broadfoot](https://github.com/broady) for design help.

doc.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
// Package graphql provides a low level GraphQL client.
22
//
33
// // create a client (safe to share across requests)
4-
// ctx := context.Background()
5-
// client, err := graphql.NewClient(ctx, "https://machinebox.io/graphql")
6-
// if err != nil {
7-
// log.Fatal(err)
8-
// }
4+
// client := graphql.NewClient("https://machinebox.io/graphql")
95
//
106
// // make a request
117
// req := graphql.NewRequest(`
@@ -26,4 +22,10 @@
2622
// if err := client.Run(ctx, req, &respData); err != nil {
2723
// log.Fatal(err)
2824
// }
25+
//
26+
// Specify client
27+
//
28+
// To specify your own http.Client, use the WithHTTPClient option:
29+
// httpclient := &http.Client{}
30+
// client := graphql.NewClient("https://machinebox.io/graphql", graphql.WithHTTPClient(httpclient))
2931
package graphql

0 commit comments

Comments
 (0)