I want to be able to pull all github pull reviews via the api. At the moment you can only GET a review via a specific number as per the below
GET /repos/:owner/:repo/pulls/:pull_number/reviews
Is there a way that instead of just 1 pull_number i can pull through all pull reviews?
Im using Postman for the requests.
You can use GraphQL API v4 iterating over the pull requests and getting reviews list for each one. But it would give you a bunch of issues that have no reviews, so you would need to use the Github Search API to filter only issues of type PR that have been reviewed :
https://api.github.com/search/issues?q=repo:mui-org/material-ui%20type:pr%20-review:none
Using GraphQL v4 you can get the reviews easily :
{
search(type: ISSUE, query: "repo:mui-org/material-ui type:pr -review:none", first: 100) {
issueCount
nodes {
... on PullRequest {
number
reviews(first: 100) {
nodes {
author {
login
}
bodyText
state
createdAt
}
}
}
}
}
}
Related
Facebook mentioned they're now making reels data available with the /insights endpoint, yay (see here )!
Although the article says they've updated their docs I don't see how it would be formatted, do we think the format will be like this?
insta_page_id/insights?metric=reels&period=lifetime
For a reels post in Instagram, you can try the following query in the Meta Graph API explorer(Assuming you have an app with required permissions):
[IGpost-id]/insights?metric=likes, comments, shares, plays,reach,saved,total_interactions
The above query should give you a response for these metric.
Currently I did not find any media_type as "reels". A reels media_type is still tagged as Video. Only way to identify if a post is a reel is through the permalink url which contains https://www.instagram.com/**reel**/XXXXXXX in it.
https://developers.facebook.com/docs/instagram-api/reference/ig-media/insights/
Thanks to #KristiLuna's comment above I was able to solve a similar problem.
Instagram reels are still identified by the Instagram Graph API as media_type: "VIDEO". The way to tell the difference between a feed video and a reel is by checking the media_product_type field on the Graph API.
My approach (to loop through an Instagram user's media):
fetch (`https://graph.facebook.com/v14.0/${ig-user-id}/media?fields=id,media_type,media_product_type`, {method: 'get'})
.then(response => response.json())
.then(data => {
let dataObject = data.data
dataObject.forEach((item, i) => {
if (dataObject[i].media_type === "VIDEO" && dataObject[i].media_product_type === "REELS") {
// do stuff
})
}
}
I´ve gotten an echo show on Christmas. Now I want to try out how I can customize it a bit. I have created several sensors whose metrics are stored in an AWS DynamoDB. Now I am wondering what possibilities I have to show charts created out of that data. Is it possible to display charts using Alexa Presentation Language (APL) directly? Is it possible to include iframes in APL?
I did not find much information on that topic. Maybe you can point me to the right direction.
Many thanks in advance
Not sure if this is what you were looking for, but you can generate SVG graphics and render those using APL VectorGraphic primitives.
You will have to build a custom skill that, when invoked, can pull the data for your metrics, and generate the APL to render the graphs.
Alternatively, if you have a different server-side rendering API for the metrics that can rasterize, you can produce a PNG and render that on the Echo Show.
For reference, I will show the code a a nodejs function which is able to navigate to an URL:
const MetricsChoiceIntentHandler = {
canHandle(handlerInput) {
return Alexa.getIntentName(handlerInput.requestEnvelope) === 'MetricsChoiceIntent';
},
handle(handlerInput) {
const choice = handlerInput.requestEnvelope.request.intent.slots.choice.value;
const speakOutput = `Alles klar. Auf zu ${choice}`;
console.log("Deine Wahl: "+choice);
if (Alexa.getSupportedInterfaces(handlerInput.requestEnvelope)['Alexa.Presentation.APL']) {
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
document: launchDocument,
token: 'jip'
});
var urlToGo="";
switch(choice){
case "gaswarner":
urlToGo="https://www.url1.com";
break;
case "temperatur":
urlToGo="https://www.url2.com"
break;
}
handlerInput.responseBuilder.addDirective({
type: "Alexa.Presentation.APL.ExecuteCommands",
token: 'jip',
commands: [{
type: "OpenURL",
source: urlToGo
}]
});
}
return handlerInput.responseBuilder
.speak(speakOutput)
.getResponse();
}
};
There are two important things to mention:
You have to respond with a document in order to navigate to a URL. This can also be a blank dummy APL document
If you want to navigate to an URL, you have to set the token (which can be anything you like) on both the document and the command directive.
i'm new to all the hot graphql/apollo stuff.
I have a subscription which gets a search result:
export const SEARCH_RESULTS_SUBSCRIPTION = gql`
subscription onSearchResultsRetrieved($sid: String!) {
searchResultsRetrieved(sid: $sid) {
status
clusteredOffers {
id
}
}
}
`;
Is it possible to query the "status" field from client cache if i need it inside another component? Or do i have to use an additional ?
In the apollo dev-tools i can see that there is a cache entry under "ROOT_SUBSCRIPTION" not "ROOT_QUERY". What does that mean?
....thanks
I found out that subscribeToMore is my friend to solve this.
At first i wrote a normal query for the data i want to subscribe to have cached data, then the cache will be updated by the subscription.
<3 apollo
I have a query like this in my React/Apollo application:
const APPLICATIONS_QUERY = gql`
{
applications {
id
applicationType {
name
}
customer {
id
isActive
name
shortName
displayTimezone
}
deployments {
id
created
user {
id
username
}
}
baseUrl
customerIdentifier
hostInformation
kibanaUrl
sentryIssues
sentryShortName
serviceClass
updown
updownToken
}
}
`;
The majority of the items in the query are in a database and so the query is quick. But a couple of the items, like sentryIssues and updown rely on external API calls, so they make the duration of the query very long.
I'd like to split the query into the database portion and the external API portion so I can show the applications table immediately and add loading spinners for the two columns that hit an external API... But I can't find a good example of incremental/progressive querying or merging the results of two queries with Apollo.
This is a good example of where the #defer directive would be helpful. You can indicate which fields you want to defer for a given query like this:
const APPLICATIONS_QUERY = gql`
{
applications {
id
applicationType {
name
}
customer #defer {
id
isActive
name
shortName
displayTimezone
}
}
}
`
In this case, the client will make one request but receive 2 responses -- the initial response with all the requested fields sans customer and a second "patch" response with just the customer field that's fired once that resolver is finished. The client does the heavy lifting and pieces these two responses together for you -- there's no additional code necessary.
Please be aware that only nullable fields can be deferred, since the initial value sent with the first response will always be null. As a bonus, react-apollo exposes a loadingState property that you can use to check the loading state for your deferred fields:
<Query query={APPLICATIONS_QUERY}>
{({ loading, error, data, loadingState }) => {
const customerComponent = loadingState.applications.customer
? <CustomerInfo customer={data.applications.customer} />
: <LoadingIndicator />
// ...
}}
</Query>
The only downside is this is an experimental feature, so at the moment you have to install the alpha preview version of both apollo-server and the client libraries to use it.
See the docs for full details.
I'm struggling with the batch request to the Facebook API in React Native. For a single request this tutorial works fine : https://github.com/facebook/react-native-fbsdk.
But can I create a batch request. Using GraphRequestBatch does not seem to work. Adding up request with addRequest() neither (such as suggested in https://github.com/facebook/react-native-fbsdk/issues/185).
Please help! I would like to send a batch of request with the same node and same edges, excepts only the time span changes.
Each request will look like :
const request = new GraphRequest('me/',
{
accessToken: accessToken,
parameters: {
fields: {
string: 'posts.since(t1).until(t2).limit(n){likes.summary(true)}'
}
}
},
responseInfoCallback);
I tried creating several requests, each with a different t1 and t2, then add them up like this :
const graphmanager = new GraphRequestManager().addRequest(requesta);
graphmanager.addRequest(requestb);
...
graphmanager.start();
But only the first request gets executed.
Thanks for the help!