1
0
mirror of synced 2024-11-22 11:56:03 +03:00

Add suggestions to ChannelSettings

This commit is contained in:
Pavel 2024-02-06 15:01:55 +03:00 committed by GitHub
commit 41cb22a720
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 153 additions and 0 deletions

View File

@ -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
*/
@ -194,4 +203,20 @@ class ChannelSettings implements ModelInterface
{
$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;
}
}

View File

@ -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;
}
}

View File

@ -54,6 +54,9 @@ class ClientListTest extends TestCase
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");
}
/**

View File

@ -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",
@ -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",
@ -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",
@ -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",
@ -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",