This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjhub.min.js
7 lines (7 loc) · 5.17 KB
/
jhub.min.js
1
2
3
4
5
6
7
/**
* jhub - JavaScript bindings for the GitHub API
* @version 2.4.1
* @link http://willitcompile.net/projects/jhub
* @license MIT
*/
!function(){function t(t,a){i.__jsonp_callback=function(t){a(t)};var r=document.getElementsByTagName("head")[0],e=document.createElement("script");e.setAttribute("src",t+"?callback=jhub.__jsonp_callback"),r.appendChild(e),r.removeChild(e)}function a(t){return{name:t.filename,language:t.language,url:t.raw_url,size:t.size,type:t.type}}function r(t){return{id:t.id,name:t.name,fullName:t.full_name,language:t.language,url:t.url,htmlUrl:t.html_url,gitUrl:t.git_url,sshUrl:t.ssh_url,cloneUrl:t.clone_url,created:t.created_at,updated:t.updated_at,pushedAt:t.pushed_at,description:t.description,fork:t.fork,defaultBranch:t.default_branch,stars:t.stargazers_count,forks:t.forks_count,homepage:t.homepage,hasPages:t.has_pages,owner:{id:t.owner.id,login:t.owner.login,htmlUrl:t.owner.html_url}}}var i={};i.init=function(t){return this.githubUser=t,this},i.gists=function(a){return t("https://api.github.com/users/"+this.githubUser+"/gists",function(t){var r=[];for(var i in t.data){var e={id:t.data[i].id,description:t.data[i].description,url:t.data[i].html_url};r.push(e)}a(r)}),this},i.gist=function(t){if(!(this instanceof i.gist))return new i.gist(t);this.gistId=t},i.gist.prototype.files=function(r){return t("https://api.github.com/gists/"+this.gistId,function(t){var i=[];for(var e in t.data.files)i.push(a(t.data.files[e]));r(i)}),this},i.gist.prototype.get=function(r){return t("https://api.github.com/gists/"+this.gistId,function(t){var i=[];for(var e in t.data.files)i.push(a(t.data.files[e]));var o={id:t.data.id,description:t.data.description,url:t.data.html_url,pullUrl:t.data.git_pull_url,pushUrl:t.data.git_push_url,files:i};r(o)}),this},i.userOrgs=function(a){return t("https://api.github.com/users/"+this.githubUser+"/orgs",function(t){var r=[];for(var i in t.data)r.push({id:t.data[i].id,login:t.data[i].login});a(r)}),this},i.org=function(t){if(!(this instanceof i.org))return new i.org(t);this.orgName=t},i.org.prototype.get=function(a){return t("https://api.github.com/orgs/"+this.orgLogin,function(t){var r={id:t.data.id,login:t.data.login,name:t.data.name,description:t.data.description,blog:t.data.blog,htmlUrl:t.data.html_url,publicRepos:t.data.public_repos};a(r)}),this},i.org.prototype.members=function(a){return t("https://api.github.com/orgs/"+this.orgName+"/public_members",function(t){var r=[];for(var i in t.data)r.push({login:t.data[i].login});a(r)}),this},i.repos=function(a){return t("https://api.github.com/users/"+i.githubUser+"/repos",function(t){var i=[];for(var e in t.data){var o=r(t.data[e]);i.push(o)}a(i)}),this},i.starredRepos=function(a){return t("https://api.github.com/users/"+i.githubUser+"/starred",function(t){var i=[];for(var e in t.data){var o=r(t.data[e]);i.push(o)}a(i)}),this},i.repo=function(t){if(!(this instanceof i.repo))return new i.repo(t);this.repoName=t},i.repo.prototype.commits=function(a){return t("https://api.github.com/repos/"+i.githubUser+"/"+this.repoName+"/commits",function(t){var r=[];for(var i in t.data)r.push({author:{name:t.data[i].author.name,email:t.data[i].author.email,date:t.data[i].author.date},committer:{name:t.data[i].committer.name,email:t.data[i].committer.email,date:t.data[i].committer.date},message:t.data[i].message});a(r)}),this},i.repo.prototype.releases=function(a){return t("https://api.github.com/repos/"+i.githubUser+"/"+this.repoName+"/releases",function(t){var r=[];for(var i in t.data){var e={id:t.data[i].id,tagName:t.data[i].tag_name,name:t.data[i].name,author:{login:t.data[i].author.login,url:t.data[i].author.url},branch:t.data[i].target_commitish,draft:t.data[i].draft,htmlUrl:t.data[i].html_url,zipballUrl:t.data[i].zipball_url,tarballUrl:t.data[i].tarball_url};r.push(e)}a(r)}),this},i.repo.prototype.tags=function(a){return t("https://api.github.com/repos/"+i.githubUser+"/"+this.repoName+"/tags",function(t){var r=[];for(var i in t.data){var e={name:t.data[i].name,zipballUrl:t.data[i].zipball_url,tarballUrl:t.data[i].tarball_url,commit:{sha:t.data[i].commit.sha,url:t.data[i].commit.url}};r.push(e)}a(r)}),this},i.repo.prototype.stargazers=function(a){return t("https://api.github.com/repos/"+i.githubUser+"/"+this.repoName+"/stargazers",function(t){var r=[];for(var i in t.data){var e={id:t.data[i].id,login:t.data[i].login,htmlUrl:t.data[i].html_url,type:t.data[i].type};r.push(e)}a(r)}),this},i.repo.prototype.contributors=function(a){return t("https://api.github.com/repos/"+i.githubUser+"/"+this.repoName+"/contributors",function(t){var r=[];for(var i in t.data){var e={id:t.data[i].id,login:t.data[i].login,url:t.data[i].url,htmlUrl:t.data[i].html_url,type:t.data[i].type,contributions:t.data[i].contributions};r.push(e)}a(r)}),this},i.user=function(t){if(!(this instanceof i.user))return new i.user(t);this.name=t},i.user.prototype.get=function(a){return t("https://api.github.com/users/"+this.name,function(t){var r={id:t.data.id,login:t.data.login,name:t.data.name,company:t.data.company,blog:t.data.blog,location:t.data.location,bio:t.data.bio,publicRepos:t.data.public_repos,publicGists:t.data.public_gists,followers:t.data.followers,following:t.data.following};a(r)}),this},"undefined"!=typeof exports?module.exports=i:window.jhub=i}();