Module: core/base-service/base

Classes

BaseService

Type Definitions

Auth

Type:
  • object
Properties:
Name Type Description
userKey string

(Optional) The key from privateConfig to use as the username.

passKey string

(Optional) The key from privateConfig to use as the password. If auth is configured, either userKey or passKey is required.

isRequired string

(Optional) If true, the service will return NotFound unless the configured credentials are present.

Source:

Badge

Badge Object, validated against serviceDataSchema

Type:
  • object
Properties:
Name Type Description
isError boolean

(Optional)

label string

(Optional)

message string | number
color string

(Optional)

link Array.<string>

(Optional)

Source:

DefaultBadgeData

Default badge properties, validated against defaultBadgeDataSchema

Type:
  • object
Properties:
Name Type Description
label string

(Optional)

color string

(Optional)

labelColor string

(Optional)

namedLogo string

(Optional)

Source:

Example

Type:
  • object
Properties:
Name Type Description
title string

Descriptive text that will be shown next to the badge. The default is to use the service class name, which probably is not what you want.

namedParams object

An object containing the values of named parameters to substitute into the compiled route pattern.

queryParams object

An object containing query parameters to include in the example URLs. For alphanumeric query parameters, specify a string value. For boolean query parameters, specify null.

pattern string

The route pattern to compile. Defaults to this.route.pattern.

staticPreview object

A rendered badge of the sort returned by handle() or render(): an object containing message and optional label and color. This is usually generated by invoking this.render() with some explicit props.

keywords Array.<string>

Additional keywords, other than words in the title. This helps users locate relevant badges.

documentation string

An HTML string that is included in the badge popup.

Source:

Route

Type:
  • object
Properties:
Name Type Description
base string

(Optional) The base path of the routes for this service. This is used as a prefix.

pattern string

A path-to-regexp pattern defining the route pattern and param names See https://www.npmjs.com/package/path-to-regexp

format RegExp

Deprecated: Regular expression to use for routes for this service's badges Use pattern instead

capture Array.<string>

Deprecated: Array of names for the capture groups in the regular expression. The handler will be passed an object containing the matches. Use pattern instead

queryParamSchema Joi.object

(Optional) A Joi schema (Joi.object({ ... }).required()) for the query param object. If you know a parameter will never receive a numeric string, you can use Joi.string(). Because of quirks in Scoutcamp and Joi, alphanumeric strings should be declared using Joi.alternatives().try(Joi.string(), Joi.number()), otherwise a value like ?success_color=999 will fail. A parameter requiring a numeric string can use Joi.number(). A parameter that receives only non-numeric strings can use Joi.string(). A parameter that never receives numeric can use Joi.string(). A boolean parameter should use Joi.equal('') and will receive an empty string on e.g. ?compact_message and undefined when the parameter is absent. (Note that in, examples.queryParams boolean query params should be given null values.)

Source: