-
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.
Update README and bump version to 0.2.0
- Loading branch information
Showing
3 changed files
with
58 additions
and
7 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
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 |
---|---|---|
@@ -1,7 +1,56 @@ | ||
# KraphQL [![Build Status](https://travis-ci.org/taskworld/kraph.svg?branch=master)](https://travis-ci.org/taskworld/kraph) [ ![Download](https://api.bintray.com/packages/tw/maven/kraph/images/download.svg) ](https://bintray.com/tw/maven/kraph/_latestVersion) | ||
GraphQL query builder written in Kotlin | ||
# Kraph [![Build Status](https://travis-ci.org/taskworld/kraph.svg?branch=master)](https://travis-ci.org/taskworld/kraph) [ ![Download](https://api.bintray.com/packages/tw/maven/kraph/images/download.svg) ](https://bintray.com/tw/maven/kraph/_latestVersion) | ||
In short, this is a GraphQL request JSON body builder for Kotlin. It will generate the JSON string for request body that work with GraphQL Server. For example, we have the GraphQL query for list all the notes. | ||
``` | ||
query { | ||
notes { | ||
id | ||
createdDate | ||
content | ||
author { | ||
name | ||
avatarUrl(size: 100) | ||
} | ||
} | ||
} | ||
``` | ||
And here is how we write it in Kotlin using Kraph. | ||
``` | ||
Kraph { | ||
query { | ||
fieldObject("notes") { | ||
field("id") | ||
field("createdDate") | ||
field("content") | ||
fieldObject("author") { | ||
field("name") | ||
field("avatarUrl", mapOf("size" to 100)) | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
As you can see, we can achieve our goal with just a few tweaks from the original query. | ||
|
||
**NOTE:** Kraph is still in an early stage. The usage may change in further development. | ||
|
||
Note that this library is still in alpha stage. The syntax usage may subject to change. Please see the example from unit tests file for now. | ||
### Features | ||
- DSL builder style. Make it easier to read and use. | ||
- Support both Query and Mutation operation. | ||
|
||
Any feedback and/or PRs is welcome. | ||
### Set up | ||
Adding Kraph to `build.gradle` | ||
``` | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
compile "com.taskworld.kraph:kraph:x.y.z" | ||
} | ||
``` | ||
|
||
### Usage | ||
Please see the example from `sample` folder for now. We will update this part ASAP. | ||
|
||
### 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
buildscript { | ||
ext { | ||
publish_version = '0.1.0' | ||
publish_version = '0.2.0' | ||
|
||
bintray_plugin_version = '0.3.4' | ||
|
||
|