I found ‘FIlterable map views’ feature from commit ab01dc123000c859c10609e77f3f0756403c5406, could you please give some example of its usage ?
The feature is visible in GraphIQL or in the Linera chain explorer
Hi @kikakkz,
The previous GraphQL API was structured in such a way that in order to see the value of a ‘map’ type object (such as chain(chainId: $chainId) { inboxes }
) you had to know the keys somehow. This feature changes the API to add plural queries like
chain(chainId: $chainId) {
inboxes {
entries {
key
}
}
}
It also adds filtering inputs to these queries like
chain(chainId: $chainId) {
inboxes(inputs: { filters: … }) {
…
}
}
Currently the only filter we support is { keys: ["key1", "key2"] }
to give a list of keys to which to restrict the query, but we plan to add more sophisticated queries in the future, as well as other inputs like pagination arguments.
As @ma2bd says, you can explore this new API in the GraphiQL IDE exported from the node service — in fact the motivation for this work was to make such exploration more accessible.
Thanks for your query! Does this answer your question satisfactorily?
— James Kay
@ma2bd @james.kay Thanks to reply. I’ll try the filter firstly, . We have a lot of scenarios to query with filter. Before I have to get all of them then filter in frontend.
@ma2bd @james.kay yeah, I can get some definition from GraphIQL. but when I try to look for the complex object, seems it’s not resolved (e.g. recipient in transfer function). could that also be supported to resolve complex object ?
GraphQL “scalar” objects are expected to be the JSON serialization of the corresponding Rust types. Right now, one has to look at the codebase but we have a task! Document the JSON-format of GraphQL scalars · Issue #1296 · linera-io/linera-protocol · GitHub
We also have some work ongoing to resolve more complex objects in our GraphQL API and generally make connections between objects more immediate. #1269 is about resolving application APIs in the top-level GraphQL API, for example.
understood~ for now i will check code to get the structure~