AssistantApiKeyConfig.fromJson constructor

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

Implementation

factory AssistantApiKeyConfig.fromJson(Map<String, dynamic> json) {
  return AssistantApiKeyConfig(
    showCloseButtons: json['showCloseButtons'] ?? true,
    showNewConversationButton: json['showNewConversationButton'] ?? true,
    forceFullMode: json['forceFullMode'] ?? false,
    privacyPolicyURL: json['privacyPolicyURL'] ?? '',
    termsOfServiceURL: json['termsOfServiceURL'] ?? '',
    maxMessagePerConversation: getInt(
      json['maxMessagePerConversation'] ?? 20,
    ),
    tooManyMessageErrorText: json['tooManyMessageErrorText'] ?? '',
    webComponentOpenerSize: getInt(json['webComponentOpenerSize'] ?? 70),
    position: json['position'] ?? 'right',
    marginBottom: getInt(json['marginBottom'] ?? 10),
    chatEngagementPrompts: json['chatEngagementPrompts'] is Iterable
        ? (json['chatEngagementPrompts'] as List)
              .where((item) => item != null)
              .map((item) => item?.toString() ?? "")
              .toList()
        : [],
    chatEngagementPromptMode: getApiKeyEngagementPromptModeEnum(
      json['chatEngagementPromptMode'],
    ),
    chatEngagementPromptRotateTime: getInt(
      json['chatEngagementPromptRotateTime'] ?? 5,
    ),
    engagementSound: json['engagementSound'] ?? true,
    hidePupauBranding: json['hidePupauBranding'] ?? false,
    headerColor: json['headerColor'] ?? '#15559d',
  );
}