JetBrains / space-kotlin-sdk

Kotlin client for JetBrains Space HTTP API
Apache License 2.0
46 stars 3 forks source link

No method for requesting tz on TD_MemberLocationPartial #2

Closed mwspellman closed 3 years ago

mwspellman commented 3 years ago

With library version loaded in gradle: implementation( "org.jetbrains:space-sdk-jvm:66755-beta" ), I am attempting to request the tz property of the profile's location, but neither timezone() nor tz() are functions on TD_MemberLocationPartial:

spaceClient.teamDirectory.profiles.getProfile( profileId ) { defaultPartial(); id(); emails { defaultPartial(); id(); email() }; name { firstName(); lastName() }; locations { defaultPartial(); id(); timezone(); tz(); }}

If I try to acess the tz property without adding timezone(); tz(); above, then I have the exception from below:

getProfile->locations->[0]->location->tz
java.lang.IllegalStateException: Property 'tz' was not requested. Reference chain:
getProfile->locations->[0]->location->tz
    at space.jetbrains.api.runtime.PropertyValueKt.getValue(PropertyValue.kt:28)
    at space.jetbrains.api.runtime.types.TD_Location.getTz(TD_Location.kt)
ark-1 commented 3 years ago

That's because tz is not in TD_MemberLocation, but in the TD_Location inside the location field. To request it, you need to write location { tz() } instead of just tz()

mwspellman commented 3 years ago

Thank you that works!