@@ -0,0 +1,1848 @@
+package com.google.sps.utils;%0A%0Aimport com.google.cloud.dialogflow.v2.QueryInput;%0Aimport com.google.cloud.dialogflow.v2.QueryResult;%0Aimport com.google.cloud.dialogflow.v2.SessionName;%0Aimport com.google.cloud.dialogflow.v2.SessionsClient;%0Aimport java.io.IOException;%0Aimport com.google.cloud.dialogflow.v2.TextInput;%0Aimport com.google.cloud.dialogflow.v2.DetectIntentResponse;%0A%0A/**%0A * DialogFlow API Detects Intent with input text.%0A**/%0A%0Apublic class TextUtils %7B%0A  public static QueryResult detectIntentStream(String text) %7B%0A    QueryResult queryResult = null;%0A%0A    try (SessionsClient sessionsClient = SessionsClient.create()) %7B%0A      // Set the session name using the sessionId (UUID) and projectID (my-project-id)%0A      SessionName session = SessionName.of(%22fair-syntax-280601%22, %221%22);%0A        String languageCode = %22en-US%22;%0A        %0A        // Set the text and language code (en-US) for the query%0A        TextInput.Builder textInput =%0A            TextInput.newBuilder().setText(text).setLanguageCode(languageCode);%0A%0A        // Build the query with the TextInput%0A        QueryInput queryInput = QueryInput.newBuilder().setText(textInput).build();%0A%0A        // Performs the detect intent request%0A        DetectIntentResponse response = sessionsClient.detectIntent(session, queryInput);%0A%0A        // Display the query result%0A        queryResult = response.getQueryResult();%0A%0A        System.out.println(%22====================%22);%0A        System.out.format(%22Query Text: '%25s'%5Cn%22, queryResult.getQueryText());%0A        System.out.format(%22Detected Intent: %25s (confidence: %25f)%5Cn%22,%0A            queryResult.getIntent().getDisplayName(), queryResult.getIntentDetectionConfidence());%0A        System.out.format(%22Fulfillment Text: '%25s'%5Cn%22, queryResult.getFulfillmentText());%0A%0A    %7D catch (IOException e) %7B%0A      e.printStackTrace();%0A    %7D%0A    return queryResult;%0A  %7D%0A%7D%0A

Add TextUtil class to retrieve QueryResult from Dialogflow