convert some service classes to static fields, run [GitHubForks GitHubGoMod GitHubIssueDetail GitHubIssues GitHubLabels GitHubLanguageCount GitHubLastCommit] (#5590)
* refactor(githubforks): convert to static fields * refactor(githubgomod): convert to static fields * refactor(githubissuedetail): convert to static fields * refactor(githubissues): convert to static fields * refactor(githublabels): convert to static fields * refactor(githublanguagecount): convert to static fields * refactor(githublastcommit): convert to static fields Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
This commit is contained in:
@@ -16,49 +16,33 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class GithubForks extends GithubAuthV4Service {
|
||||
static get category() {
|
||||
return 'social'
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github/forks',
|
||||
pattern: ':user/:repo',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub forks',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
// TODO: This is currently a literal, as `staticPreview` doesn't
|
||||
// support `link`.
|
||||
staticPreview: {
|
||||
label: 'Fork',
|
||||
message: '150',
|
||||
style: 'social',
|
||||
},
|
||||
// staticPreview: {
|
||||
// ...this.render({ user: 'badges', repo: 'shields', forkCount: 150 }),
|
||||
// label: 'fork',
|
||||
// style: 'social',
|
||||
// },
|
||||
queryParams: { label: 'Fork' },
|
||||
documentation,
|
||||
static category = 'social'
|
||||
static route = { base: 'github/forks', pattern: ':user/:repo' }
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub forks',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
]
|
||||
}
|
||||
// TODO: This is currently a literal, as `staticPreview` doesn't
|
||||
// support `link`.
|
||||
staticPreview: {
|
||||
label: 'Fork',
|
||||
message: '150',
|
||||
style: 'social',
|
||||
},
|
||||
// staticPreview: {
|
||||
// ...this.render({ user: 'badges', repo: 'shields', forkCount: 150 }),
|
||||
// label: 'fork',
|
||||
// style: 'social',
|
||||
// },
|
||||
queryParams: { label: 'Fork' },
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'forks',
|
||||
namedLogo: 'github',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: 'forks', namedLogo: 'github' }
|
||||
|
||||
static render({ user, repo, forkCount }) {
|
||||
return {
|
||||
|
||||
@@ -16,64 +16,55 @@ const goVersionRegExp = new RegExp('^go (.+)$', 'm')
|
||||
const keywords = ['golang']
|
||||
|
||||
module.exports = class GithubGoModGoVersion extends ConditionalGithubAuthV3Service {
|
||||
static get category() {
|
||||
return 'version'
|
||||
static category = 'version'
|
||||
static route = {
|
||||
base: 'github/go-mod/go-version',
|
||||
pattern: ':user/:repo/:branch*',
|
||||
queryParamSchema,
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github/go-mod/go-version',
|
||||
pattern: ':user/:repo/:branch*',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub go.mod Go version',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: 'gohugoio', repo: 'hugo' },
|
||||
staticPreview: this.render({ version: '1.12' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
{
|
||||
title: 'GitHub go.mod Go version (branch)',
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: {
|
||||
user: 'gohugoio',
|
||||
repo: 'hugo',
|
||||
branch: 'master',
|
||||
},
|
||||
staticPreview: this.render({ version: '1.12', branch: 'master' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
{
|
||||
title: 'GitHub go.mod Go version (subfolder of monorepo)',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: 'golang', repo: 'go' },
|
||||
queryParams: { filename: 'src/go.mod' },
|
||||
staticPreview: this.render({ version: '1.14' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
{
|
||||
title: 'GitHub go.mod Go version (branch & subfolder of monorepo)',
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: { user: 'golang', repo: 'go', branch: 'master' },
|
||||
queryParams: { filename: 'src/go.mod' },
|
||||
staticPreview: this.render({ version: '1.14' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
]
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub go.mod Go version',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: 'gohugoio', repo: 'hugo' },
|
||||
staticPreview: this.render({ version: '1.12' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
{
|
||||
title: 'GitHub go.mod Go version (branch)',
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: {
|
||||
user: 'gohugoio',
|
||||
repo: 'hugo',
|
||||
branch: 'master',
|
||||
},
|
||||
staticPreview: this.render({ version: '1.12', branch: 'master' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
{
|
||||
title: 'GitHub go.mod Go version (subfolder of monorepo)',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: { user: 'golang', repo: 'go' },
|
||||
queryParams: { filename: 'src/go.mod' },
|
||||
staticPreview: this.render({ version: '1.14' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
{
|
||||
title: 'GitHub go.mod Go version (branch & subfolder of monorepo)',
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: { user: 'golang', repo: 'go', branch: 'master' },
|
||||
queryParams: { filename: 'src/go.mod' },
|
||||
staticPreview: this.render({ version: '1.14' }),
|
||||
documentation,
|
||||
keywords,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'Go' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'Go' }
|
||||
|
||||
static render({ version, branch }) {
|
||||
return renderVersionBadge({
|
||||
|
||||
@@ -153,54 +153,45 @@ const propertyMap = {
|
||||
}
|
||||
|
||||
module.exports = class GithubIssueDetail extends GithubAuthV3Service {
|
||||
static get category() {
|
||||
return 'issue-tracking'
|
||||
static category = 'issue-tracking'
|
||||
static route = {
|
||||
base: 'github',
|
||||
pattern:
|
||||
':issueKind(issues|pulls)/detail/:property(state|title|author|label|comments|age|last-update)/:user/:repo/:number([0-9]+)',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github',
|
||||
pattern:
|
||||
':issueKind(issues|pulls)/detail/:property(state|title|author|label|comments|age|last-update)/:user/:repo/:number([0-9]+)',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub issue/pull request detail',
|
||||
namedParams: {
|
||||
issueKind: 'issues',
|
||||
property: 'state',
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
number: '979',
|
||||
},
|
||||
staticPreview: this.render({
|
||||
property: 'state',
|
||||
value: { state: 'closed' },
|
||||
isPR: false,
|
||||
number: '979',
|
||||
}),
|
||||
keywords: [
|
||||
'state',
|
||||
'title',
|
||||
'author',
|
||||
'label',
|
||||
'comments',
|
||||
'age',
|
||||
'last update',
|
||||
],
|
||||
documentation,
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub issue/pull request detail',
|
||||
namedParams: {
|
||||
issueKind: 'issues',
|
||||
property: 'state',
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
number: '979',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({
|
||||
property: 'state',
|
||||
value: { state: 'closed' },
|
||||
isPR: false,
|
||||
number: '979',
|
||||
}),
|
||||
keywords: [
|
||||
'state',
|
||||
'title',
|
||||
'author',
|
||||
'label',
|
||||
'comments',
|
||||
'age',
|
||||
'last update',
|
||||
],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'issue/pull request',
|
||||
color: 'informational',
|
||||
}
|
||||
static defaultBadgeData = {
|
||||
label: 'issue/pull request',
|
||||
color: 'informational',
|
||||
}
|
||||
|
||||
static render({ property, value, isPR, number }) {
|
||||
|
||||
@@ -38,207 +38,195 @@ const isClosedVariant = {
|
||||
}
|
||||
|
||||
module.exports = class GithubIssues extends GithubAuthV4Service {
|
||||
static get category() {
|
||||
return 'issue-tracking'
|
||||
static category = 'issue-tracking'
|
||||
static route = {
|
||||
base: 'github',
|
||||
pattern:
|
||||
':variant(issues|issues-closed|issues-pr|issues-pr-closed):raw(-raw)?/:user/:repo/:label*',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github',
|
||||
pattern:
|
||||
':variant(issues|issues-closed|issues-pr|issues-pr-closed):raw(-raw)?/:user/:repo/:label*',
|
||||
}
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub issues',
|
||||
pattern: 'issues/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'issues',
|
||||
message: '167 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub issues',
|
||||
pattern: 'issues-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open issues',
|
||||
message: '167',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub issues by-label',
|
||||
pattern: 'issues/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'service-badge issues',
|
||||
message: '110 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub issues by-label',
|
||||
pattern: 'issues-raw/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open service-badge issues',
|
||||
message: '110',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed issues',
|
||||
pattern: 'issues-closed/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'issues',
|
||||
message: '899 closed',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed issues',
|
||||
pattern: 'issues-closed-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'closed issues',
|
||||
message: '899',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests',
|
||||
pattern: 'issues-pr/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'pull requests',
|
||||
message: '136 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests',
|
||||
pattern: 'issues-pr-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open pull requests',
|
||||
message: '136',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed pull requests',
|
||||
pattern: 'issues-pr-closed/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'pull requests',
|
||||
message: '7k closed',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed pull requests',
|
||||
pattern: 'issues-pr-closed-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'closed pull requests',
|
||||
message: '7k',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests by-label',
|
||||
pattern: 'issues-pr/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'service-badge pull requests',
|
||||
message: '8 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequests', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests by-label',
|
||||
pattern: 'issues-pr-raw/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open service-badge pull requests',
|
||||
message: '8',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequests', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub issues',
|
||||
pattern: 'issues/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'issues',
|
||||
message: '167 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub issues',
|
||||
pattern: 'issues-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open issues',
|
||||
message: '167',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub issues by-label',
|
||||
pattern: 'issues/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'service-badge issues',
|
||||
message: '110 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub issues by-label',
|
||||
pattern: 'issues-raw/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open service-badge issues',
|
||||
message: '110',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed issues',
|
||||
pattern: 'issues-closed/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'issues',
|
||||
message: '899 closed',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed issues',
|
||||
pattern: 'issues-closed-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'closed issues',
|
||||
message: '899',
|
||||
color: 'yellow',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests',
|
||||
pattern: 'issues-pr/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'pull requests',
|
||||
message: '136 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests',
|
||||
pattern: 'issues-pr-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open pull requests',
|
||||
message: '136',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed pull requests',
|
||||
pattern: 'issues-pr-closed/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'pull requests',
|
||||
message: '7k closed',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub closed pull requests',
|
||||
pattern: 'issues-pr-closed-raw/:user/:repo',
|
||||
namedParams: {
|
||||
user: 'cdnjs',
|
||||
repo: 'cdnjs',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'closed pull requests',
|
||||
message: '7k',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequest', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests by-label',
|
||||
pattern: 'issues-pr/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'service-badge pull requests',
|
||||
message: '8 open',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequests', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'GitHub pull requests by-label',
|
||||
pattern: 'issues-pr-raw/:user/:repo/:label',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
label: 'service-badge',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'open service-badge pull requests',
|
||||
message: '8',
|
||||
color: 'yellow',
|
||||
},
|
||||
keywords: ['pullrequests', 'pr'],
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'issues',
|
||||
color: 'informational',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: 'issues', color: 'informational' }
|
||||
|
||||
static render({ isPR, isClosed, issueCount, raw, label }) {
|
||||
const state = isClosed ? 'closed' : 'open'
|
||||
|
||||
@@ -9,37 +9,22 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class GithubLabels extends GithubAuthV3Service {
|
||||
static get category() {
|
||||
return 'issue-tracking'
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github/labels',
|
||||
pattern: ':user/:repo/:name',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub labels',
|
||||
namedParams: {
|
||||
user: 'atom',
|
||||
repo: 'atom',
|
||||
name: 'help-wanted',
|
||||
},
|
||||
staticPreview: this.render({ name: 'help-wanted', color: '#159818' }),
|
||||
documentation,
|
||||
static category = 'issue-tracking'
|
||||
static route = { base: 'github/labels', pattern: ':user/:repo/:name' }
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub labels',
|
||||
namedParams: {
|
||||
user: 'atom',
|
||||
repo: 'atom',
|
||||
name: 'help-wanted',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ name: 'help-wanted', color: '#159818' }),
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: ' ',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: ' ' }
|
||||
|
||||
static render({ name, color }) {
|
||||
return {
|
||||
|
||||
@@ -4,36 +4,21 @@ const { BaseGithubLanguage } = require('./github-languages-base')
|
||||
const { documentation } = require('./github-helpers')
|
||||
|
||||
module.exports = class GithubLanguageCount extends BaseGithubLanguage {
|
||||
static get category() {
|
||||
return 'analysis'
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github/languages/count',
|
||||
pattern: ':user/:repo',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub language count',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
staticPreview: this.render({ count: 5 }),
|
||||
documentation,
|
||||
static category = 'analysis'
|
||||
static route = { base: 'github/languages/count', pattern: ':user/:repo' }
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub language count',
|
||||
namedParams: {
|
||||
user: 'badges',
|
||||
repo: 'shields',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ count: 5 }),
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'languages',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: 'languages' }
|
||||
|
||||
static render({ count }) {
|
||||
return {
|
||||
|
||||
@@ -23,48 +23,33 @@ const schema = Joi.array()
|
||||
.required()
|
||||
|
||||
module.exports = class GithubLastCommit extends GithubAuthV3Service {
|
||||
static get category() {
|
||||
return 'activity'
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'github/last-commit',
|
||||
pattern: ':user/:repo/:branch*',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'GitHub last commit',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: {
|
||||
user: 'google',
|
||||
repo: 'skia',
|
||||
},
|
||||
staticPreview: this.render({ commitDate: '2013-07-31T20:01:41Z' }),
|
||||
...commonExampleAttrs,
|
||||
static category = 'activity'
|
||||
static route = { base: 'github/last-commit', pattern: ':user/:repo/:branch*' }
|
||||
static examples = [
|
||||
{
|
||||
title: 'GitHub last commit',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: {
|
||||
user: 'google',
|
||||
repo: 'skia',
|
||||
},
|
||||
{
|
||||
title: 'GitHub last commit (branch)',
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: {
|
||||
user: 'google',
|
||||
repo: 'skia',
|
||||
branch: 'infra/config',
|
||||
},
|
||||
staticPreview: this.render({ commitDate: '2013-07-31T20:01:41Z' }),
|
||||
...commonExampleAttrs,
|
||||
staticPreview: this.render({ commitDate: '2013-07-31T20:01:41Z' }),
|
||||
...commonExampleAttrs,
|
||||
},
|
||||
{
|
||||
title: 'GitHub last commit (branch)',
|
||||
pattern: ':user/:repo/:branch',
|
||||
namedParams: {
|
||||
user: 'google',
|
||||
repo: 'skia',
|
||||
branch: 'infra/config',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ commitDate: '2013-07-31T20:01:41Z' }),
|
||||
...commonExampleAttrs,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'last commit',
|
||||
}
|
||||
}
|
||||
static defaultBadgeData = { label: 'last commit' }
|
||||
|
||||
static render({ commitDate }) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user