public final class RequestHelper extends Object
HandlerInput
.Modifier and Type | Method and Description |
---|---|
static RequestHelper |
forHandlerInput(HandlerInput input)
Creates an
RequestHelper instance against the provided handler input. |
String |
getAccountLinkingAccessToken()
Retrieves the account linking access token from the request.
|
String |
getApiAccessToken()
Retrieves the API access token from the request.
|
String |
getDeviceId()
Retrieves the device ID from the request.
|
DialogState |
getDialogState()
Retrieves the dialog state from the request.
|
String |
getIntentName()
Retrieves the name of the
Intent from the request. |
String |
getLocale()
Retrieves the locale from the the request.
|
String |
getRequestType()
Retrieves the type of the request.
|
Optional<Slot> |
getSlot(String slotName)
Returns the
Slot for the given slot name from the request. |
Optional<String> |
getSlotValue(String slotName)
Returns the value from the given
Slot in the request. |
SlotValueWrapper |
getSlotValueWrapper(String slotName)
Returns a
SlotValueWrapper wrapping the underlying SlotValue from the given slot. |
SupportedInterfaces |
getSupportedInterfaces()
Retrieves the
SupportedInterfaces from the request. |
Optional<String> |
getUserId()
Returns the userId in the request.
|
boolean |
isNewSession()
Returns whether the request is a new session.
|
public static RequestHelper forHandlerInput(HandlerInput input)
RequestHelper
instance against the provided handler input.input
- handler inputpublic String getLocale()
public String getRequestType()
public String getIntentName()
Intent
from the request.
The method retrieves the intent name from the input request, only if the input request is an IntentRequest
.
An IllegalArgumentException
is thrown if not.public String getAccountLinkingAccessToken()
public String getApiAccessToken()
ServiceClientFactory
.public String getDeviceId()
public DialogState getDialogState()
IllegalArgumentException
if the incoming request is not an IntentRequest
.public Optional<Slot> getSlot(String slotName)
Slot
for the given slot name from the request.
This method attempts to retrieve the requested Slot
from the incoming request. If the slot does not
exist in the request, an Optional
empty is returned.
This method returns an IllegalArgumentException
if the incoming request is not an IntentRequest
.public Optional<String> getSlotValue(String slotName)
Slot
in the request.
This method attempts to retrieve the requested Slot
's value from the incoming request. If the slot does
exist in the request, an Optional
empty is returned.
This method returns an IllegalArgumentException
if the incoming request is not an IntentRequest
.public SlotValueWrapper getSlotValueWrapper(String slotName)
SlotValueWrapper
wrapping the underlying SlotValue
from the given slot.slotName
- name of the slot to retrieve SlotValue
and create a SlotValueWrapper
.SlotValueWrapper
.public SupportedInterfaces getSupportedInterfaces()
SupportedInterfaces
from the request.
This method returns an object listing each interface that the device supports. For example, if
supportedInterfaces includes AudioPlayer, then you know that the device supports streaming audio using the
AudioPlayer interface.public boolean isNewSession()
IllegalArgumentException
if the request is not an in-session request.public Optional<String> getUserId()
Copyright © 2020. All rights reserved.