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

Add suggestions to ChannelSettings

This commit is contained in:
Alex Komarichev 2024-02-05 19:21:42 +03:00
parent 93924bf3b5
commit e14afbf773
4 changed files with 153 additions and 0 deletions

View File

@ -83,6 +83,15 @@ class ChannelSettings implements ModelInterface
*/ */
private $file; private $file;
/**
* @var ChannelSettingsSuggestions $suggestions
*
* @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsSuggestions")
* @Accessor(getter="getSuggestions",setter="setSuggestions")
* @SkipWhenEmpty()
*/
private $suggestions;
/** /**
* @return ChannelSettingsStatus|null * @return ChannelSettingsStatus|null
*/ */
@ -194,4 +203,20 @@ class ChannelSettings implements ModelInterface
{ {
$this->file = $file; $this->file = $file;
} }
/**
* @return ChannelSettingsSuggestions|null
*/
public function getSuggestions(): ?ChannelSettingsSuggestions
{
return $this->suggestions;
}
/**
* @param ChannelSettingsSuggestions $suggestions
*/
public function setSuggestions(ChannelSettingsSuggestions $suggestions)
{
$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)
{
$this->email = $email;
}
/**
* @return string|null
*/
public function getPhone(): ?string
{
return $this->phone;
}
/**
* @param string $phone
*/
public function setPhone(string $phone)
{
$this->phone = $phone;
}
/**
* @return string|null
*/
public function getText(): ?string
{
return $this->text;
}
/**
* @param string $text
*/
public function setText(string $text)
{
$this->text = $text;
}
}

View File

@ -54,6 +54,9 @@ class ClientListTest extends TestCase
static::assertCount(5, $response, "Incorrect channels count"); static::assertCount(5, $response, "Incorrect channels count");
static::assertInstanceOf(Channel\Channel::class, $response[0], "Incorrect channel instance"); 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", "quoting": "both",
"deleting": "receive", "deleting": "receive",
"max_items_count": 1 "max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
} }
}, },
"created_at": "2019-06-11T12:46:48.72241Z", "created_at": "2019-06-11T12:46:48.72241Z",
@ -79,6 +84,11 @@
"quoting": "both", "quoting": "both",
"deleting": "receive", "deleting": "receive",
"max_items_count": 1 "max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
} }
}, },
"created_at": "2019-06-11T12:41:44.660495Z", "created_at": "2019-06-11T12:41:44.660495Z",
@ -123,6 +133,11 @@
"quoting": "both", "quoting": "both",
"deleting": "receive", "deleting": "receive",
"max_items_count": 1 "max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
} }
}, },
"created_at": "2019-06-11T12:38:24.322413Z", "created_at": "2019-06-11T12:38:24.322413Z",
@ -167,6 +182,11 @@
"quoting": "both", "quoting": "both",
"deleting": "receive", "deleting": "receive",
"max_items_count": 1 "max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
} }
}, },
"created_at": "2019-06-11T12:33:08.676214Z", "created_at": "2019-06-11T12:33:08.676214Z",
@ -211,6 +231,11 @@
"quoting": "both", "quoting": "both",
"deleting": "receive", "deleting": "receive",
"max_items_count": 1 "max_items_count": 1
},
"suggestions": {
"text": "both",
"email": "both",
"phone": "both"
} }
}, },
"created_at": "2019-06-11T12:33:08Z", "created_at": "2019-06-11T12:33:08Z",