本文整理匯總了TypeScript中gh-issues-api.GHRepository類的典型用法代碼示例。如果您正苦於以下問題:TypeScript GHRepository類的具體用法?TypeScript GHRepository怎麽用?TypeScript GHRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了GHRepository類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: GHRepository
var promises = repositories.map(repoName => {
var repo:GHRepository;
if (user && token) {
repo = new GHRepository(owner, repoName, user, token);
} else {
repo = new GHRepository(owner, repoName);
}
var report = {
name: repoName,
};
return repo.loadAllIssues()
.then(() => {
var promises = labels.map(label => {
var filterCollection = new FilterCollection();
filterCollection.label = new IssueLabelFilter(label);
return Promise.all([
repo.list(IssueType.All, IssueState.Open, filterCollection).then(issues => report[label] = issues.length),
repo.list(IssueType.All, IssueState.Open).then(issues => report['total'] = issues.length)
]);
});
return Promise.all(promises);
})
.then(() => {
var counters = labels.map(label => report[label]).join(',');
csvLines.push(report.name + ',' + counters + ',' + report['total']);
});
});
示例2: token
.option('-p, --password [password/token]', 'Github password or security token (used to authenticate the request and raise API calls rate limits)')
.option('-d, --days [days]', 'Days since the last time the issue was updated (7 by default)')
.parse(process.argv);
if (commander.args.length < 2) {
commander.help();
process.exit(-1);
}
var owner = commander.args[0];
var repository = commander.args[1];
var user = commander.user;
var token = commander.password;
var days = commander.days || 7;
var repo:GHRepository;
if (user && token) {
repo = new GHRepository(owner, repository, user, token);
} else {
repo = new GHRepository(owner, repository);
}
var cutOffDate = moment().subtract(days, 'days').toDate();
console.log('Looking at issues not updated since ' + moment(cutOffDate).fromNow());
var createActivityFilter = function(issueActivity: IssueActivity, timestamp: Date) {
var filterCollection = new FilterCollection();
filterCollection.activity = new IssueActivityFilter(issueActivity, timestamp);
filterCollection.activity.negated = true;
return filterCollection;
};
示例3: username
.usage('[options] <OWNER> <REPOSITORY>')
.option('-u, --user [user]', 'Github username (used to authenticate the request and raise API calls rate limits)')
.option('-p, --password [password/token]', 'Github password or security token (used to authenticate the request and raise API calls rate limits)')
.parse(process.argv);
if (commander.args.length < 2) {
commander.help();
process.exit(-1);
}
var owner = commander.args[0];
var repository = commander.args[1];
var user = commander.user;
var token = commander.password;
var repo:GHRepository;
if (user && token) {
repo = new GHRepository(owner, repository, user, token);
} else {
repo = new GHRepository(owner, repository);
}
var last24Hours = new Date(Date.now() - 86400000);
var last7days = new Date(Date.now() - 604800000);
var createActivityFilter = function(issueActivity: IssueActivity, timestamp: Date) {
var filterCollection = new FilterCollection();
filterCollection.activity = new IssueActivityFilter(issueActivity, timestamp);
return filterCollection;
};
示例4: FilterCollection
var promises = labels.map(label => {
var filterCollection = new FilterCollection();
filterCollection.label = new IssueLabelFilter(label);
return Promise.all([
repo.list(IssueType.All, IssueState.Open, filterCollection).then(issues => report[label] = issues.length),
repo.list(IssueType.All, IssueState.Open).then(issues => report['total'] = issues.length)
]);
});
示例5: function
var countcmd = function(params: Array<string>) {
var query = translateParams(params);
repo.list(query.type, query.state, query.filters).then(issues => {
console.log(issues.length);
startPrompt();
});
};
示例6:
.then(() => repo.list(IssueType.Issue, IssueState.Open, notUpdated))
示例7:
repo.loadAllIssues().then(() => {
return Promise.all([
repo.list(IssueType.Issue, IssueState.Open),
repo.list(IssueType.Issue, IssueState.Closed),
repo.list(IssueType.PullRequest, IssueState.Open),
repo.list(IssueType.PullRequest, IssueState.Closed),
repo.list(IssueType.Issue, IssueState.All, createdLastWeek),
repo.list(IssueType.Issue, IssueState.Open, updatedLastWeek),
repo.list(IssueType.Issue, IssueState.Closed, closedLastWeek),
repo.list(IssueType.PullRequest, IssueState.All, createdLastWeek),
repo.list(IssueType.PullRequest, IssueState.Open, updatedLastWeek),
repo.list(IssueType.PullRequest, IssueState.Closed, closedLastWeek),
repo.list(IssueType.Issue, IssueState.All, createdLastDay),
repo.list(IssueType.Issue, IssueState.Open, updatedLastDay),
repo.list(IssueType.Issue, IssueState.Closed, closedLastDay),
repo.list(IssueType.PullRequest, IssueState.All, createdLastDay),
repo.list(IssueType.PullRequest, IssueState.Open, updatedLastDay),
repo.list(IssueType.PullRequest, IssueState.Closed, closedLastDay)
]);
}).then(function(issuesList){