MessageFactory

MessageFactory

Factory class to create the various message types of Oracle Digital Assistant Conversation Message Model (CMM)

Constructor

new MessageFactory()

Source:

Methods

(static) createActionField(action)

Description:
  • Creates an instance of the ActionField class.
Source:
Parameters:
Name Type Description
action The action of the action field.
Returns:
The created instance of the ActionField.

(static) createAttachment(type, url) → {Attachment}

Description:
  • Creates a new attachment
Source:
Parameters:
Name Type Description
type AttachmentType The type of the attachment (required).
url string The URL of the attachment (required).
Returns:
A new instance of the Attachment class.
Type
Attachment

(static) createAttachmentMessage(attachment) → {AttachmentMessage}

Description:
  • Creates a new attachment message
Source:
Parameters:
Name Type Description
attachment Attachment The attachment of the message.
Returns:
A new instance of AttachmentMessage.
Type
AttachmentMessage

(static) createCallAction(label, phoneNumber) → {CallAction}

Description:
  • Create a new Call action
Source:
Parameters:
Name Type Description
label string The label of the Call action.
phoneNumber string The phone number associated with the call action.
Returns:
A new instance of the CallAction class.
Type
CallAction

(static) createCard(title) → {Card}

Description:
  • Creates a new card
Source:
Parameters:
Name Type Description
title string The title of the card
Returns:
A new instance of the Card.
Type
Card

(static) createCardMessage(cards) → {CardMessage}

Description:
  • Creates a new card message
Source:
Parameters:
Name Type Description
cards Array.<Card> The cards of the message.
Returns:
A new instance of the CardMessage.
Type
CardMessage

(static) createCommandMessage(command) → {CommandMessage}

Description:
  • Creates an instance of the CommandMessage class.
Source:
Parameters:
Name Type Description
command CommandType The command type.
Returns:
The created instance of the CommandMessage.
Type
CommandMessage

(static) createCustomEventAction(label, event) → {CustomEventAction}

Description:
  • Create a new custom event handler invocation action
Source:
Parameters:
Name Type Description
label string The label of the button that invokes the custom event handle when clicked.
event string The name of the custom event handler
Returns:
A new instance of the CustomEventAction class.
Type
CustomEventAction

(static) createDatePickerField(id, label) → {DatePickerField}

Description:
  • Creates an instance of the DatePickerField class.
Source:
Parameters:
Name Type Description
id string The ID of the date picker field.
label string The label of the field.
Returns:
The created instance of the DatePickerField.
Type
DatePickerField

(static) createEditFormMessage(fields) → {EditFormMessage}

Description:
  • Creates an instance of the EditFormMessage class.
Source:
Parameters:
Name Type Description
fields Array.<Field> The list of fields in the edit form message.
Returns:
The created instance of the EditFormMessage.
Type
EditFormMessage

(static) createExecuteApplicationActionCommandMessage(applicationName, action) → {ExecuteApplicationActionCommandMessage}

Description:
  • Creates an instance of the ExecuteApplicationActionCommandMessage class.
Source:
Parameters:
Name Type Description
applicationName string The name of the application
action string The action to execute
Returns:
The created instance of the ExecuteApplicationActionCommandMessage.
Type
ExecuteApplicationActionCommandMessage

(static) createFormMessage(forms) → {FormMessage}

Description:
  • Creates an instance of the FormMessage class.
Source:
Parameters:
Name Type Description
forms Array.<ReadOnlyForm> The list of forms in the message.
Returns:
The created instance of the FormMessage.
Type
FormMessage

(static) createKeyword(postback, keywords) → {Keyword}

Description:
  • Creates an instance of Keyword.
Source:
Parameters:
Name Type Description
postback any The postback to set.
keywords Array.<string> The keywords to set.
Returns:
A new instance of the Keyword class.
Type
Keyword

(static) createLinkField(label, value, linkLabel) → {LinkField}

Description:
  • Creates an instance of the LinkField class.
Source:
Parameters:
Name Type Description
label string The label of the link field.
value string The value of the link field.
linkLabel string The link label of the link field.
Returns:
The created instance of the LinkField.
Type
LinkField

