Selection
type to generate a concrete type for your selection (e.g. Selection<String, Objects.Human>
). You can find all generated phantom types by typing
Unions.
Interfaces.
Objects.
Operations.
Selection.
that contains type-alias for unions, interfaces, objects and operations. In that case, you don’t have to specify the type-lock anymore and simply provide the return type (e.g. Selection.Human<String>
).
Unions
Interfaces
list
- to query listsnullable
- to query nullable fieldsnonNullOrFail
- to query nullable fields that should be thereSelection
static functions .list
, .nullable
, and .nonNullOrFail
.
id
field in Human
type. There are many cases where we only query id
field from the Human
that’s why we create a human id selection.
selection
helper method that lets you make a selection on the whole TypeLock
from inside the selection.
Human
again.
map
function on selection and provide a mapping.
⚠️ Don’t make any nested calls to the API. Use the first half of the initializer to fetch all the data and return the calculated result. Just don’t make nested requests.
NOTE: Always make all selection before throwing errors!
NOTE:age
andisGoodDog
values are nullable in our schema but aren’t nullable in our model.
query
and decode
.
query
returns a spec-compliant GraphQL query and a variable set that you should use in your request.decode
accepts the body of the response and returns the decoded result.query
anddecode
don’t actually communicate with the server. To do that, use one of the official clients or create your own.
Besidesquery
anddecode
selection also contains wide range of utility functions that help you understand the structure of a given query. Those functions won’t be covered here. You should follow their comments to understand what they do and examine official clients to see how they are used.