GitHub GraphQL API
let username = `xgqfrms-GitHub`;
repo = `Node-CLI-Tools/commits`;
const url = `https://api.github.com/repos/${username}/${repo}`;
// https://api.github.com/repos/xgqfrms-GitHub/Node-CLI-Tools/commits
// Error API: https://api.github.com/users/${username}/${repo}
fetch(`https://api.github.com/repos/${username}/${repo}`,{
data: {
client_id: '08ecc2f68d922f1????',
client_secret: '5846d428b5340812b76c9637eceaee97934????'
}
})
.then((response) => response.json())
.then((json)=> {
console.log(`json = ${json}`);
return repos = json;
})
.then((repos)=>{
console.log(`repos = ${repos}`);
console.log(`repos = ${repos.length}`);
console.log(`repos$ 0 = ${repos[0]}`);
console.log(`repos$ 1 = ${repos[1]}`);
for (let i = 0; i < repos.length; i++) {
console.log(`repos${i} = ${repos[i]}`);
}
});
// https://api.github.com/users/xgqfrms
// https://api.github.com/users/xgqfrms/react2 ???
let nct = ((username=`xgqfrms-GitHub`, repo=`Node-CLI-Tools`) => {
fetch(`https://api.github.com/repos/${username}/${repo}/commits`,{
data: {
client_id: '08ecc2f68d922f1????',
client_secret: '5846d428b5340812b76c9637eceaee97934????'
}
})
.then((response) => response.json())
.then((json)=> {
return repos = json;
})
.then((repos)=>{
console.log(repos);
});
})();
/*
API
https://developer.github.com/v3/repos/
https://developer.github.com/v3/users/
https://developer.github.com/v3/repos/#list-user-repositories
https://developer.github.com/v3/repos/#list-organization-repositories
*/
fetch(`https://api.github.com/orgs/webgeeker/repos/`,{
data: {
client_id: '08ecc2f68d922f1????',
client_secret: '5846d428b5340812b76c9637eceaee97934????'
}
})
.then((response) => response.json())
.then((json)=> {
console.log(`json = ${json}`);
return repos = json;
});
fetch(`https://api.github.com/users`,{
data: {
client_id: '08ecc2f68d922f1????',
client_secret: '5846d428b5340812b76c9637eceaee97934????'
}
})
.then((response) => response.json())
.then((json)=> {
console.log(`json = ${json}`);
return repos = json;
});
fetch(`https://api.github.com/users/xgqfrms`,{
data: {
client_id: '08ecc2f68d922f1????',
client_secret: '5846d428b5340812b76c9637eceaee97934????'
}
})
.then((response) => response.json())
.then((json)=> {
console.log(`json = ${json}`);
return repos = json;
});
https://developer.github.com/v4/
数据脱敏
https://gist.github.com/xgqfrms-GitHub/d3f1ac685335d481572d5390d7c31a1c
https://www.pluralsight.com/courses/graphql-scalable-apis
https://www.pluralsight.com/courses/react-apps-with-relay-graphql-flux
https://www.pluralsight.com/blog/career/smarter-secrets-passion-projects
samer-buna React & GraphQL
https://www.pluralsight.com/authors/samer-buna