Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRepositoryContents(arg,cb){
- let masterTreeSHA;
- getLatestMasterTreeSha(arg,(master)=>{
- masterTreeSHA = master['commit']['commit']['tree']['sha'];
- let options = {
- method:"GET",
- url: arg.baseRepoApiUrl+'/git/trees/'+masterTreeSHA+'?recursive=1',
- headers: {
- 'Authorization': arg.keyStr
- }
- };
- request(options, (error, response, body) =>{
- if(!error){
- cb(JSON.parse(body));
- }else {
- console.log("can't fetch latest tree ")
- }
- });
- });
- }
- function getLatestMasterTreeSha(arg, cb){
- let options = {
- method:"GET",
- url: arg.baseRepoApiUrl+'/branches/master',
- headers: {
- 'Authorization': arg.keyStr
- }
- };
- request(options, (error, response, body) =>{
- if(!error){
- cb(JSON.parse(body));
- }else {
- console.log("can't fetch latest master commit ")
- }
- });
- }
Add Comment
Please, Sign In to add comment