Skip to content

Commit

Permalink
Add suggestions to ChannelSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
Neur0toxine authored Feb 6, 2024
2 parents 93924bf + 8892e5f commit 41cb22a
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Bot/Model/Entity/Channel/ChannelSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ class ChannelSettings implements ModelInterface
*/
private $file;

/**
* @var ChannelSettingsSuggestions $suggestions
*
* @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsSuggestions")
* @Accessor(getter="getSuggestions",setter="setSuggestions")
* @SkipWhenEmpty()
*/
private $suggestions;

/**
* @return ChannelSettingsStatus|null
*/
Expand Down Expand Up @@ -194,4 +203,20 @@ public function setFile(ChannelSettingsItem $file)
{
$this->file = $file;
}

/**
* @return ChannelSettingsSuggestions|null
*/
public function getSuggestions(): ?ChannelSettingsSuggestions
{
return $this->suggestions;
}

/**
* @param ChannelSettingsSuggestions $suggestions
*/
public function setSuggestions(ChannelSettingsSuggestions $suggestions): void
{
$this->suggestions = $suggestions;
}
}
100 changes: 100 additions & 0 deletions src/Bot/Model/Entity/Channel/ChannelSettingsSuggestions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php

/**
* PHP version 7.1
*
* ChannelSettingsSuggestions entity
*
* @package RetailCrm\Mg\Bot\Model\Entity\Channel
*/

namespace RetailCrm\Mg\Bot\Model\Entity\Channel;

use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\SkipWhenEmpty;
use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\ModelInterface;

/**
* ChannelSettingsSuggestions class
*
* @package RetailCrm\Mg\Bot\Model\Entity\Channel
*/
class ChannelSettingsSuggestions implements ModelInterface
{
/**
* @var string $email
*
* @Type("string")
* @Accessor(getter="getEmail", setter="setEmail")
* @SkipWhenEmpty()
*/
private $email;

/**
* @var string $phone
*
* @Type("string")
* @Accessor(getter="getPhone", setter="setPhone")
* @SkipWhenEmpty()
*/
private $phone;

/**
* @var string $text
*
*
* @Type("string")
* @Accessor(getter="getText", setter="setText")
* @SkipWhenEmpty()
*/
private $text;

/**
* @return string|null
*/
public function getEmail(): ?string
{
return $this->email;
}

/**
* @param string $email
*/
public function setEmail(string $email): void
{
$this->email = $email;
}

/**
* @return string|null
*/
public function getPhone(): ?string
{
return $this->phone;
}

/**
* @param string $phone
*/
public function setPhone(string $phone): void
{
$this->phone = $phone;
}

/**
* @return string|null
*/
public function getText(): ?string
{
return $this->text;
}

/**
* @param string $text
*/
public function setText(string $text): void
{
$this->text = $text;
}
}
3 changes: 3 additions & 0 deletions tests/Bot/Tests/ClientListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function testChannels()

static::assertCount(5, $response, "Incorrect channels count");
static::assertInstanceOf(Channel\Channel::class, $response[0], "Incorrect channel instance");

$textSuggestions = $response[0]->getSettings()->getSuggestions()->getText();
static::assertStringContainsString("both", $textSuggestions, "Incorrect text suggestions");
}

/**
Expand Down
25 changes: 25 additions & 0 deletions tests/Resources/channels.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"quoting": "both",
"deleting": "receive",
"max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
}
},
"created_at": "2019-06-11T12:46:48.72241Z",
Expand Down Expand Up @@ -79,6 +84,11 @@
"quoting": "both",
"deleting": "receive",
"max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
}
},
"created_at": "2019-06-11T12:41:44.660495Z",
Expand Down Expand Up @@ -123,6 +133,11 @@
"quoting": "both",
"deleting": "receive",
"max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
}
},
"created_at": "2019-06-11T12:38:24.322413Z",
Expand Down Expand Up @@ -167,6 +182,11 @@
"quoting": "both",
"deleting": "receive",
"max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
}
},
"created_at": "2019-06-11T12:33:08.676214Z",
Expand Down Expand Up @@ -211,6 +231,11 @@
"quoting": "both",
"deleting": "receive",
"max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
}
},
"created_at": "2019-06-11T12:33:08Z",
Expand Down

0 comments on commit 41cb22a

Please sign in to comment.