-
Notifications
You must be signed in to change notification settings - Fork 655
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
Update ApolloClient and ApolloRequest APIs from With-ers to Builders #3404
Conversation
This PR is easier to read in a few steps:
What's left:
|
apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloRequest.kt
Outdated
Show resolved
Hide resolved
apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloRequest.kt
Show resolved
Hide resolved
apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloRequest.kt
Outdated
Show resolved
Hide resolved
apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloRequest.kt
Outdated
Show resolved
Hide resolved
...he/src/commonMain/kotlin/com/apollographql/apollo3/cache/normalized/ClientCacheExtensions.kt
Show resolved
Hide resolved
...monMain/kotlin/com/apollographql/apollo3/cache/normalized/internal/ApolloCacheInterceptor.kt
Show resolved
Hide resolved
apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo3/ApolloClient.kt
Show resolved
Hide resolved
apollo-runtime/src/commonMain/kotlin/com/apollographql/apollo3/ApolloClient.kt
Outdated
Show resolved
Hide resolved
A few comments but looks good overall, Thanks! For the
Especially for properties that start with a verb, it makes it explicit that it's only a getter? Any thoughts? |
🙏
Yes, good idea! I first thought of renaming them |
apollo-api/src/commonMain/kotlin/com/apollographql/apollo3/api/ApolloRequest.kt
Outdated
Show resolved
Hide resolved
return networkTransport(networkTransport.copy( | ||
engine = CachingHttpEngine( | ||
directory = directory, | ||
maxSize = maxSize, | ||
delegate = networkTransport.engine | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random thoughts: should we go Builders
all the way down and convert HttpNetworkTransport
to Builders
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not completely sure. Maybe we could come up with a rule of thumb like: if there are more than n possible parameters, let's have a builder, otherwise a regular constructor is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 strong arguments for Builders
everywhere though:
- consistency
- java interop
Also add precision about splitting ExecutionParameters and adding a toBuilder method.
…PI available, to ease the transition
…for clarity abnd consistency
87b3b90
to
3c509ee
Compare
(Another PR with further doc updates following this change will come later.) |
Related to #3301, this adds a proposal to implement a Buildersbased API instead of the current With-ers based on on the 3.x branch.