Skip to content

Commit

Permalink
Fix small misses in docs and types.
Browse files Browse the repository at this point in the history
  • Loading branch information
parkerziegler committed Nov 7, 2020
1 parent a501521 commit e53982c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ yarn add reason-urql urql graphql

We try to keep our bindings as close to latest `urql` as possible. However, `urql` tends to make releases a bit ahead of `reason-urql`. To get a compatible version, we recommend always staying strictly within this project's `peerDependency` range for `urql`.

#### 2. Add `graphql-ppx-re`.
#### 2. Add `@reasonml-community/graphql-ppx`.

To get the most out of compile time type checks for your GraphQL queries, mutations, and subscriptions, we use [`@reasonml-community/graphql-ppx`](https://github.com/reasonml-community/graphql-ppx). Add this to your project's `devDependencies`.

Expand All @@ -50,7 +50,11 @@ Add `reason-urql`, `wonka`, and `@reasonml-community/graphql-ppx` to your `bs-de

```json
{
"bs-dependencies": ["reason-urql", "wonka", "@reasonml-community/graphql-ppx"],
"bs-dependencies": [
"reason-urql",
"wonka",
"@reasonml-community/graphql-ppx"
],
"ppx-flags": ["@reasonml-community/graphql-ppx/ppx"]
}
```
Expand Down Expand Up @@ -148,6 +152,7 @@ This project follows the [all contributors spec](https://github.com/kentcdodds/a

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

## Maintenance Status
Expand Down
8 changes: 4 additions & 4 deletions docs/client-and-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ module GetAllDogs = [%graphql
|}
];
Client.query(~client, ~query=(GetAllDogs), ())
Client.query(~client, ~query=(module GetAllDogs), ())
|> Js.Promise.then_(data => {
switch(Client.(data.response)) {
| Data(d) => /* Access data returned from executing the request. */
Expand Down Expand Up @@ -253,9 +253,9 @@ Client.executeMutation(~client, ~mutation=(module LikeDog), LikeDog.{ key: "VmeR

The same as `Client.executeMutation`, but returns a `Js.Promise.t` rather than a `wonka` `source`. This method accepts all of the same arguments as `Client.executeMutation`.

| Return | Description |
| ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `Js.Promise.t(Client.clientResponse('response))` | A `Js.Promise.t` containing a record of the results of mutation execution. Use the `response` field on this record for pattern matching. |
| Return | Description |
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `Js.Promise.t(Client.clientResponse('data))` | A `Js.Promise.t` containing a record of the results of mutation execution. Use the `response` field on this record for pattern matching. |

#### Example

Expand Down
10 changes: 5 additions & 5 deletions src/Client.re
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ let make =

/* The record representing the response returned by the client after
it has been converted by urqlClientResponseToReason. */
type response('response) =
| Data('response)
type response('data) =
| Data('data)
| Error(CombinedError.t)
| Empty;

type clientResponse('response) = {
data: option('response),
type clientResponse('data) = {
data: option('data),
error: option(CombinedError.t),
extensions: option(Js.Dict.t(string)),
response: response('response),
response: response('data),
stale: option(bool),
};

Expand Down
14 changes: 7 additions & 7 deletions src/Client.rei
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,22 @@ let make:
) =>
t;

type response('response) =
| Data('response)
type response('data') =
| Data('data')
| Error(CombinedError.t)
| Empty;

type clientResponse('response) = {
data: option('response),
type clientResponse('data') = {
data: option('data'),
error: option(CombinedError.t),
extensions: option(Js.Dict.t(string)),
response: response('response),
response: response('data'),
stale: option(bool),
};

let clientResponseToReason:
(~response: Types.operationResult('data), ~parse: 'data => 'response) =>
clientResponse('response);
(~response: Types.operationResult('dataJs), ~parse: 'dataJs => 'data') =>
clientResponse('data');

let executeQuery:
(
Expand Down

0 comments on commit e53982c

Please sign in to comment.