PostTextResponse.fromJson constructor

PostTextResponse.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory PostTextResponse.fromJson(Map<String, dynamic> json) {
  return PostTextResponse(
    activeContexts: (json['activeContexts'] as List?)
        ?.whereNotNull()
        .map((e) => ActiveContext.fromJson(e as Map<String, dynamic>))
        .toList(),
    alternativeIntents: (json['alternativeIntents'] as List?)
        ?.whereNotNull()
        .map((e) => PredictedIntent.fromJson(e as Map<String, dynamic>))
        .toList(),
    botVersion: json['botVersion'] as String?,
    dialogState: (json['dialogState'] as String?)?.toDialogState(),
    intentName: json['intentName'] as String?,
    message: json['message'] as String?,
    messageFormat: (json['messageFormat'] as String?)?.toMessageFormatType(),
    nluIntentConfidence: json['nluIntentConfidence'] != null
        ? IntentConfidence.fromJson(
            json['nluIntentConfidence'] as Map<String, dynamic>)
        : null,
    responseCard: json['responseCard'] != null
        ? ResponseCard.fromJson(json['responseCard'] as Map<String, dynamic>)
        : null,
    sentimentResponse: json['sentimentResponse'] != null
        ? SentimentResponse.fromJson(
            json['sentimentResponse'] as Map<String, dynamic>)
        : null,
    sessionAttributes: (json['sessionAttributes'] as Map<String, dynamic>?)
        ?.map((k, e) => MapEntry(k, e as String)),
    sessionId: json['sessionId'] as String?,
    slotToElicit: json['slotToElicit'] as String?,
    slots: (json['slots'] as Map<String, dynamic>?)
        ?.map((k, e) => MapEntry(k, e as String)),
  );
}