https://github.com/lusingander/kraphql-github
Kotlin DSL for GitHub GraphQL API (GitHub API v4)
https://github.com/lusingander/kraphql-github
github github-api-v4 graphql kotlin kotlin-dsl
Last synced: 11 months ago
JSON representation
Kotlin DSL for GitHub GraphQL API (GitHub API v4)
- Host: GitHub
- URL: https://github.com/lusingander/kraphql-github
- Owner: lusingander
- License: mit
- Created: 2020-11-15T01:26:24.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T09:37:39.000Z (over 2 years ago)
- Last Synced: 2025-01-16T16:23:54.987Z (about 1 year ago)
- Topics: github, github-api-v4, graphql, kotlin, kotlin-dsl
- Language: Kotlin
- Homepage: https://jitpack.io/#lusingander/kraphql-github
- Size: 1.68 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
kraphql-github
====
[](https://jitpack.io/#lusingander/kraphql-github)
Kotlin DSL for [GitHub GraphQL API (GitHub API v4)](https://docs.github.com/en/free-pro-team@latest/graphql)
Current version: based on the [schema 2023-10-07](https://docs.github.com/en/free-pro-team@latest/graphql/overview/changelog#schema-changes-for-2023-10-07).
## About
With the power of Kotlin DSL, you can effortlessly build queries for the GitHub GraphQL API while ensuring type correctness.

## Installation
```groovy
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.lusingander:kraphql-github:v0.0.33'
}
```
## Usage
```kotlin
fun main() {
val q = query {
search(query = "kotlin in:name sort:stars", first = 10, type = SearchType.REPOSITORY) {
nodes {
`on Repository` {
name
owner {
login
}
description
stargazerCount
pullRequests(first = 5, orderBy = IssueOrder(field = IssueOrderField.UPDATED_AT, direction = OrderDirection.DESC)) {
nodes {
number
title
updatedAt
}
}
}
}
repositoryCount
}
}
println(q.toString())
// println(q.toEscapedString())
// Output: (it doesn't actually include line breaks)
//
// query {
// search(first: 10, query: "kotlin in:name sort:stars", type: REPOSITORY) {
// nodes {
// ... on Repository {
// name
// owner {
// login
// }
// description
// stargazerCount
// pullRequests(first: 5, orderBy: {direction: DESC, field: UPDATED_AT}) {
// nodes {
// number
// title
// updatedAt
// }
// }
// }
// }
// repositoryCount
// }
// }
}
```
For more details, see [examples.md](./examples.md).
## Related projects
Source codes are generated by [lusingander/kraphql](https://github.com/lusingander/kraphql).