Add BaseGraphqlService, support [github] V4 API (#3763)

* add base class for Graphql APIs
* add GithubAuthV4Service + updates to GH token pool
* update github forks to use GithubAuthV4Service
* rename GithubAuthService to GithubAuthV3Service
This commit is contained in:
chris48s
2019-07-29 21:42:03 +01:00
committed by GitHub
parent 320de79309
commit 75ee413178
36 changed files with 756 additions and 120 deletions

View File

@@ -2,6 +2,7 @@
const serverSecrets = require('../../lib/server-secrets')
const { colorScale } = require('../color-formatters')
const { InvalidResponse, NotFound } = require('..')
const documentation = `
<p>
@@ -24,6 +25,14 @@ function errorMessagesFor(notFoundMessage = 'repo not found') {
}
}
function transformErrors(errors) {
if (errors[0].type === 'NOT_FOUND') {
return new NotFound({ prettyMessage: 'repo not found' })
} else {
return new InvalidResponse({ prettyMessage: errors[0].message })
}
}
const commentsColor = colorScale([1, 3, 10, 25], undefined, true)
function staticAuthConfigured() {
@@ -35,5 +44,6 @@ module.exports = {
stateColor,
commentsColor,
errorMessagesFor,
transformErrors,
staticAuthConfigured,
}