migrate examples to openApi part 2; affects [archlinux bitcomponents bountysource cdnjs chrome clearlydefined clojars cocoapods coincap] (#9428)
* convert an example that doesn't matter * migrate some services from examples to openApi * improve and de-dupe service titles * revert changes to codefactor
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
import { renderVersionBadge } from '../version.js'
|
import { renderVersionBadge } from '../version.js'
|
||||||
import { BaseJsonService } from '../index.js'
|
import { BaseJsonService, pathParams } from '../index.js'
|
||||||
|
|
||||||
const schema = Joi.object({
|
const schema = Joi.object({
|
||||||
pkgver: Joi.string().required(),
|
pkgver: Joi.string().required(),
|
||||||
@@ -13,17 +13,27 @@ export default class ArchLinux extends BaseJsonService {
|
|||||||
pattern: ':repository/:architecture/:packageName',
|
pattern: ':repository/:architecture/:packageName',
|
||||||
}
|
}
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/archlinux/v/{repository}/{architecture}/{packageName}': {
|
||||||
title: 'Arch Linux package',
|
get: {
|
||||||
namedParams: {
|
summary: 'Arch Linux package',
|
||||||
architecture: 'x86_64',
|
parameters: pathParams(
|
||||||
repository: 'core',
|
{
|
||||||
packageName: 'pacman',
|
name: 'repository',
|
||||||
|
example: 'core',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'architecture',
|
||||||
|
example: 'x86_64',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'packageName',
|
||||||
|
example: 'pacman',
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
staticPreview: renderVersionBadge({ version: '5.1.3' }),
|
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'arch linux' }
|
static defaultBadgeData = { label: 'arch linux' }
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Joi from 'joi'
|
|||||||
import { metric } from '../text-formatters.js'
|
import { metric } from '../text-formatters.js'
|
||||||
import { nonNegativeInteger } from '../validators.js'
|
import { nonNegativeInteger } from '../validators.js'
|
||||||
import { downloadCount } from '../color-formatters.js'
|
import { downloadCount } from '../color-formatters.js'
|
||||||
import { BaseJsonService } from '../index.js'
|
import { BaseJsonService, pathParams } from '../index.js'
|
||||||
|
|
||||||
const collectionSchema = Joi.object({
|
const collectionSchema = Joi.object({
|
||||||
payload: Joi.object({
|
payload: Joi.object({
|
||||||
@@ -17,14 +17,23 @@ export default class BitComponents extends BaseJsonService {
|
|||||||
pattern: ':owner/:collection',
|
pattern: ':owner/:collection',
|
||||||
}
|
}
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/bit/collection/total-components/{owner}/{collection}': {
|
||||||
title: 'bit',
|
get: {
|
||||||
namedParams: { owner: 'ramda', collection: 'ramda' },
|
summary: 'Bit',
|
||||||
staticPreview: this.render({ count: 330 }),
|
parameters: pathParams(
|
||||||
keywords: ['components'],
|
{
|
||||||
|
name: 'owner',
|
||||||
|
example: 'ramda',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'collection',
|
||||||
|
example: 'ramda',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'components' }
|
static defaultBadgeData = { label: 'components' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
import { metric } from '../text-formatters.js'
|
import { metric } from '../text-formatters.js'
|
||||||
import { BaseJsonService } from '../index.js'
|
import { BaseJsonService, pathParams } from '../index.js'
|
||||||
|
|
||||||
const schema = Joi.object({ activity_total: Joi.number().required() })
|
const schema = Joi.object({ activity_total: Joi.number().required() })
|
||||||
|
|
||||||
@@ -8,13 +8,17 @@ export default class Bountysource extends BaseJsonService {
|
|||||||
static category = 'funding'
|
static category = 'funding'
|
||||||
static route = { base: 'bountysource/team', pattern: ':team/activity' }
|
static route = { base: 'bountysource/team', pattern: ':team/activity' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/bountysource/team/{team}/activity': {
|
||||||
title: 'Bountysource',
|
get: {
|
||||||
namedParams: { team: 'mozilla-core' },
|
summary: 'Bountysource',
|
||||||
staticPreview: this.render({ total: 53000 }),
|
parameters: pathParams({
|
||||||
|
name: 'team',
|
||||||
|
example: 'mozilla-core',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'bounties' }
|
static defaultBadgeData = { label: 'bounties' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
import { renderVersionBadge } from '../version.js'
|
import { renderVersionBadge } from '../version.js'
|
||||||
import { BaseJsonService, NotFound } from '../index.js'
|
import { BaseJsonService, NotFound, pathParams } from '../index.js'
|
||||||
|
|
||||||
const cdnjsSchema = Joi.object({
|
const cdnjsSchema = Joi.object({
|
||||||
// optional due to non-standard 'not found' condition
|
// optional due to non-standard 'not found' condition
|
||||||
@@ -11,12 +11,17 @@ export default class Cdnjs extends BaseJsonService {
|
|||||||
static category = 'version'
|
static category = 'version'
|
||||||
static route = { base: 'cdnjs/v', pattern: ':library' }
|
static route = { base: 'cdnjs/v', pattern: ':library' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/cdnjs/v/{library}': {
|
||||||
namedParams: { library: 'jquery' },
|
get: {
|
||||||
staticPreview: this.render({ version: '1.5.2' }),
|
summary: 'Cdnjs',
|
||||||
|
parameters: pathParams({
|
||||||
|
name: 'library',
|
||||||
|
example: 'jquery',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'cdnjs' }
|
static defaultBadgeData = { label: 'cdnjs' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import { currencyFromCode } from '../text-formatters.js'
|
import { currencyFromCode } from '../text-formatters.js'
|
||||||
import { NotFound } from '../index.js'
|
import { NotFound, pathParams } from '../index.js'
|
||||||
import BaseChromeWebStoreService from './chrome-web-store-base.js'
|
import BaseChromeWebStoreService from './chrome-web-store-base.js'
|
||||||
|
|
||||||
export default class ChromeWebStorePrice extends BaseChromeWebStoreService {
|
export default class ChromeWebStorePrice extends BaseChromeWebStoreService {
|
||||||
static category = 'funding'
|
static category = 'funding'
|
||||||
static route = { base: 'chrome-web-store/price', pattern: ':storeId' }
|
static route = { base: 'chrome-web-store/price', pattern: ':storeId' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/chrome-web-store/price/{storeId}': {
|
||||||
title: 'Chrome Web Store',
|
get: {
|
||||||
namedParams: { storeId: 'ogffaloegjglncjfehdfplabnoondfjo' },
|
summary: 'Chrome Web Store Price',
|
||||||
staticPreview: this.render({ priceCurrency: 'USD', price: 0 }),
|
parameters: pathParams({
|
||||||
|
name: 'storeId',
|
||||||
|
example: 'ogffaloegjglncjfehdfplabnoondfjo',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'price' }
|
static defaultBadgeData = { label: 'price' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import { renderDownloadsBadge } from '../downloads.js'
|
import { renderDownloadsBadge } from '../downloads.js'
|
||||||
import { redirector, NotFound } from '../index.js'
|
import { redirector, NotFound, pathParams } from '../index.js'
|
||||||
import BaseChromeWebStoreService from './chrome-web-store-base.js'
|
import BaseChromeWebStoreService from './chrome-web-store-base.js'
|
||||||
|
|
||||||
class ChromeWebStoreUsers extends BaseChromeWebStoreService {
|
class ChromeWebStoreUsers extends BaseChromeWebStoreService {
|
||||||
static category = 'downloads'
|
static category = 'downloads'
|
||||||
static route = { base: 'chrome-web-store/users', pattern: ':storeId' }
|
static route = { base: 'chrome-web-store/users', pattern: ':storeId' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/chrome-web-store/users/{storeId}': {
|
||||||
title: 'Chrome Web Store',
|
get: {
|
||||||
namedParams: { storeId: 'ogffaloegjglncjfehdfplabnoondfjo' },
|
summary: 'Chrome Web Store Users',
|
||||||
staticPreview: renderDownloadsBadge({ downloads: 573 }),
|
parameters: pathParams({
|
||||||
|
name: 'storeId',
|
||||||
|
example: 'ogffaloegjglncjfehdfplabnoondfjo',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'users' }
|
static defaultBadgeData = { label: 'users' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import { renderVersionBadge } from '../version.js'
|
import { renderVersionBadge } from '../version.js'
|
||||||
import { NotFound } from '../index.js'
|
import { NotFound, pathParams } from '../index.js'
|
||||||
import BaseChromeWebStoreService from './chrome-web-store-base.js'
|
import BaseChromeWebStoreService from './chrome-web-store-base.js'
|
||||||
|
|
||||||
export default class ChromeWebStoreVersion extends BaseChromeWebStoreService {
|
export default class ChromeWebStoreVersion extends BaseChromeWebStoreService {
|
||||||
static category = 'version'
|
static category = 'version'
|
||||||
static route = { base: 'chrome-web-store/v', pattern: ':storeId' }
|
static route = { base: 'chrome-web-store/v', pattern: ':storeId' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/chrome-web-store/v/{storeId}': {
|
||||||
title: 'Chrome Web Store',
|
get: {
|
||||||
namedParams: { storeId: 'ogffaloegjglncjfehdfplabnoondfjo' },
|
summary: 'Chrome Web Store Version',
|
||||||
staticPreview: renderVersionBadge({ version: 'v1.1.0' }),
|
parameters: pathParams({
|
||||||
|
name: 'storeId',
|
||||||
|
example: 'ogffaloegjglncjfehdfplabnoondfjo',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'chrome web store' }
|
static defaultBadgeData = { label: 'chrome web store' }
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
optionalNonNegativeInteger,
|
optionalNonNegativeInteger,
|
||||||
} from '../validators.js'
|
} from '../validators.js'
|
||||||
import { floorCount as floorCountColor } from '../color-formatters.js'
|
import { floorCount as floorCountColor } from '../color-formatters.js'
|
||||||
import { BaseJsonService, NotFound } from '../index.js'
|
import { BaseJsonService, NotFound, pathParams } from '../index.js'
|
||||||
|
|
||||||
const schema = Joi.object({
|
const schema = Joi.object({
|
||||||
scores: Joi.object({
|
scores: Joi.object({
|
||||||
@@ -24,19 +24,35 @@ export default class ClearlyDefinedService extends BaseJsonService {
|
|||||||
pattern: 'score/:type/:provider/:namespace/:name/:revision',
|
pattern: 'score/:type/:provider/:namespace/:name/:revision',
|
||||||
}
|
}
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/clearlydefined/score/{type}/{provider}/{namespace}/{name}/{revision}': {
|
||||||
title: 'ClearlyDefined Score',
|
get: {
|
||||||
namedParams: {
|
summary: 'ClearlyDefined Score',
|
||||||
type: 'npm',
|
parameters: pathParams(
|
||||||
provider: 'npmjs',
|
{
|
||||||
namespace: '-',
|
name: 'type',
|
||||||
name: 'jquery',
|
example: 'npm',
|
||||||
revision: '3.4.1',
|
},
|
||||||
|
{
|
||||||
|
name: 'provider',
|
||||||
|
example: 'npmjs',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'namespace',
|
||||||
|
example: '-',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'name',
|
||||||
|
example: 'jquery',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'revision',
|
||||||
|
example: '3.4.1',
|
||||||
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
staticPreview: this.render({ score: 88 }),
|
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'score' }
|
static defaultBadgeData = { label: 'score' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { pathParams } from '../index.js'
|
||||||
import { renderDownloadsBadge } from '../downloads.js'
|
import { renderDownloadsBadge } from '../downloads.js'
|
||||||
import { BaseClojarsService } from './clojars-base.js'
|
import { BaseClojarsService } from './clojars-base.js'
|
||||||
|
|
||||||
@@ -5,12 +6,17 @@ export default class ClojarsDownloads extends BaseClojarsService {
|
|||||||
static category = 'downloads'
|
static category = 'downloads'
|
||||||
static route = { base: 'clojars/dt', pattern: ':clojar+' }
|
static route = { base: 'clojars/dt', pattern: ':clojar+' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/clojars/dt/{clojar}': {
|
||||||
namedParams: { clojar: 'prismic' },
|
get: {
|
||||||
staticPreview: renderDownloadsBadge({ downloads: 117 }),
|
summary: 'Clojars Downloads',
|
||||||
|
parameters: pathParams({
|
||||||
|
name: 'clojar',
|
||||||
|
example: 'prismic',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'downloads' }
|
static defaultBadgeData = { label: 'downloads' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js'
|
import { coveragePercentage as coveragePercentageColor } from '../color-formatters.js'
|
||||||
import { BaseJsonService } from '../index.js'
|
import { BaseJsonService, pathParams } from '../index.js'
|
||||||
|
|
||||||
const schema = Joi.object({
|
const schema = Joi.object({
|
||||||
cocoadocs: Joi.object({
|
cocoadocs: Joi.object({
|
||||||
@@ -12,13 +12,17 @@ export default class CocoapodsDocs extends BaseJsonService {
|
|||||||
static category = 'analysis'
|
static category = 'analysis'
|
||||||
static route = { base: 'cocoapods/metrics/doc-percent', pattern: ':spec' }
|
static route = { base: 'cocoapods/metrics/doc-percent', pattern: ':spec' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/cocoapods/metrics/doc-percent/{spec}': {
|
||||||
title: 'Cocoapods doc percentage',
|
get: {
|
||||||
namedParams: { spec: 'AFNetworking' },
|
summary: 'Cocoapods doc percentage',
|
||||||
staticPreview: this.render({ percentage: 94 }),
|
parameters: pathParams({
|
||||||
|
name: 'spec',
|
||||||
|
example: 'AFNetworking',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'docs' }
|
static defaultBadgeData = { label: 'docs' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
|
import { pathParams } from '../index.js'
|
||||||
import BaseCocoaPodsService from './cocoapods-base.js'
|
import BaseCocoaPodsService from './cocoapods-base.js'
|
||||||
|
|
||||||
export default class CocoapodsLicense extends BaseCocoaPodsService {
|
export default class CocoapodsLicense extends BaseCocoaPodsService {
|
||||||
static category = 'license'
|
static category = 'license'
|
||||||
static route = { base: 'cocoapods/l', pattern: ':spec' }
|
static route = { base: 'cocoapods/l', pattern: ':spec' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/cocoapods/l/{spec}': {
|
||||||
title: 'Cocoapods',
|
get: {
|
||||||
namedParams: { spec: 'AFNetworking' },
|
summary: 'Cocoapods License',
|
||||||
staticPreview: this.render({ license: 'MIT' }),
|
parameters: pathParams({
|
||||||
|
name: 'spec',
|
||||||
|
example: 'AFNetworking',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'license' }
|
static defaultBadgeData = { label: 'license' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
|
import { pathParams } from '../index.js'
|
||||||
import BaseCocoaPodsService from './cocoapods-base.js'
|
import BaseCocoaPodsService from './cocoapods-base.js'
|
||||||
|
|
||||||
export default class CocoapodsPlatform extends BaseCocoaPodsService {
|
export default class CocoapodsPlatform extends BaseCocoaPodsService {
|
||||||
static category = 'platform-support'
|
static category = 'platform-support'
|
||||||
static route = { base: 'cocoapods/p', pattern: ':spec' }
|
static route = { base: 'cocoapods/p', pattern: ':spec' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/cocoapods/p/{spec}': {
|
||||||
title: 'Cocoapods platforms',
|
get: {
|
||||||
namedParams: { spec: 'AFNetworking' },
|
summary: 'Cocoapods platforms',
|
||||||
staticPreview: this.render({
|
parameters: pathParams({
|
||||||
platforms: ['ios', 'osx', 'watchos', 'tvos'],
|
name: 'spec',
|
||||||
}),
|
example: 'AFNetworking',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'platform' }
|
static defaultBadgeData = { label: 'platform' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { pathParams } from '../index.js'
|
||||||
import { renderVersionBadge } from '../version.js'
|
import { renderVersionBadge } from '../version.js'
|
||||||
import BaseCocoaPodsService from './cocoapods-base.js'
|
import BaseCocoaPodsService from './cocoapods-base.js'
|
||||||
|
|
||||||
@@ -5,13 +6,17 @@ export default class CocoapodsVersion extends BaseCocoaPodsService {
|
|||||||
static category = 'version'
|
static category = 'version'
|
||||||
static route = { base: 'cocoapods/v', pattern: ':spec' }
|
static route = { base: 'cocoapods/v', pattern: ':spec' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/cocoapods/v/{spec}': {
|
||||||
title: 'Cocoapods',
|
get: {
|
||||||
namedParams: { spec: 'AFNetworking' },
|
summary: 'Cocoapods Version',
|
||||||
staticPreview: renderVersionBadge({ version: 'v3.2.1' }),
|
parameters: pathParams({
|
||||||
|
name: 'spec',
|
||||||
|
example: 'AFNetworking',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'pod' }
|
static defaultBadgeData = { label: 'pod' }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
|
import { pathParams } from '../index.js'
|
||||||
import { floorCount } from '../color-formatters.js'
|
import { floorCount } from '../color-formatters.js'
|
||||||
import BaseCoincapService from './coincap-base.js'
|
import BaseCoincapService from './coincap-base.js'
|
||||||
|
|
||||||
@@ -14,16 +15,17 @@ const schema = Joi.object({
|
|||||||
export default class CoincapChangePercent24HrUsd extends BaseCoincapService {
|
export default class CoincapChangePercent24HrUsd extends BaseCoincapService {
|
||||||
static route = { base: 'coincap/change-percent-24hr', pattern: ':assetId' }
|
static route = { base: 'coincap/change-percent-24hr', pattern: ':assetId' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/coincap/change-percent-24hr/{assetId}': {
|
||||||
title: 'Coincap (Change Percent 24Hr)',
|
get: {
|
||||||
namedParams: { assetId: 'bitcoin' },
|
summary: 'Coincap (Change Percent 24Hr)',
|
||||||
staticPreview: this.render({
|
parameters: pathParams({
|
||||||
asset: { name: 'bitcoin', changePercent24Hr: '2.0670573674501840"' },
|
name: 'assetId',
|
||||||
}),
|
example: 'bitcoin',
|
||||||
keywords: ['bitcoin', 'crypto', 'cryptocurrency'],
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static percentFormat(changePercent24Hr) {
|
static percentFormat(changePercent24Hr) {
|
||||||
return `${parseInt(changePercent24Hr).toFixed(2)}%`
|
return `${parseInt(changePercent24Hr).toFixed(2)}%`
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
|
import { pathParams } from '../index.js'
|
||||||
import BaseCoincapService from './coincap-base.js'
|
import BaseCoincapService from './coincap-base.js'
|
||||||
|
|
||||||
const schema = Joi.object({
|
const schema = Joi.object({
|
||||||
@@ -13,16 +14,17 @@ const schema = Joi.object({
|
|||||||
export default class CoincapPriceUsd extends BaseCoincapService {
|
export default class CoincapPriceUsd extends BaseCoincapService {
|
||||||
static route = { base: 'coincap/price-usd', pattern: ':assetId' }
|
static route = { base: 'coincap/price-usd', pattern: ':assetId' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/coincap/price-usd/{assetId}': {
|
||||||
title: 'Coincap (Price USD)',
|
get: {
|
||||||
namedParams: { assetId: 'bitcoin' },
|
summary: 'Coincap (Price USD)',
|
||||||
staticPreview: this.render({
|
parameters: pathParams({
|
||||||
asset: { name: 'bitcoin', priceUsd: '19116.0479117336250772' },
|
name: 'assetId',
|
||||||
}),
|
example: 'bitcoin',
|
||||||
keywords: ['bitcoin', 'crypto', 'cryptocurrency'],
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static priceFormat(price) {
|
static priceFormat(price) {
|
||||||
return `$${parseFloat(price)
|
return `$${parseFloat(price)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Joi from 'joi'
|
import Joi from 'joi'
|
||||||
|
import { pathParams } from '../index.js'
|
||||||
import BaseCoincapService from './coincap-base.js'
|
import BaseCoincapService from './coincap-base.js'
|
||||||
|
|
||||||
const schema = Joi.object({
|
const schema = Joi.object({
|
||||||
@@ -13,14 +14,17 @@ const schema = Joi.object({
|
|||||||
export default class CoincapRank extends BaseCoincapService {
|
export default class CoincapRank extends BaseCoincapService {
|
||||||
static route = { base: 'coincap/rank', pattern: ':assetId' }
|
static route = { base: 'coincap/rank', pattern: ':assetId' }
|
||||||
|
|
||||||
static examples = [
|
static openApi = {
|
||||||
{
|
'/coincap/rank/{assetId}': {
|
||||||
title: 'Coincap (Rank)',
|
get: {
|
||||||
namedParams: { assetId: 'bitcoin' },
|
summary: 'Coincap (Rank)',
|
||||||
staticPreview: this.render({ asset: { name: 'bitcoin', rank: '1' } }),
|
parameters: pathParams({
|
||||||
keywords: ['bitcoin', 'crypto', 'cryptocurrency'],
|
name: 'assetId',
|
||||||
|
example: 'bitcoin',
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
]
|
}
|
||||||
|
|
||||||
static render({ asset }) {
|
static render({ asset }) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default class DeprecatedGithubWorkflowStatus extends BaseService {
|
|||||||
pattern: ':various+',
|
pattern: ':various+',
|
||||||
}
|
}
|
||||||
|
|
||||||
static examples = []
|
static openApi = {}
|
||||||
|
|
||||||
static defaultBadgeData = { label: 'build' }
|
static defaultBadgeData = { label: 'build' }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user