-
-
Save debasishbsws/f7ca11128aa73e1f241be499e706b385 to your computer and use it in GitHub Desktop.
Github graphql Api pinned repositories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get data from the Github GraphQl api | |
async function get_repo() { | |
try { | |
fetch('https://api.github.com/graphql', { | |
method: 'post', | |
headers: { | |
Authorization: `key, | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ | |
query: `{ | |
user(login: "UserNameHere") { | |
pinnedItems(first: 6, types: REPOSITORY) { | |
nodes { | |
... on RepositoryInfo { | |
name | |
description | |
url | |
createdAt | |
updatedAt | |
} | |
} | |
} | |
} | |
}` | |
}) | |
}) | |
.then((response) => response.json()).then(x => {repo_data(x.data.user.pinnedItems.nodes)}) | |
}catch(err) { | |
console.log("it was not possible to get the pinned repositories from github" , err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment