-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename connection to cursorConnection and update README
- Loading branch information
Showing
5 changed files
with
79 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,8 +51,8 @@ Adding Kraph to `build.gradle` | |
|
||
### Guide | ||
If you are not familiar with GraphQL syntax, We recommended to read on this [specification](https://facebook.github.io/graphql/) to have an overview of how to write Graphql. Usually, you should be able to use the query from other tools(e.g. [GraphiQL](https://github.com/graphql/graphiql)) with a few tweaks. First, let's see what Kraph provided for you. | ||
|
||
- `query` represents QUERY operation in GraphQL. It can be named by passing String as a parameter. The `query` block can only contains `field` or `fieldObject`. | ||
#### Simple GraphQL | ||
- `query`/`mutation` represents QUERY and MUTATION operation in GraphQL. It can be named by passing String as a parameter. | ||
``` | ||
/* | ||
* query GetUsers { | ||
|
@@ -64,6 +64,17 @@ If you are not familiar with GraphQL syntax, We recommended to read on this [spe | |
... | ||
} | ||
} | ||
/* | ||
* mutation updateUserProfile { | ||
* ... | ||
* } | ||
*/ | ||
Kraph { | ||
mutation("UpdateUserProfile") { | ||
... | ||
} | ||
} | ||
``` | ||
- `field` and `fieldObject` represents FIELD in SELECTION SET. The different is that `fieldObject` allow you to have it owns SELECTION SET, which represent data object in GraphQL. Both of them have a parameter named `args` for arguments in paritcular field. | ||
``` | ||
|
@@ -86,19 +97,57 @@ If you are not familiar with GraphQL syntax, We recommended to read on this [spe | |
} | ||
} | ||
``` | ||
- `mutation` represents MUTATION operation in GraphQL. The `mutation` block can have only contains `func`. | ||
#### Relay | ||
- `func` represents as FIELD inside MUTATION block that follow [Relay Input Object Mutations](https://facebook.github.io/relay/graphql/mutations.htm) specification. | ||
``` | ||
/* | ||
* mutation updateUserProfile { | ||
* ... | ||
* mutation { | ||
* userLogin(input: {email: "[email protected]", password: "abcd1234"}) { | ||
* accessToken | ||
* user { | ||
* id | ||
* } | ||
* } | ||
* } | ||
*/ | ||
Kraph { | ||
mutation("UpdateUserProfile") { | ||
... | ||
mutation { | ||
func("userLogin", input = mapOf("email" to "[email protected]", "password" to "abcd1234")) { | ||
field("accessToken") | ||
fieldObject("") { | ||
field("id") | ||
field("email") | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
- `cursorConnection` represents as FIELD that follow [Relay Cursor Connections](https://facebook.github.io/relay/graphql/connections.htm) specification | ||
``` | ||
/* | ||
* query { | ||
* users(first: 10, after: "user::1234") { | ||
* edges { | ||
* node { | ||
* id | ||
* name | ||
* } | ||
* } | ||
* } | ||
* } | ||
*/ | ||
Kraph { | ||
cursorConnection("users", first = 10, after = "user::1234") { | ||
edges { | ||
node { | ||
field("id") | ||
field("name") | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
- `func` represents as FIELD inside MUTATION block. The reason we did not used `fieldObject` | ||
### Contributing to Kraph | ||
We use Github issues for tracking bugs and requests. Any feedback and/or PRs is welcome. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters