Files
shields/services/cocoapods/cocoapods-platform.service.js
chris48sandGitHub b2f47a3303 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
2023-08-08 23:57:47 +00:00

35 lines
876 B
JavaScript

import { pathParams } from '../index.js'
import BaseCocoaPodsService from './cocoapods-base.js'
export default class CocoapodsPlatform extends BaseCocoaPodsService {
static category = 'platform-support'
static route = { base: 'cocoapods/p', pattern: ':spec' }
static openApi = {
'/cocoapods/p/{spec}': {
get: {
summary: 'Cocoapods platforms',
parameters: pathParams({
name: 'spec',
example: 'AFNetworking',
}),
},
},
}
static defaultBadgeData = { label: 'platform' }
static render({ platforms }) {
return {
message: platforms.join(' | '),
// https://github.com/badges/shields/pull/184
color: '#989898',
}
}
async handle({ spec }) {
const { platforms } = await this.fetch({ spec })
return this.constructor.render({ platforms: Object.keys(platforms) })
}
}