(static) createLocationAction(label) → {LocationAction}

Description:
  • Create a new action to send the geo location
Source:
Parameters:
Name Type Description
label string The label of the action.
Returns:
A new instance of the LocationAction class.
Type
LocationAction

(static) createMediaField(label, value, mediaType)

Description:
  • Creates an instance of the MediaField class.
Source:
Parameters:
Name Type Description
label The label of the field.
value The URL value of the field
mediaType The media type for the field.
Returns:
The created instance of the MediaField.

(static) createMultiSelectField(id, label, options) → {MultiSelectField}

Description:
  • Creates an instance of the MultiSelectField class.
Source:
Parameters:
Name Type Description
id string The ID of the field.
label string The label of the field.
options Array.<SelectFieldOption> The options of the field.
Returns:
The created instance of the MultiSelectField.
Type
MultiSelectField

(static) createNumberInputField(id, label) → {NumberInputField}

Description:
  • Creates an instance of the NumberInputField class.
Source:
Parameters:
Name Type Description
id string The unique identifier of the field.
label string The label of the field.
Returns:
The created instance of the NumberInputField.
Type
NumberInputField

(static) createPaginationInfo(totalCount, rangeSize, rangeStart) → {PaginationInfo}

Description:
  • Creates an instance of the PaginationInfo class.
Source:
Parameters:
Name Type Description
totalCount number The total count.
rangeSize number The range size.
rangeStart number The range start.
Returns:
The created instance of the PaginationInfo.
Type
PaginationInfo

(static) createPopupAction(label, popupContent) → {PopupAction}

Description:
  • Create a new Popup action
Source:
Parameters:
Name Type Description
label string The label of the Popup action.
popupContent NonRawMessage The content shown in the popup.
Returns:
A new instance of the PopupAction class.
Type
PopupAction

(static) createPostbackAction(label, postback) → {PostbackAction}

Description:
  • Create a new postback action
Source:
Parameters:
Name Type Description
label string The label of the postback action.
postback object The postback associated with the action.
Returns:
A new instance of the PostbackAction class.
Type
PostbackAction

(static) createRawMessage(payload) → {RawMessage}

Description:
  • Creates an instance of the RawMessage class.
Source:
Parameters:
Name Type Description
payload object The message payload.
Returns:
The created instance of the RawMessage.
Type
RawMessage

(static) createReadOnlyForm(fields) → {ReadOnlyForm}

Description:
  • Creates an instance of the ReadOnlyForm class.
Source:
Parameters:
Name Type Description
fields Array.<ReadOnlyField> The list of fields in the read-only form.
Returns:
The created instance of the ReadOnlyForm.
Type
ReadOnlyForm

(static) createRow(fields) → {Row}

Description:
  • Creates an instance of the Row class.
Source:
Parameters:
Name Type Description
fields Array.<ReadOnlyField> The list of fields in the row
Returns:
The created instance of the Row.
Type
Row

(static) createSelectFieldOption(label, value) → {SelectFieldOption}

Description:
  • Creates an instance of the SelectFieldOption class.
Source:
Parameters:
Name Type Description
label string The label of the option.
value any The value of the option. If not specified, the label is used as the value.
Returns:
The created instance of the SelectFieldOption.
Type
SelectFieldOption

(static) createShareAction(label) → {ShareAction}

Description:
  • Create a new share action (facebook only)
Source:
Parameters:
Name Type Description
label string The label of the action.
Returns:
A new instance of the ShareAction class.
Type
ShareAction

(static) createSingleSelectField(id, label, options) → {SingleSelectField}

Description:
  • Creates an instance of the SingleSelectField class.
Source:
Parameters:
Name Type Description
id string The unique identifier of the field.
label string The label of the field.
options Array.<SelectFieldOption> The options of the field.
Returns:
The created instance of the SingleSelectField.
Type
SingleSelectField

(static) createSubmitFormAction(label, postback) → {SubmitFormAction}

Description:
  • Create a new submit form action
