github apollographql/apollo-kotlin v3.0.0-beta02

latest releases: v4.1.0, v4.0.1, v4.0.0...
3 years ago

This version introduces fluent APIs on operations, more multiplatform targets, more compatibility helpers
to ease transition from v2.x, and other fixes.

✨ [new and breaking] Fluent APIs (#3447)

The API to execute operations now uses the Fluent style, where you can chain method calls together. The ApolloClient query, mutate and subscribe methods now return an ApolloCall that can be configured, and on which you can call execute to execute the operation.

Before:

val request = ApolloRequest.Builder(HeroQuery()).fetchPolicy(FetchPolicy.NetworkOnly).build()
val response = apolloClient.query(request)

After (fluent):

val response = apolloClient.query(HeroQuery())
        .fetchPolicy(FetchPolicy.NetworkOnly)
        .execute()

If you were using cacheAndNetwork, it's now executeCacheAndNetwork:

// Before
apolloClient.cacheAndNetwork(query)

// After
apolloClient.query(query).executeCacheAndNetwork()

✨ [new] New multiplatform targets (#3487)

This release adds support for these new targets:

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

Additionally, apollo-api (models) is now compiled for linuxX64. Follow this issue for updates on this - and contributions on this area are welcome!

✨ [new] Sealed interfaces in generated code (#3448)

When using the responseBased codegen, now interfaces will be generated as sealed when possible.

Because sealed interfaces are only available since Kotlin 1.5, a new Gradle option languageVersion has been introduced to control this behavior (and potentially future language features used by the codegen).

✨ [new] Version 2 compatibility helpers

To ease transition from 2.x, this release provides:

  • a CustomTypeAdapter that can be used for custom scalars in the same way as in 2.x
  • an Input helper that will map to 3.x Optional automatically

These helpers are deprecated and are to be used only as a temporary measure - they will be removed in a future version.

💙 External contributors

Thanks to @davidec-twinlogix, @pauldavies83 @nachtien and @Pitel for their awesome contributions!

👷 All Changes

  • Add a "compat" v2 CustomTypeAdapter to v3 Adapter API (#3482)
  • Add a few targets (#3487)
  • Add parsing of non-standard Error fields (#3485)
  • Resolve name clashes the same way as in 2.x (#3486)
  • Make the packageName error more explicit for users that are migrating (#3477)
  • Fix pointer use after free (#3478)
  • Add Apple Silicon iOS Simulator Targets (#3481)
  • Check minimum Kotlin version in the plugin (#3475)
  • Migrate HttpRequest With-ers to Builders (#3474)
  • Add .customScalarAdapter(CustomScalarAdapters) on ApolloClient.Builder (#3472)
  • Bump KSP and Okio to stable 🎉 (#3473)
  • [RFC] Fluent query API (#3447)
  • Generate sealed interfaces in response based codegen (#3448)
  • Add MySealedClass.knownValues() (#3465)
  • Added Long support to RecordFieldJsonAdapter (#3468)
  • Add an iOSX64 test and publish apollo-testing-support for ios (#3463)
  • Add customTypesMapping for backward compatibility (#3452)
  • Add Input backward compat layer (#3456)
  • Rename include to includes (#3451)

Don't miss a new apollo-kotlin release

NewReleases is sending notifications on new releases.