Members
(abstract) auth :Auth
Configuration for the authentication helper that prepares credentials for upstream requests.
See also the config schema in ./server.js and doc/server-secrets.md.
To use the configured auth in the handler or fetch method, wrap the _request() input params in a call to one of:
- this.authHelper.withBasicAuth()
- this.authHelper.withBearerAuthHeader()
- this.authHelper.withQueryStringAuth()
For example: this._request(this.authHelper.withBasicAuth({ url, schema, options }))
Type:
- Auth
- Source:
defaultBadgeData :DefaultBadgeData
Default data for the badge. These defaults are used if the value is neither included in the service data from the handler nor overridden by the user via query parameters.
Type:
- DefaultBadgeData
- Source:
(abstract) openApi :openApiSchema
An OpenAPI Paths Object describing this service's route or routes in OpenAPI format.
Type:
- openApiSchema
- Source:
- See:
(abstract) routeEnum :Array.<string>
If the route pattern includes an enum, this property should be set to the array of allowed values. This is used to validate the route pattern and generate the OpenAPI spec. enum applies to the first param in the route pattern.
Type:
- Array.<string>
- Source:
(abstract, static) category :string
Name of the category to sort this badge into (eg. "build"). Used to sort the badges on the main shields.io website.
Type:
- string
- Source:
(abstract, static) route :Route
Route to mount this service on
Type:
- Route
- Source:
Methods
(async, abstract) handle(namedParams, queryParams) → {Badge}
Asynchronous function to handle requests for this service. Take the route
parameters (as defined in the route property), perform a request using
this._requestFetcher, and return the badge data.
Parameters:
| Name | Type | Description |
|---|---|---|
namedParams |
object | Params parsed from route pattern defined in this.route.pattern or this.route.capture |
queryParams |
object | Params parsed from the query string |
- Source:
Returns:
badge Object validated against serviceDataSchema
- Type
- Badge
(static) getEnum(param) → {Array.<string>}
If old route enum is used (legacy): Extract an array of allowed values from this service's route pattern for a given route parameter
If new routeEnum is used: Return the array of allowed values for a given route parameter from the routeEnum property
Parameters:
| Name | Type | Description |
|---|---|---|
param |
string | The name of a param in this service's route pattern |
- Source:
Returns:
Array of allowed values for this param
- Type
- Array.<string>