diff --git a/.gitignore b/.gitignore
index dd9286b..8d66bfa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -185,3 +185,9 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
/.php_cs.cache
+
+# phpDocumentor
+phpDocumentor.phar
+phpDocumentor.phar.pubkey
+mg-bot-api-client-php.pages/*
+build/*
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 79babc0..2010005 100644
--- a/Makefile
+++ b/Makefile
@@ -17,3 +17,12 @@ stan:
@echo "==> Running analysis"
@php $(BIN_DIR)/phpstan analyse -l 4 -c $(ROOT_DIR)/phpstan.neon $(SRC_DIR)
@echo "==> Analysis complete"
+
+docs:
+ @echo "==> Building docs"
+ifeq ($(wildcard *.phar), )
+ @wget https://github.com/phpDocumentor/phpDocumentor2/releases/download/v3.0.0-alpha.3/phpDocumentor.phar -O phpDocumentor.phar
+ @wget https://github.com/phpDocumentor/phpDocumentor2/releases/download/v3.0.0-alpha.3/phpDocumentor.phar.pubkey -O phpDocumentor.phar.pubkey
+ @chmod +x phpDocumentor.phar
+ @php phpDocumentor.phar --config $(ROOT_DIR)/phpdoc.dist.xml
+endif
\ No newline at end of file
diff --git a/apigen.neon b/apigen.neon
deleted file mode 100644
index 5c74aed..0000000
--- a/apigen.neon
+++ /dev/null
@@ -1,32 +0,0 @@
-extensions:
- - php
-
-source:
- - src
-
-exclude:
- - tests/
- - vendor/
- - bin/
- - docs/
-
-charset:
- - auto
- - UTF-8
- - Windows-1251
-
-title: retailCRM PHP MG Bot API client
-templateTheme: bootstrap
-groups: auto
-
-accessLevels:
- - public
- - protected
-
-internal: true
-php: false
-tree: true
-deprecated: true
-todo: true
-destination: ../mg-bot-api-client-php.pages/
-download: false
diff --git a/composer.json b/composer.json
index 38e6582..836779f 100644
--- a/composer.json
+++ b/composer.json
@@ -15,12 +15,11 @@
"php": ">=7.0",
"ext-curl": "*",
"ext-json": "*",
- "jms/serializer": "1.13.*",
- "symfony/validator": "^4.2",
"doctrine/annotations": "^1.6",
"doctrine/cache": "^1.8",
"guzzlehttp/guzzle": "6.0",
- "lazyjsonmapper/lazyjsonmapper": "^1.6"
+ "lazyjsonmapper/lazyjsonmapper": "^1.6",
+ "symfony/validator": "^4.3"
},
"require-dev": {
"phpunit/phpunit": "6.5.*",
diff --git a/composer.lock b/composer.lock
index 8d3ee74..dfa678f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "acac73ae68db3b7df3284c70aa591bbd",
+ "content-hash": "2d108dc8d869c82038b7dd68b27c44c9",
"packages": [
{
"name": "corneltek/getoptionkit",
@@ -191,62 +191,6 @@
],
"time": "2018-08-21T18:01:43+00:00"
},
- {
- "name": "doctrine/instantiator",
- "version": "1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/instantiator.git",
- "reference": "a2c590166b2133a4633738648b6b064edae0814a"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
- "reference": "a2c590166b2133a4633738648b6b064edae0814a",
- "shasum": ""
- },
- "require": {
- "php": "^7.1"
- },
- "require-dev": {
- "doctrine/coding-standard": "^6.0",
- "ext-pdo": "*",
- "ext-phar": "*",
- "phpbench/phpbench": "^0.13",
- "phpstan/phpstan-phpunit": "^0.11",
- "phpstan/phpstan-shim": "^0.11",
- "phpunit/phpunit": "^7.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Marco Pivetta",
- "email": "ocramius@gmail.com",
- "homepage": "http://ocramius.github.com/"
- }
- ],
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://www.doctrine-project.org/projects/instantiator.html",
- "keywords": [
- "constructor",
- "instantiate"
- ],
- "time": "2019-03-17T17:37:11+00:00"
- },
{
"name": "doctrine/lexer",
"version": "v1.0.1",
@@ -481,180 +425,6 @@
],
"time": "2018-12-04T20:46:45+00:00"
},
- {
- "name": "jms/metadata",
- "version": "1.7.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/metadata.git",
- "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e5854ab1aa643623dc64adde718a8eec32b957a8",
- "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "doctrine/cache": "~1.0",
- "symfony/cache": "~3.1"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.5.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Metadata\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Asmir Mustafic",
- "email": "goetas@gmail.com"
- },
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Class/method/property metadata management in PHP",
- "keywords": [
- "annotations",
- "metadata",
- "xml",
- "yaml"
- ],
- "time": "2018-10-26T12:40:10+00:00"
- },
- {
- "name": "jms/parser-lib",
- "version": "1.0.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/parser-lib.git",
- "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d",
- "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d",
- "shasum": ""
- },
- "require": {
- "phpoption/phpoption": ">=0.9,<2.0-dev"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "JMS\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "description": "A library for easily creating recursive-descent parsers.",
- "time": "2012-11-18T18:08:43+00:00"
- },
- {
- "name": "jms/serializer",
- "version": "1.13.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/serializer.git",
- "reference": "00863e1d55b411cc33ad3e1de09a4c8d3aae793c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/00863e1d55b411cc33ad3e1de09a4c8d3aae793c",
- "reference": "00863e1d55b411cc33ad3e1de09a4c8d3aae793c",
- "shasum": ""
- },
- "require": {
- "doctrine/annotations": "^1.0",
- "doctrine/instantiator": "^1.0.3",
- "jms/metadata": "^1.3",
- "jms/parser-lib": "1.*",
- "php": "^5.5|^7.0",
- "phpcollection/phpcollection": "~0.1",
- "phpoption/phpoption": "^1.1"
- },
- "conflict": {
- "twig/twig": "<1.12"
- },
- "require-dev": {
- "doctrine/orm": "~2.1",
- "doctrine/phpcr-odm": "^1.3|^2.0",
- "ext-pdo_sqlite": "*",
- "jackalope/jackalope-doctrine-dbal": "^1.1.5",
- "phpunit/phpunit": "^4.8|^5.0",
- "propel/propel1": "~1.7",
- "psr/container": "^1.0",
- "symfony/dependency-injection": "^2.7|^3.3|^4.0",
- "symfony/expression-language": "^2.6|^3.0",
- "symfony/filesystem": "^2.1",
- "symfony/form": "~2.1|^3.0",
- "symfony/translation": "^2.1|^3.0",
- "symfony/validator": "^2.2|^3.0",
- "symfony/yaml": "^2.1|^3.0",
- "twig/twig": "~1.12|~2.0"
- },
- "suggest": {
- "doctrine/cache": "Required if you like to use cache functionality.",
- "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.",
- "symfony/yaml": "Required if you'd like to serialize data to YAML format."
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-1.x": "1.13-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "JMS\\Serializer": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Asmir Mustafic",
- "email": "goetas@gmail.com"
- },
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.",
- "homepage": "http://jmsyst.com/libs/serializer",
- "keywords": [
- "deserialization",
- "jaxb",
- "json",
- "serialization",
- "xml"
- ],
- "time": "2018-07-25T13:58:54+00:00"
- },
{
"name": "lazyjsonmapper/lazyjsonmapper",
"version": "v1.6.3",
@@ -705,104 +475,6 @@
],
"time": "2018-05-02T16:57:09+00:00"
},
- {
- "name": "phpcollection/phpcollection",
- "version": "0.5.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-collection.git",
- "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6",
- "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6",
- "shasum": ""
- },
- "require": {
- "phpoption/phpoption": "1.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "0.4-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PhpCollection": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "General-Purpose Collection Library for PHP",
- "keywords": [
- "collection",
- "list",
- "map",
- "sequence",
- "set"
- ],
- "time": "2015-05-17T12:39:23+00:00"
- },
- {
- "name": "phpoption/phpoption",
- "version": "1.5.0",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-option.git",
- "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed",
- "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "phpunit/phpunit": "4.7.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PhpOption\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com"
- }
- ],
- "description": "Option Type for PHP",
- "keywords": [
- "language",
- "option",
- "php",
- "type"
- ],
- "time": "2015-07-25T16:39:46+00:00"
- },
{
"name": "psr/http-message",
"version": "1.0.1",
@@ -895,36 +567,47 @@
},
{
"name": "symfony/contracts",
- "version": "v1.0.2",
+ "version": "v1.1.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/contracts.git",
- "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf"
+ "reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf",
- "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf",
+ "url": "https://api.github.com/repos/symfony/contracts/zipball/2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
+ "reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
"shasum": ""
},
"require": {
"php": "^7.1.3"
},
+ "replace": {
+ "symfony/cache-contracts": "self.version",
+ "symfony/event-dispatcher-contracts": "self.version",
+ "symfony/http-client-contracts": "self.version",
+ "symfony/service-contracts": "self.version",
+ "symfony/translation-contracts": "self.version"
+ },
"require-dev": {
"psr/cache": "^1.0",
- "psr/container": "^1.0"
+ "psr/container": "^1.0",
+ "symfony/polyfill-intl-idn": "^1.10"
},
"suggest": {
"psr/cache": "When using the Cache contracts",
"psr/container": "When using the Service contracts",
- "symfony/cache-contracts-implementation": "",
- "symfony/service-contracts-implementation": "",
- "symfony/translation-contracts-implementation": ""
+ "psr/event-dispatcher": "When using the EventDispatcher contracts",
+ "symfony/cache-implementation": "",
+ "symfony/event-dispatcher-implementation": "",
+ "symfony/http-client-implementation": "",
+ "symfony/service-implementation": "",
+ "symfony/translation-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "1.1-dev"
}
},
"autoload": {
@@ -959,7 +642,7 @@
"interoperability",
"standards"
],
- "time": "2018-12-05T08:06:11+00:00"
+ "time": "2019-06-05T13:28:50+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -1080,29 +763,29 @@
},
{
"name": "symfony/validator",
- "version": "v4.2.5",
+ "version": "v4.3.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/validator.git",
- "reference": "db5457ed88aacc1a040d4961ee52cddad3e5a4aa"
+ "reference": "ea74d2843fd8a9f2d4800136c985d13da586a405"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/validator/zipball/db5457ed88aacc1a040d4961ee52cddad3e5a4aa",
- "reference": "db5457ed88aacc1a040d4961ee52cddad3e5a4aa",
+ "url": "https://api.github.com/repos/symfony/validator/zipball/ea74d2843fd8a9f2d4800136c985d13da586a405",
+ "reference": "ea74d2843fd8a9f2d4800136c985d13da586a405",
"shasum": ""
},
"require": {
"php": "^7.1.3",
- "symfony/contracts": "^1.0.2",
"symfony/polyfill-ctype": "~1.8",
- "symfony/polyfill-mbstring": "~1.0"
+ "symfony/polyfill-mbstring": "~1.0",
+ "symfony/translation-contracts": "^1.1"
},
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
"symfony/dependency-injection": "<3.4",
"symfony/http-kernel": "<3.4",
- "symfony/intl": "<4.1",
+ "symfony/intl": "<4.3",
"symfony/translation": "<4.2",
"symfony/yaml": "<3.4"
},
@@ -1114,10 +797,12 @@
"symfony/config": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/expression-language": "~3.4|~4.0",
+ "symfony/http-client": "^4.3",
"symfony/http-foundation": "~4.1",
"symfony/http-kernel": "~3.4|~4.0",
- "symfony/intl": "~4.1",
+ "symfony/intl": "^4.3",
"symfony/property-access": "~3.4|~4.0",
+ "symfony/property-info": "~3.4|~4.0",
"symfony/translation": "~4.2",
"symfony/var-dumper": "~3.4|~4.0",
"symfony/yaml": "~3.4|~4.0"
@@ -1132,13 +817,14 @@
"symfony/http-foundation": "",
"symfony/intl": "",
"symfony/property-access": "For accessing properties within comparison constraints",
+ "symfony/property-info": "To automatically add NotNull and Type constraints",
"symfony/translation": "For translating validation errors.",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "4.2-dev"
+ "dev-master": "4.3-dev"
}
},
"autoload": {
@@ -1165,7 +851,7 @@
],
"description": "Symfony Validator Component",
"homepage": "https://symfony.com",
- "time": "2019-03-30T15:58:42+00:00"
+ "time": "2019-06-03T20:27:40+00:00"
}
],
"packages-dev": [
@@ -1275,6 +961,62 @@
],
"time": "2019-01-28T20:25:53+00:00"
},
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "a2c590166b2133a4633738648b6b064edae0814a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
+ "reference": "a2c590166b2133a4633738648b6b064edae0814a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1"
+ },
+ "require-dev": {
+ "doctrine/coding-standard": "^6.0",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpbench/phpbench": "^0.13",
+ "phpstan/phpstan-phpunit": "^0.11",
+ "phpstan/phpstan-shim": "^0.11",
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://www.doctrine-project.org/projects/instantiator.html",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2019-03-17T17:37:11+00:00"
+ },
{
"name": "friendsofphp/php-cs-fixer",
"version": "v2.14.2",
diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml
new file mode 100644
index 0000000..18287ae
--- /dev/null
+++ b/phpdoc.dist.xml
@@ -0,0 +1,20 @@
+
+
+ retailCRM PHP MG Bot API client
+
+ docs
+ utf8
+
+ php
+
+
+
+ mg-bot-api-client-php.pages
+
+
+
+
+
+ src
+
+
\ No newline at end of file
diff --git a/src/Bot/Client.php b/src/Bot/Client.php
index e248267..56a8369 100644
--- a/src/Bot/Client.php
+++ b/src/Bot/Client.php
@@ -33,7 +33,14 @@ use RetailCrm\Mg\Bot\Model\Response\MessageSendResponse;
*/
class Client
{
+ /**
+ * @internal
+ */
const VERSION = 'v1';
+
+ /**
+ * @internal
+ */
const ERROR_ONLY_RESPONSE = 'ErrorOnlyResponse';
/**
@@ -44,25 +51,26 @@ class Client
/**
* Init
*
- * @param string $url api url
- * @param string $token api key
- * @param bool $debug debug flag
+ * @param string $url MG API URL
+ * @param string $token MG API Key
+ * @param bool $debug Enable or disable debug mode - will log all requests to STDOUT (default: false)
+ * @param \GuzzleHttp\HandlerStack $handler GuzzleHttp::HandlerStack instance (default: null)
*/
- public function __construct($url, $token, $debug = false)
+ public function __construct($url, $token, $debug = false, $handler = null)
{
$url = sprintf("%sapi/bot/%s", Url::normalizeUrl($url), self::VERSION);
- $this->client = new HttpClient($url, $token, $debug);
+ $this->client = new HttpClient($url, $token, $debug ? STDOUT : null, $handler);
}
/**
* @param string $path
* @param string $method
- * @param object $request
+ * @param object $request Request parameters
* @param string $responseType
* @param int $serializeTo
* @param bool $arrayOfObjects
*
- * @return object|array|null
+ * @return object
* @throws \Exception
*/
private function getData(
@@ -133,9 +141,9 @@ class Client
/**
* Returns filtered bots list
*
- * @param Model\Request\BotsRequest $request
+ * @param Model\Request\BotsRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function bots(Model\Request\BotsRequest $request)
@@ -144,7 +152,7 @@ class Client
'/bots',
HttpClient::METHOD_GET,
$request,
- static::getEntityClass('Bot', 'Bot'),
+ static::getEntityClass('Bot'),
Serializer::S_ARRAY,
true
);
@@ -153,9 +161,9 @@ class Client
/**
* Edit bot info
*
- * @param Model\Request\InfoRequest $request
+ * @param Model\Request\InfoRequest $request Request parameters
*
- * @return ErrorOnlyResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object
* @throws \Exception
*/
public function info(Model\Request\InfoRequest $request)
@@ -171,9 +179,9 @@ class Client
/**
* Returns filtered channels list
*
- * @param Model\Request\ChannelsRequest $request
+ * @param Model\Request\ChannelsRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function channels(Model\Request\ChannelsRequest $request)
@@ -191,9 +199,9 @@ class Client
/**
* Returns filtered chats list
*
- * @param Model\Request\ChatsRequest $request
+ * @param Model\Request\ChatsRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function chats(Model\Request\ChatsRequest $request)
@@ -211,9 +219,9 @@ class Client
/**
* Returns filtered commands list
*
- * @param Model\Request\CommandsRequest $request
+ * @param Model\Request\CommandsRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function commands(Model\Request\CommandsRequest $request)
@@ -231,9 +239,9 @@ class Client
/**
* Edit commands for exact bot
*
- * @param Model\Request\CommandEditRequest $request
+ * @param Model\Request\CommandEditRequest $request Request parameters
*
- * @return ErrorOnlyResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object
* @throws \Exception
*/
public function commandEdit(Model\Request\CommandEditRequest $request)
@@ -250,9 +258,9 @@ class Client
/**
* Delete command for exact bot
*
- * @param string $request
+ * @param string $request Request parameters
*
- * @return ErrorOnlyResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object
* @throws \Exception
*/
public function commandDelete(string $request)
@@ -269,9 +277,9 @@ class Client
/**
* Returns filtered customers list
*
- * @param Model\Request\CustomersRequest $request
+ * @param Model\Request\CustomersRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function customers(Model\Request\CustomersRequest $request)
@@ -289,9 +297,9 @@ class Client
/**
* Returns filtered dialogs list
*
- * @param Model\Request\DialogsRequest $request
+ * @param Model\Request\DialogsRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function dialogs(Model\Request\DialogsRequest $request)
@@ -309,9 +317,9 @@ class Client
/**
* Assign dialog to exact user
*
- * @param Model\Request\DialogAssignRequest $request
+ * @param Model\Request\DialogAssignRequest $request Request parameters
*
- * @return AssignResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\AssignResponse|object
* @throws \Exception
*/
public function dialogAssign(Model\Request\DialogAssignRequest $request)
@@ -328,9 +336,9 @@ class Client
/**
* Close exact dialog
*
- * @param string $request
+ * @param string $request Request parameters
*
- * @return ErrorOnlyResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object
* @throws \Exception
*/
public function dialogClose(string $request)
@@ -346,9 +354,9 @@ class Client
/**
* Returns filtered members list
*
- * @param Model\Request\MembersRequest $request
+ * @param Model\Request\MembersRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function members(Model\Request\MembersRequest $request)
@@ -366,9 +374,9 @@ class Client
/**
* Returns filtered messages list
*
- * @param Model\Request\MessagesRequest $request
+ * @param Model\Request\MessagesRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function messages(Model\Request\MessagesRequest $request)
@@ -386,9 +394,9 @@ class Client
/**
* Send a message
*
- * @param Model\Request\MessageSendRequest $request
+ * @param Model\Request\MessageSendRequest $request Request parameters
*
- * @return MessageSendResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\MessageSendResponse|object
* @throws \Exception
*/
public function messageSend(Model\Request\MessageSendRequest $request)
@@ -404,9 +412,9 @@ class Client
/**
* Edit a message
*
- * @param Model\Request\MessageEditRequest $request
+ * @param Model\Request\MessageEditRequest $request Request parameters
*
- * @return MessageSendResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\MessageSendResponse|object
* @throws \Exception
*/
public function messageEdit(Model\Request\MessageEditRequest $request)
@@ -422,9 +430,9 @@ class Client
/**
* Delete a message
*
- * @param string $request
+ * @param string $request Request parameters
*
- * @return ErrorOnlyResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ErrorOnlyResponse|object
* @throws \Exception
*/
public function messageDelete(string $request)
@@ -440,9 +448,9 @@ class Client
/**
* Returns filtered users list
*
- * @param Model\Request\UsersRequest $request
+ * @param Model\Request\UsersRequest $request Request parameters
*
- * @return ListResponse|object|null
+ * @return \RetailCrm\Mg\Bot\Model\Response\ListResponse|object
* @throws \Exception
*/
public function users(Model\Request\UsersRequest $request)
diff --git a/src/Bot/HttpClient.php b/src/Bot/HttpClient.php
index 9f9dd93..a9ce032 100644
--- a/src/Bot/HttpClient.php
+++ b/src/Bot/HttpClient.php
@@ -38,10 +38,29 @@ use function GuzzleHttp\Psr7\stream_for;
*/
class HttpClient
{
+ /**
+ * GET HTTP Method constant
+ */
const METHOD_GET = 'GET';
+
+ /**
+ * POST HTTP Method constant
+ */
const METHOD_POST = 'POST';
+
+ /**
+ * PUT HTTP Method constant
+ */
const METHOD_PUT = 'PUT';
+
+ /**
+ * PATCH HTTP Method constant
+ */
const METHOD_PATCH = 'PATCH';
+
+ /**
+ * DELETE HTTP Method constant
+ */
const METHOD_DELETE = 'DELETE';
protected $basePath;
@@ -51,14 +70,15 @@ class HttpClient
private $client;
/**
- * Client constructor.
+ * HTTP Client constructor.
+ * Provide $stdout (for example: STDOUT) to log all requests.
*
- * @param string $url api url
- * @param string $token api token
- * @param bool|resource $stdout default output for debug
- * @param HandlerStack $handler
+ * @param string $url MG API URL
+ * @param string $token MG API Key
+ * @param null|resource $stdout Output to log all requests (optional, default: null)
+ * @param \GuzzleHttp\HandlerStack $handler GuzzleHttp::HandlerStack instance (default: null)
*/
- public function __construct($url, $token, $stdout = STDOUT, $handler = null)
+ public function __construct($url, $token, $stdout = null, $handler = null)
{
if (false === stripos($url, 'https://')) {
throw new InvalidArgumentException('API schema requires HTTPS protocol');
@@ -84,10 +104,10 @@ class HttpClient
/**
* Make HTTP request
*
- * @param string $path request url
- * @param string $method (default: 'GET')
- * @param mixed $request (default: null)
- * @param int $serializeTo
+ * @param string $path Request URL
+ * @param string $method Request method (default: 'GET')
+ * @param mixed $request Request model (default: null)
+ * @param int $serializeTo Serializer::S_JSON or Serializer::S_ARRAY
*
* @return ResponseInterface
* @throws \Exception
diff --git a/src/Bot/Model/Entity/Bot.php b/src/Bot/Model/Entity/Bot.php
new file mode 100644
index 0000000..2ff85db
--- /dev/null
+++ b/src/Bot/Model/Entity/Bot.php
@@ -0,0 +1,84 @@
+
+ * @license https://opensource.org/licenses/MIT MIT License
+ * @link http://help.retailcrm.pro/docs/Developers
+ */
+
+namespace RetailCrm\Mg\Bot\Model\Entity;
+
+/**
+ * PHP version 7.0
+ *
+ * Bot class. Schema:
+ *
+ * | Field name | Data type |
+ * |----------------|-----------|
+ * | name | string |
+ * | events | array |
+ * | client_id | string |
+ * | avatar_url | string |
+ * | roles | array |
+ * | deactivated_at | string |
+ * | is_active | bool |
+ * | is_self | bool |
+ * | is_system | bool |
+ *
+ * @package RetailCrm\Mg\Bot\Model\Entity
+ * @author retailCRM
+ * @license https://opensource.org/licenses/MIT MIT License
+ * @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method array getEvents() "Get `events` value"
+ * @method $this setEvents(array $value) "Set `events` value"
+ * @method string getClientId() "Get `client_id` value"
+ * @method $this setClientId(string $value) "Set `client_id` value"
+ * @method string getAvatarUrl() "Get `avatar_url` value"
+ * @method $this setAvatarUrl(string $value) "Set `avatar_url` value"
+ * @method array getRoles() "Get `roles` value"
+ * @method $this setRoles(array $value) "Set `roles` value"
+ * @method string getDeactivatedAt() "Get `deactivated_at` value"
+ * @method $this setDeactivatedAt(string $value) "Set `deactivated_at` value"
+ * @method bool getIsActive() "Get `is_active` value"
+ * @method $this setIsActive(bool $value) "Set `is_active` value"
+ * @method bool getIsSelf() "Get `is_self` value"
+ * @method $this setIsSelf(bool $value) "Set `is_self` value"
+ * @method bool getIsSystem() "Get `is_system` value"
+ * @method $this setIsSystem(bool $value) "Set `is_system` value"
+ */
+class Bot extends CommonFields
+{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
+ const JSON_PROPERTY_MAP = [
+ 'name' => 'string',
+ 'events' => 'mixed',
+ 'client_id' => 'string',
+ 'avatar_url' => 'string',
+ 'roles' => 'mixed',
+ 'deactivated_at' => 'string',
+ 'is_active' => 'bool',
+ 'is_self' => 'bool',
+ 'is_system' => 'bool'
+ ];
+}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Bot/Bot.php b/src/Bot/Model/Entity/Bot/Bot.php
deleted file mode 100644
index fd5318b..0000000
--- a/src/Bot/Model/Entity/Bot/Bot.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * @license https://opensource.org/licenses/MIT MIT License
- * @link http://help.retailcrm.pro/docs/Developers
- */
-
-namespace RetailCrm\Mg\Bot\Model\Entity\Bot;
-
-use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
-
-/**
- * PHP version 7.0
- *
- * Bot class
- *
- * @package RetailCrm\Mg\Bot\Model\Entity\Bot
- * @author retailCRM
- * @license https://opensource.org/licenses/MIT MIT License
- * @link http://help.retailcrm.pro/docs/Developers
- *
- * @method string getName()
- * @method $this setName(string $value)
- * @method array getEvents()
- * @method $this setEvents(array $value)
- * @method string getClientId()
- * @method $this setClientId(string $value)
- * @method string getAvatarUrl()
- * @method $this setAvatarUrl(string $value)
- * @method array getRoles()
- * @method $this setRoles(array $value)
- * @method string getDeactivatedAt()
- * @method $this setDeactivatedAt(string $value)
- * @method bool getIsActive()
- * @method $this setIsActive(bool $value)
- * @method bool getIsSelf()
- * @method $this setIsSelf(bool $value)
- * @method bool getIsSystem()
- * @method $this setIsSystem(bool $value)
- */
-class Bot extends CommonFields
-{
- const JSON_PROPERTY_MAP = [
- 'name' => 'string',
- 'events' => '[]',
- 'client_id' => 'string',
- 'avatar_url' => 'string',
- 'roles' => '[]',
- 'deactivated_at' => 'string',
- 'is_active' => 'bool',
- 'is_self' => 'bool',
- 'is_system' => 'bool'
- ];
-}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Channel/Channel.php b/src/Bot/Model/Entity/Channel/Channel.php
index 394ec3f..f4bbd02 100644
--- a/src/Bot/Model/Entity/Channel/Channel.php
+++ b/src/Bot/Model/Entity/Channel/Channel.php
@@ -18,28 +18,51 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * Channel class
+ * Channel class. Schema:
+ *
+ * | Field name | Data type |
+ * |----------------|-----------------|
+ * | activated_at | string |
+ * | deactivated_at | string |
+ * | is_active | bool |
+ * | settings | ChannelSettings |
+ * | type | string |
+ * | name | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Channel
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getActivatedAt()
- * @method $this setActivatedAt(string $value)
- * @method string getDeactivatedAt()
- * @method $this setDeactivatedAt(string $value)
- * @method bool getIsActive(bool $value)
- * @method $this setIsActive()
- * @method ChannelSettings getChannelSettings()
- * @method $this setChannelSettings(ChannelSettings $value)
- * @method string getType()
- * @method $this setType(string $value)
- * @method string getName()
- * @method $this setName(string $value)
+ * @method string getActivatedAt() "Get `activated_at` value"
+ * @method $this setActivatedAt(string $value) "Set `activated_at` value"
+ * @method string getDeactivatedAt() "Get `deactivated_at` value"
+ * @method $this setDeactivatedAt(string $value) "Set `deactivated_at` value"
+ * @method bool getIsActive() "Get `is_active` value"
+ * @method $this setIsActive(bool $value) "Set `is_active` value"
+ * @method ChannelSettings getSettings() "Get `settings` value"
+ * @method $this setSettings(ChannelSettings $value) "Set `settings` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
*/
class Channel extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'activated_at' => 'string',
'deactivated_at' => 'string',
diff --git a/src/Bot/Model/Entity/Channel/ChannelSettings.php b/src/Bot/Model/Entity/Channel/ChannelSettings.php
index 97b2c4e..cbd87d0 100644
--- a/src/Bot/Model/Entity/Channel/ChannelSettings.php
+++ b/src/Bot/Model/Entity/Channel/ChannelSettings.php
@@ -18,28 +18,51 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * ChannelSettings class
+ * ChannelSettings class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|---------------------|
+ * | status | ChannelSettingsItem |
+ * | text | ChannelSettingsItem |
+ * | product | ChannelSettingsItem |
+ * | order | ChannelSettingsItem |
+ * | image | ChannelSettingsItem |
+ * | file | ChannelSettingsItem |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Channel
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method ChannelSettingsItem getStatus()
- * @method $this setStatus(ChannelSettingsItem $value)
- * @method ChannelSettingsItem getText()
- * @method $this setText(ChannelSettingsItem $value)
- * @method ChannelSettingsItem getProduct()
- * @method $this setProduct(ChannelSettingsItem $value)
- * @method ChannelSettingsItem getOrder()
- * @method $this setOrder(ChannelSettingsItem $value)
- * @method ChannelSettingsItem getImage()
- * @method $this setImage(ChannelSettingsItem $value)
- * @method ChannelSettingsItem getFile()
- * @method $this setFile(ChannelSettingsItem $value)
+ * @method ChannelSettingsItem getStatus() "Get `status` value"
+ * @method $this setStatus(ChannelSettingsItem $value) "Set `status` value"
+ * @method ChannelSettingsItem getText() "Get `text` value"
+ * @method $this setText(ChannelSettingsItem $value) "Set `text` value"
+ * @method ChannelSettingsItem getProduct() "Get `product` value"
+ * @method $this setProduct(ChannelSettingsItem $value) "Set `product` value"
+ * @method ChannelSettingsItem getOrder() "Get `order` value"
+ * @method $this setOrder(ChannelSettingsItem $value) "Set `order` value"
+ * @method ChannelSettingsItem getImage() "Get `image` value"
+ * @method $this setImage(ChannelSettingsItem $value) "Set `image` value"
+ * @method ChannelSettingsItem getFile() "Get `file` value"
+ * @method $this setFile(ChannelSettingsItem $value) "Set `file` value"
*/
class ChannelSettings extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'status' => 'ChannelSettingsItem',
'text' => 'ChannelSettingsItem',
diff --git a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php
index ff90775..408888c 100644
--- a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php
+++ b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php
@@ -13,37 +13,56 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Channel;
-use JMS\Serializer\Annotation as Serializer;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * ChannelSettingsItem class
+ * ChannelSettingsItem class. Schema:
+ *
+ * | Field name | Data type |
+ * |-----------------|-----------|
+ * | creating | string |
+ * | editing | string |
+ * | quoting | string |
+ * | deleting | string |
+ * | delivered | string |
+ * | max_items_count | int |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Channel
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getCreating()
- * @method $this setCreating(string $value)
- * @method string getEditing()
- * @method $this setEditing(string $value)
- * @method string getQuoting()
- * @method $this setQuoting(string $value)
- * @method string getDeleting()
- * @method $this setDeleting(string $value)
- * @method string getDelivered()
- * @method $this setDelivered(string $value)
- * @method int getMaxItemsCount()
- * @method $this setMaxItemsCount(int $value)
+ * @method string getCreating() "Get `creating` value"
+ * @method $this setCreating(string $value) "Set `creating` value"
+ * @method string getEditing() "Get `editing` value"
+ * @method $this setEditing(string $value) "Set `editing` value"
+ * @method string getQuoting() "Get `quoting` value"
+ * @method $this setQuoting(string $value) "Set `quoting` value"
+ * @method string getDeleting() "Get `deleting` value"
+ * @method $this setDeleting(string $value) "Set `deleting` value"
+ * @method string getDelivered() "Get `delivered` value"
+ * @method $this setDelivered(string $value) "Set `delivered` value"
+ * @method int getMaxItemsCount() "Get `max_items_count` value"
+ * @method $this setMaxItemsCount(int $value) "Set `max_items_count` value"
*/
class ChannelSettingsItem extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'creating' => 'string',
'editing' => 'string',
diff --git a/src/Bot/Model/Entity/Chat/Chat.php b/src/Bot/Model/Entity/Chat/Chat.php
index f26efd1..3920fa7 100644
--- a/src/Bot/Model/Entity/Chat/Chat.php
+++ b/src/Bot/Model/Entity/Chat/Chat.php
@@ -18,16 +18,57 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * Chat class
+ * Chat class. Schema:
+ *
+ * | Field name | Data type |
+ * |---------------|-----------------|
+ * | avatar | string |
+ * | name | string |
+ * | channel | Channel |
+ * | members | array |
+ * | customer | Customer |
+ * | author_id | int |
+ * | last_message | ChatLastMessage |
+ * | last_activity | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Chat
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
+ * @method string getAvatar() "Get `avatar` value"
+ * @method $this setAvatar(string $value) "Set `avatar` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method Channel getChannel() "Get `channel` value"
+ * @method $this setChannel(Channel $value) "Set `channel` value"
+ * @method array getMembers() "Get `members` value"
+ * @method $this setMembers(array $value) "Set `members` value"
+ * @method Customer getCustomer() "Get `customer` value"
+ * @method $this setCustomer(Customer $value) "Set `customer` value"
+ * @method int getAuthorId() "Get `author_id` value"
+ * @method $this setAuthorId(int $value) "Set `author_id` value"
+ * @method ChatLastMessage getLastMessage() "Get `last_message` value"
+ * @method $this setLastMessage(ChatLastMessage $value) "Set `last_message` value"
+ * @method string getLastActivity() "Get `last_activity` value"
+ * @method $this setLastActivity(string $value) "Set `last_activity` value"
*/
class Chat extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'avatar' => 'string',
'name' => 'string',
diff --git a/src/Bot/Model/Entity/Chat/ChatLastMessage.php b/src/Bot/Model/Entity/Chat/ChatLastMessage.php
index 0c0e557..f31b338 100644
--- a/src/Bot/Model/Entity/Chat/ChatLastMessage.php
+++ b/src/Bot/Model/Entity/Chat/ChatLastMessage.php
@@ -19,22 +19,42 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * ChatLastMessage class
+ * ChatLastMessage class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | id | int |
+ * | time | string |
+ * | type | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Chat
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method int getId()
- * @method $this setId(int $value)
- * @method string getTime()
- * @method $this setTime(string $value)
- * @method string getType()
- * @method $this setType(string $value)
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method string getTime() "Get `time` value"
+ * @method $this setTime(string $value) "Set `time` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
*/
class ChatLastMessage extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'id' => 'int',
'time' => 'string',
diff --git a/src/Bot/Model/Entity/Chat/ChatMember.php b/src/Bot/Model/Entity/Chat/ChatMember.php
index 2d1fc32..380cd5e 100644
--- a/src/Bot/Model/Entity/Chat/ChatMember.php
+++ b/src/Bot/Model/Entity/Chat/ChatMember.php
@@ -18,24 +18,45 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * ChatMember class
+ * ChatMember class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | chat_id | int |
+ * | user_id | int |
+ * | is_author | bool |
+ * | state | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Chat
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method int getChatId()
- * @method $this setChatId(int $value)
- * @method int getUserId()
- * @method $this setUserId(int $value)
- * @method bool getIsAuthor()
- * @method $this setIsAuthor(bool $value)
- * @method string getState()
- * @method $this setState(string $value)
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method int getUserId() "Get `user_id` value"
+ * @method $this setUserId(int $value) "Set `user_id` value"
+ * @method bool getIsAuthor() "Get `is_author` value"
+ * @method $this setIsAuthor(bool $value) "Set `is_author` value"
+ * @method string getState() "Get `state` value"
+ * @method $this setState(string $value) "Set `state` value"
*/
class ChatMember extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'chat_id' => 'int',
'user_id' => 'int',
diff --git a/src/Bot/Model/Entity/Command.php b/src/Bot/Model/Entity/Command.php
index e3c1391..4c3a828 100644
--- a/src/Bot/Model/Entity/Command.php
+++ b/src/Bot/Model/Entity/Command.php
@@ -16,20 +16,39 @@ namespace RetailCrm\Mg\Bot\Model\Entity;
/**
* PHP version 7.0
*
- * Command class
+ * Command class. Schema:
+ *
+ * | Field name | Data type |
+ * |-------------|-----------|
+ * | name | string |
+ * | description | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getName()
- * @method $this setName(string $value)
- * @method string getDescription()
- * @method $this setDescription(string $value)
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method string getDescription() "Get `description` value"
+ * @method $this setDescription(string $value) "Set `description` value"
*/
class Command extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'name' => 'string',
'description' => 'string'
diff --git a/src/Bot/Model/Entity/CommonFields.php b/src/Bot/Model/Entity/CommonFields.php
index 630a952..1f066d5 100644
--- a/src/Bot/Model/Entity/CommonFields.php
+++ b/src/Bot/Model/Entity/CommonFields.php
@@ -13,23 +13,47 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * CommonFields trait
+ * CommonFields trait. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | id | int |
+ * | created_at | string |
+ * | updated_at | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method string getCreatedAt() "Get `created_at` value"
+ * @method $this setCreatedAt(string $value) "Set `created_at` value"
+ * @method string getUpdatedAt() "Get `updated_at` value"
+ * @method $this setUpdatedAt(string $value) "Set `updated_at` value"
*/
class CommonFields extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'id' => 'int',
'created_at' => 'string',
diff --git a/src/Bot/Model/Entity/Customer.php b/src/Bot/Model/Entity/Customer.php
index 0238e38..c647b98 100644
--- a/src/Bot/Model/Entity/Customer.php
+++ b/src/Bot/Model/Entity/Customer.php
@@ -18,40 +18,69 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * Customer class
+ * Customer class. Schema:
+ *
+ * | Field name | Data type |
+ * |-------------|-----------|
+ * | external_id | string |
+ * | channel_id | int |
+ * | username | string |
+ * | first_name | string |
+ * | last_name | string |
+ * | avatar_url | string |
+ * | profile_url | string |
+ * | revoked_at | string |
+ * | country | string |
+ * | language | string |
+ * | phone | string |
+ * | email | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getExternalId()
- * @method $this setExternalId(string $value)
- * @method int getChannelId()
- * @method $this setChannelId(int $value)
- * @method string getUsername()
- * @method $this setUsername(string $value)
- * @method string getFirstName()
- * @method $this setFirstName(string $value)
- * @method string getLastName()
- * @method $this setLastName(string $value)
- * @method string getAvatarUrl()
- * @method $this setAvatarUrl(string $value)
- * @method string getProfileUrl()
- * @method $this setProfileUrl(string $value)
- * @method string getRevokedAt()
- * @method $this setRevokedAt(string $value)
- * @method string getCountry()
- * @method $this setCountry(string $value)
- * @method string getLanguage()
- * @method $this setLanguage(string $value)
- * @method string getPhone()
- * @method $this setPhone(string $value)
- * @method string getEmail()
- * @method $this setEmail(string $value)
+ * @method string getExternalId() "Get `external_id` value"
+ * @method $this setExternalId(string $value) "Set `external_id` value"
+ * @method int getChannelId() "Get `channel_id` value"
+ * @method $this setChannelId(int $value) "Set `channel_id` value"
+ * @method string getUsername() "Get `username` value"
+ * @method $this setUsername(string $value) "Set `username` value"
+ * @method string getFirstName() "Get `first_name` value"
+ * @method $this setFirstName(string $value) "Set `first_name` value"
+ * @method string getLastName() "Get `last_name` value"
+ * @method $this setLastName(string $value) "Set `last_name` value"
+ * @method string getAvatarUrl() "Get `avatar_url` value"
+ * @method $this setAvatarUrl(string $value) "Set `avatar_url` value"
+ * @method string getProfileUrl() "Get `profile_url` value"
+ * @method $this setProfileUrl(string $value) "Set `profile_url` value"
+ * @method string getRevokedAt() "Get `revoked_at` value"
+ * @method $this setRevokedAt(string $value) "Set `revoked_at` value"
+ * @method string getCountry() "Get `country` value"
+ * @method $this setCountry(string $value) "Set `country` value"
+ * @method string getLanguage() "Get `language` value"
+ * @method $this setLanguage(string $value) "Set `language` value"
+ * @method string getPhone() "Get `phone` value"
+ * @method $this setPhone(string $value) "Set `phone` value"
+ * @method string getEmail() "Get `email` value"
+ * @method $this setEmail(string $value) "Set `email` value"
*/
class Customer extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'external_id' => 'string',
'channel_id' => 'int',
diff --git a/src/Bot/Model/Entity/Dialog.php b/src/Bot/Model/Entity/Dialog.php
index f54f46b..b4b11b6 100644
--- a/src/Bot/Model/Entity/Dialog.php
+++ b/src/Bot/Model/Entity/Dialog.php
@@ -18,32 +18,57 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * Dialog class
+ * Dialog class. Schema:
+ *
+ * | Field name | Data type |
+ * |-------------------|-------------|
+ * | bot_id | int |
+ * | chat_id | int |
+ * | begin_message_id | int |
+ * | ending_message_id | int |
+ * | closed_at | string |
+ * | is_assigned | bool |
+ * | responsible | Responsible |
+ * | is_active | bool |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method int getBotId()
- * @method $this setBotId(int $value)
- * @method int getChatId()
- * @method $this setChatId(int $value)
- * @method int getBeginMessageId()
- * @method $this setBeginMessageId(int $value)
- * @method int getEndingMessageId()
- * @method $this setEndingMessageId(int $value)
- * @method string getClosedAt()
- * @method $this setClosedAt(string $value)
- * @method bool getIsAssigned()
- * @method $this setIsAssigned(bool $value)
- * @method Responsible getResponsible()
- * @method $this setResponsible(Responsible $value)
- * @method bool getIsActive()
- * @method $this setIsActive(bool $value)
+ * @method int getBotId() "Get `bot_id` value"
+ * @method $this setBotId(int $value) "Set `bot_id` value"
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method int getBeginMessageId() "Get `begin_message_id` value"
+ * @method $this setBeginMessageId(int $value) "Set `begin_message_id` value"
+ * @method int getEndingMessageId() "Get `ending_message_id` value"
+ * @method $this setEndingMessageId(int $value) "Set `ending_message_id` value"
+ * @method string getClosedAt() "Get `closed_at` value"
+ * @method $this setClosedAt(string $value) "Set `closed_at` value"
+ * @method bool getIsAssigned() "Get `is_assigned` value"
+ * @method $this setIsAssigned(bool $value) "Set `is_assigned` value"
+ * @method Responsible getResponsible() "Get `responsible` value"
+ * @method $this setResponsible(Responsible $value) "Set `responsible` value"
+ * @method bool getIsActive() "Get `is_active` value"
+ * @method $this setIsActive(bool $value) "Set `is_active` value"
*/
class Dialog extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'bot_id' => 'int',
'chat_id' => 'int',
diff --git a/src/Bot/Model/Entity/FileMeta.php b/src/Bot/Model/Entity/FileMeta.php
index 1450628..9fb480c 100644
--- a/src/Bot/Model/Entity/FileMeta.php
+++ b/src/Bot/Model/Entity/FileMeta.php
@@ -18,15 +18,39 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * FileMeta class
+ * FileMeta class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | height | int |
+ * | width | int |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getHeight() "Get `height` value"
+ * @method $this setHeight(int $value) "Set `height` value"
+ * @method int getWidth() "Get `width` value"
+ * @method $this setWidth(int $value) "Set `width` value"
*/
class FileMeta extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'height' => 'int',
'width' => 'int'
diff --git a/src/Bot/Model/Entity/Message/Item.php b/src/Bot/Model/Entity/Message/Item.php
index 6dc129b..61a0e68 100644
--- a/src/Bot/Model/Entity/Message/Item.php
+++ b/src/Bot/Model/Entity/Message/Item.php
@@ -18,22 +18,42 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * Item class
+ * Item class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | id | int |
+ * | size | int |
+ * | caption | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method int getId()
- * @method $this setId(int $value)
- * @method int getSize()
- * @method $this setSize(int $value)
- * @method string getCaption()
- * @method $this setCaption(string $value)
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method int getSize() "Get `size` value"
+ * @method $this setSize(int $value) "Set `size` value"
+ * @method string getCaption() "Get `caption` value"
+ * @method $this setCaption(string $value) "Set `caption` value"
*/
class Item extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'id' => 'int',
'size' => 'int',
diff --git a/src/Bot/Model/Entity/Message/Message.php b/src/Bot/Model/Entity/Message/Message.php
index 6de19d9..b335e07 100644
--- a/src/Bot/Model/Entity/Message/Message.php
+++ b/src/Bot/Model/Entity/Message/Message.php
@@ -18,42 +18,84 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * Message class
+ * Message class. Schema:
+ *
+ * | Field name | Data type |
+ * |-----------------|----------------|
+ * | actions | array |
+ * | items | array |
+ * | from | User |
+ * | time | string |
+ * | type | string |
+ * | scope | string |
+ * | chat_id | int |
+ * | content | string |
+ * | is_read | bool |
+ * | is_edit | bool |
+ * | status | string |
+ * | action | string |
+ * | dialog | Dialog |
+ * | channel_id | int |
+ * | channel_sent_at | string |
+ * | order | MessageOrder |
+ * | product | MessageProduct |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getTime()
- * @method $this setTime(string $value)
- * @method string getType()
- * @method $this setType(string $value)
- * @method string getScope()
- * @method $this setScope(string $value)
- * @method int getChatId()
- * @method $this setChatId(int $value)
- * @method string getContent()
- * @method $this setContent(string $value)
- * @method bool getIsRead()
- * @method $this setIsRead(bool $value)
- * @method bool getIsEdit()
- * @method $this setIsEdit(bool $value)
- * @method string getStatus()
- * @method $this setStatus(string $value)
- * @method string getAction()
- * @method $this setAction(string $value)
- * @method int getChannelId()
- * @method $this setChannelId(int $value)
- * @method string getChannelSentAt()
- * @method $this setChannelSentAt(string $value)
- * @method MessageOrder getOrder()
- * @method $this setOrder(MessageOrder $value)
- * @method MessageProduct getProduct()
- * @method $this setProduct(MessageProduct $value)
+ * @method array getActions() "Get `actions` value"
+ * @method $this setActions(array $value) "Set `actions` value"
+ * @method array getItems() "Get `items` value"
+ * @method $this setItems(array $value) "Set `items` value"
+ * @method User getFrom() "Get `from` value"
+ * @method $this setFrom(User $value) "Set `from` value"
+ * @method string getTime() "Get `time` value"
+ * @method $this setTime(string $value) "Set `time` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
+ * @method string getScope() "Get `scope` value"
+ * @method $this setScope(string $value) "Set `scope` value"
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method string getContent() "Get `content` value"
+ * @method $this setContent(string $value) "Set `content` value"
+ * @method bool getIsRead() "Get `is_read` value"
+ * @method $this setIsRead(bool $value) "Set `is_read` value"
+ * @method bool getIsEdit() "Get `is_edit` value"
+ * @method $this setIsEdit(bool $value) "Set `is_edit` value"
+ * @method string getStatus() "Get `status` value"
+ * @method $this setStatus(string $value) "Set `status` value"
+ * @method string getAction() "Get `action` value"
+ * @method $this setAction(string $value) "Set `action` value"
+ * @method Dialog getDialog() "Get `dialog` value"
+ * @method $this setDialog(Dialog $value) "Set `dialog` value"
+ * @method int getChannelId() "Get `channel_id` value"
+ * @method $this setChannelId(int $value) "Set `channel_id` value"
+ * @method string getChannelSentAt() "Get `channel_sent_at` value"
+ * @method $this setChannelSentAt(string $value) "Set `channel_sent_at` value"
+ * @method MessageOrder getOrder() "Get `order` value"
+ * @method $this setOrder(MessageOrder $value) "Set `order` value"
+ * @method MessageProduct getProduct() "Get `product` value"
+ * @method $this setProduct(MessageProduct $value) "Set `product` value"
*/
class Message extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'actions' => '[]',
'items' => 'Item[]',
diff --git a/src/Bot/Model/Entity/Message/MessageCost.php b/src/Bot/Model/Entity/Message/MessageCost.php
index 1e35d09..cbc2835 100644
--- a/src/Bot/Model/Entity/Message/MessageCost.php
+++ b/src/Bot/Model/Entity/Message/MessageCost.php
@@ -18,20 +18,39 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageCost class
+ * MessageCost class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | currency | string |
+ * | value | float |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getCurrency()
- * @method $this setCurrency(string $value)
- * @method float getValue()
- * @method $this setValue(float $value)
+ * @method string getCurrency() "Get `currency` value"
+ * @method $this setCurrency(string $value) "Set `currency` value"
+ * @method float getValue() "Get `value` value"
+ * @method $this setValue(float $value) "Set `value` value"
*/
class MessageCost extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'currency' => 'string',
'value' => 'float'
diff --git a/src/Bot/Model/Entity/Message/MessageDelivery.php b/src/Bot/Model/Entity/Message/MessageDelivery.php
index 6c00993..3b0d48c 100644
--- a/src/Bot/Model/Entity/Message/MessageDelivery.php
+++ b/src/Bot/Model/Entity/Message/MessageDelivery.php
@@ -18,24 +18,45 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageDelivery class
+ * MessageDelivery class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-------------|
+ * | address | string |
+ * | comment | string |
+ * | name | string |
+ * | price | MessageCost |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getAddress()
- * @method $this setAddress(string $value)
- * @method string getComment()
- * @method $this setComment(string $value)
- * @method string getName()
- * @method $this setName(string $value)
- * @method MessageCost getPrice()
- * @method $this setPrice(MessageCost $value)
+ * @method string getAddress() "Get `address` value"
+ * @method $this setAddress(string $value) "Set `address` value"
+ * @method string getComment() "Get `comment` value"
+ * @method $this setComment(string $value) "Set `comment` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method MessageCost getPrice() "Get `price` value"
+ * @method $this setPrice(MessageCost $value) "Set `price` value"
*/
class MessageDelivery extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'address' => 'string',
'comment' => 'string',
diff --git a/src/Bot/Model/Entity/Message/MessageOrder.php b/src/Bot/Model/Entity/Message/MessageOrder.php
index cd05092..870fc42 100644
--- a/src/Bot/Model/Entity/Message/MessageOrder.php
+++ b/src/Bot/Model/Entity/Message/MessageOrder.php
@@ -18,26 +18,54 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageOrder class
+ * MessageOrder class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|--------------------|
+ * | cost | MessageCost |
+ * | date | string |
+ * | delivery | MessageDelivery |
+ * | items | array |
+ * | number | string |
+ * | payments | array |
+ * | status | MessageStatus |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method MessageCost getCost()
- * @method $this setCost(MessageCost $value)
- * @method string getDate()
- * @method $this setDate(string $value)
- * @method MessageDelivery getDelivery()
- * @method $this setDelivery(MessageDelivery $value)
- * @method string getNumber()
- * @method $this setNumber(string $value)
- * @method MessageStatus getStatus()
- * @method $this setStatus(MessageStatus $value)
+ * @method MessageCost getCost() "Get `cost` value"
+ * @method $this setCost(MessageCost $value) "Set `cost` value"
+ * @method string getDate() "Get `date` value"
+ * @method $this setDate(string $value) "Set `date` value"
+ * @method MessageDelivery getDelivery() "Get `delivery` value"
+ * @method $this setDelivery(MessageDelivery $value) "Set `delivery` value"
+ * @method array getItems() "Get `items` value"
+ * @method $this setItems(array $value) "Set `items` value"
+ * @method string getNumber() "Get `number` value"
+ * @method $this setNumber(string $value) "Set `number` value"
+ * @method array getPayments() "Get `payments` value"
+ * @method $this setPayments(array $value) "Set `payments` value"
+ * @method MessageStatus getStatus() "Get `status` value"
+ * @method $this setStatus(MessageStatus $value) "Set `status` value"
*/
class MessageOrder extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'cost' => 'MessageCost',
'date' => 'string',
diff --git a/src/Bot/Model/Entity/Message/MessageOrderItem.php b/src/Bot/Model/Entity/Message/MessageOrderItem.php
index fcc3bed..bd2a76f 100644
--- a/src/Bot/Model/Entity/Message/MessageOrderItem.php
+++ b/src/Bot/Model/Entity/Message/MessageOrderItem.php
@@ -18,26 +18,48 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageOrderItem class
+ * MessageOrderItem class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------------|
+ * | img | string |
+ * | name | string |
+ * | price | MessageCost |
+ * | quantity | MessageQuantity |
+ * | url | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getImg()
- * @method $this setImg(string $value)
- * @method string getName()
- * @method $this setName(string $value)
- * @method MessageCost getPrice()
- * @method $this setPrice(MessageCost $value)
- * @method MessageQuantity getQuantity()
- * @method $this setQuantity(MessageQuantity $value)
- * @method string getUrl()
- * @method $this setUrl(string $value)
+ * @method string getImg() "Get `img` value"
+ * @method $this setImg(string $value) "Set `img` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method MessageCost getPrice() "Get `price` value"
+ * @method $this setPrice(MessageCost $value) "Set `price` value"
+ * @method MessageQuantity getQuantity() "Get `quantity` value"
+ * @method $this setQuantity(MessageQuantity $value) "Set `quantity` value"
+ * @method string getUrl() "Get `url` value"
+ * @method $this setUrl(string $value) "Set `url` value"
*/
class MessageOrderItem extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'img' => 'string',
'name' => 'string',
diff --git a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php
index 1f0e48b..7f07c05 100644
--- a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php
+++ b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php
@@ -18,20 +18,39 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * MessageOrderPaymentStatus class
+ * MessageOrderPaymentStatus class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | name | string |
+ * | payed | bool |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getName()
- * @method $this setName(string $value)
- * @method bool getPayed()
- * @method $this setPayed(bool $value)
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method bool getPayed() "Get `payed` value"
+ * @method $this setPayed(bool $value) "Set `payed` value"
*/
class MessageOrderPaymentStatus extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'name' => 'string',
'payed' => 'bool'
diff --git a/src/Bot/Model/Entity/Message/MessagePayment.php b/src/Bot/Model/Entity/Message/MessagePayment.php
index 9c22702..8c702b6 100644
--- a/src/Bot/Model/Entity/Message/MessagePayment.php
+++ b/src/Bot/Model/Entity/Message/MessagePayment.php
@@ -18,22 +18,42 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * MessagePayment class
+ * MessagePayment class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|---------------------------|
+ * | amount | MessageCost |
+ * | name | string |
+ * | status | MessageOrderPaymentStatus |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method MessageCost getAmount()
- * @method $this setAmount(MessageCost $value)
- * @method string getName()
- * @method $this setName(string $value)
- * @method MessageOrderPaymentStatus getStatus()
- * @method $this setStatus(MessageOrderPaymentStatus $value)
+ * @method MessageCost getAmount() "Get `amount` value"
+ * @method $this setAmount(MessageCost $value) "Set `amount` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method MessageOrderPaymentStatus getStatus() "Get `status` value"
+ * @method $this setStatus(MessageOrderPaymentStatus $value) "Set `status` value"
*/
class MessagePayment extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'amount' => 'MessageCost',
'name' => 'string',
diff --git a/src/Bot/Model/Entity/Message/MessageProduct.php b/src/Bot/Model/Entity/Message/MessageProduct.php
index 0f1d651..3d9521f 100644
--- a/src/Bot/Model/Entity/Message/MessageProduct.php
+++ b/src/Bot/Model/Entity/Message/MessageProduct.php
@@ -18,30 +18,54 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageProduct class
+ * MessageProduct class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------------|
+ * | article | string |
+ * | cost | MessageCost |
+ * | id | int |
+ * | img | string |
+ * | name | string |
+ * | quantity | MessageQuantity |
+ * | url | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getArticle()
- * @method $this setArticle(string $value)
- * @method MessageCost getCost()
- * @method $this setCost(MessageCost $value)
- * @method int getId()
- * @method $this setId(int $value)
- * @method string getImg()
- * @method $this setImg(string $value)
- * @method string getName()
- * @method $this setName(string $value)
- * @method MessageQuantity getQuantity()
- * @method $this setQuantity(MessageQuantity $value)
- * @method string getUrl()
- * @method $this setUrl(string $value)
+ * @method string getArticle() "Get `article` value"
+ * @method $this setArticle(string $value) "Set `article` value"
+ * @method MessageCost getCost() "Get `cost` value"
+ * @method $this setCost(MessageCost $value) "Set `cost` value"
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method string getImg() "Get `img` value"
+ * @method $this setImg(string $value) "Set `img` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method MessageQuantity getQuantity() "Get `quantity` value"
+ * @method $this setQuantity(MessageQuantity $value) "Set `quantity` value"
+ * @method string getUrl() "Get `url` value"
+ * @method $this setUrl(string $value) "Set `url` value"
*/
class MessageProduct extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'article' => 'string',
'cost' => 'MessageCost',
diff --git a/src/Bot/Model/Entity/Message/MessageQuantity.php b/src/Bot/Model/Entity/Message/MessageQuantity.php
index 0e1fe0b..bd03741 100644
--- a/src/Bot/Model/Entity/Message/MessageQuantity.php
+++ b/src/Bot/Model/Entity/Message/MessageQuantity.php
@@ -18,20 +18,39 @@ use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * MessageQuantity class
+ * MessageQuantity class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | unit | string |
+ * | value | float |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getUnit()
- * @method $this setUnit(string $value)
- * @method float getValue()
- * @method $this setValue(float $value)
+ * @method string getUnit() "Get `unit` value"
+ * @method $this setUnit(string $value) "Set `unit` value"
+ * @method float getValue() "Get `value` value"
+ * @method $this setValue(float $value) "Set `value` value"
*/
class MessageQuantity extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'unit' => 'string',
'value' => 'float'
diff --git a/src/Bot/Model/Entity/Message/MessageStatus.php b/src/Bot/Model/Entity/Message/MessageStatus.php
index 3d94de2..6668537 100644
--- a/src/Bot/Model/Entity/Message/MessageStatus.php
+++ b/src/Bot/Model/Entity/Message/MessageStatus.php
@@ -18,20 +18,39 @@ use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageStatus class
+ * MessageStatus class. Schema:
+ *
+ * | Field name | Data type |
+ * |------------|-----------|
+ * | code | string |
+ * | name | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity\Message
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getCode()
- * @method $this setCode(string $value)
- * @method float getName()
- * @method $this setName(float $value)
+ * @method string getCode() "Get `code` value"
+ * @method $this setCode(string $value) "Set `code` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
*/
class MessageStatus extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'code' => 'string',
'name' => 'string'
diff --git a/src/Bot/Model/Entity/Responsible.php b/src/Bot/Model/Entity/Responsible.php
index e2622a6..dd7105e 100644
--- a/src/Bot/Model/Entity/Responsible.php
+++ b/src/Bot/Model/Entity/Responsible.php
@@ -13,22 +13,47 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\Type;
use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * Responsible class
+ * Responsible class. Schema:
+ *
+ * | Field name | Data type |
+ * |-------------|-----------|
+ * | assigned_at | string |
+ * | id | int |
+ * | type | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getAssignedAt() "Get `assigned_at` value"
+ * @method $this setAssignedAt(string $value) "Set `assigned_at` value"
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
*/
class Responsible extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'assigned_at' => 'string',
'id' => 'int',
diff --git a/src/Bot/Model/Entity/User.php b/src/Bot/Model/Entity/User.php
index 1ab13bd..0dc52b0 100644
--- a/src/Bot/Model/Entity/User.php
+++ b/src/Bot/Model/Entity/User.php
@@ -16,30 +16,63 @@ namespace RetailCrm\Mg\Bot\Model\Entity;
/**
* PHP version 7.0
*
- * User class
+ * User class. Schema:
+ *
+ * | Field name | Data type |
+ * |-------------|-----------|
+ * | external_id | string |
+ * | type | string |
+ * | avatar | string |
+ * | name | string |
+ * | username | string |
+ * | first_name | string |
+ * | last_name | string |
+ * | is_active | bool |
+ * | is_online | bool |
+ * | revoked_at | string |
*
* @package RetailCrm\Mg\Bot\Model\Entity
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method int getId()
- * @method $this setId(int $value)
- * @method string getType()
- * @method $this setType(string $value)
- * @method string getAvatar()
- * @method $this setAvatar(string $value)
- * @method string getName()
- * @method $this setName(string $value)
- * @method string getUsername()
- * @method $this setUsername(string $value)
- * @method string getFirstName()
- * @method $this setFirstName(string $value)
- * @method string getLastName()
- * @method $this setLastName(string $value)
+ * @method string getExternalId() "Get `external_id` value"
+ * @method $this setExternalId(string $value) "Set `external_id` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
+ * @method string getAvatar() "Get `avatar` value"
+ * @method $this setAvatar(string $value) "Set `avatar` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method string getUsername() "Get `username` value"
+ * @method $this setUsername(string $value) "Set `username` value"
+ * @method string getFirstName() "Get `first_name` value"
+ * @method $this setFirstName(string $value) "Set `first_name` value"
+ * @method string getLastName() "Get `last_name` value"
+ * @method $this setLastName(string $value) "Set `last_name` value"
+ * @method bool getIsActive() "Get `is_active` value"
+ * @method $this setIsActive(bool $value) "Set `is_active` value"
+ * @method bool getIsOnline() "Get `is_online` value"
+ * @method $this setIsOnline(bool $value) "Set `is_online` value"
+ * @method string getRevokedAt() "Get `revoked_at` value"
+ * @method $this setRevokedAt(string $value) "Set `revoked_at` value"
*/
class User extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'external_id' => 'string',
'type' => 'string',
diff --git a/src/Bot/Model/Request/BotsRequest.php b/src/Bot/Model/Request/BotsRequest.php
index 6625f1a..555d611 100644
--- a/src/Bot/Model/Request/BotsRequest.php
+++ b/src/Bot/Model/Request/BotsRequest.php
@@ -13,90 +13,48 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * BotsRequest class
+ * BotsRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | active | int |
+ * | self | int |
+ * | roles | array |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getActive() "Get `active` value"
+ * @method $this setActive(int $value) "Set `active` value"
+ * @method int getSelf() "Get `self` value"
+ * @method $this setSelf(int $value) "Set `self` value"
+ * @method array getRoles() "Get `roles` value"
+ * @method $this setRoles(array $value) "Set `roles` value"
*/
-class BotsRequest
+class BotsRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @Type("int")
- * @Accessor(getter="getActive",setter="setActive")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $active;
-
- /**
- * @Type("int")
- * @Accessor(getter="getSelf",setter="setSelf")
- * @SkipWhenEmpty
- */
- private $self;
-
- /**
- * @Type("array")
- * @Accessor(getter="getRoles",setter="setRoles")
- * @SkipWhenEmpty
- */
- private $roles;
-
- /**
- * @return int
- */
- public function getSelf()
- {
- return $this->self;
- }
-
- /**
- * @param int $self
- */
- public function setSelf($self)
- {
- $this->self = $self;
- }
-
- /**
- * @return int
- */
- public function getActive()
- {
- return $this->active;
- }
-
- /**
- * @param int $active
- */
- public function setActive($active)
- {
- $this->active = $active;
- }
-
- /**
- * @return array
- */
- public function getRoles()
- {
- return $this->roles;
- }
-
- /**
- * @param array $roles
- */
- public function setRoles($roles)
- {
- $this->roles = $roles;
- }
+ const JSON_PROPERTY_MAP = [
+ 'active' => 'int',
+ 'self' => 'int',
+ 'roles' => 'string[]'
+ ];
}
diff --git a/src/Bot/Model/Request/ChannelsRequest.php b/src/Bot/Model/Request/ChannelsRequest.php
index 738f0a4..39bbb5a 100644
--- a/src/Bot/Model/Request/ChannelsRequest.php
+++ b/src/Bot/Model/Request/ChannelsRequest.php
@@ -13,67 +13,44 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * ChannelsRequest class
+ * ChannelsRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | types | array |
+ * | active | int |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method array getTypes() "Get `types` value"
+ * @method $this setTypes(array $value) "Set `types` value"
+ * @method int getActive() "Get `active` value"
+ * @method $this setActive(int $value) "Set `active` value"
*/
-class ChannelsRequest
+class ChannelsRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @Type("array")
- * @Accessor(getter="getTypes",setter="setTypes")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $types;
-
- /**
- * @Type("int")
- * @Accessor(getter="getActive",setter="setActive")
- * @SkipWhenEmpty
- */
- private $active;
-
- /**
- * @return array
- */
- public function getTypes()
- {
- return $this->types;
- }
-
- /**
- * @param array $types
- */
- public function setTypes($types)
- {
- $this->types = $types;
- }
-
- /**
- * @return int
- */
- public function getActive()
- {
- return $this->active;
- }
-
- /**
- * @param int $active
- */
- public function setActive($active)
- {
- $this->active = $active;
- }
+ const JSON_PROPERTY_MAP = [
+ 'types' => 'string[]',
+ 'active' => 'int'
+ ];
}
diff --git a/src/Bot/Model/Request/ChatsRequest.php b/src/Bot/Model/Request/ChatsRequest.php
index 91f1396..efdc76e 100644
--- a/src/Bot/Model/Request/ChatsRequest.php
+++ b/src/Bot/Model/Request/ChatsRequest.php
@@ -13,67 +13,44 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * ChatsRequest class
+ * ChatsRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | channel_id | int |
+ * | channel_type | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getChannelId() "Get `channel_id` value"
+ * @method $this setChannelId(int $value) "Set `channel_id` value"
+ * @method string getChannelType() "Get `channel_type` value"
+ * @method $this setChannelType(string $value) "Set `channel_type` value"
*/
-class ChatsRequest
+class ChatsRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @Type("int")
- * @Accessor(getter="getChannelId",setter="setChannelId")
- * @SkipWhenEmpty()
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $channelId;
-
- /**
- * @Type("string")
- * @Accessor(getter="getChannelType",setter="setChannelType")
- * @SkipWhenEmpty()
- */
- private $channelType;
-
- /**
- * @return int
- */
- public function getChannelId()
- {
- return $this->channelId;
- }
-
- /**
- * @param int $channelId
- */
- public function setChannelId($channelId)
- {
- $this->channelId = $channelId;
- }
-
- /**
- * @return string
- */
- public function getChannelType()
- {
- return $this->channelType;
- }
-
- /**
- * @param string $channelType
- */
- public function setChannelType($channelType)
- {
- $this->channelType = $channelType;
- }
+ const JSON_PROPERTY_MAP = [
+ 'channel_id' => 'int',
+ 'channel_type' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/CommandEditRequest.php b/src/Bot/Model/Request/CommandEditRequest.php
index e95161d..fe41cc5 100644
--- a/src/Bot/Model/Request/CommandEditRequest.php
+++ b/src/Bot/Model/Request/CommandEditRequest.php
@@ -13,97 +13,50 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-use Symfony\Component\Validator\Constraints as Assert;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * CommandEditRequest class
+ * CommandEditRequest class. Parametres:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | bot_id | int |
+ * | name | string |
+ * | description | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getBotId() "Get `bot_id` value"
+ * @method $this setBotId(int $value) "Set `bot_id` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method string getDescription() "Get `description` value"
+ * @method $this setDescription(string $value) "Set `description` value"
*/
-class CommandEditRequest
+class CommandEditRequest extends LazyJsonMapper
{
/**
- * @var int $botId
- *
- * @Type("int")
- * @Accessor(getter="getBotId",setter="setBotId")
- *
- * @Assert\NotBlank
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $botId;
-
- /**
- * @var string $name
- *
- * @Type("string")
- * @Accessor(getter="getName",setter="setName")
- *
- * @Assert\NotBlank
- */
- private $name;
-
- /**
- * @var string $description
- *
- * @Type("string")
- * @Accessor(getter="getDescription",setter="setDescription")
- * @SkipWhenEmpty
- */
- private $description;
-
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @param string $name
- */
- public function setName(string $name)
- {
- $this->name = $name;
- }
-
- /**
- * @return string
- */
- public function getDescription()
- {
- return $this->description;
- }
-
- /**
- * @param string $description
- */
- public function setDescription(string $description)
- {
- $this->description = $description;
- }
-
- /**
- * @return int
- */
- public function getBotId()
- {
- return $this->botId;
- }
-
- /**
- * @param int $botId
- */
- public function setBotId(int $botId)
- {
- $this->botId = $botId;
- }
+ const JSON_PROPERTY_MAP = [
+ 'bot_id' => 'int',
+ 'name' => 'string',
+ 'description' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/CommandsRequest.php b/src/Bot/Model/Request/CommandsRequest.php
index 0a718e7..0216d7a 100644
--- a/src/Bot/Model/Request/CommandsRequest.php
+++ b/src/Bot/Model/Request/CommandsRequest.php
@@ -13,44 +13,40 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * CommandsRequest class
+ * CommandsRequest class. Parametres:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | name | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
*/
-class CommandsRequest
+class CommandsRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @Type("string")
- * @Accessor(getter="getName",setter="setName")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $name;
-
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
+ const JSON_PROPERTY_MAP = [
+ 'name' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/CommonFields.php b/src/Bot/Model/Request/CommonFields.php
index 5ade7d0..8664ff3 100644
--- a/src/Bot/Model/Request/CommonFields.php
+++ b/src/Bot/Model/Request/CommonFields.php
@@ -13,88 +13,50 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * CommonFields trait
+ * CommonFields class. Parametres:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | id | int |
+ * | since | string |
+ * | until | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method string getSince() "Get `since` value"
+ * @method $this setSince(string $value) "Set `since` value"
+ * @method string getUntil() "Get `until` value"
+ * @method $this setUntil(string $value) "Set `until` value"
*/
-trait CommonFields
+class CommonFields extends LazyJsonMapper
{
/**
- * @Type("int")
- * @Accessor(getter="getId",setter="setId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $id;
-
- /**
- * @Type("string")
- * @Accessor(getter="getSince",setter="setSince")
- * @SkipWhenEmpty
- */
- private $since;
-
- /**
- * @Type("string")
- * @Accessor(getter="getUntil",setter="setUntil")
- * @SkipWhenEmpty
- */
- private $until;
-
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * @param int $id
- */
- public function setId($id)
- {
- $this->id = $id;
- }
-
- /**
- * @return string
- */
- public function getSince()
- {
- return $this->since;
- }
-
- /**
- * @param string $since
- */
- public function setSince($since)
- {
- $this->since = $since;
- }
-
- /**
- * @return string
- */
- public function getUntil()
- {
- return $this->until;
- }
-
- /**
- * @param string $until
- */
- public function setUntil($until)
- {
- $this->until = $until;
- }
+ const JSON_PROPERTY_MAP = [
+ 'id' => 'int',
+ 'since' => 'string',
+ 'until' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/CustomersRequest.php b/src/Bot/Model/Request/CustomersRequest.php
index d15604d..51cd4ba 100644
--- a/src/Bot/Model/Request/CustomersRequest.php
+++ b/src/Bot/Model/Request/CustomersRequest.php
@@ -13,44 +13,40 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * CustomersRequest class
+ * CustomersRequest class. Parametres:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | external_id | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getExternalId() "Get `external_id` value"
+ * @method $this setExternalId(string $value) "Set `external_id` value"
*/
-class CustomersRequest
+class CustomersRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @Type("string")
- * @Accessor(getter="getExternalId",setter="setExternalId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $externalId;
-
- /**
- * @return string
- */
- public function getExternalId()
- {
- return $this->externalId;
- }
-
- /**
- * @param string $externalId
- */
- public function setExternalId($externalId)
- {
- $this->externalId = $externalId;
- }
+ const JSON_PROPERTY_MAP = [
+ 'external_id' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/DialogAssignRequest.php b/src/Bot/Model/Request/DialogAssignRequest.php
index 3837ee1..4bddd54 100644
--- a/src/Bot/Model/Request/DialogAssignRequest.php
+++ b/src/Bot/Model/Request/DialogAssignRequest.php
@@ -13,94 +13,50 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * DialogAssignRequest class
+ * DialogAssignRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | dialog_id | int |
+ * | user_id | int |
+ * | bot_id | int |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getDialogId() "Get `dialog_id` value"
+ * @method $this setDialogId(int $value) "Set `dialog_id` value"
+ * @method int getUserId() "Get `user_id` value"
+ * @method $this setUserId(int $value) "Set `user_id` value"
+ * @method int getBotId() "Get `bot_id` value"
+ * @method $this setBotId(int $value) "Set `bot_id` value"
*/
-class DialogAssignRequest
+class DialogAssignRequest extends LazyJsonMapper
{
/**
- * @var int $dialogId
- *
- * @Type("int")
- * @Accessor(getter="getDialogId,setter="setDialogId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $dialogId;
-
- /**
- * @var int $userId
- *
- * @Type("int")
- * @Accessor(getter="getUserId",setter="setUserId")
- * @SkipWhenEmpty
- */
- private $userId;
-
- /**
- * @var int $botId
- *
- * @Type("int")
- * @Accessor(getter="getBotId",setter="setBotId")
- * @SkipWhenEmpty()
- */
- private $botId;
-
- /**
- * @return int
- */
- public function getDialogId()
- {
- return $this->dialogId;
- }
-
- /**
- * @param int $dialogId
- */
- public function setDialogId(int $dialogId)
- {
- $this->dialogId = $dialogId;
- }
-
- /**
- * @return int
- */
- public function getUserId()
- {
- return $this->userId;
- }
-
- /**
- * @param int $userId
- */
- public function setUserId(int $userId)
- {
- $this->userId = $userId;
- }
-
- /**
- * @return int
- */
- public function getBotId()
- {
- return $this->botId;
- }
-
- /**
- * @param int $botId
- */
- public function setBotId(int $botId)
- {
- $this->botId = $botId;
- }
+ const JSON_PROPERTY_MAP = [
+ 'dialog_id' => 'int',
+ 'user_id' => 'int',
+ 'bot_id' => 'int'
+ ];
}
diff --git a/src/Bot/Model/Request/DialogsRequest.php b/src/Bot/Model/Request/DialogsRequest.php
index e2a6a8b..ba1baed 100644
--- a/src/Bot/Model/Request/DialogsRequest.php
+++ b/src/Bot/Model/Request/DialogsRequest.php
@@ -13,146 +13,56 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * DialogsRequest class
+ * DialogsRequest class. Parametres:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | chat_id | int |
+ * | user_id | int |
+ * | bot_id | int |
+ * | active | int |
+ * | assign | int |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method int getUserId() "Get `user_id` value"
+ * @method $this setUserId(int $value) "Set `user_id` value"
+ * @method int getBotId() "Get `bot_id` value"
+ * @method $this setBotId(int $value) "Set `bot_id` value"
+ * @method int getActive() "Get `active` value"
+ * @method $this setActive(int $value) "Set `active` value"
+ * @method int getAssign() "Get `assign` value"
+ * @method $this setAssign(int $value) "Set `assign` value"
*/
-class DialogsRequest
+class DialogsRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @var int $chatId
- *
- * @Type("int")
- * @Accessor(getter="getChatId",setter="setChatId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $chatId;
-
- /**
- * @var int $userId
- *
- * @Type("int")
- * @Accessor(getter="getUserId",setter="setUserId")
- * @SkipWhenEmpty
- */
- private $userId;
-
- /**
- * @var int $botId
- *
- * @Type("int")
- * @Accessor(getter="getBotId",setter="setBotId")
- * @SkipWhenEmpty()
- */
- private $botId;
-
- /**
- * @var int $active
- *
- * @Type("int")
- * @Accessor(getter="getActive",setter="setActive")
- * @SkipWhenEmpty
- */
- private $active;
-
- /**
- * @var int $assign
- *
- * @Type("int")
- * @Accessor(getter="getAssign",setter="setAssign")
- * @SkipWhenEmpty
- */
- private $assign;
-
- /**
- * @return int
- */
- public function getChatId()
- {
- return $this->chatId;
- }
-
- /**
- * @param int $chatId
- */
- public function setChatId(int $chatId)
- {
- $this->chatId = $chatId;
- }
-
- /**
- * @return int
- */
- public function getUserId()
- {
- return $this->userId;
- }
-
- /**
- * @param int $userId
- */
- public function setUserId(int $userId)
- {
- $this->userId = $userId;
- }
-
- /**
- * @return int
- */
- public function getBotId()
- {
- return $this->botId;
- }
-
- /**
- * @param int $botId
- */
- public function setBotId(int $botId)
- {
- $this->botId = $botId;
- }
-
- /**
- * @return int
- */
- public function getActive()
- {
- return $this->active;
- }
-
- /**
- * @param int $active
- */
- public function setActive(int $active)
- {
- $this->active = $active;
- }
-
- /**
- * @return int
- */
- public function getAssign()
- {
- return $this->assign;
- }
-
- /**
- * @param int $assign
- */
- public function setAssign(int $assign)
- {
- $this->assign = $assign;
- }
+ const JSON_PROPERTY_MAP = [
+ 'chat_id' => 'int',
+ 'user_id' => 'int',
+ 'bot_id' => 'int',
+ 'active' => 'int',
+ 'assign' => 'int'
+ ];
}
diff --git a/src/Bot/Model/Request/InfoRequest.php b/src/Bot/Model/Request/InfoRequest.php
index d4a5d43..1cdda08 100644
--- a/src/Bot/Model/Request/InfoRequest.php
+++ b/src/Bot/Model/Request/InfoRequest.php
@@ -13,94 +13,50 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * InfoRequest class
+ * InfoRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | name | string |
+ * | avatarUrl | string |
+ * | roles | array |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method string getAvatarUrl() "Get `avatarUrl` value"
+ * @method $this setAvatarUrl(string $value) "Set `avatarUrl` value"
+ * @method array getRoles() "Get `roles` value"
+ * @method $this setRoles(array $value) "Set `roles` value"
*/
-class InfoRequest
+class InfoRequest extends LazyJsonMapper
{
/**
- * @var string $name
- *
- * @Type("string")
- * @Accessor(getter="getName",setter="setName")
- * @SkipWhenEmpty()
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $name;
-
- /**
- * @var string $avatarUrl
- *
- * @Type("string")
- * @Accessor(getter="getAvatarUrl",setter="setAvatarUrl")
- * @SkipWhenEmpty()
- */
- private $avatarUrl;
-
- /**
- * @var array $roles
- *
- * @Type("array")
- * @Accessor(getter="getRoles",setter="setRoles")
- * @SkipWhenEmpty()
- */
- private $roles;
-
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @param string $name
- */
- public function setName(string $name)
- {
- $this->name = $name;
- }
-
- /**
- * @return string
- */
- public function getAvatarUrl()
- {
- return $this->avatarUrl;
- }
-
- /**
- * @param string $avatarUrl
- */
- public function setAvatarUrl(string $avatarUrl)
- {
- $this->avatarUrl = $avatarUrl;
- }
-
- /**
- * @return array
- */
- public function getRoles()
- {
- return $this->roles;
- }
-
- /**
- * @param array $roles
- */
- public function setRoles(array $roles)
- {
- $this->roles = $roles;
- }
+ const JSON_PROPERTY_MAP = [
+ 'name' => 'string',
+ 'avatarUrl' => 'string',
+ 'roles' => 'string[]'
+ ];
}
diff --git a/src/Bot/Model/Request/MembersRequest.php b/src/Bot/Model/Request/MembersRequest.php
index ea4050b..e4f1f0c 100644
--- a/src/Bot/Model/Request/MembersRequest.php
+++ b/src/Bot/Model/Request/MembersRequest.php
@@ -13,144 +13,58 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MembersRequest class
+ * MembersRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | chat_id | int |
+ * | user_id | int |
+ * | state | string |
+ * | since | string |
+ * | until | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method int getUserId() "Get `user_id` value"
+ * @method $this setUserId(int $value) "Set `user_id` value"
+ * @method string getState() "Get `state` value"
+ * @method $this setState(string $value) "Set `state` value"
+ * @method string getSince() "Get `since` value"
+ * @method $this setSince(string $value) "Set `since` value"
+ * @method string getUntil() "Get `until` value"
+ * @method $this setUntil(string $value) "Set `until` value"
*/
-class MembersRequest
+class MembersRequest extends LazyJsonMapper
{
/**
- * @var int $chatId
- *
- * @Type("int")
- * @Accessor(getter="getChatId",setter="setChatId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $chatId;
-
- /**
- * @var int $userId
- *
- * @Type("int")
- * @Accessor(getter="getUserId",setter="setUserId")
- * @SkipWhenEmpty
- */
- private $userId;
-
- /**
- * @var string $state
- *
- * @Type("string")
- * @Accessor(getter="getState",setter="setState")
- * @SkipWhenEmpty
- */
- private $state;
-
- /**
- * @var string $since
- *
- * @Type("string")
- * @Accessor(getter="getSince",setter="setSince")
- * @SkipWhenEmpty
- */
- private $since;
-
- /**
- * @var string $until
- *
- * @Type("string")
- * @Accessor(getter="getUntil",setter="setUntil")
- * @SkipWhenEmpty
- */
- private $until;
-
- /**
- * @return int
- */
- public function getChatId()
- {
- return $this->chatId;
- }
-
- /**
- * @param int $chatId
- */
- public function setChatId(int $chatId)
- {
- $this->chatId = $chatId;
- }
-
- /**
- * @return int
- */
- public function getUserId()
- {
- return $this->userId;
- }
-
- /**
- * @param int $userId
- */
- public function setUserId(int $userId)
- {
- $this->userId = $userId;
- }
-
- /**
- * @return string
- */
- public function getState()
- {
- return $this->state;
- }
-
- /**
- * @param string $state
- */
- public function setState(string $state)
- {
- $this->state = $state;
- }
-
- /**
- * @return string
- */
- public function getSince()
- {
- return $this->since;
- }
-
- /**
- * @param string $since
- */
- public function setSince(string $since)
- {
- $this->since = $since;
- }
-
- /**
- * @return string
- */
- public function getUntil()
- {
- return $this->until;
- }
-
- /**
- * @param string $until
- */
- public function setUntil(string $until)
- {
- $this->until = $until;
- }
+ const JSON_PROPERTY_MAP = [
+ 'chat_id' => 'int',
+ 'user_id' => 'int',
+ 'state' => 'string',
+ 'since' => 'string',
+ 'until' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/MessageEditRequest.php b/src/Bot/Model/Request/MessageEditRequest.php
index 4cf9baa..513d020 100644
--- a/src/Bot/Model/Request/MessageEditRequest.php
+++ b/src/Bot/Model/Request/MessageEditRequest.php
@@ -13,69 +13,46 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * MessageEditRequest class
+ * MessageEditRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | id | int |
+ * | content | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getId() "Get `id` value"
+ * @method $this setId(int $value) "Set `id` value"
+ * @method string getContent() "Get `content` value"
+ * @method $this setContent(string $value) "Set `content` value"
*/
-class MessageEditRequest
+class MessageEditRequest extends LazyJsonMapper
{
/**
- * @var int $id
- *
- * @Type("int")
- * @Accessor(getter="getId",setter="setId")
- * @SkipWhenEmpty()
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $id;
-
- /**
- * @var string $content
- *
- * @Type("string")
- * @Accessor(getter="getContent",setter="setContent")
- * @SkipWhenEmpty()
- */
- private $content;
-
- /**
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
-
- /**
- * @param int $id
- */
- public function setId(int $id)
- {
- $this->id = $id;
- }
-
- /**
- * @return string
- */
- public function getContent()
- {
- return $this->content;
- }
-
- /**
- * @param string $content
- */
- public function setContent(string $content)
- {
- $this->content = $content;
- }
+ const JSON_PROPERTY_MAP = [
+ 'id' => 'int',
+ 'content' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/MessageSendRequest.php b/src/Bot/Model/Request/MessageSendRequest.php
index 254134f..efbba5b 100644
--- a/src/Bot/Model/Request/MessageSendRequest.php
+++ b/src/Bot/Model/Request/MessageSendRequest.php
@@ -13,227 +13,72 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-use Symfony\Component\Validator\Constraints as Assert;
+use LazyJsonMapper\LazyJsonMapper;
use RetailCrm\Mg\Bot\Model\Entity\Order;
use RetailCrm\Mg\Bot\Model\Entity\Product;
/**
* PHP version 7.0
*
- * MessageSendRequest class
+ * MessageSendRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |------------------|----------------|
+ * | type | string |
+ * | content | string |
+ * | product | MessageProduct |
+ * | order | MessageOrder |
+ * | items | array |
+ * | scope | string |
+ * | chat_id | int |
+ * | quote_message_id | int |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
+ * @method string getContent() "Get `content` value"
+ * @method $this setContent(string $value) "Set `content` value"
+ * @method MessageProduct getProduct() "Get `product` value"
+ * @method $this setProduct(MessageProduct $value) "Set `product` value"
+ * @method MessageOrder getOrder() "Get `order` value"
+ * @method $this setOrder(MessageOrder $value) "Set `order` value"
+ * @method array getItems() "Get `items` value"
+ * @method $this setItems(array $value) "Set `items` value"
+ * @method string getScope() "Get `scope` value"
+ * @method $this setScope(string $value) "Set `scope` value"
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method int getQuoteMessageId() "Get `quote_message_id` value"
+ * @method $this setQuoteMessageId(int $value) "Set `quote_message_id` value"
*/
-class MessageSendRequest
+class MessageSendRequest extends LazyJsonMapper
{
/**
- * @var string $type
- *
- * @Type("string")
- * @Accessor(getter="getType",setter="setType")
- * @SkipWhenEmpty()
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $type;
-
- /**
- * @var string $content
- *
- * @Type("string")
- * @Accessor(getter="getContent",setter="setContent")
- *
- * @Assert\NotBlank
- */
- private $content;
-
- /**
- * @var Product $product
- *
- * @Type("Product")
- * @Accessor(getter="getProduct",setter="setProduct")
- * @SkipWhenEmpty()
- */
- private $product;
-
- /**
- * @var Order $order
- *
- * @Type("Order")
- * @Accessor(getter="getOrder",setter="setOrder")
- * @SkipWhenEmpty()
- */
- private $order;
-
- /**
- * @var array $items
- *
- * @Type("array")
- * @Accessor(getter="getItems",setter="setItems")
- * @SkipWhenEmpty()
- */
- private $items;
-
- /**
- * @var string $scope
- *
- * @Type("string")
- * @Accessor(getter="getScope",setter="setScope")
- *
- * @Assert\NotBlank
- */
- private $scope;
-
- /**
- * @var int $chatId
- *
- * @Type("int")
- * @Accessor(getter="getChatId",setter="setChatId")
- *
- * @Assert\NotBlank
- */
- private $chatId;
-
-
- /**
- * @var int $quoteMessageId
- *
- * @Type("int")
- * @Accessor(getter="getQuoteMessageId",setter="setQuoteMessageId")
- * @SkipWhenEmpty
- */
- private $quoteMessageId;
-
-
- /**
- * @return int
- */
- public function getChatId()
- {
- return $this->chatId;
- }
-
- /**
- * @param int $chatId
- */
- public function setChatId(int $chatId)
- {
- $this->chatId = $chatId;
- }
-
- /**
- * @return string
- */
- public function getScope()
- {
- return $this->scope;
- }
-
- /**
- * @param string $scope
- */
- public function setScope(string $scope)
- {
- $this->scope = $scope;
- }
-
- /**
- * @return string
- */
- public function getType()
- {
- return $this->type;
- }
-
- /**
- * @param string $type
- */
- public function setType(string $type)
- {
- $this->type = $type;
- }
-
- /**
- * @return string
- */
- public function getContent()
- {
- return $this->content;
- }
-
- /**
- * @param string $content
- */
- public function setContent(string $content)
- {
- $this->content = $content;
- }
-
- /**
- * @return Product
- */
- public function getProduct()
- {
- return $this->product;
- }
-
- /**
- * @param Product $product
- */
- public function setProduct(Product $product)
- {
- $this->product = $product;
- }
-
- /**
- * @return Order
- */
- public function getOrder()
- {
- return $this->order;
- }
-
- /**
- * @param Order $order
- */
- public function setOrder(Order $order)
- {
- $this->order = $order;
- }
-
- /**
- * @return array
- */
- public function getItems()
- {
- return $this->items;
- }
-
- /**
- * @param array $items
- */
- public function setItems(array $items)
- {
- $this->items = $items;
- }
-
- /**
- * @return int
- */
- public function getQuoteMessageId()
- {
- return $this->quoteMessageId;
- }
-
- /**
- * @param int $quoteMessageId
- */
- public function setQuoteMessageId(int $quoteMessageId)
- {
- $this->quoteMessageId = $quoteMessageId;
- }
+ const JSON_PROPERTY_MAP = [
+ 'type' => 'string',
+ 'content' => 'string',
+ 'product' => '\RetailCrm\Mg\Bot\Model\Entity\Message\MessageProduct',
+ 'order' => '\RetailCrm\Mg\Bot\Model\Entity\Message\MessageOrder',
+ 'items' => '\RetailCrm\Mg\Bot\Model\Entity\Message\Item[]',
+ 'scope' => 'string',
+ 'chat_id' => 'int',
+ 'quote_message_id' => 'int'
+ ];
}
diff --git a/src/Bot/Model/Request/MessagesRequest.php b/src/Bot/Model/Request/MessagesRequest.php
index a32e243..7a6c9f0 100644
--- a/src/Bot/Model/Request/MessagesRequest.php
+++ b/src/Bot/Model/Request/MessagesRequest.php
@@ -13,246 +13,72 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * MessagesRequest class
+ * MessagesRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | chat_id | int |
+ * | dialog_id | int |
+ * | user_id | int |
+ * | customer_id | int |
+ * | bot_id | int |
+ * | channel_id | int |
+ * | channel_type | string |
+ * | scope | string |
+ * | type | string |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method int getChatId() "Get `chat_id` value"
+ * @method $this setChatId(int $value) "Set `chat_id` value"
+ * @method int getDialogId() "Get `dialog_id` value"
+ * @method $this setDialogId(int $value) "Set `dialog_id` value"
+ * @method int getUserId() "Get `user_id` value"
+ * @method $this setUserId(int $value) "Set `user_id` value"
+ * @method int getCustomerId() "Get `customer_id` value"
+ * @method $this setCustomerId(int $value) "Set `customer_id` value"
+ * @method int getBotId() "Get `bot_id` value"
+ * @method $this setBotId(int $value) "Set `bot_id` value"
+ * @method int getChannelId() "Get `channel_id` value"
+ * @method $this setChannelId(int $value) "Set `channel_id` value"
+ * @method string getChannelType() "Get `channel_type` value"
+ * @method $this setChannelType(string $value) "Set `channel_type` value"
+ * @method string getScope() "Get `scope` value"
+ * @method $this setScope(string $value) "Set `scope` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
*/
-class MessagesRequest
+class MessagesRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @var int $chatId
- *
- * @Type("int")
- * @Accessor(getter="getChatId",setter="setChatId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $chatId;
-
- /**
- * @var int $dialogId
- *
- * @Type("int")
- * @Accessor(getter="getDialogId",setter="setDialogId")
- * @SkipWhenEmpty
- */
- private $dialogId;
-
- /**
- * @var int $userId
- *
- * @Type("int")
- * @Accessor(getter="getUserId",setter="setUserId")
- * @SkipWhenEmpty
- */
- private $userId;
-
- /**
- * @var int $customerId
- *
- * @Type("int")
- * @Accessor(getter="getCustomerId",setter="setCustomerId")
- * @SkipWhenEmpty()
- */
- private $customerId;
-
- /**
- * @var int $botId
- *
- * @Type("int")
- * @Accessor(getter="getBotId",setter="setBotId")
- * @SkipWhenEmpty()
- */
- private $botId;
-
- /**
- * @var int $channelId
- *
- * @Type("int")
- * @Accessor(getter="getChannelId",setter="setChannelId")
- * @SkipWhenEmpty()
- */
- private $channelId;
-
- /**
- * @var string $channelType
- *
- * @Type("string")
- * @Accessor(getter="getChannelType",setter="setChannelType")
- * @SkipWhenEmpty()
- */
- private $channelType;
-
- /**
- * @var string $scope
- *
- * @Type("string")
- * @Accessor(getter="getScope",setter="setScope")
- * @SkipWhenEmpty()
- */
- private $scope;
-
- /**
- * @var string $type
- *
- * @Type("string")
- * @Accessor(getter="getType",setter="setType")
- * @SkipWhenEmpty()
- */
- private $type;
-
- /**
- * @return int
- */
- public function getChatId()
- {
- return $this->chatId;
- }
-
- /**
- * @param int $chatId
- */
- public function setChatId(int $chatId)
- {
- $this->chatId = $chatId;
- }
-
- /**
- * @return int
- */
- public function getDialogId()
- {
- return $this->dialogId;
- }
-
- /**
- * @param int $dialogId
- */
- public function setDialogId(int $dialogId)
- {
- $this->dialogId = $dialogId;
- }
-
- /**
- * @return int
- */
- public function getUserId()
- {
- return $this->userId;
- }
-
- /**
- * @param int $userId
- */
- public function setUserId(int $userId)
- {
- $this->userId = $userId;
- }
-
- /**
- * @return int
- */
- public function getCustomerId()
- {
- return $this->customerId;
- }
-
- /**
- * @param int $customerId
- */
- public function setCustomerId(int $customerId)
- {
- $this->customerId = $customerId;
- }
-
- /**
- * @return int
- */
- public function getBotId()
- {
- return $this->botId;
- }
-
- /**
- * @param int $botId
- */
- public function setBotId(int $botId)
- {
- $this->botId = $botId;
- }
-
- /**
- * @return int
- */
- public function getChannelId()
- {
- return $this->channelId;
- }
-
- /**
- * @param int $channelId
- */
- public function setChannelId(int $channelId)
- {
- $this->channelId = $channelId;
- }
-
- /**
- * @return string
- */
- public function getChannelType()
- {
- return $this->channelType;
- }
-
- /**
- * @param string $channelType
- */
- public function setChannelType(string $channelType)
- {
- $this->channelType = $channelType;
- }
-
- /**
- * @return string
- */
- public function getScope()
- {
- return $this->scope;
- }
-
- /**
- * @param string $scope
- */
- public function setScope(string $scope)
- {
- $this->scope = $scope;
- }
-
- /**
- * @return string
- */
- public function getType()
- {
- return $this->type;
- }
-
- /**
- * @param string $type
- */
- public function setType(string $type)
- {
- $this->type = $type;
- }
+ const JSON_PROPERTY_MAP = [
+ 'chat_id' => 'int',
+ 'dialog_id' => 'int',
+ 'user_id' => 'int',
+ 'customer_id' => 'int',
+ 'bot_id' => 'int',
+ 'channel_id' => 'int',
+ 'channel_type' => 'string',
+ 'scope' => 'string',
+ 'type' => 'string'
+ ];
}
diff --git a/src/Bot/Model/Request/UsersRequest.php b/src/Bot/Model/Request/UsersRequest.php
index 3bd40fd..c38ffc3 100644
--- a/src/Bot/Model/Request/UsersRequest.php
+++ b/src/Bot/Model/Request/UsersRequest.php
@@ -13,90 +13,48 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-
/**
* PHP version 7.0
*
- * UsersRequest class
+ * UsersRequest class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | external_id | string |
+ * | active | int |
+ * | online | int |
*
* @package RetailCrm\Mg\Bot\Model\Request
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getExternalId() "Get `external_id` value"
+ * @method $this setExternalId(string $value) "Set `external_id` value"
+ * @method int getActive() "Get `active` value"
+ * @method $this setActive(int $value) "Set `active` value"
+ * @method int getOnline() "Get `online` value"
+ * @method $this setOnline(int $value) "Set `online` value"
*/
-class UsersRequest
+class UsersRequest extends CommonFields
{
- use CommonFields;
-
/**
- * @Type("string")
- * @Accessor(getter="getExternalId",setter="setExternalId")
- * @SkipWhenEmpty
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
*/
- private $externalId;
-
- /**
- * @Type("int")
- * @Accessor(getter="getActive",setter="setActive")
- * @SkipWhenEmpty
- */
- private $active;
-
- /**
- * @Type("int")
- * @Accessor(getter="getOnline",setter="setOnline")
- * @SkipWhenEmpty
- */
- private $online;
-
- /**
- * @return string
- */
- public function getExternalId()
- {
- return $this->externalId;
- }
-
- /**
- * @param string $externalId
- */
- public function setExternalId($externalId)
- {
- $this->externalId = $externalId;
- }
-
- /**
- * @return int
- */
- public function getActive()
- {
- return $this->active;
- }
-
- /**
- * @param int $active
- */
- public function setActive($active)
- {
- $this->active = $active;
- }
-
- /**
- * @return int
- */
- public function getOnline()
- {
- return $this->online;
- }
-
- /**
- * @param int $online
- */
- public function setOnline($online)
- {
- $this->online = $online;
- }
+ const JSON_PROPERTY_MAP = [
+ 'external_id' => 'string',
+ 'active' => 'int',
+ 'online' => 'int'
+ ];
}
diff --git a/src/Bot/Model/Response/AssignResponse.php b/src/Bot/Model/Response/AssignResponse.php
index 41eea26..9830fd3 100644
--- a/src/Bot/Model/Response/AssignResponse.php
+++ b/src/Bot/Model/Response/AssignResponse.php
@@ -18,24 +18,45 @@ use RetailCrm\Mg\Bot\Model\Entity\Responsible;
/**
* PHP version 7.0
*
- * AssignResponse class
+ * AssignResponse class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------------|-------------|
+ * | is_reassign | bool |
+ * | left_manager_id | int |
+ * | previous_responsible | Responsible |
+ * | responsible | Responsible |
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method bool getIsReassign()
- * @method $this setIsReassign(bool $value)
- * @method int getLeftManagerId()
- * @method $this setLeftManagerId(int $value)
- * @method Responsible getPreviousResponsible()
- * @method $this setPreviousResponsible(Responsible $value)
- * @method Responsible getResponsible()
- * @method $this setResponsible(Responsible $value)
+ * @method bool getIsReassign() "Get `is_reassign` value"
+ * @method $this setIsReassign(bool $value) "Set `is_reassign` value"
+ * @method int getLeftManagerId() "Get `left_manager_id` value"
+ * @method $this setLeftManagerId(int $value) "Set `left_manager_id` value"
+ * @method Responsible getPreviousResponsible() "Get `previous_responsible` value"
+ * @method $this setPreviousResponsible(Responsible $value) "Set `previous_responsible` value"
+ * @method Responsible getResponsible() "Get `responsible` value"
+ * @method $this setResponsible(Responsible $value) "Set `responsible` value"
*/
class AssignResponse extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'is_reassign' => 'bool',
'left_manager_id' => 'int',
diff --git a/src/Bot/Model/Response/CommonFields.php b/src/Bot/Model/Response/CommonFields.php
index 8fd9b26..63e2002 100644
--- a/src/Bot/Model/Response/CommonFields.php
+++ b/src/Bot/Model/Response/CommonFields.php
@@ -13,27 +13,42 @@
namespace RetailCrm\Mg\Bot\Model\Response;
-use JMS\Serializer\Annotation as Serializer;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
use LazyJsonMapper\LazyJsonMapper;
use RetailCrm\Mg\Bot\Model\Entity\Error;
/**
* PHP version 7.0
*
- * Error trait
+ * Error trait. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | errors | array |
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method array getErrors()
- * @method $this setErrors(array $value)
+ * @method array getErrors() "Get `errors` value"
+ * @method $this setErrors(array $value) "Set `errors` value"
*/
class CommonFields extends LazyJsonMapper
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'errors' => 'string[]'
];
diff --git a/src/Bot/Model/Response/FullFileResponse.php b/src/Bot/Model/Response/FullFileResponse.php
index ef141b1..53ce746 100644
--- a/src/Bot/Model/Response/FullFileResponse.php
+++ b/src/Bot/Model/Response/FullFileResponse.php
@@ -16,24 +16,45 @@ namespace RetailCrm\Mg\Bot\Model\Response;
/**
* PHP version 7.0
*
- * FullFileResponse class
+ * FullFileResponse class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | id | string |
+ * | size | int |
+ * | type | string |
+ * | url | string |
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getId()
- * @method $this setId(string $value)
- * @method int getSize()
- * @method $this setSize(int $value)
- * @method string getType()
- * @method $this setType(string $value)
- * @method string getUrl()
- * @method $this setUrl(string $value)
+ * @method string getId() "Get `id` value"
+ * @method $this setId(string $value) "Set `id` value"
+ * @method int getSize() "Get `size` value"
+ * @method $this setSize(int $value) "Set `size` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
+ * @method string getUrl() "Get `url` value"
+ * @method $this setUrl(string $value) "Set `url` value"
*/
class FullFileResponse extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'id' => 'string',
'size' => 'int',
diff --git a/src/Bot/Model/Response/ListResponse.php b/src/Bot/Model/Response/ListResponse.php
index 725c6de..6fabeea 100644
--- a/src/Bot/Model/Response/ListResponse.php
+++ b/src/Bot/Model/Response/ListResponse.php
@@ -16,14 +16,36 @@ namespace RetailCrm\Mg\Bot\Model\Response;
/**
* PHP version 7.0
*
- * ListResponse class
+ * ListResponse class.
+ *
+ * This class implements `ArrayAccess` and `Iterator` interfaces.
+ * It means you can access items using array syntax, or use this class in `foreach` loop.
+ *
+ * Example:
+ * ```
+ * $request = new \RetailCrm\Mg\Bot\Model\Request\BotsRequest();
+ * $request->setActive(1);
+ * $request->setRoles([Constants::BOT_ROLE_RESPONSIBLE]);
+ *
+ * $data = $client->bots($request);
+ * $firstBot = $data[0];
+ *
+ * foreach($data as $bot) { ... }
+ * ```
+ *
+ * Fields:
+ *
+ * | Field name | Data type |
+ * |----------------|---------------|
+ * | result | array[object] |
+ * | errors | array[string] |
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*/
-class ListResponse implements \Iterator {
+class ListResponse implements \Iterator, \ArrayAccess {
/**
* @var array
*/
@@ -73,19 +95,69 @@ class ListResponse implements \Iterator {
}
/**
- * @param $name
+ * Set offset
+ *
+ * @param mixed $offset offset value
+ * @param mixed $value value
+ *
+ * @return void
+ * @internal
+ */
+ public function offsetSet($offset, $value)
+ {
+ throw new \BadMethodCallException(
+ "This call not allowed: offsetSet [$offset] [$value]"
+ );
+ }
+
+ /**
+ * Unset offset
+ *
+ * @param mixed $offset offset value
+ *
+ * @return void
+ * @internal
+ */
+ public function offsetUnset($offset)
+ {
+ throw new \BadMethodCallException(
+ "This call not allowed: offsetSet [$offset]"
+ );
+ }
+ /**
+ * Check offset
+ *
+ * @param mixed $offset offset value
+ *
+ * @return bool
+ * @internal
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->items[$offset]);
+ }
+ /**
+ * Get offset
+ *
+ * @param mixed $offset offset value
*
* @return mixed
+ * @internal
*/
- public function get($name)
+ public function offsetGet($offset)
{
- return $this->items[$name];
+ if (!isset($this->items[$offset])) {
+ throw new \InvalidArgumentException("Item \"$offset\" not found");
+ }
+
+ return $this->items[$offset];
}
/**
* @param $name
*
* @return mixed
+ * @internal
*/
public function __get($name)
{
@@ -94,6 +166,7 @@ class ListResponse implements \Iterator {
/**
* Implements rewind() for Iterable
+ * @internal
*/
public function rewind() {
$this->position = 0;
@@ -102,6 +175,7 @@ class ListResponse implements \Iterator {
/**
* Implements current() for Iterable
*
+ * @internal
* @return mixed
*/
public function current() {
@@ -111,6 +185,7 @@ class ListResponse implements \Iterator {
/**
* Implements key() for Iterable
*
+ * @internal
* @return int|mixed
*/
public function key() {
@@ -119,6 +194,7 @@ class ListResponse implements \Iterator {
/**
* Implements next() for Iterable
+ * @internal
*/
public function next() {
++$this->position;
@@ -127,6 +203,7 @@ class ListResponse implements \Iterator {
/**
* Implements valid() for Iterable
*
+ * @internal
* @return bool
*/
public function valid() {
diff --git a/src/Bot/Model/Response/MessageSendResponse.php b/src/Bot/Model/Response/MessageSendResponse.php
index 3625df4..e392ccb 100644
--- a/src/Bot/Model/Response/MessageSendResponse.php
+++ b/src/Bot/Model/Response/MessageSendResponse.php
@@ -16,20 +16,39 @@ namespace RetailCrm\Mg\Bot\Model\Response;
/**
* PHP version 7.0
*
- * MessageSendResponse class
+ * MessageSendResponse class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | message_id | int |
+ * | time | string |
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method int getMessageId()
- * @method $this setMessageId(int $value)
- * @method string getTime()
- * @method $this setTime(string $value)
+ * @method int getMessageId() "Get `message_id` value"
+ * @method $this setMessageId(int $value) "Set `message_id` value"
+ * @method string getTime() "Get `time` value"
+ * @method $this setTime(string $value) "Set `time` value"
*/
class MessageSendResponse extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'message_id' => 'int',
'time' => 'string'
diff --git a/src/Bot/Model/Response/UploadFileResponse.php b/src/Bot/Model/Response/UploadFileResponse.php
index 7759d9f..6f9032f 100644
--- a/src/Bot/Model/Response/UploadFileResponse.php
+++ b/src/Bot/Model/Response/UploadFileResponse.php
@@ -13,40 +13,62 @@
namespace RetailCrm\Mg\Bot\Model\Response;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\Type;
-use RetailCrm\Mg\Bot\Model\Response\CommonFields;
use RetailCrm\Mg\Bot\Model\Entity\FileMeta;
/**
* PHP version 7.0
*
- * UploadFileResponse class
+ * UploadFileResponse class. Parameters:
+ *
+ * | Parameter name | Data type |
+ * |----------------|-----------|
+ * | created_at | string |
+ * | hash | string |
+ * | id | string |
+ * | meta | FileMeta |
+ * | mime_type | string |
+ * | size | int |
+ * | source_url | string |
+ * | type | string |
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*
- * @method string getCreatedAt()
- * @method $this setCreatedAt(string $value)
- * @method string getHash()
- * @method $this setHash(string $value)
- * @method string getId()
- * @method $this setId(string $value)
- * @method FileMeta getMeta()
- * @method $this setMeta(FileMeta $value)
- * @method string getMimeType()
- * @method $this setMimeType(string $value)
- * @method int getSize()
- * @method $this setSize(int $value)
- * @method string getSourceUrl()
- * @method $this setSourceUrl(string $value)
- * @method string getType()
- * @method $this setType(string $value)
+ * @method string getCreatedAt() "Get `created_at` value"
+ * @method $this setCreatedAt(string $value) "Set `created_at` value"
+ * @method string getHash() "Get `hash` value"
+ * @method $this setHash(string $value) "Set `hash` value"
+ * @method string getId() "Get `id` value"
+ * @method $this setId(string $value) "Set `id` value"
+ * @method FileMeta getMeta() "Get `meta` value"
+ * @method $this setMeta(FileMeta $value) "Set `meta` value"
+ * @method string getMimeType() "Get `mime_type` value"
+ * @method $this setMimeType(string $value) "Set `mime_type` value"
+ * @method int getSize() "Get `size` value"
+ * @method $this setSize(int $value) "Set `size` value"
+ * @method string getSourceUrl() "Get `source_url` value"
+ * @method $this setSourceUrl(string $value) "Set `source_url` value"
+ * @method string getType() "Get `type` value"
+ * @method $this setType(string $value) "Set `type` value"
*/
class UploadFileResponse extends CommonFields
{
+ /**
+ * JSON fields. Use setters and getters to work with this values.
+ * Setters will return model instance, so you can construct any model like this:
+ * ```
+ * $request = (new InfoRequest())
+ * ->setName("...")
+ * ->setRoles([...]);
+ *```
+ * Model constructor can accept array as initial data. You can use
+ * this to initialize models:
+ * ```
+ * $request = new InfoRequest(["name" => "...", "roles" => [...]]);
+ * ```
+ */
const JSON_PROPERTY_MAP = [
'created_at' => 'string',
'hash' => 'string',
diff --git a/src/Exception/CurlException.php b/src/Exception/CurlException.php
deleted file mode 100644
index 8412b22..0000000
--- a/src/Exception/CurlException.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
- * @license https://opensource.org/licenses/MIT MIT License
- * @link http://help.retailcrm.pro/docs/Developers
- */
-
-namespace RetailCrm\Common\Exception;
-
-use RuntimeException;
-
-/**
- * PHP version 7.0
- *
- * Class CurlException
- *
- * @package RetailCrm\Common\Exception
- * @author retailCRM
- * @license https://opensource.org/licenses/MIT MIT License
- * @link http://help.retailcrm.pro/docs/Developers
- */
-class CurlException extends RuntimeException
-{
-}
diff --git a/src/Exception/LimitException.php b/src/Exception/LimitException.php
index f79084c..9e65c70 100644
--- a/src/Exception/LimitException.php
+++ b/src/Exception/LimitException.php
@@ -18,7 +18,7 @@ use DomainException;
/**
* PHP version 7.0
*
- * Class CurlException
+ * Class LimitException
*
* @package RetailCrm\Common\Exception
* @author retailCRM
diff --git a/src/Register.php b/src/Register.php
index 27d36a1..9d3d6b7 100644
--- a/src/Register.php
+++ b/src/Register.php
@@ -13,334 +13,71 @@
namespace RetailCrm\Common;
-use JMS\Serializer\Annotation\Accessor;
-use JMS\Serializer\Annotation\SkipWhenEmpty;
-use JMS\Serializer\Annotation\Type;
-use Symfony\Component\Validator\Constraints as Assert;
+use LazyJsonMapper\LazyJsonMapper;
/**
* PHP version 7.0
*
- * RequestHelper class
+ * Register helper class. Fields:
+ *
+ * | Field name | Data type |
+ * |--------------------|-----------|
+ * | code | string |
+ * | integrationCode | string |
+ * | active | string |
+ * | name | string |
+ * | logo | string |
+ * | clientId | string |
+ * | baseUrl | string |
+ * | accountUrl | string |
+ * | actions | array |
+ * | availableCountries | array |
+ * | integrations | array |
*
* @package RetailCrm\Common
* @author retailCRM
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
+ *
+ * @method string getCode() "Get `code` value"
+ * @method $this setCode(string $value) "Set `code` value"
+ * @method string getIntegrationCode() "Get `integrationCode` value"
+ * @method $this setIntegrationCode(string $value) "Set `integrationCode` value"
+ * @method string getActive() "Get `active` value"
+ * @method $this setActive(string $value) "Set `active` value"
+ * @method string getName() "Get `name` value"
+ * @method $this setName(string $value) "Set `name` value"
+ * @method string getLogo() "Get `logo` value"
+ * @method $this setLogo(string $value) "Set `logo` value"
+ * @method string getClientId() "Get `clientId` value"
+ * @method $this setClientId(string $value) "Set `clientId` value"
+ * @method string getBaseUrl() "Get `baseUrl` value"
+ * @method $this setBaseUrl(string $value) "Set `baseUrl` value"
+ * @method string getAccountUrl() "Get `accountUrl` value"
+ * @method $this setAccountUrl(string $value) "Set `accountUrl` value"
+ * @method array getActions() "Get `actions` value"
+ * @method $this setActions(array $value) "Set `actions` value"
+ * @method array getAvailableCountries() "Get `availableCountries` value"
+ * @method $this setAvailableCountries(array $value) "Set `availableCountries` value"
+ * @method array getIntegrations() "Get `integrations` value"
+ * @method $this setIntegrations(array $value) "Set `integrations` value"
*/
-class Register
+class Register extends LazyJsonMapper
{
/**
- * @var string $code
- *
- * @Type("string")
- * @Accessor(getter="getCode",setter="setCode")
- *
- * @Assert\NotBlank
+ * @internal
*/
- private $code;
-
- /**
- * @var string $integrationCode
- *
- * @Type("string")
- * @Accessor(getter="getIntegrationCode",setter="setIntegrationCode")
- *
- * @Assert\NotBlank
- */
- private $integrationCode;
-
- /**
- * @var string $active
- * @Type("string")
- * @Accessor(getter="getActive",setter="setActive")
- * @SkipWhenEmpty
- */
- private $active;
-
- /**
- * @var string $name
- *
- * @Type("string")
- * @Accessor(getter="getName",setter="setName")
- * @SkipWhenEmpty
- */
- private $name;
-
- /**
- * @var string $logo
- *
- * @Type("string")
- * @Accessor(getter="getLogo",setter="setLogo")
- * @SkipWhenEmpty
- *
- * @Assert\Url(
- * message = "The logo url is not a valid url",
- * protocols = {"http", "https"}
- * )
- */
- private $logo;
-
- /**
- * @var string $clientId
- *
- * @Type("string")
- * @Accessor(getter="getClientId",setter="setClientId")
- *
- * @Assert\NotBlank
- */
- private $clientId;
-
- /**
- * @var string $baseUrl
- *
- * @Type("string")
- * @Accessor(getter="getBaseUrl",setter="setBaseUrl")
- *
- * @Assert\NotBlank
- * @Assert\Url(
- * message = "The baseUrl is not a valid url",
- * protocols = {"http", "https"}
- * )
- */
- private $baseUrl;
-
- /**
- * @var string $accountUrl
- *
- * @Type("string")
- * @Accessor(getter="getAccountUrl",setter="setAccountUrl")
- *
- * @Assert\NotBlank
- * @Assert\Url(
- * message = "The baseUrl is not a valid url",
- * protocols = {"http", "https"}
- * )
- */
- private $accountUrl;
-
- /**
- * @var array $actions
- *
- * @Type("array")
- * @Accessor(getter="getActions",setter="setActions")
- *
- * @Assert\NotBlank
- */
- private $actions;
-
- /**
- * @var array $availableCountries
- *
- * @Type("array")
- * @Accessor(getter="getAvailableCountries",setter="setAvailableCountries")
- * @SkipWhenEmpty
- */
- private $availableCountries;
-
- /**
- * @var array $integrations
- *
- * @Type("array")
- * @Accessor(getter="getIntegrations",setter="setIntegrations")
- *
- * @Assert\NotBlank
- */
- private $integrations;
-
- /**
- * @return string
- */
- public function getCode()
- {
- return $this->code;
- }
-
- /**
- * @param string $code
- */
- public function setCode(string $code)
- {
- $this->code = $code;
- }
-
- /**
- * @return string
- */
- public function getIntegrationCode()
- {
- return $this->integrationCode;
- }
-
- /**
- * @param string $integrationCode
- */
- public function setIntegrationCode(string $integrationCode)
- {
- $this->integrationCode = $integrationCode;
- }
-
- /**
- * @return string
- */
- public function getActive()
- {
- return $this->active;
- }
-
- /**
- * @param string $active
- */
- public function setActive(string $active)
- {
- $this->active = $active;
- }
-
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * @param string $name
- */
- public function setName(string $name)
- {
- $this->name = $name;
- }
-
- /**
- * @return string
- */
- public function getLogo()
- {
- return $this->logo;
- }
-
- /**
- * @param string $logo
- */
- public function setLogo(string $logo)
- {
- $this->logo = $logo;
- }
-
- /**
- * @return string
- */
- public function getClientId()
- {
- return $this->clientId;
- }
-
- /**
- * @param string $clientId
- */
- public function setClientId(string $clientId)
- {
- $this->clientId = $clientId;
- }
-
- /**
- * @return string
- */
- public function getBaseUrl()
- {
- return $this->baseUrl;
- }
-
- /**
- * @param string $baseUrl
- */
- public function setBaseUrl(string $baseUrl)
- {
- $this->baseUrl = $baseUrl;
- }
-
- /**
- * @return string
- */
- public function getAccountUrl()
- {
- return $this->accountUrl;
- }
-
- /**
- * @param string $accountUrl
- */
- public function setAccountUrl(string $accountUrl)
- {
- $this->accountUrl = $accountUrl;
- }
-
- /**
- * @return array
- */
- public function getActions()
- {
- return $this->actions;
- }
-
- /**
- * @param array $actions
- */
- public function setActions(array $actions)
- {
- $this->actions = $actions;
- }
-
- /**
- * @return array
- */
- public function getAvailableCountries()
- {
- return $this->availableCountries;
- }
-
- /**
- * @param array $availableCountries
- */
- public function setAvailableCountries(array $availableCountries)
- {
- $this->availableCountries = $availableCountries;
- }
-
- /**
- * @return array
- */
- public function getIntegrations()
- {
- return $this->integrations;
- }
-
- /**
- * @param array $integrations
- */
- public function setIntegrations(array $integrations)
- {
- $this->integrations = $integrations;
- }
-
- /**
- * Get configuration as JSON
- *
- * @return array|string
- */
- public function getJsonConfiguration()
- {
- return Serializer::serialize($this);
- }
-
- /**
- * Get configuration as array
- *
- * @return array|string
- */
- public function getArrayConfiguration()
- {
- return Serializer::serialize($this, Serializer::S_ARRAY);
- }
+ const JSON_PROPERTY_MAP = [
+ 'code' => 'string',
+ 'integrationCode' => 'string',
+ 'active' => 'string',
+ 'name' => 'string',
+ 'logo' => 'string',
+ 'clientId' => 'string',
+ 'baseUrl' => 'string',
+ 'accountUrl' => 'string',
+ 'actions' => 'mixed',
+ 'availableCountries' => 'string[]',
+ 'integrations' => 'mixed'
+ ];
}
diff --git a/src/Serializer.php b/src/Serializer.php
index 85f46fb..290d267 100644
--- a/src/Serializer.php
+++ b/src/Serializer.php
@@ -13,8 +13,6 @@
namespace RetailCrm\Common;
-use JMS\Serializer\SerializerBuilder;
-
/**
* PHP version 7.0
*
@@ -27,7 +25,14 @@ use JMS\Serializer\SerializerBuilder;
*/
class Serializer
{
+ /**
+ * Serialization flag: serialize object to PHP Array
+ */
const S_ARRAY = 0;
+
+ /**
+ * Serialization flag: serialize object to JSON string
+ */
const S_JSON = 1;
/**
@@ -41,15 +46,14 @@ class Serializer
public static function serialize($request, $serialize = self::S_JSON)
{
$serialized = null;
- $serializer = SerializerBuilder::create()->build();
switch ($serialize) {
case self::S_ARRAY:
- $serialized = $serializer->toArray($request);
+ $serialized = $request->asArray();
break;
case self::S_JSON:
default:
- $serialized = $serializer->serialize($request, 'json');
+ $serialized = $request->asJson();
break;
}
diff --git a/src/Url.php b/src/Url.php
index 983c30d..c5423f2 100644
--- a/src/Url.php
+++ b/src/Url.php
@@ -25,15 +25,12 @@ namespace RetailCrm\Common;
*/
class Url
{
- const RFC_DEFAULT = 1;
- const RFC_CUSTOM = 2;
-
- private $parts = [];
-
- public function __toString()
- {
- return $this->build();
- }
+ /**
+ * This class is used to store normalizeUrl method
+ * which is used in Client and HttpClient to check
+ * trailing slash.
+ */
+ private function __construct() {}
/**
* Check trailing slash into url
@@ -50,77 +47,4 @@ class Url
return $url;
}
-
- /**
- * Build request url
- *
- * @param string $path
- * @param array $parameters
- * @param int $rfc
- *
- * @return string
- */
- public function buildUrl($path, $parameters, $rfc = self::RFC_DEFAULT)
- {
- $url = $path;
-
- switch ($rfc) {
- case self::RFC_CUSTOM:
- foreach ($parameters as $key => $value) {
- if (is_array($value)) {
- foreach ($value as $element) {
- $this->add($key, $element);
- }
- } else {
- $this->add($key, $value);
- }
- }
-
- $url = sprintf("%s?%s", $url, $this->build());
- break;
- case self::RFC_DEFAULT:
- default:
- $queryString = http_build_query($parameters, '', '&');
- $url = sprintf("%s?%s", $path, $queryString);
- break;
- }
-
- return $url;
- }
-
- /**
- * Add each key valued element of parameters array
- * to internal structure before build
- *
- * @param string $key
- * @param mixed $value
- *
- * @return void
- */
- private function add($key, $value)
- {
- $this->parts[] = array(
- 'key' => $key,
- 'value' => $value
- );
- }
-
- /**
- * Build query string with same keys if needed
- *
- * @param string $separator
- * @param string $equals
- *
- * @return string
- */
- private function build($separator = '&', $equals = '=')
- {
- $queryString = array();
-
- foreach ($this->parts as $part) {
- $queryString[] = urlencode($part['key']) . $equals . urlencode($part['value']);
- }
-
- return implode($separator, $queryString);
- }
}
diff --git a/tests/Bot/Test/TestCase.php b/tests/Bot/Test/TestCase.php
index 52a455c..027ae8f 100644
--- a/tests/Bot/Test/TestCase.php
+++ b/tests/Bot/Test/TestCase.php
@@ -14,6 +14,8 @@
namespace RetailCrm\Mg\Bot\Test;
use PHPUnit\Framework\TestCase as BaseCase;
+use GuzzleHttp\Handler\MockHandler;
+use GuzzleHttp\HandlerStack;
use RetailCrm\Mg\Bot\Client;
/**
@@ -30,25 +32,29 @@ class TestCase extends BaseCase
/**
* Return bot api client object
*
- * @param string $url (default: null)
- * @param string $key (default: null)
- * @param bool $debug (default: false)
+ * @param string $url (default: null)
+ * @param string $key (default: null)
+ * @param bool $debug (default: false)
+ * @param array $response (default: null)
*
- * @return \RetailCrm\Mg\Bot\Client
+ * @return Client
*/
public static function getApiClient(
$url = null,
$key = null,
- $debug = false
+ $debug = false,
+ ...$response
) {
$configUrl = getenv('MG_BOT_URL');
$configKey = getenv('MG_BOT_KEY');
$configDbg = getenv('MG_BOT_DBG');
+ $mock = new MockHandler($response ?: []);
return new Client(
$url ?: $configUrl,
$key ?: $configKey,
- $debug ?: $configDbg
+ $debug ?: $configDbg,
+ empty($response) ? null : HandlerStack::create($mock)
);
}
}
diff --git a/tests/Bot/Tests/ClientListTest.php b/tests/Bot/Tests/ClientListTest.php
index 9518b32..f498e7c 100644
--- a/tests/Bot/Tests/ClientListTest.php
+++ b/tests/Bot/Tests/ClientListTest.php
@@ -126,7 +126,7 @@ class ClientListTest extends TestCase
$data = $client->bots($request);
- print_r($data);
+ print_r($data[0]);
}
/**
diff --git a/tests/Bot/Tests/MessagesTest.php b/tests/Bot/Tests/MessagesTest.php
index 259304f..a46b0d5 100644
--- a/tests/Bot/Tests/MessagesTest.php
+++ b/tests/Bot/Tests/MessagesTest.php
@@ -13,12 +13,7 @@
namespace RetailCrm\Mg\Bot\Tests;
-use Exception;
-use InvalidArgumentException;
-use RetailCrm\Common\Exception\CurlException;
-use RetailCrm\Common\Exception\InvalidJsonException;
use RetailCrm\Mg\Bot\Model\Constants;
-use RetailCrm\Mg\Bot\Model\Request\CommandEditRequest;
use RetailCrm\Mg\Bot\Model\Request\MessageSendRequest;
use RetailCrm\Mg\Bot\Test\TestCase;