Can GraphQL query for orders that contain particular items

Is (now or in the future) Square’s implementation of GraphQL capable of a query for all orders that contain a particular item? For example, return all closed orders from 2020 whose line items contain caffe mocha. If so, what would this query look like?

Obviously, I’m hoping there’s a way to do this, as the alternative seems to be SearchOrders returning a large number of orders, then filtering nearly all of them away by scanning their line items, which would be a lot slower. Given that on Square Dashboard, you can do my proposed query quite quickly, I’m thinking this should be quite viable.

Thanks

I am so sorry for the delay. At this time the ability to parse orders for a text like “caffe mocha” or the variation_id in an order isn’t currently available. You can pass in a list of orders and return all the catalog_object_ids and the name of the line item. That query would look like:

{
    orders(
        filter: {
                  ids: { equalToAnyOf: [
                "bWBhGyQnqw6PTCFdfRKGzEzjGJCZY",
                "t1EBocwqjBilGJ2OfzkdzKW2IrYZY"
            ]
        }
                        merchants: { equalToAnyOf: ["0F5SS1WQBNTGG"]}
    }
    ){
        nodes {
             lineItems{
                 name
                 itemVariation{
                     id
                 }
             }
        }
    }
}

:slightly_smiling_face: