Refactor jira,jitpack,jsdelivr,keybase service files (#5581)
This commit is contained in:
@@ -21,24 +21,17 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JiraIssue extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'issue-tracking'
|
||||
}
|
||||
static category = 'issue-tracking'
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'jira/issue',
|
||||
pattern: ':issueKey',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
|
||||
static get auth() {
|
||||
return authConfig
|
||||
}
|
||||
static auth = authConfig
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'JIRA issue',
|
||||
namedParams: {
|
||||
@@ -54,11 +47,8 @@ module.exports = class JiraIssue extends BaseJsonService {
|
||||
}),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { color: 'lightgrey', label: 'jira' }
|
||||
}
|
||||
static defaultBadgeData = { color: 'lightgrey', label: 'jira' }
|
||||
|
||||
static render({ issueKey, statusName, statusColor }) {
|
||||
let color = 'lightgrey'
|
||||
|
||||
@@ -33,24 +33,17 @@ const documentation = `
|
||||
`
|
||||
|
||||
module.exports = class JiraSprint extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'issue-tracking'
|
||||
}
|
||||
static category = 'issue-tracking'
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'jira/sprint',
|
||||
pattern: ':sprintId',
|
||||
queryParamSchema,
|
||||
}
|
||||
}
|
||||
|
||||
static get auth() {
|
||||
return authConfig
|
||||
}
|
||||
static auth = authConfig
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'JIRA sprint completion',
|
||||
namedParams: {
|
||||
@@ -66,11 +59,8 @@ module.exports = class JiraSprint extends BaseJsonService {
|
||||
documentation,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'jira' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'jira' }
|
||||
|
||||
static render({ numCompletedIssues, numTotalIssues }) {
|
||||
const percentComplete = numTotalIssues
|
||||
|
||||
@@ -10,19 +10,14 @@ const schema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class JitPackVersion extends BaseJsonService {
|
||||
static get category() {
|
||||
return 'version'
|
||||
}
|
||||
static category = 'version'
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'jitpack/v',
|
||||
pattern: ':vcs(github|bitbucket|gitlab|gitee)/:user/:repo',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'JitPack',
|
||||
namedParams: {
|
||||
@@ -34,11 +29,8 @@ module.exports = class JitPackVersion extends BaseJsonService {
|
||||
keywords: ['java', 'maven'],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'jitpack' }
|
||||
}
|
||||
static defaultBadgeData = { label: 'jitpack' }
|
||||
|
||||
async fetch({ vcs, user, repo }) {
|
||||
const url = `https://jitpack.io/api/builds/com.${vcs}.${user}/${repo}/latest`
|
||||
|
||||
@@ -3,15 +3,12 @@
|
||||
const { schema, periodMap, BaseJsDelivrService } = require('./jsdelivr-base')
|
||||
|
||||
module.exports = class JsDelivrHitsGitHub extends BaseJsDelivrService {
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'jsdelivr/gh',
|
||||
pattern: ':period(hd|hw|hm|hy)/:user/:repo',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'jsDelivr hits (GitHub)',
|
||||
namedParams: {
|
||||
@@ -22,7 +19,6 @@ module.exports = class JsDelivrHitsGitHub extends BaseJsDelivrService {
|
||||
staticPreview: this.render({ period: 'hm', hits: 9809876 }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
async fetch({ period, user, repo }) {
|
||||
return this._requestJson({
|
||||
|
||||
@@ -3,15 +3,12 @@
|
||||
const { schema, periodMap, BaseJsDelivrService } = require('./jsdelivr-base')
|
||||
|
||||
module.exports = class JsDelivrHitsNPM extends BaseJsDelivrService {
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'jsdelivr/npm',
|
||||
pattern: ':period(hd|hw|hm|hy)/:scope(@[^/]+)?/:packageName',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'jsDelivr hits (npm)',
|
||||
pattern: ':period(hd|hw|hm|hy)/:packageName',
|
||||
@@ -32,7 +29,6 @@ module.exports = class JsDelivrHitsNPM extends BaseJsDelivrService {
|
||||
staticPreview: this.render({ period: 'hm', hits: 94123 }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
async fetch({ period, packageName }) {
|
||||
return this._requestJson({
|
||||
|
||||
@@ -29,15 +29,12 @@ const bitcoinAddressSchema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class KeybaseBTC extends KeybaseProfile {
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'keybase/btc',
|
||||
pattern: ':username',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'Keybase BTC',
|
||||
namedParams: { username: 'skyplabs' },
|
||||
@@ -47,14 +44,11 @@ module.exports = class KeybaseBTC extends KeybaseProfile {
|
||||
keywords: ['bitcoin'],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
static defaultBadgeData = {
|
||||
label: 'btc',
|
||||
color: 'informational',
|
||||
}
|
||||
}
|
||||
|
||||
static render({ address }) {
|
||||
return {
|
||||
@@ -62,9 +56,7 @@ module.exports = class KeybaseBTC extends KeybaseProfile {
|
||||
}
|
||||
}
|
||||
|
||||
static get apiVersion() {
|
||||
return '1.0'
|
||||
}
|
||||
static apiVersion = '1.0'
|
||||
|
||||
async handle({ username }) {
|
||||
const options = {
|
||||
|
||||
@@ -25,29 +25,23 @@ const keyFingerprintSchema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class KeybasePGP extends KeybaseProfile {
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'keybase/pgp',
|
||||
pattern: ':username',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'Keybase PGP',
|
||||
namedParams: { username: 'skyplabs' },
|
||||
staticPreview: this.render({ fingerprint: '1863145FD39EE07E' }),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
static defaultBadgeData = {
|
||||
label: 'pgp',
|
||||
color: 'informational',
|
||||
}
|
||||
}
|
||||
|
||||
static render({ fingerprint }) {
|
||||
return {
|
||||
@@ -55,9 +49,7 @@ module.exports = class KeybasePGP extends KeybaseProfile {
|
||||
}
|
||||
}
|
||||
|
||||
static get apiVersion() {
|
||||
return '1.0'
|
||||
}
|
||||
static apiVersion = '1.0'
|
||||
|
||||
async handle({ username }) {
|
||||
const options = {
|
||||
|
||||
@@ -27,15 +27,12 @@ const stellarAddressSchema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class KeybaseXLM extends KeybaseProfile {
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'keybase/xlm',
|
||||
pattern: ':username',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'Keybase XLM',
|
||||
namedParams: { username: 'skyplabs' },
|
||||
@@ -45,14 +42,11 @@ module.exports = class KeybaseXLM extends KeybaseProfile {
|
||||
keywords: ['stellar'],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
static defaultBadgeData = {
|
||||
label: 'xlm',
|
||||
color: 'informational',
|
||||
}
|
||||
}
|
||||
|
||||
static render({ address }) {
|
||||
return {
|
||||
@@ -60,9 +54,7 @@ module.exports = class KeybaseXLM extends KeybaseProfile {
|
||||
}
|
||||
}
|
||||
|
||||
static get apiVersion() {
|
||||
return '1.0'
|
||||
}
|
||||
static apiVersion = '1.0'
|
||||
|
||||
async handle({ username }) {
|
||||
const options = {
|
||||
|
||||
@@ -29,15 +29,12 @@ const zcachAddressSchema = Joi.object({
|
||||
}).required()
|
||||
|
||||
module.exports = class KeybaseZEC extends KeybaseProfile {
|
||||
static get route() {
|
||||
return {
|
||||
static route = {
|
||||
base: 'keybase/zec',
|
||||
pattern: ':username',
|
||||
}
|
||||
}
|
||||
|
||||
static get examples() {
|
||||
return [
|
||||
static examples = [
|
||||
{
|
||||
title: 'Keybase ZEC',
|
||||
namedParams: { username: 'skyplabs' },
|
||||
@@ -47,14 +44,11 @@ module.exports = class KeybaseZEC extends KeybaseProfile {
|
||||
keywords: ['zcash'],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return {
|
||||
static defaultBadgeData = {
|
||||
label: 'zec',
|
||||
color: 'informational',
|
||||
}
|
||||
}
|
||||
|
||||
static render({ address }) {
|
||||
return {
|
||||
@@ -62,9 +56,7 @@ module.exports = class KeybaseZEC extends KeybaseProfile {
|
||||
}
|
||||
}
|
||||
|
||||
static get apiVersion() {
|
||||
return '1.0'
|
||||
}
|
||||
static apiVersion = '1.0'
|
||||
|
||||
async handle({ username }) {
|
||||
const options = {
|
||||
|
||||
Reference in New Issue
Block a user