Source:
Parameters:
Name Type Description
label string The label of the action.
postback object The postback associated with the action.
Returns:
A new instance of the SubmitFormAction class.
Type
SubmitFormAction

(static) createTableFormMessage(headings, rows, forms) → {TableFormMessage}

Description:
  • Creates an instance of TableFormMessage.
Source:
Parameters:
Name Type Description
headings Array.<TableHeading> The table headings.
rows Array.<Row> The table rows.
forms Array.<ReadOnlyForm> The read-only forms.
Returns:
A new instance of TableFormMessage.
Type
TableFormMessage

(static) createTableHeading(label) → {TableHeading}

Description:
  • Creates an instance of the TableHeading class.
Source:
Parameters:
Name Type Description
label string The label of the header column
Returns:
The created instance of the TableHeading.
Type
TableHeading

(static) createTableMessage(headings, rows) → {TableMessage}

Description:
  • Creates a new instance of TableMessage.
Source:
Parameters:
Name Type Description
headings Array.<TableHeading> The table headings.
rows Array.<Row> The table rows.
Returns:
A new instance of TableMessage.
Type
TableMessage

(static) createTextField(label, value) → {TextField}

Description:
  • Creates an instance of the TextField class.
Source:
Parameters:
Name Type Description
label string The label of the field.
value any The value of the field.
Returns:
The created instance of the TextField.
Type
TextField

(static) createTextInputField(id, label) → {TextInputField}

Description:
  • Creates an instance of the TextInputField class.
Source:
Parameters:
Name Type Description
id string The unique identifier of the field.
label string The label of the field.
Returns:
The created instance of the TextInputField.
Type
TextInputField

(static) createTextMessage(text) → {TextMessage}

Description:
  • Create a new text message
Source:
Parameters:
Name Type Description
text string The text content of the message.
Returns:
A new instance of the TextMessage class.
Type
TextMessage

(static) createTextStreamMessage(text, aggregateText, streamId, streamState) → {TextStreamMessage}

Description:
  • Create a new text stream message
Source:
Parameters:
Name Type Description
text string The latest text chunk of the stream
aggregateText string Aggregate text that has been streamed so far
streamId string Unique identifier of the text stream
streamState StreamState the state of the stream: start, running or end
Returns:
A new instance of the TextStreamMessage class.
Type
TextStreamMessage

(static) createTimePickerField(id, label) → {TimePickerField}

Description:
  • Creates an instance of the TimePickerField class.
Source:
Parameters:
Name Type Description
id string The unique identifier of the field.
label string The label of the field.
Returns:
The created instance of the TimePickerField.
Type
TimePickerField

(static) createToggleField(id, label, valueOff, valueOn) → {ToggleField}

Description:
  • Creates an instance of the ToggleField class.
Source:
Parameters:
Name Type Description
id string The unique identifier of the field.
label string The label of the field.
valueOff any The value when the toggle is off.
valueOn any The value when the toggle is on.
Returns:
The created instance of the ToggleField.
Type
ToggleField

(static) createUpdateApplicationContextCommandMessage(applicationName) → {UpdateApplicationContextCommandMessage}

Description:
  • Creates an instance of the UpdateApplicationContextCommandMessage class.
Source:
Parameters:
Name Type Description
applicationName string The name of the application
Returns:
The created instance of the UpdateApplicationContextCommandMessage.
Type
UpdateApplicationContextCommandMessage

(static) createUrlAction(label, url) → {UrlAction}

Description:
  • Create a new URL action
Source:
Parameters:
Name Type Description
label string The label of the URL action.
url string The URL associated with the action.
Returns:
A new instance of the UrlAction class.
Type
UrlAction

(static) createVoice(text) → {Voice}

Description:
  • Create a new voice settings object
Source:
Parameters:
Name Type Description
text string The text of the voice settings
Returns:
A new instance of the Voice class.
Type
Voice

(static) messageFromJson(json) → {NonRawMessage}

Description:
  • Converts a message from JSON representation into an instance of corresponding message type class.
Source:
Parameters:
Name Type Description
json any The JSON representation of the message
Returns:
An instance of a subclass of a NonRawMessage.
Type
NonRawMessage