-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uniformize operation APIs? #3494
Comments
I like this change (favoring the 1st one without "call") because it mirrors the GraphQL syntax. |
Silly question. Why not keeping the 2.x API? (added also in the main description as option 3.) apolloClient.query(query).await()
apolloClient.mutate(mutation).await()
apolloClient.subscribe(subscription).toFlow() |
Do you mean as a (deprecated) migration helper? |
Not really. What about keeping it for real? Except it doesn't need the imports? |
So they would be a synonym of |
That.
|
I see! I personally prefer |
The counter argument can be made that subscriptions are of different kind (Flow) so could use different name. But yea...
100% agree, that's a good point. Also now is certainly a good time to think of what this API will look like under defer/stream. What we decide now would have to be somewhat compatible. |
One more argument for // Might be tempting to call it a day and assume something changed (doesn't work)
apolloClient.mutate(mutation)
// `mutation` is not an action so it's a hint that execute() is required
apolloClient.mutation(mutation).execute() PS: can we add an annotation to warn if the return value isn't used? |
Just a reminder of the current situation: ApolloCall<D: Operation.Data> (abstract)
fun executeAsFlow(): Flow<ApolloResponse<D>>
ApolloQueryCall<D: Query.Data>
suspend fun execute(): ApolloResponse<D>
ApolloMutationCall<D: Mutation.Data>
suspend fun execute(): ApolloResponse<D>
ApolloSubscriptionCall<D: Subscription.Data>
fun execute(): Flow<ApolloResponse<D>> It's still very early on the reflection about defer/stream but it seems to me that we could already go for this naming convention:
This means in the future, for queries and mutations, partial results could be obtained by calling This also means WDYT? |
This makes sense. I'm all for deleting About
This is relatively similar to what SQLDelight is doing with Query.asFlow (except they're using |
Good point about the So it would look like this in
In a future version, we may need to add |
About checking the return values, I dug a bit:
|
Not strong opinion about having |
Closing per #3594 |
Currently we have:
I find it weird, especially in the mutation/subscription case we have 2 chained verbs. Should we do this instead?
or
or
Given that 3.0 is coming soon, it's now or never
The text was updated successfully, but these errors were encountered: