Query reactions by issue number and user - graphql

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.

Related

How can I get the project name for a timelog issue entry using the project ID from a Gitlab GraphQL query

I'm using the graphql explorer for gitlab and I'm trying to get timelog entries for a given user (as below).
The response gives me a projectId which I assume I'd have to use in a subsequent query (I don't believe I can get it in the same query?), but the project object doesn't let me find the project by ID, only fullpath.
Am I correct in understanding that I would need to use the projects query and provide the id there? In trying that (query below), I just get the error 12345678 is not a valid GitLab ID. (obviously I'm using a real ID given previously).
So, two points/questions I guess:
The timelog entry provides a projectId which I can't use in either the project or projects query to get the project name?
I can't just return the project name directly in the same query as the original user timelog one?
Any thoughts greatly appreciated.
{
users(usernames: ["user1"]) {
nodes {
id
username
timelogs(startDate: "2022-05-03T09:00:00") {
nodes {
issue {
projectId
}
timeSpent
}
}
}
}
}
{
projects(ids:[12345678]) {
nodes {
name
}
}
}
I don't know if this helps, but I use:
{
group(fullPath: "groupname") {
name
timelogs(startTime: "2022-04-01", endTime: "2022-04-30", username: "roberto") {
pageInfo {
hasNextPage
endCursor
}
nodes {
user {
username
}
issue {
iid
webUrl
state
projectId
title
}
spentAt
timeSpent
summary
note {
body
url
}
}
}
}
}

How to get app subscription status from Shopify API

Is there a way to determine the subcsription status of an app via the Shopify node client or in the GraphQL API?
Given a user has signed up to our public app, when they log in. then I should be able to check if their Shopify subscription to our app is still active.
I can see via the GraphQL API I can query
currentAppInstallation {
activeSubscriptions {
id
name
test
}
}
This seems to return an empty array, implying my test store I doesn't have any active subscriptions. This may be due to my app and shop being in test mode though.
Does anybody know if this is the case or is there another way to get the subscription status?
Also, it would be good to do via the Shopify client if that is possible?
This is how I did if I have the APP subscription ID, I got the GraphQL query from Shopify's Billing API documentation:
query {
node(id: "gid://shopify/AppSubscription/4019585080") {
...on AppSubscription {
billingInterval
createdAt
currentPeriodEnd
id
name
status
test
lineItems {
plan {
pricingDetails {
...on AppRecurringPricing {
interval
price {
amount
currencyCode
}
}
...on AppUsagePricing {
terms
cappedAmount {
amount
currencyCode
}
balanceUsed {
amount
currencyCode
}
}
}
}
}
}
}
}
Notice that status is defined at root, so you'll get it inside the node.

How do I filter issue comment authors using 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?

Is it possible for vue-apollo to return different results from the Playground?

I have a GraphQL query called myAccounts which returns an array of accounts. When I go to the Playground and call the query:
{
accounts {
email
}
}
I get this result:
"data": {
"accounts": [
{
"email": "zach#email-one.com",
},
{
"email": "zach#email-two.com",
}
]
}
However, when I am in my Component, vue-apollo returns two items in the array, but seems to overwrite the second item with the first. Here is the query (in MyAccounts.gql):
query myAccounts {
accounts: myAccounts {
email
}
}
and here is the Apollo query in the component:
import MY_ACCOUNTS_QUERY from '~/apollo/queries/MyAccounts'
...
apollo: {
accounts: {
query: MY_ACCOUNTS_QUERY,
result(data) {
console.log(JSON.stringify(data))
}
}
}
and here is what vue-apollo logs out through the result:
{
"data":{
"accounts":[
{
"email":"zach#email-one.com",
"__typename":"Account"
},
{
"email":"zach#email-one.com",
"__typename":"Account"
}
]
},
"loading":false,
"networkStatus":7,
"stale":false
}
Expected behavior
I would expect the data returned in the Playground to be identical to what vue-apollo is fetching.
Versions
vue: 2.6.10
vue-apollo: #nuxtjs/apollo: 4.0.0-rc18
Additional context
I thought the result hook would be the best way to debug, but any other suggestions gladly welcomed. I assumed that this was a bug in our code, but I cannot figure out what could be causing the repetition (and mismatch).
Apollo normalizes its cache based on the __typename and the id (or _id) field. You need to include an id or _id field in your selection set alongside email. Failing to do so results in both objects being assigned the same key. If you don't have an id field to request, you'll need to provide a custom dataIdFromObject function as shown here.
From Guillaume Chau (https://github.com/Akryum):
This is because the Apollo Client cache can't compute a different ID
for the two items, so you endup with Account:undefined (or similar)
for both. Open the Apollo devtools and look at the myAccounts key in
the cache.
Learn more:
https://www.apollographql.com/docs/react/caching/cache-configuration/

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!

Resources