Files
shields/services/visual-studio-app-center/visual-studio-app-center-base.js
James Cahill 9868025154 Added [VisualStudioAppCenter] badges 🎉 (#4108)
* VisualStudioAppCenterBuilds

* [vsacb] Add schema, documentation and use buildStatus for rendering

* Add VSACReleasesVersion badge and test

* Make tests green again, add another nock test and fix category

* Add VSAC Releases Size badge and test

* Add VSAC Base class

* [vsacb] use base fetch function

* Add VSACR OSVersion service and tests

* Finishing touches

* Change slug from VSAC to Visual-Studio-App-Center

* Use prettyBytes for rendering

* CQ

* Use bytes response directly

* Remove superfluous required statement

* Improve os version badge format

* Switch to nock for build test

Co-authored-by: Pierre-Yves B. <PyvesDev@gmail.com>
Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2020-02-04 19:43:15 +00:00

41 lines
888 B
JavaScript

'use strict'
const { BaseJsonService } = require('..')
const keywords = [
'visual-studio',
'vsac',
'visual-studio-app-center',
'app-center',
]
const documentation =
"You will need to create a <b>read-only</b> API token <a target='_blank' href='https://appcenter.ms/settings/apitokens'>here</a>."
class BaseVisualStudioAppCenterService extends BaseJsonService {
async fetch({
owner,
app,
token,
schema,
url = `https://api.appcenter.ms/v0.1/apps/${owner}/${app}/releases/latest`,
}) {
return this._requestJson({
schema,
options: {
headers: {
'X-API-Token': token,
},
},
errorMessages: {
401: 'invalid token',
403: 'project not found',
404: 'project not found',
},
url,
})
}
}
module.exports = { keywords, documentation, BaseVisualStudioAppCenterService }