AbstractHandler
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β
Dβ
Fβ
Rβ
Implementsβ
RequestHandlerHandler\<C,D,F,R>
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β
readonlytype:string
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:37
Implementation ofβ
intentIdβ
readonlyintentId: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β
appIdβ
readonlyappId:string
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:41
The ID for the app the intent belongs to.
Implementation ofβ
organizationIdβ
readonlyorganizationId:string
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:43
The organization ID for the app of which this intent belongs.
Implementation ofβ
createdAtβ
readonlycreatedAt:string
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:45
ISO-8601 string of when the intent was created.
Implementation ofβ
contentβ
readonlycontent:C
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:47
Implementation ofβ
dataβ
data:
D
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:49
Implementation ofβ
forwardβ
readonlyforward:F
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:51
Implementation ofβ
redirectβ
readonlyredirect:R
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:53
Implementation ofβ
name?β
readonlyoptionalname:string
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:55
The human readable name of the intent.
Implementation ofβ
slots?β
readonlyoptionalslots:Slot[]
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:57
The slots defined within the utterance patterns and their Entity types.
Implementation ofβ
slotTypes?β
readonlyoptionalslotTypes:SlotTypeMap
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:59
A map of the slot type definition.
Deprecatedβ
Use Entities
Implementation ofβ
permissions?β
readonlyoptionalpermissions:UserDataType[]
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:61
Implementation ofβ
Methodsβ
isOwnRequest()β
isOwnRequest(
request):boolean
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:86
Determines if the request is for itself.
Parametersβ
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β
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β
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β
contextβ
Returnsβ
Promise\<ExecutablePath>
canHandleInputUnknown()β
canHandleInputUnknown(
request,context):boolean
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:151
Can handle InputUnknown
Parametersβ
requestβ
contextβ
Returnsβ
boolean
repeat()β
protectedrepeat(request,context):Promise\<void>
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:176
Repeats the last uttered response.
Parametersβ
requestβ
contextβ
Returnsβ
Promise\<void>
inputUnknown()β
protectedinputUnknown(request,context):Promise\<void>
Defined in: packages/stentor-handler/src/AbstractHandler/Handler.ts:197
Handles the situation where the handler
Parametersβ
requestβ
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β
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β
contextβ
Returnsβ
Promise\<void>
Implementation ofβ
RequestHandler.handleRequest