I'd like to pass the following key:value pairs to a GraphQL query. I imagine it working something like this, but have been unable to find a way to achieve this.
query myPortfolio {
portfolio(holdings: {"btc": 0.12, "ltc": 12.1}) {
# ...
}
}
I attempted to create a special type and pass it as an array, but this failed compilation.
type Holding {
coin: String!
amount: Float!
}
type Query {
portfolio(holdings: [Holding!]): Portfolio!
}
Error: The type of Query.portfolio(holdings:) must be Input Type but got: [Holding!].