Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Response by JsonResponse #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions src/AmazonAlexaDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

namespace BotMan\Drivers\AmazonAlexa;

use BotMan\BotMan\Users\User;
use Illuminate\Support\Collection;
use BotMan\BotMan\Drivers\HttpDriver;
use Techworker\Ssml\ContainerElement;
use BotMan\BotMan\Messages\Incoming\Answer;
use BotMan\BotMan\Messages\Outgoing\Question;
use Symfony\Component\HttpFoundation\Request;
use BotMan\BotMan\Drivers\Events\GenericEvent;
use Symfony\Component\HttpFoundation\Response;
use BotMan\Drivers\AmazonAlexa\Extensions\Card;
use BotMan\BotMan\Drivers\HttpDriver;
use BotMan\BotMan\Interfaces\DriverEventInterface;
use BotMan\BotMan\Messages\Incoming\Answer;
use BotMan\BotMan\Messages\Incoming\IncomingMessage;
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
use BotMan\BotMan\Messages\Outgoing\Question;
use BotMan\BotMan\Users\User;
use BotMan\Drivers\AmazonAlexa\Extensions\Card;
use Illuminate\Support\Collection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Techworker\Ssml\ContainerElement;

class AmazonAlexaDriver extends HttpDriver
{
Expand Down Expand Up @@ -111,7 +111,7 @@ public function isBot()
* @param string|Question|IncomingMessage $message
* @param IncomingMessage $matchingMessage
* @param array $additionalParameters
* @return Response
* @return array
*/
public function buildServicePayload($message, $matchingMessage, $additionalParameters = [])
{
Expand All @@ -136,7 +136,7 @@ public function buildServicePayload($message, $matchingMessage, $additionalParam

/**
* @param mixed $payload
* @return Response
* @return JsonResponse
*/
public function sendPayload($payload)
{
Expand All @@ -149,7 +149,7 @@ public function sendPayload($payload)
$response->card = $payload['card'] ?? null;
$response->shouldEndSession = $payload['shouldEndSession'] ?? false;

return Response::create(json_encode($response->render()))->send();
return JsonResponse::create($response->render())->send();
}

/**
Expand All @@ -166,33 +166,34 @@ public function isConfigured()
* @param string $endpoint
* @param array $parameters
* @param IncomingMessage $matchingMessage
* @return Response
* @return JsonResponse
*/
public function sendRequest($endpoint, array $parameters, IncomingMessage $matchingMessage)
{
//
}



/**
* @return JsonResponse
*/
public function dialogDelegate()
{
$response = [
'version' => '1.0',
'sessionAttributes' => [],
'response' => [
'outputSpeech' => null,
'card' => null,
'directives' => [
[
'type' => 'Dialog.Delegate'
]
],
'reprompt' => null,
'shouldEndSession' => false,
'outputSpeech' => null,
'card' => null,
'directives' => [
[
'type' => 'Dialog.Delegate'
]
],
'reprompt' => null,
'shouldEndSession' => false,
]
];

return Response::create(json_encode($response))->send();
return JsonResponse::create($response)->send();
}
}