Skip to content

Commit

Permalink
add dialog delegate intent
Browse files Browse the repository at this point in the history
  • Loading branch information
DaDeather committed Aug 31, 2019
1 parent 368cdb1 commit 627bfa4
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Responses/Directive/AbstractDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ abstract class AbstractDirective
{
public const TYPE_APL_RENDER_DOCUMENT = 'Alexa.Presentation.APL.RenderDocument';
public const TYPE_APL_EXECUTE_COMMANDS = 'Alexa.Presentation.APL.ExecuteCommands';
public const TYPE_DIALOG_DELEGATE = 'Dialog.Delegate';

/**
* @var string|null
Expand Down
53 changes: 53 additions & 0 deletions src/Responses/Directive/DialogDelegate/UpdatedIntent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace DaDaDev\AmazonAlexa\Responses\Directive\DialogDelegate;

use DaDaDev\AmazonAlexa\Requests\RequestTypes\IntentElements\Intent;
use DaDaDev\AmazonAlexa\Requests\RequestTypes\IntentElements\Slot;

class UpdatedIntent extends Intent
{
/**
* @param string|null $name
* @return $this
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}

/**
* @param string|null $confirmationStatus
* @return $this
*/
public function setConfirmationStatus(?string $confirmationStatus): self
{
$this->confirmationStatus = $confirmationStatus;
return $this;
}

/**
* @param Slot[]|null $slots
* @return $this
*/
public function setSlots(?array $slots): self
{
$this->slots = $slots;

return $this;
}

/**
* @param string $slotName
* @param Slot $slot
*
* @return $this
*/
public function setSlot(string $slotName, Slot $slot): self
{
$this->slots[$slotName] = $slot;

return $this;
}
}
39 changes: 39 additions & 0 deletions src/Responses/Directive/DialogDelegateDirective.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace DaDaDev\AmazonAlexa\Responses\Directive;

use DaDaDev\AmazonAlexa\Responses\Directive\DialogDelegate\UpdatedIntent;
use JMS\Serializer\Annotation as JMS;

class DialogDelegateDirective extends AbstractDirective
{
/**
* @var UpdatedIntent|null
* @JMS\Type("DaDaDev\AmazonAlexa\Responses\Directive\DialogDelegate\UpdatedIntent")
* @JMS\SerializedName("updatedIntent")
*/
protected $updatedIntent;

public function __construct()
{
$this->setType(self::TYPE_DIALOG_DELEGATE);
}

/**
* @return UpdatedIntent|null
*/
public function getUpdatedIntent(): ?UpdatedIntent
{
return $this->updatedIntent;
}

/**
* @param UpdatedIntent|null $updatedIntent
* @return $this
*/
public function setUpdatedIntent(?UpdatedIntent $updatedIntent): self
{
$this->updatedIntent = $updatedIntent;
return $this;
}
}
12 changes: 12 additions & 0 deletions src/Responses/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ public function setDirectives(?array $directives): Response
return $this;
}

/**
* @param AbstractDirective $directive
*
* @return Response
*/
public function addDirective(AbstractDirective $directive): Response
{
$this->directives[] = $directive;

return $this;
}

/**
* @return bool|null
*/
Expand Down

0 comments on commit 627bfa4

Please sign in to comment.