Files
shields/services/conda/conda-base.js
T
Paul MelnikowandGitHub 1cdcaabd38 Unify order of properties and methods in services (#3353)
I find having these in a consistent order makes the services much faster to read.

This is the order I’ve generally been using:

1. Category
2. Route
3. Examples
4. Rendering
5. Other helpers (`fetch()`, `transform()`)
6. `handle()`
2019-04-23 21:36:04 -04:00

33 lines
733 B
JavaScript

'use strict'
const Joi = require('joi')
const { BaseJsonService } = require('..')
const { nonNegativeInteger } = require('../validators')
const condaSchema = Joi.object({
latest_version: Joi.string().required(),
conda_platforms: Joi.array()
.items(Joi.string())
.required(),
files: Joi.array()
.items(
Joi.object({
ndownloads: nonNegativeInteger,
})
)
.required(),
}).required()
module.exports = class BaseCondaService extends BaseJsonService {
static get defaultBadgeData() {
return { label: 'conda' }
}
async fetch({ channel, pkg }) {
return this._requestJson({
schema: condaSchema,
url: `https://api.anaconda.org/package/${channel}/${pkg}`,
})
}
}