Hi, Im trying out `Apollo3` for my Android GraphQL...
# android
t
Hi, Im trying out
Apollo3
for my Android GraphQL client calls
Apollo3 has this sealed class for warpping Optional values...
Copy code
sealed class Optional<out V> {
  fun getOrNull() = (this as? Present)?.value
  fun getOrThrow() = getOrNull() ?: throw MissingValueException()

  data class Present<V>(val value: V) : Optional<V>()
  object Absent : Optional<Nothing>()

  fun <V : Any> presentIfNotNull(value: V?): Optional<V> = if (value == null) Absent else Present(value)
}
I can successfully employ
Present
,
Copy code
FilterEpisode(name = Optional.Present(value = "in"))
however I cannot use the function
presentIfNotNull
how do I refer to this function?
Screenshot 2021-08-24 at 12.28.26.png
m
Hi ๐Ÿ‘‹
What
Optional
are you importing?
t
๐Ÿ‘‹
Copy code
import com.apollographql.apollo3.api.Optional
m
Yikes, just checking this out, looks like
presentIfNotNull
is an instance function not static ๐Ÿคฆโ€โ™‚๏ธ
I'll fix this
t
๐Ÿ‘
thats what
alpha
is for ๐Ÿ˜„
๐Ÿ˜„ 1
m
Yep ๐Ÿ˜ฌ
Thanks for the heads up!
t
I feel part of the team ๐Ÿ˜‰
m
FWIW, we also have #apollo-android here for specific questions
t
nice, I'll use that next time ๐Ÿ˜„
153 Views