-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace BotMan\Drivers\AmazonAlexa; | ||
|
||
use Illuminate\Support\Collection; | ||
|
||
class AlexaOutputSpeech { | ||
const TYPE_SSML = 'SSML'; | ||
const TYPE_PLAIN_TEXT = 'PlainText'; | ||
|
||
public $type = self::TYPE_PLAIN_TEXT; | ||
|
||
public $text = null; | ||
|
||
public $ssml = null; | ||
|
||
public function render() { | ||
return Collection::make([ | ||
'type' => $this->type, | ||
'text' => $this->text, | ||
'ssml' => $this->ssml, | ||
])->filter()->toArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace BotMan\Drivers\AmazonAlexa; | ||
|
||
use Alexa\Response\Response; | ||
|
||
class AlexaResponse extends Response | ||
{ | ||
|
||
const TYPE_PLAIN_TEXT = 'PlainText'; | ||
|
||
const TYPE_SSML = 'SSML'; | ||
|
||
public function respondText(string $text) | ||
{ | ||
$this->outputSpeech = new AlexaOutputSpeech; | ||
$this->outputSpeech->type = self::TYPE_PLAIN_TEXT; | ||
$this->outputSpeech->text = $text; | ||
|
||
return $this; | ||
} | ||
|
||
public function respondSsml(string $ssml) | ||
{ | ||
$this->outputSpeech = new AlexaOutputSpeech; | ||
$this->outputSpeech->type = self::TYPE_SSML; | ||
$this->outputSpeech->ssml = $ssml; | ||
|
||
return $this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters