{"id":13565829,"url":"https://github.com/prestongarno/kotlinq","last_synced_at":"2025-07-11T18:09:04.244Z","repository":{"id":91910361,"uuid":"98687463","full_name":"prestongarno/kotlinq","owner":"prestongarno","description":"Kotlin DSL for GraphQL ","archived":false,"fork":false,"pushed_at":"2018-06-18T05:18:36.000Z","size":5959,"stargazers_count":29,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-01T08:41:38.323Z","etag":null,"topics":["graphql","graphql-schema","java","kotlin"],"latest_commit_sha":null,"homepage":"http://kotlinq.org","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prestongarno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-07-28T20:52:26.000Z","updated_at":"2023-03-18T19:43:55.000Z","dependencies_parsed_at":"2023-07-23T20:30:52.660Z","dependency_job_id":null,"html_url":"https://github.com/prestongarno/kotlinq","commit_stats":null,"previous_names":["prestongarno/ktq"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prestongarno%2Fkotlinq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prestongarno%2Fkotlinq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prestongarno%2Fkotlinq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prestongarno%2Fkotlinq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prestongarno","download_url":"https://codeload.github.com/prestongarno/kotlinq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219860762,"owners_count":16556011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-schema","java","kotlin"],"created_at":"2024-08-01T13:01:56.202Z","updated_at":"2024-10-11T13:21:41.207Z","avatar_url":"https://github.com/prestongarno.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"***a Kotlin GraphQL client for composable, reusable GraphQL queries***\n-----------------------------\n\n[![Download](https://api.bintray.com/packages/prestongarno/kotlinq/kotlinq-core/images/download.svg)](https://bintray.com/com/prestongarno/kotlinq/kotlinq-core/_latestVersion)\n[![Build Status](https://travis-ci.org/prestongarno/kotlinq.svg?branch=master)](https://travis-ci.org/prestongarno/kotlinq)\n\n\n## Query DSL (new with version 0.4.0)\n\nVersion 0.4.0 supports [**ad-hoc, type-hinted**](https://github.com/prestongarno/kotlinq/blob/query-dsl/query-dsl/src/main/kotlin/org/kotlinq/dsl/extensions/FreePropertyExtensionScope.kt) but natively expressed queries and mutations!\n\n\nA powerful feature is the ability to **compose** and **reuse** graphql queries easily.\n\n\n\n## GraphQL Star Wars example\n\nDefine a \"Human\" type fragment:\n\n```\n    fun humanDef() = fragment(\"Human\") {\n      \"name\"(string)\n      \"nicknames\" listOf !string\n    }\n```\n\nDefine a \"Droid\" type fragment:\n\n```\n    fun droidDef() = fragment(\"Droid\") {\n      \"modelNumber\"(string)\n      \"owner\" on humanDef()\n    }\n```\n\nNow, define a query for Star Wars characters:\n\n```\n    fun charactersQuery(fragments: List\u003cFragment\u003e) = query {\n      \"characters\"(\"first\" to 10)..listOf {\n        on..fragments\n      }\n    }\n```\n\nQuery characters from Star Wars that are humans:\n\n```\n    val query = charactersQuery(listOf(humanDef())\n    println(query.toGraphQl(pretty = true))\n```\n\nprints: \n\n```\n{\n  characters(first: 100) {\n    __typename\n    ... on Human {\n      name\n      nicknames\n    }\n  }\n}\n```\n\nBut if you want to query both humans and droids, to do so it's as simple as:\n\n```\n    val query = charactersQuery(listOf(humanDef(), droidDef()))\n    println(query.toGraphQl(pretty = true))\n```\n\n\nwhich results in:\n\n```\n{\n  characters(first: 100) {\n    __typename\n    ... on Human {\n      name\n      nicknames\n    }\n    ... on Droid {\n      modelNumber\n      maker {\n        name\n        nicknames\n      }\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprestongarno%2Fkotlinq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprestongarno%2Fkotlinq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprestongarno%2Fkotlinq/lists"}