Skip to content

Commit

Permalink
Apollo 4.0.0-beta.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed Nov 11, 2023
1 parent 8e62073 commit 55746e3
Show file tree
Hide file tree
Showing 10 changed files with 480 additions and 128 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ksp = "1.9.20-1.0.14"
androidGradlePlugin = "8.3.0-alpha13"
gradle-toolchainsResolverPlugin = "0.7.0"
appVersioning = "1.3.1"
apollo = "3.8.2"
apollo = "4.0.0-beta.2"
googleServices = "4.4.0"
wire = "4.9.1"
detekt = "1.23.3"
Expand Down
10 changes: 8 additions & 2 deletions kmp/data-runtime-cloud/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.github.reactivecircus.kstreamlined.buildlogic.envOrProp

plugins {
id("kstreamlined.kmp.common")
id("kstreamlined.kmp.test")
Expand All @@ -7,9 +9,13 @@ plugins {
apollo {
service("kstreamlined") {
packageName.set("io.github.reactivecircus.kstreamlined.graphql")
codegenModels.set("responseBased")
flattenModels.set(true)
codegenModels.set("experimental_operationBasedWithInterfaces")
generateMethods.set(listOf("equalsHashCode", "toString"))
generateInputBuilders.set(true)
generateDataBuilders.set(true)
introspection {
endpointUrl.set(envOrProp("KSTREAMLINED_API_ENDPOINT"))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ type Query {
"""
feedSources: [FeedSource!]!

_service: _Service
_service: _Service!
}

type TalkingKotlin implements FeedEntry {
Expand Down Expand Up @@ -459,6 +459,324 @@ type _Service {
sdl: String!
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
type __Directive {
"""
The __Directive type represents a Directive that a server supports.
"""
name: String!

description: String

isRepeatable: Boolean!

locations: [__DirectiveLocation!]!

args(includeDeprecated: Boolean = false): [__InputValue!]!
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
An enum describing valid locations where a directive can be placed
"""
enum __DirectiveLocation {
"""
Indicates the directive is valid on queries.
"""
QUERY

"""
Indicates the directive is valid on mutations.
"""
MUTATION

"""
Indicates the directive is valid on subscriptions.
"""
SUBSCRIPTION

"""
Indicates the directive is valid on fields.
"""
FIELD

"""
Indicates the directive is valid on fragment definitions.
"""
FRAGMENT_DEFINITION

"""
Indicates the directive is valid on fragment spreads.
"""
FRAGMENT_SPREAD

"""
Indicates the directive is valid on inline fragments.
"""
INLINE_FRAGMENT

"""
Indicates the directive is valid on variable definitions.
"""
VARIABLE_DEFINITION

"""
Indicates the directive is valid on a schema SDL definition.
"""
SCHEMA

"""
Indicates the directive is valid on a scalar SDL definition.
"""
SCALAR

"""
Indicates the directive is valid on an object SDL definition.
"""
OBJECT

"""
Indicates the directive is valid on a field SDL definition.
"""
FIELD_DEFINITION

"""
Indicates the directive is valid on a field argument SDL definition.
"""
ARGUMENT_DEFINITION

"""
Indicates the directive is valid on an interface SDL definition.
"""
INTERFACE

"""
Indicates the directive is valid on an union SDL definition.
"""
UNION

"""
Indicates the directive is valid on an enum SDL definition.
"""
ENUM

"""
Indicates the directive is valid on an enum value SDL definition.
"""
ENUM_VALUE

"""
Indicates the directive is valid on an input object SDL definition.
"""
INPUT_OBJECT

"""
Indicates the directive is valid on an input object field SDL definition.
"""
INPUT_FIELD_DEFINITION
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
type __EnumValue {
name: String!

description: String

isDeprecated: Boolean!

deprecationReason: String
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
type __Field {
name: String!

description: String

args(includeDeprecated: Boolean = false): [__InputValue!]!

type: __Type!

isDeprecated: Boolean!

deprecationReason: String
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
type __InputValue {
name: String!

description: String

type: __Type!

defaultValue: String

isDeprecated: Boolean

deprecationReason: String
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.
"""
type __Schema {
description: String

"""
A list of all types supported by this server.
"""
types: [__Type!]!

"""
The type that query operations will be rooted at.
"""
queryType: __Type!

"""
If this server supports mutation, the type that mutation operations will be rooted at.
"""
mutationType: __Type

"""
'A list of all directives supported by this server.
"""
directives: [__Directive!]!

"""
'If this server support subscription, the type that subscription operations will be rooted at.
"""
subscriptionType: __Type
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
type __Type {
kind: __TypeKind!

name: String

description: String

fields(includeDeprecated: Boolean = false): [__Field!]

interfaces: [__Type!]

possibleTypes: [__Type!]

enumValues(includeDeprecated: Boolean = false): [__EnumValue!]

inputFields(includeDeprecated: Boolean = false): [__InputValue!]

ofType: __Type

"""
This field is considered experimental because it has not yet been ratified in the graphql specification
"""
isOneOf: Boolean

specifiedByURL: String

specifiedByUrl: String @deprecated(reason: "This legacy name has been replaced by `specifiedByURL`")
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
An enum describing what kind of type a given __Type is
"""
enum __TypeKind {
"""
Indicates this type is a scalar. 'specifiedByURL' is a valid field
"""
SCALAR

"""
Indicates this type is an object. `fields` and `interfaces` are valid fields.
"""
OBJECT

"""
Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.
"""
INTERFACE

"""
Indicates this type is a union. `possibleTypes` is a valid field.
"""
UNION

"""
Indicates this type is an enum. `enumValues` is a valid field.
"""
ENUM

"""
Indicates this type is an input object. `inputFields` is a valid field.
"""
INPUT_OBJECT

"""
Indicates this type is a list. `ofType` is a valid field.
"""
LIST

"""
Indicates this type is a non-null. `ofType` is a valid field.
"""
NON_NULL
}

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
Directs the executor to include this field or fragment only when the `if` argument is true
"""
directive @include ("Included when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
Directs the executor to skip this field or fragment when the `if` argument is true.
"""
directive @skip ("Skipped when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT

directive @extends on OBJECT|INTERFACE

directive @external on FIELD_DEFINITION

directive @key (fields: _FieldSet!) repeatable on OBJECT|INTERFACE

directive @provides (fields: _FieldSet!) on FIELD_DEFINITION

directive @requires (fields: _FieldSet!) on FIELD_DEFINITION

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
Marks the field, argument, input field or enum value as deprecated
"""
directive @deprecated ("The reason for the deprecation" reason: String = "No longer supported") on FIELD_DEFINITION|ARGUMENT_DEFINITION|ENUM_VALUE|INPUT_FIELD_DEFINITION

# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
# noinspection GraphQLTypeRedefinition
"""
Exposes a URL that specifies the behaviour of this scalar.
"""
directive @specifiedBy ("The URL that specifies the behaviour of this scalar." url: String!) on SCALAR

"""
Indicates an Input Object is a OneOf Input Object.
"""
directive @oneOf on INPUT_OBJECT

schema {
query: Query
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CloudFeedRepo(private val apolloClient: ApolloClient) : FeedRepo {
apolloClient.query(FeedSourcesQuery())
.defaultFetchPolicy(refresh)
.execute()
.dataAssertNoErrors.feedSources
.dataOrThrow().feedSources
}.onFailure {
Logger.w("Query failed", it)
}.getOrThrow().map { it.toModel() }
Expand All @@ -36,7 +36,7 @@ class CloudFeedRepo(private val apolloClient: ApolloClient) : FeedRepo {
)
.defaultFetchPolicy(refresh)
.execute()
.dataAssertNoErrors.feedEntries
.dataOrThrow().feedEntries
}.onFailure {
Logger.w("Query failed", it)
}.getOrThrow().map { it.toModel() }
Expand Down
Loading

0 comments on commit 55746e3

Please sign in to comment.