All Projects β†’ apollographql β†’ Apollo Android

apollographql / Apollo Android

Licence: mit
πŸ€– Β A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Apollo Android

Apollo Client
πŸš€ Β A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
Stars: ✭ 17,070 (+478.84%)
Mutual labels:  graphql, apollographql, graphql-client
StarWars
Minimal GraphQL based Jetpack Compose, Wear Compose and SwiftUI Kotlin Multiplatform sample (using StarWars endpoint - https://graphql.org/swapi-graphql)
Stars: ✭ 165 (-94.4%)
Mutual labels:  graphql-client, apollographql, kotlin-multiplatform
Graphql Query Test Mock
Easily mock GraphQL queries in your Relay Modern / Apollo / any-other-GraphQL-client tests.
Stars: ✭ 49 (-98.34%)
Mutual labels:  graphql, apollographql, graphql-client
Apollo Ios
πŸ“± Β A strongly-typed, caching GraphQL client for iOS, written in Swift.
Stars: ✭ 3,192 (+8.24%)
Mutual labels:  graphql, apollographql, graphql-client
Apollo Angular
A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
Stars: ✭ 1,058 (-64.12%)
Mutual labels:  graphql, apollographql, graphql-client
Aboutlibraries
AboutLibraries automatically detects all dependencies of a project and collects their information including the license. Optionally visualising it via the provided ui components.
Stars: ✭ 2,777 (-5.83%)
Mutual labels:  multiplatform, kotlin-multiplatform
Python Graphql Client
Simple GraphQL client for Python 2.7+
Stars: ✭ 133 (-95.49%)
Mutual labels:  graphql, graphql-client
Neuron
A GraphQL client for Elixir
Stars: ✭ 244 (-91.73%)
Mutual labels:  graphql, graphql-client
Apollo Opentracing
Performance trace your Apollo GraphQL server with Opentracing
Stars: ✭ 154 (-94.78%)
Mutual labels:  graphql, apollographql
Client Side Graphql
Stars: ✭ 119 (-95.96%)
Mutual labels:  graphql, graphql-client
Apollo Server
🌍  Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more.
Stars: ✭ 12,145 (+311.83%)
Mutual labels:  graphql, apollographql
Modelizr
Generate GraphQL queries from models that can be mocked and normalized.
Stars: ✭ 175 (-94.07%)
Mutual labels:  graphql, graphql-client
Apollo Federation Ruby
A Ruby implementation of Apollo Federation
Stars: ✭ 131 (-95.56%)
Mutual labels:  graphql, apollographql
Apollo2 Subscriptions How To
Apollo Server 2 how to setup subscriptions
Stars: ✭ 125 (-95.76%)
Mutual labels:  graphql, apollographql
Githunt Angular
An Apollo with Angular full-stack example app: vote for your favorite GitHub repos!
Stars: ✭ 144 (-95.12%)
Mutual labels:  graphql, apollographql
React Graphql Github Apollo
πŸš€ A React + Apollo + GraphQL GitHub Client. Your opportunity to learn about these technologies in a real world application.
Stars: ✭ 1,563 (-47%)
Mutual labels:  graphql, apollographql
Graphql Kafka Subscriptions
Apollo graphql subscriptions over Kafka protocol
Stars: ✭ 154 (-94.78%)
Mutual labels:  graphql, apollographql
Graphql.js
A Simple and Isomorphic GraphQL Client for JavaScript
Stars: ✭ 2,206 (-25.19%)
Mutual labels:  graphql, graphql-client
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+2.03%)
Mutual labels:  graphql, graphql-client
Gramps Legacy
The core data source combination engine of GrAMPS.
Stars: ✭ 198 (-93.29%)
Mutual labels:  graphql, apollographql

Apollo Kotlin

GitHub license Join the community Slack CI Maven Central OSS Snapshots

Apollo Kotlin (formerly known as Apollo Android) is a GraphQL client that generates Kotlin and Java models from GraphQL queries.

Apollo Kotlin executes queries and mutations against a GraphQL server and returns results as query-specific Kotlin types. This means you don't have to deal with parsing JSON, or passing around Maps and making clients cast values to the right type manually. You also don't have to write model types yourself, because these are generated from the GraphQL definitions your UI uses.

Because generated types are query-specific, you can only access data that you actually specify as part of a query. If you don't ask for a particular field in a query, you can't access the corresponding property on the returned data structure.

This library is designed primarily with Android in mind, but you can use it in any Java/Kotlin app, including multiplatform.

Features

  • Java and Kotlin Multiplatform code generation
  • Queries, Mutations and Subscriptions
  • Reflection-free parsing
  • Normalized cache
  • Custom scalar types
  • HTTP cache
  • Auto Persisted Queries
  • Query batching
  • File uploads
  • Espresso IdlingResource
  • Fake models for tests
  • AppSync and graphql-ws websockets
  • GraphQL AST parser

