Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SkillRequestFactory

Builder class for generating mock skill request.

Hierarchy

  • SkillRequestFactory

Index

Constructors

Properties

_request: any
skillContext: SkillContext

Methods

  • aplUserEventRequest(param0: { components?: any; eventArguments?: [any]; source?: any; token?: string }): RequestEnvelope
  • connectionsResponse(param0: { name?: string; payload?: {}; status?: ConnectionsStatus; token?: string }): RequestEnvelope
  • getRequest(): any
  • Returns internal request object of SkillRequestFactory. This method would be useful if you want to generate custom request object with withSession() and withRequest() methods

    Returns any

    request object with values set by withSession() and withRequest() methods

  • intentRequest(intentName: string, slots?: {}): RequestEnvelope
  • Builds mock IntentRequest type request.

    Parameters

    • intentName: string

      intent name

    • Optional slots: {}

      slot values

      • [slotName: string]: any

    Returns RequestEnvelope

    RequestEnvelope object that represents IntentRequest type request with intentName and slots

  • launchRequest(): RequestEnvelope
  • Builds mock LaunchRequest type request.

    Returns RequestEnvelope

    RequestEnvelope object that represents LaunchRequest type request

  • sessionEndedRequest(reason?: string, error?: { message: string; type: string }): RequestEnvelope
  • Adds request to _request internal property. You can take it by using getRequest(). Use this method if you want to build your own custom request like following. This method would be helpful if SkillRequestFactory doens't support to generate the request you want.

    const mockRequest = skillRequestFactory
    .withRequest(someRequestJson)
    .getRequest();

    Parameters

    • request: any

      Request object you want to generate by SkillRequestFacotry

    Returns SkillRequestFactory

    SkillRequestFacotry object that has the request object to internal request property.

  • Adds json object of Session to internal request object. You can take it by using getRequest(). Use this method if you want to build your own custom request like following.

    const mockRequest = skillRequestFactory
    .withSession()
    .withRequest(someRequestJson)
    .getRequest();

    If you want to customize Session, you should it throught SkillContext object.

    skillRequestFactory.skillContext = newSkillContext;
    const mockRequest = skillRequestFactory
    .withSession() // <- This includes session in newSkillContext
    .withRequest(someRequestJson)
    .getRequest();

    Returns SkillRequestFactory

    SkillRequestFacotry object that has the session object to internal request property.

Generated using TypeDoc