Convert [maintenance mastodon matrix mavencentral] classes to static props (#5588)
* Refactor jira,jitpack,jsdelivr,keybase service files * refactor maintenance mastodon matric and maven-central service files Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
@@ -3,36 +3,28 @@
|
||||
const { NonMemoryCachingBaseService } = require('..')
|
||||
|
||||
module.exports = class Maintenance extends NonMemoryCachingBaseService {
|
||||
static get category() {
|
||||
return 'other'
|
||||
static category = 'other'
|
||||
|
||||
static route = {
|
||||
base: 'maintenance',
|
||||
pattern: ':maintained/:year(\\d{4})',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'maintenance',
|
||||
pattern: ':maintained/:year(\\d{4})',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Maintenance',
|
||||
pattern: ':maintained(yes|no)/:year',
|
||||
namedParams: {
|
||||
maintained: 'yes',
|
||||
year: '2019',
|
||||
},
|
||||
staticPreview: this.render({ isMaintained: false, targetYear: '2018' }),
|
||||
keywords: ['maintained'],
|
||||
static examples = [
|
||||
{
|
||||
title: 'Maintenance',
|
||||
pattern: ':maintained(yes|no)/:year',
|
||||
namedParams: {
|
||||
maintained: 'yes',
|
||||
year: '2019',
|
||||
},
|
||||
]
|
||||
}
|
||||
staticPreview: this.render({ isMaintained: false, targetYear: '2018' }),
|
||||
keywords: ['maintained'],
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
label: 'maintained',
|
||||
}
|
||||
static defaultBadgeData = {
|
||||
label: 'maintained',
|
||||
}
|
||||
|
||||
static render({ isMaintained, isStale, targetYear, message }) {
|
||||
|
||||
@@ -21,40 +21,32 @@ const documentation = `
|
||||
`
|
||||
|
||||
module.exports = class MastodonFollow extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'social'
|
||||
static category = 'social'
|
||||
|
||||
static route = {
|
||||
base: 'mastodon/follow',
|
||||
pattern: ':id',
|
||||
queryParamSchema,
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'mastodon/follow',
|
||||
pattern: ':id',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Mastodon Follow',
|
||||
namedParams: {
|
||||
id: '26471',
|
||||
},
|
||||
queryParams: { domain: 'https://mastodon.social' },
|
||||
staticPreview: {
|
||||
label: 'Follow',
|
||||
message: '862',
|
||||
style: 'social',
|
||||
},
|
||||
documentation,
|
||||
static examples = [
|
||||
{
|
||||
title: 'Mastodon Follow',
|
||||
namedParams: {
|
||||
id: '26471',
|
||||
},
|
||||
]
|
||||
}
|
||||
queryParams: { domain: 'https://mastodon.social' },
|
||||
staticPreview: {
|
||||
label: 'Follow',
|
||||
message: '862',
|
||||
style: 'social',
|
||||
},
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
namedLogo: 'mastodon',
|
||||
}
|
||||
static defaultBadgeData = {
|
||||
namedLogo: 'mastodon',
|
||||
}
|
||||
|
||||
static render({ username, followers, domain }) {
|
||||
|
||||
@@ -53,43 +53,33 @@ const documentation = `
|
||||
`
|
||||
|
||||
module.exports = class Matrix extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'chat'
|
||||
static category = 'chat'
|
||||
|
||||
static route = {
|
||||
base: 'matrix',
|
||||
pattern: ':roomAlias',
|
||||
queryParamSchema,
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'matrix',
|
||||
pattern: ':roomAlias',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
static examples = [
|
||||
{
|
||||
title: 'Matrix',
|
||||
namedParams: { roomAlias: 'twim:matrix.org' },
|
||||
staticPreview: this.render({ members: 42 }),
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'Matrix',
|
||||
namedParams: { roomAlias: 'twim:matrix.org' },
|
||||
queryParams: { server_fqdn: 'matrix.org' },
|
||||
staticPreview: this.render({ members: 42 }),
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Matrix',
|
||||
namedParams: { roomAlias: 'twim:matrix.org' },
|
||||
staticPreview: this.render({ members: 42 }),
|
||||
documentation,
|
||||
},
|
||||
{
|
||||
title: 'Matrix',
|
||||
namedParams: { roomAlias: 'twim:matrix.org' },
|
||||
queryParams: { server_fqdn: 'matrix.org' },
|
||||
staticPreview: this.render({ members: 42 }),
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
}
|
||||
static _cacheLength = 30
|
||||
|
||||
static get _cacheLength() {
|
||||
return 30
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'chat' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'chat' }
|
||||
|
||||
static render({ members }) {
|
||||
return {
|
||||
|
||||
@@ -15,52 +15,44 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class MavenCentral extends BaseXmlService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
static category = 'version'
|
||||
|
||||
static route = {
|
||||
base: 'maven-central/v',
|
||||
pattern: ':groupId/:artifactId/:versionPrefix?',
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'maven-central/v',
|
||||
pattern: ':groupId/:artifactId/:versionPrefix?',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
{
|
||||
title: 'Maven Central',
|
||||
pattern: ':groupId/:artifactId',
|
||||
namedParams: {
|
||||
groupId: 'org.apache.maven',
|
||||
artifactId: 'apache-maven',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'maven-central',
|
||||
message: 'v3.6.0',
|
||||
color: 'blue',
|
||||
},
|
||||
static examples = [
|
||||
{
|
||||
title: 'Maven Central',
|
||||
pattern: ':groupId/:artifactId',
|
||||
namedParams: {
|
||||
groupId: 'org.apache.maven',
|
||||
artifactId: 'apache-maven',
|
||||
},
|
||||
{
|
||||
title: 'Maven Central with version prefix filter',
|
||||
pattern: ':groupId/:artifactId/:versionPrefix',
|
||||
namedParams: {
|
||||
groupId: 'org.apache.maven',
|
||||
artifactId: 'apache-maven',
|
||||
versionPrefix: '2',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'maven-central',
|
||||
message: 'v2.2.1',
|
||||
color: 'blue',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'maven-central',
|
||||
message: 'v3.6.0',
|
||||
color: 'blue',
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
title: 'Maven Central with version prefix filter',
|
||||
pattern: ':groupId/:artifactId/:versionPrefix',
|
||||
namedParams: {
|
||||
groupId: 'org.apache.maven',
|
||||
artifactId: 'apache-maven',
|
||||
versionPrefix: '2',
|
||||
},
|
||||
staticPreview: {
|
||||
label: 'maven-central',
|
||||
message: 'v2.2.1',
|
||||
color: 'blue',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'maven-central' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'maven-central' }
|
||||
|
||||
async fetch({ groupId, artifactId }) {
|
||||
const group = encodeURIComponent(groupId).replace(/\./g, '/')
|
||||
|
||||
Reference in New Issue
Block a user