How do I filter issue comment authors using GraphQL - graphql

I'm trying to figure out how to get the list of comments on an issue using GraphQL. I'm able to get comments by everyone but not only by author.
My code:
query {
repository(name: "maintainer-bot", owner: "Xenfo") {
issue(number: 16) {
comments(first: 10) {
nodes {
author {
login
}
}
}
}
}
}
My question: How would I filter the comments returned so that only the user with the name Xenfo has his comments returned?

Related

How to filter a query on linkedFrom?

I have a collection of authors. Some authors have written blogs, others have not. I can reference the total amount of blogs they've written using:
query {
authorCollection {
linkedFrom {
blogCollection {
total
}
}
}
}
What I want, however, is a list of authors with more than 1 blog post. Some have written blogs, others have not. How can I filter the query to do so? Ive tried something like this but this is not possible:
query {
authorCollection(where: {linkedFrom: //This is not an available option}) {
linkedFrom {
blogCollection {
total
}
}
}
}

Performing A GraphQL Selection On A Union for shopify SellingPlanPricingPolicy

I am trying to get union data using the Graphql APIfor Shopify and am unable to find any documentation on selecting data in unions.
Here is my current query:
query subscriptionPlans {
sellingPlanGroup(id: 1234) {
id
name
sellingPlans(first: 1) {
edges {
node {
id
billingPolicy {
... on SellingPlanRecurringBillingPolicy {
interval
intervalCount
}
}
pricingPolicies {
on
SellingPlanRecurringPricingPolicy {
afterCycle
adjustmentType
adjustmentValue {
on
SellingPlanPricingPolicyPercentageValue {
percentage
}
on
MoneyV2 {
amount
currencyCode
}
}
}
}
}
}
}
}
}
I am able to retrieve the sellingPlans in this scenario. When I get to the SellingPlanPricingPolicy portion I run into issues. I am receiving the error:
Selections can't be made directly on unions (see selections on SellingPlanPricingPolicy)
However, I am unable to find any documentation on making selections using the documentation at: https://shopify.dev/docs/admin-api/graphql/reference/products-and-collections/sellingplanpricingpoli...
Any help with this would be appreciated. I just need an example of how to select this information.
Found the answer in https://graphql.org/learn/queries/#meta-fields. In case of sponsorEntity it looks like this:
sponsorEntity {
... on User {
name
}
}
The solution is to select the attributes on the respective sub-type of the union.

How can I filter by uid of a linked document / relationship using the prismic graphql api?

I am trying to list a set of articles by their categories, by uid, and I'm assuming that I would have to use the where query, but I'm not able to get that to worked on linked documents.
The issue seems to be that where only accepts a string on a field, but in the case of a linked document you would need to dig down to the uid field.
I'm not sure if I'm using the wrong query, but struggling to find anything in the documentation to help me out.
I tried digging into the category object:
{
allDirectoryServices(
where: { category: { _meta: { uid: "developers" } } }
) {
edges {
node {
name
city
region
country
category {
...on DirectoryTaxonomy {
_meta {
uid
}
name
}
}
}
}
}
}
But that returns an error that it's expecting a string:
"message": "Expected type String, found {_meta: {uid: \"developers\"}}.",
{
allDirectoryServices(
where: { category: "developers"}
) {
edges {
node {
name
city
region
country
category {
...on DirectoryTaxonomy {
_meta {
uid
}
name
}
}
}
}
}
}
This returns no results, obviously.
I asked this question on the Prismic Slack group too, and got the answer from them:
In order to query by a Content Relationship / Link field like this, you need to use the document ID.
where: { category: "WBsLfioAABNUo9Kk" }
Unfortunately it isn’t possible to query by the UID (or any other field).
I imagine they will be updating their documentation soonish, as this isn't covered by it.
Thanks to the Prismic guys!

How to get variant by variant Id from product object using by graphql Shopify

Query so far
{
product1: product(id: "gid://shopify/Product/777854222396") {
title
totalVariants
variants(first:99) {
.....
}
hasOutOfStockVariants
}
product2: product(id: "gid://shopify/Product/511571296316") {
title
}
}
What can be done to fetch variant based on id
I have found ProductVariant on their GraphQL Admin API reference docs, you can take reference from their else I didn't find any ProductVariant Schema open at QueryRoot as defined here in the open graphQL admin panel although they have mentioned an example.
query {
productVariant(id: "gid://shopify/ProductVariant/10782354800682") {
inventoryItem {
inventoryLevels (first:10) {
edges {
node {
location {
name
}
available
}
}
}
}
}
}

Query reactions by issue number and user

Is there a way to query reactions filtering on issue number and user?
{
repository(owner: "w3c", name: "webcomponents") {
issue(number: 688) {
title
reactions(last: 100) { <--- I want to filter on user here
edges {
node {
user {
login
}
content
id
}
}
}
}
}
}
https://developer.github.com/v4/explorer/
Not at the moment, but you can request this functionality by creating a new post here and tagging the post as a schema-request.
No, unfortunately github graphql api doesn't provide this capability to query reactions by known user in this context.

Resources