本文整理汇总了TypeScript中gh-issues-api.GHRepository.loadAllIssues方法的典型用法代码示例。如果您正苦于以下问题:TypeScript GHRepository.loadAllIssues方法的具体用法?TypeScript GHRepository.loadAllIssues怎么用?TypeScript GHRepository.loadAllIssues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gh-issues-api.GHRepository
的用法示例。
在下文中一共展示了GHRepository.loadAllIssues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: function
var createActivityFilter = function(issueActivity: IssueActivity, timestamp: Date) {
var filterCollection = new FilterCollection();
filterCollection.activity = new IssueActivityFilter(issueActivity, timestamp);
return filterCollection;
};
var createdLastWeek = createActivityFilter(IssueActivity.Created, last7days);
var updatedLastWeek = createActivityFilter(IssueActivity.Updated, last7days);
var closedLastWeek = createActivityFilter(IssueActivity.Closed, last7days);
var createdLastDay = createActivityFilter(IssueActivity.Created, last24Hours);
var updatedLastDay = createActivityFilter(IssueActivity.Updated, last24Hours);
var closedLastDay = createActivityFilter(IssueActivity.Closed, last24Hours);
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),
示例3: GHRepository
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;
};
var notUpdated = createActivityFilter(IssueActivity.Updated, cutOffDate);
repo.loadAllIssues()
.then(() => repo.list(IssueType.Issue, IssueState.Open, notUpdated))
.then(issuesList => {
console.log(issuesList.length + ' issues not updated in the past ' + days + ' days:');
issuesList.forEach(issue => {
console.log('[' + issue.number + '] ' + issue.title + ': last updated: ' + moment(issue.updated_at).fromNow());
});
process.exit(0);
});
示例4: function
var loadcmd = function() {
console.log('Loading issues from Github...');
repo.loadAllIssues().then(() => startPrompt());
};