TLDR:
What's wrong with this GraphQL query? Note that the ... on BinaryComponent
isn't rendered although the ... on Component
confirms these are multimedia items being returned?
{
items(filter: {itemTypes: [COMPONENT],
#keyword: {categoryId:9195, key: "valueThatExists"}
customMeta: {key: "clientViews", value: "valueThatExists"}}) {
#noting we are using the metadata XML name here and not the keyword XML name
edges {
node {
... on BinaryComponent {
#nothing picked up here?
title_fromBINARY:title
variants {
edges {
node {
variantId
binaryId_fromBINARY:binaryId
downloadUrl
description
}
}
}
}
... on Component {
itemId_fromCOMPONENT:itemId
multiMedia
schemaId #this validates these are binaries and tagged but how do we drilldown to the download url?
taxonomies {
key
title
}
}
}
}
}
}
We have a taxonomy where we have a category with keywords representing clients and sub-keywords under those representing a specific view of the business.
Category ClientViews [categoryId: 9195]
- Client 1
- view 1_1
- view 1_2
- Client 2
- view 2_1
- view 2_2
- Client 3
- view 3_1
We then tag MM assets with the client View (these sub-keywords are unique to each client).
Using GraphQL we want to get a list of the views under a specific client (so we can present these as, say, sections) and then within the view list all the relevant PDFs (eventually we'll include other filtering attributes also).
We are trying to use GraphQL to get a list of all MM items that are attributed with (amongst a couple of other attributes) the specific view.
I can get a list of views for a specific client using something like this:
specificClientViews: keyword(namespaceId: 1, publicationId: 925, categoryId: 9195, keywordId: 91098)
{
name, itemId, key, hasChildren
children {
edges{
node {
title, itemId, key
}
}
}
}
And this returns the views as expected and then I suppose I can iterate through the views and request the associated PDFs (of course - wrapping these up into as a single PCA response would be great but not sure we can do that without new graphql schemas etc.).
side question: is there a better way to achieve this same aim without having to rely on the IDs?
So we get to the main question as above. Using the query I've put above, why do we not detect the BinaryComponent; the ... on Component
section is hit/rendered but the ... on BinaryComponent
isn't.
I've only seen ... on BinaryComponent
used when the query is specifically a Component{} and had hoped that this would be usable here; is there a better way to achieve this?
Also - I am able to run a query to get components and display the custom meta and taxonomy details so it's all published and in place.