Skip to main content

AbstractHandler

Stentor API Reference


Stentor API Reference / stentor-handler/src / AbstractHandler

Abstract Class: AbstractHandler\<C, D, F, R>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:30

The AbstractHandler takes in intents and translates them to responses.

All handlers must extend the AbstractHandler.

Extended by​

Type Parameters​

C​

C extends Content = Content

D​

D extends Data = Data

F​

F extends Forward = Forward

R​

R extends Redirect = Redirect

Implements​

Constructors​

Constructor​

new AbstractHandler\<C, D, F, R>(props): AbstractHandler\<C, D, F, R>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:63

Parameters​

props​

Handler\<C, D, F, R>

Returns​

AbstractHandler\<C, D, F, R>

Properties​

type​

readonly type: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:37

Implementation of​

Handler.type


intentId​

readonly intentId: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:39

The ID of the intent, typically a combination of the name and a random string.

Implementation of​

Handler.intentId


appId​

readonly appId: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:41

The ID for the app the intent belongs to.

Implementation of​

Handler.appId


organizationId​

readonly organizationId: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:43

The organization ID for the app of which this intent belongs.

Implementation of​

Handler.organizationId


createdAt​

readonly createdAt: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:45

ISO-8601 string of when the intent was created.

Implementation of​

Handler.createdAt


content​

readonly content: C

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:47

Implementation of​

Handler.content


data​

data: D

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:49

Implementation of​

Handler.data


forward​

readonly forward: F

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:51

Implementation of​

Handler.forward


redirect​

readonly redirect: R

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:53

Implementation of​

Handler.redirect


name?​

readonly optional name: string

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:55

The human readable name of the intent.

Implementation of​

Handler.name


slots?​

readonly optional slots: Slot[]

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:57

The slots defined within the utterance patterns and their Entity types.

Implementation of​

Handler.slots


slotTypes?​

readonly optional slotTypes: SlotTypeMap

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:59

A map of the slot type definition.

Deprecated​

Use Entities

Implementation of​

Handler.slotTypes


permissions?​

readonly optional permissions: UserDataType[]

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:61

Implementation of​

Handler.permissions

Methods​

isOwnRequest()​

isOwnRequest(request): boolean

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:86

Determines if the request is for itself.

Parameters​

request​

Request

Returns​

boolean


canHandleRequest()​

canHandleRequest(request, context): boolean

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:97

In order to determine if another handler needs to be requested, we need to see if the current handler can handle the request.

Parameters​

request​

Request

context​

Context

Returns​

boolean

Implementation of​

RequestHandler.canHandleRequest


forwardingPathForRequest()​

forwardingPathForRequest(request, context): Promise\<ExecutablePath>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:126

Get the forwarding path for the provided request.

Returns undefined if a path could not be found.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<ExecutablePath>


redirectingPathForRequest()​

redirectingPathForRequest(request, context): Promise\<ExecutablePath>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:139

Check if we have redirects (applied before handling the request). Usually some gate condition.

Returns undefined if a path could not be found.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<ExecutablePath>


canHandleInputUnknown()​

canHandleInputUnknown(request, context): boolean

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:151

Can handle InputUnknown

Parameters​

request​

Request

context​

Context

Returns​

boolean


repeat()​

protected repeat(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:176

Repeats the last uttered response.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>


inputUnknown()​

protected inputUnknown(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:197

Handles the situation where the handler

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>


start()​

start(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:269

Kicks off the handler, typically called when the intent associated with the handler is requested.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>

Deprecated​

  • Use handleRequest(), this is now just a wrapper that calls handleRequest()

handleRequest()​

handleRequest(request, context): Promise\<void>

Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:279

Handles the incoming request. Sets the necessary responses and saves the necessary items to storage.

Parameters​

request​

Request

context​

Context

Returns​

Promise\<void>

Implementation of​

RequestHandler.handleRequest