Multiplatform

Apollo Kotlin is a Kotlin Multiplatform project.

Here's the current matrix of supported features per platform:

jvm AppleΒΉ js linuxX64
apollo-api (models) βœ… βœ… βœ… βœ…
apollo-runtime (network, query batching, apq, ...) βœ… βœ… βœ…Β² 🚫
apollo-normalized-cache βœ… βœ… βœ… 🚫
apollo-adapters βœ… βœ… βœ… 🚫
apollo-normalized-cache-sqlite βœ… βœ… 🚫 🚫
apollo-http-cache βœ… 🚫 🚫 🚫

ΒΉ: Apple currently includes:

  • macosX64
  • macosArm64
  • iosArm64
  • iosX64
  • iosSimulatorArm64
  • watchosArm64
  • watchosSimulatorArm64
  • tvosArm64
  • tvosX64
  • tvosSimulatorArm64

Β²: WebSockets are currently not supported on js

Documentation

Check the project website for in depth documentation.

Getting started

If you are new to GraphQL, check out the tutorial that will guide you through building an Android app using Apollo, Kotlin and coroutines.

If you'd like to add Apollo Kotlin to an existing project, follow these steps:

Add the plugin to your build.gradle.kts:

plugins {
  id("com.apollographql.apollo3").version("x.y.z")
}

Add the runtime dependency:

dependencies { 
  implementation("com.apollographql.apollo3:apollo-runtime:x.y.z")
}

Set the package name to use for the generated models:

apollo {
  packageName.set("com.example")
}

Apollo Kotlin supports three types of files:

  • .graphqls schema files: describes the types in your backend using the GraphQL syntax.
  • .json schema files: describes the types in your backend using the Json syntax.
  • .graphql executable files: describes your queries and operations in the GraphQL syntax.

By default, Apollo Kotlin requires a schema in your module's src/main/graphql directory. You can download a schema using introspection with the ./gradlew downloadApolloSchema task. Sometimes introspection is disabled and you will have to ask your backend team to provide a schema. Copy this schema to your module:

cp ${schema} ${module}/src/main/graphql/ 

Write a query in a ${module}/src/main/graphql/GetRepository.graphql file:

query HeroQuery($id: String!) {
  hero(id: $id) {
    id
    name
    appearsIn
  }
}

Build your project, this will generate a HeroQuery class that you can use with an instance of ApolloClient:

  // Create a client
  val apolloClient = ApolloClient.Builder()
      .serverUrl("https://example.com/graphql")
      .build()

  // Execute your query. This will suspend until the response is received.
  val response = apolloClient.query(HeroQuery(id = "1")).execute()

  println("Hero.name=${response.data?.hero?.name}")

To learn more about other Apollo Kotlin APIs:

IntelliJ Plugin

The JS Graphql IntelliJ Plugin provides auto-completion, error highlighting, and go-to-definition functionality for your .graphql files. You can create a .graphqlconfig file to use GraphQL scratch files to work with your schema outside product code (such as to write temporary queries to test resolvers).

Releases

The latest version is Maven Central

Check the changelog for the release history.

Releases are hosted on Maven Central. The plugin is additionally hosted on the Gradle Plugin Portal

plugins {
  id("com.apollographql.apollo3").version("x.y.z")
}

repositories {
  mavenCentral()
}

dependencies {
  implementation("com.apollographql.apollo3:apollo-runtime:x.y.z")

  // optional: if you want to use the normalized cache
  implementation("com.apollographql.apollo3:apollo-normalized-cache-sqlite:x.y.z")
  // optional: if you just want the generated models and parsers and write your own HTTP code/cache code, you can remove apollo-runtime
  // and use apollo-api instead  
  implementation("com.apollographql.apollo3:apollo-api:x.y.z")
}

Snapshots

Latest development changes are available in Sonatype's snapshots repository:

repositories {
  maven { 
    url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
  }
}

Requirements

Some platforms have specific requirements:

  • Android API level 21+
  • JDK 8+
  • iOS 13+

For building, it requires:

  • Gradle 5.6
  • Kotlin 1.4+

Contributing

If you'd like to contribute, please see Contributing.md.

Additional resources

Who is Apollo?

Apollo builds open-source software and a graph platform to unify GraphQL across your apps and services. We help you ship faster with:

  • Apollo Studio – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes.
  • Apollo Federation – The industry-standard open architecture for building a distributed graph. Use Apollo’s gateway to compose a unified graph from multiple subgraphs, determine a query plan, and route requests across your services.
  • Apollo Client – The most popular GraphQL client for the web. Apollo also builds and maintains Apollo iOS and Apollo Kotlin.
  • Apollo Server – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.

Learn how to build with Apollo

Check out the Odyssey learning platform, the perfect place to start your GraphQL journey with videos and interactive code challenges. Join the Apollo Community to interact with and get technical help from the GraphQL community.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].