diff --git a/.travis.yml b/.travis.yml
index a9223bc..17a7351 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,13 +12,4 @@ before_script:
- flags="-o"
- composer install $flags
-script: make travis
-
-deploy:
- provider: pages
- skip_cleanup: true
- github_token: $GITHUB_TOKEN
- local_dir: mg-bot-api-client-php.pages
- keep_history: true
- on:
- branch: master
\ No newline at end of file
+script: make test
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 207e8d9..75c11c8 100644
--- a/Makefile
+++ b/Makefile
@@ -21,23 +21,4 @@ endif
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
-endif
-ifeq (, $(shell which dot))
-ifeq ($(wildcard dot/dot), )
- @mkdir -p $(ROOT_DIR)/dot
- @wget https://github.com/Neur0toxine/mwgraphviz/raw/master/dot_static -O $(ROOT_DIR)/dot/dot
- @chmod +x $(ROOT_DIR)/dot/dot
-endif
-endif
- @php phpDocumentor.phar --config $(ROOT_DIR)/phpdoc.dist.xml
-
-travis: test docs
- @echo "==> Done."
\ No newline at end of file
+ @echo "==> Analysis complete"
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 00ac1b7..24a347d 100644
--- a/composer.json
+++ b/composer.json
@@ -12,21 +12,21 @@
}
],
"require": {
- "php": ">=7.1",
+ "php": ">=7.0",
"ext-curl": "*",
"ext-json": "*",
- "doctrine/cache": "1.6.*",
- "guzzlehttp/guzzle": "6.3.*",
- "lazyjsonmapper/lazyjsonmapper": "^1.6",
- "symfony/validator": "3.4.*",
- "doctrine/annotations": "1.6.*",
- "symfony/dotenv": "3.4.*"
+ "jms/serializer": "1.13.*",
+ "symfony/validator": "^4.2",
+ "doctrine/annotations": "^1.6",
+ "doctrine/cache": "^1.8",
+ "guzzlehttp/guzzle": "6.3.*"
},
"require-dev": {
"phpunit/phpunit": "6.5.*",
"phpmd/phpmd": "2.6.*",
"phpstan/phpstan": "0.9.*",
"squizlabs/php_codesniffer": "3.4.*",
+ "symfony/dotenv": "^4.2",
"friendsofphp/php-cs-fixer": "^2.14"
},
"support": {
@@ -47,7 +47,5 @@
"config": {
"bin-dir": "bin",
"process-timeout": 600
- },
- "minimum-stability": "dev",
- "prefer-stable": true
+ }
}
diff --git a/composer.lock b/composer.lock
index 61c951d..00c2b6f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,50 +4,8 @@
"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": "37c04715365723f98332d71aa2ee402e",
+ "content-hash": "881d5b814546ed880206e10657ac877b",
"packages": [
- {
- "name": "corneltek/getoptionkit",
- "version": "2.6.0",
- "source": {
- "type": "git",
- "url": "https://github.com/c9s/GetOptionKit.git",
- "reference": "995607ddf4fc90ebdb4a7d58fe972d581ad8495f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/c9s/GetOptionKit/zipball/995607ddf4fc90ebdb4a7d58fe972d581ad8495f",
- "reference": "995607ddf4fc90ebdb4a7d58fe972d581ad8495f",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.6.x-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "GetOptionKit\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Yo-An Lin",
- "email": "yoanlin93@gmail.com"
- }
- ],
- "description": "Powerful command-line option toolkit",
- "homepage": "http://github.com/c9s/GetOptionKit",
- "time": "2017-06-30T14:54:48+00:00"
- },
{
"name": "doctrine/annotations",
"version": "v1.6.1",
@@ -118,33 +76,38 @@
},
{
"name": "doctrine/cache",
- "version": "v1.6.2",
+ "version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
- "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b"
+ "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b",
- "reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b",
+ "url": "https://api.github.com/repos/doctrine/cache/zipball/d768d58baee9a4862ca783840eca1b9add7a7f57",
+ "reference": "d768d58baee9a4862ca783840eca1b9add7a7f57",
"shasum": ""
},
"require": {
- "php": "~5.5|~7.0"
+ "php": "~7.1"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
- "phpunit/phpunit": "~4.8|~5.0",
- "predis/predis": "~1.0",
- "satooshi/php-coveralls": "~0.6"
+ "alcaeus/mongo-php-adapter": "^1.1",
+ "doctrine/coding-standard": "^4.0",
+ "mongodb/mongodb": "^1.1",
+ "phpunit/phpunit": "^7.0",
+ "predis/predis": "~1.0"
+ },
+ "suggest": {
+ "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.6.x-dev"
+ "dev-master": "1.8.x-dev"
}
},
"autoload": {
@@ -179,33 +142,86 @@
}
],
"description": "Caching library offering an object-oriented API for many cache backends",
- "homepage": "http://www.doctrine-project.org",
+ "homepage": "https://www.doctrine-project.org",
"keywords": [
"cache",
"caching"
],
- "time": "2017-07-22T12:49:21+00:00"
+ "time": "2018-08-21T18:01:43+00:00"
},
{
- "name": "doctrine/lexer",
- "version": "1.0.2",
+ "name": "doctrine/instantiator",
+ "version": "1.2.0",
"source": {
"type": "git",
- "url": "https://github.com/doctrine/lexer.git",
- "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8"
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "a2c590166b2133a4633738648b6b064edae0814a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8",
- "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8",
+ "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",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/lexer.git",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
- "require-dev": {
- "phpunit/phpunit": "^4.5"
- },
"type": "library",
"extra": {
"branch-alias": {
@@ -213,8 +229,8 @@
}
},
"autoload": {
- "psr-4": {
- "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer"
+ "psr-0": {
+ "Doctrine\\Common\\Lexer\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -235,16 +251,13 @@
"email": "schmittjoh@gmail.com"
}
],
- "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.",
- "homepage": "https://www.doctrine-project.org/projects/lexer.html",
+ "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "http://www.doctrine-project.org",
"keywords": [
- "annotations",
- "docblock",
"lexer",
- "parser",
- "php"
+ "parser"
],
- "time": "2019-06-08T11:03:04+00:00"
+ "time": "2014-09-09T13:34:57+00:00"
},
{
"name": "guzzlehttp/guzzle",
@@ -430,54 +443,276 @@
"time": "2018-12-04T20:46:45+00:00"
},
{
- "name": "lazyjsonmapper/lazyjsonmapper",
- "version": "v1.6.3",
+ "name": "jms/metadata",
+ "version": "1.7.0",
"source": {
"type": "git",
- "url": "https://github.com/lazyjsonmapper/lazyjsonmapper.git",
- "reference": "51e093b50f4de15d2d64548b3ca743713eed6ee9"
+ "url": "https://github.com/schmittjoh/metadata.git",
+ "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/lazyjsonmapper/lazyjsonmapper/zipball/51e093b50f4de15d2d64548b3ca743713eed6ee9",
- "reference": "51e093b50f4de15d2d64548b3ca743713eed6ee9",
+ "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e5854ab1aa643623dc64adde718a8eec32b957a8",
+ "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8",
"shasum": ""
},
"require": {
- "corneltek/getoptionkit": "2.*",
- "php": ">=5.6"
+ "php": ">=5.3.0"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "^2.7.1",
- "phpunit/phpunit": "6.*"
+ "doctrine/cache": "~1.0",
+ "symfony/cache": "~3.1"
},
- "bin": [
- "bin/lazydoctor"
- ],
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.5.x-dev"
+ }
+ },
"autoload": {
- "psr-4": {
- "LazyJsonMapper\\": "src/"
+ "psr-0": {
+ "Metadata\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "Apache-2.0"
+ "MIT"
],
"authors": [
{
- "name": "SteveJobzniak",
- "homepage": "https://github.com/SteveJobzniak",
- "role": "Developer"
+ "name": "Asmir Mustafic",
+ "email": "goetas@gmail.com"
+ },
+ {
+ "name": "Johannes M. Schmitt",
+ "email": "schmittjoh@gmail.com"
}
],
- "description": "Advanced, intelligent & automatic object-oriented JSON containers for PHP.",
- "homepage": "https://github.com/SteveJobzniak/LazyJsonMapper",
+ "description": "Class/method/property metadata management in PHP",
"keywords": [
- "development",
- "json"
+ "annotations",
+ "metadata",
+ "xml",
+ "yaml"
],
- "time": "2018-05-02T16:57:09+00:00"
+ "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": "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",
@@ -571,47 +806,36 @@
},
{
"name": "symfony/contracts",
- "version": "v1.1.3",
+ "version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/contracts.git",
- "reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5"
+ "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/contracts/zipball/2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
- "reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
+ "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf",
+ "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf",
"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",
- "symfony/polyfill-intl-idn": "^1.10"
+ "psr/container": "^1.0"
},
"suggest": {
"psr/cache": "When using the Cache contracts",
"psr/container": "When using the Service contracts",
- "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": ""
+ "symfony/cache-contracts-implementation": "",
+ "symfony/service-contracts-implementation": "",
+ "symfony/translation-contracts-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1-dev"
+ "dev-master": "1.0-dev"
}
},
"autoload": {
@@ -646,64 +870,7 @@
"interoperability",
"standards"
],
- "time": "2019-06-05T13:28:50+00:00"
- },
- {
- "name": "symfony/dotenv",
- "version": "v3.4.28",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/dotenv.git",
- "reference": "7b33c7b6f497898a173e4b9d6a7698cd789d54ce"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/dotenv/zipball/7b33c7b6f497898a173e4b9d6a7698cd789d54ce",
- "reference": "7b33c7b6f497898a173e4b9d6a7698cd789d54ce",
- "shasum": ""
- },
- "require": {
- "php": "^5.5.9|>=7.0.8"
- },
- "require-dev": {
- "symfony/process": "~3.2|~4.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.4-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Dotenv\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Registers environment variables from a .env file",
- "homepage": "https://symfony.com",
- "keywords": [
- "dotenv",
- "env",
- "environment"
- ],
- "time": "2019-04-01T07:08:40+00:00"
+ "time": "2018-12-05T08:06:11+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -823,120 +990,47 @@
"time": "2019-02-06T07:57:58+00:00"
},
{
- "name": "symfony/translation",
- "version": "v4.3.1",
+ "name": "symfony/validator",
+ "version": "v4.2.5",
"source": {
"type": "git",
- "url": "https://github.com/symfony/translation.git",
- "reference": "5dda505e5f65d759741dfaf4e54b36010a4b57aa"
+ "url": "https://github.com/symfony/validator.git",
+ "reference": "db5457ed88aacc1a040d4961ee52cddad3e5a4aa"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/5dda505e5f65d759741dfaf4e54b36010a4b57aa",
- "reference": "5dda505e5f65d759741dfaf4e54b36010a4b57aa",
+ "url": "https://api.github.com/repos/symfony/validator/zipball/db5457ed88aacc1a040d4961ee52cddad3e5a4aa",
+ "reference": "db5457ed88aacc1a040d4961ee52cddad3e5a4aa",
"shasum": ""
},
"require": {
"php": "^7.1.3",
- "symfony/polyfill-mbstring": "~1.0",
- "symfony/translation-contracts": "^1.1.2"
- },
- "conflict": {
- "symfony/config": "<3.4",
- "symfony/dependency-injection": "<3.4",
- "symfony/yaml": "<3.4"
- },
- "provide": {
- "symfony/translation-implementation": "1.0"
- },
- "require-dev": {
- "psr/log": "~1.0",
- "symfony/config": "~3.4|~4.0",
- "symfony/console": "~3.4|~4.0",
- "symfony/dependency-injection": "~3.4|~4.0",
- "symfony/finder": "~2.8|~3.0|~4.0",
- "symfony/http-kernel": "~3.4|~4.0",
- "symfony/intl": "~3.4|~4.0",
- "symfony/service-contracts": "^1.1.2",
- "symfony/var-dumper": "~3.4|~4.0",
- "symfony/yaml": "~3.4|~4.0"
- },
- "suggest": {
- "psr/log-implementation": "To use logging capability in translator",
- "symfony/config": "",
- "symfony/yaml": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.3-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "Symfony\\Component\\Translation\\": ""
- },
- "exclude-from-classmap": [
- "/Tests/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "https://symfony.com/contributors"
- }
- ],
- "description": "Symfony Translation Component",
- "homepage": "https://symfony.com",
- "time": "2019-06-03T20:27:40+00:00"
- },
- {
- "name": "symfony/validator",
- "version": "v3.4.28",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/validator.git",
- "reference": "23cf394faaffb6257f5764fbfc2db12ec30956f1"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/validator/zipball/23cf394faaffb6257f5764fbfc2db12ec30956f1",
- "reference": "23cf394faaffb6257f5764fbfc2db12ec30956f1",
- "shasum": ""
- },
- "require": {
- "php": "^5.5.9|>=7.0.8",
+ "symfony/contracts": "^1.0.2",
"symfony/polyfill-ctype": "~1.8",
- "symfony/polyfill-mbstring": "~1.0",
- "symfony/translation": "~2.8|~3.0|~4.0"
+ "symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
- "symfony/dependency-injection": "<3.3",
- "symfony/http-kernel": "<3.3.5",
+ "symfony/dependency-injection": "<3.4",
+ "symfony/http-kernel": "<3.4",
+ "symfony/intl": "<4.1",
+ "symfony/translation": "<4.2",
"symfony/yaml": "<3.4"
},
"require-dev": {
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.0",
"egulias/email-validator": "^1.2.8|~2.0",
- "symfony/cache": "~3.1|~4.0",
- "symfony/config": "~2.8|~3.0|~4.0",
- "symfony/dependency-injection": "~3.3|~4.0",
- "symfony/expression-language": "~2.8|~3.0|~4.0",
- "symfony/http-foundation": "~2.8|~3.0|~4.0",
- "symfony/http-kernel": "^3.3.5|~4.0",
- "symfony/intl": "^2.8.18|^3.2.5|~4.0",
- "symfony/property-access": "~2.8|~3.0|~4.0",
- "symfony/var-dumper": "~3.3|~4.0",
+ "symfony/cache": "~3.4|~4.0",
+ "symfony/config": "~3.4|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/expression-language": "~3.4|~4.0",
+ "symfony/http-foundation": "~4.1",
+ "symfony/http-kernel": "~3.4|~4.0",
+ "symfony/intl": "~4.1",
+ "symfony/property-access": "~3.4|~4.0",
+ "symfony/translation": "~4.2",
+ "symfony/var-dumper": "~3.4|~4.0",
"symfony/yaml": "~3.4|~4.0"
},
"suggest": {
@@ -949,12 +1043,13 @@
"symfony/http-foundation": "",
"symfony/intl": "",
"symfony/property-access": "For accessing properties within comparison constraints",
+ "symfony/translation": "For translating validation errors.",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.4-dev"
+ "dev-master": "4.2-dev"
}
},
"autoload": {
@@ -981,7 +1076,7 @@
],
"description": "Symfony Validator Component",
"homepage": "https://symfony.com",
- "time": "2019-05-05T16:11:06+00:00"
+ "time": "2019-03-30T15:58:42+00:00"
}
],
"packages-dev": [
@@ -1091,62 +1186,6 @@
],
"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",
@@ -3892,6 +3931,63 @@
"homepage": "https://symfony.com",
"time": "2019-03-30T15:58:42+00:00"
},
+ {
+ "name": "symfony/dotenv",
+ "version": "v4.2.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/dotenv.git",
+ "reference": "b541d63b83532be55a020db8ed2e50598385a583"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/dotenv/zipball/b541d63b83532be55a020db8ed2e50598385a583",
+ "reference": "b541d63b83532be55a020db8ed2e50598385a583",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1.3"
+ },
+ "require-dev": {
+ "symfony/process": "~3.4|~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Dotenv\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Registers environment variables from a .env file",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "dotenv",
+ "env",
+ "environment"
+ ],
+ "time": "2019-04-01T07:32:59+00:00"
+ },
{
"name": "symfony/event-dispatcher",
"version": "v4.2.5",
@@ -4415,12 +4511,12 @@
}
],
"aliases": [],
- "minimum-stability": "dev",
+ "minimum-stability": "stable",
"stability-flags": [],
- "prefer-stable": true,
+ "prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": ">=7.1",
+ "php": ">=7.0",
"ext-curl": "*",
"ext-json": "*"
},
diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml
deleted file mode 100644
index e6d5719..0000000
--- a/phpdoc.dist.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- 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/Model/Entity/Bot.php b/src/Bot/Model/Entity/Bot.php
index 2ff85db..6880a33 100644
--- a/src/Bot/Model/Entity/Bot.php
+++ b/src/Bot/Model/Entity/Bot.php
@@ -13,72 +13,246 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+
/**
* 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 |
+ * Bot class
*
* @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
+class Bot
{
+ use 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
*/
- 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'
- ];
+ private $name;
+
+ /**
+ * @var array $events
+ *
+ * @Type("array")
+ * @Accessor(getter="getEvents",setter="setEvents")
+ * @SkipWhenEmpty()
+ */
+ private $events;
+
+ /**
+ * @var string $clientId
+ *
+ * @Type("string")
+ * @Accessor(getter="getClientId",setter="setClientId")
+ * @SkipWhenEmpty()
+ */
+ private $clientId;
+
+ /**
+ * @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;
+
+ /**
+ * @var string $deactivatedAt
+ *
+ * @Type("string")
+ * @Accessor(getter="getDeactivatedAt",setter="setDeactivatedAt")
+ * @SkipWhenEmpty()
+ */
+ private $deactivatedAt;
+
+ /**
+ * @var bool $isActive
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsActive",setter="setIsActive")
+ * @SkipWhenEmpty()
+ */
+ private $isActive;
+
+ /**
+ * @var bool $isSelf
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsSelf",setter="setIsSelf")
+ * @SkipWhenEmpty()
+ */
+ private $isSelf;
+
+ /**
+ * @var bool $isSystem
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsSystem",setter="setIsSystem")
+ * @SkipWhenEmpty()
+ */
+ private $isSystem;
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return array
+ */
+ public function getEvents(): array
+ {
+ return $this->events;
+ }
+
+ /**
+ * @param array $events
+ */
+ public function setEvents(array $events)
+ {
+ $this->events = $events;
+ }
+
+ /**
+ * @return string
+ */
+ public function getClientId(): string
+ {
+ return $this->clientId;
+ }
+
+ /**
+ * @param string $clientId
+ */
+ public function setClientId(string $clientId)
+ {
+ $this->clientId = $clientId;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAvatarUrl(): string
+ {
+ return $this->avatarUrl;
+ }
+
+ /**
+ * @param string $avatarUrl
+ */
+ public function setAvatarUrl(string $avatarUrl)
+ {
+ $this->avatarUrl = $avatarUrl;
+ }
+
+ /**
+ * @return array
+ */
+ public function getRoles(): array
+ {
+ return $this->roles;
+ }
+
+ /**
+ * @param array $roles
+ */
+ public function setRoles(array $roles)
+ {
+ $this->roles = $roles;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDeactivatedAt(): string
+ {
+ return $this->deactivatedAt;
+ }
+
+ /**
+ * @param string $deactivatedAt
+ */
+ public function setDeactivatedAt(string $deactivatedAt)
+ {
+ $this->deactivatedAt = $deactivatedAt;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isActive(): bool
+ {
+ return $this->isActive;
+ }
+
+ /**
+ * @param bool $isActive
+ */
+ public function setIsActive(bool $isActive)
+ {
+ $this->isActive = $isActive;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isSelf(): bool
+ {
+ return $this->isSelf;
+ }
+
+ /**
+ * @param bool $isSelf
+ */
+ public function setIsSelf(bool $isSelf)
+ {
+ $this->isSelf = $isSelf;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isSystem(): bool
+ {
+ return $this->isSystem;
+ }
+
+ /**
+ * @param bool $isSystem
+ */
+ public function setIsSystem(bool $isSystem)
+ {
+ $this->isSystem = $isSystem;
+ }
}
\ 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 f4bbd02..1c88d8f 100644
--- a/src/Bot/Model/Entity/Channel/Channel.php
+++ b/src/Bot/Model/Entity/Channel/Channel.php
@@ -14,61 +14,164 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Channel;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * Channel class. Schema:
- *
- * | Field name | Data type |
- * |----------------|-----------------|
- * | activated_at | string |
- * | deactivated_at | string |
- * | is_active | bool |
- * | settings | ChannelSettings |
- * | type | string |
- * | name | string |
+ * Channel class
*
* @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() "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
+class Channel
{
+ use 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" => [...]]);
- * ```
+ * @var \DateTime $activatedAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getActivatedAt",setter="setActivatedAt")
*/
- const JSON_PROPERTY_MAP = [
- 'activated_at' => 'string',
- 'deactivated_at' => 'string',
- 'is_active' => 'bool',
- 'settings' => 'ChannelSettings',
- 'type' => 'string',
- 'name' => 'string'
- ];
+ private $activatedAt;
+
+ /**
+ * @var \DateTime $deactivatedAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getDeactivatedAt",setter="setDeactivatedAt")
+ */
+ private $deactivatedAt;
+
+ /**
+ * @var bool $isActive
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsActive",setter="setIsActive")
+ */
+ private $isActive;
+
+ /**
+ * @var ChannelSettings $settings
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettings")
+ * @Accessor(getter="getSettings",setter="setSettings")
+ */
+ private $settings;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ */
+ private $type;
+
+ /**
+ * @var string $actions
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ */
+ private $name;
+
+ /**
+ * @return \DateTime
+ */
+ public function getActivatedAt(): \DateTime
+ {
+ return $this->activatedAt;
+ }
+
+ /**
+ * @param \DateTime $activatedAt
+ */
+ public function setActivatedAt(\DateTime $activatedAt)
+ {
+ $this->activatedAt = $activatedAt;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getDeactivatedAt(): \DateTime
+ {
+ return $this->deactivatedAt;
+ }
+
+ /**
+ * @param \DateTime $deactivatedAt
+ */
+ public function setDeactivatedAt(\DateTime $deactivatedAt)
+ {
+ $this->deactivatedAt = $deactivatedAt;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isActive(): bool
+ {
+ return $this->isActive;
+ }
+
+ /**
+ * @param bool $isActive
+ */
+ public function setIsActive(bool $isActive)
+ {
+ $this->isActive = $isActive;
+ }
+
+ /**
+ * @return ChannelSettings
+ */
+ public function getSettings(): ChannelSettings
+ {
+ return $this->settings;
+ }
+
+ /**
+ * @param ChannelSettings $settings
+ */
+ public function setSettings(ChannelSettings $settings)
+ {
+ $this->settings = $settings;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Channel/ChannelSettings.php b/src/Bot/Model/Entity/Channel/ChannelSettings.php
index cbd87d0..a858518 100644
--- a/src/Bot/Model/Entity/Channel/ChannelSettings.php
+++ b/src/Bot/Model/Entity/Channel/ChannelSettings.php
@@ -13,62 +13,192 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Channel;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * ChannelSettings class. Schema:
- *
- * | Field name | Data type |
- * |------------|---------------------|
- * | status | ChannelSettingsItem |
- * | text | ChannelSettingsItem |
- * | product | ChannelSettingsItem |
- * | order | ChannelSettingsItem |
- * | image | ChannelSettingsItem |
- * | file | ChannelSettingsItem |
+ * ChannelSettings class
*
* @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() "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
+class ChannelSettings
{
/**
- * 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" => [...]]);
- * ```
+ * @var ChannelSettingsStatus $status
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsStatus")
+ * @Accessor(getter="getStatus",setter="setStatus")
*/
- const JSON_PROPERTY_MAP = [
- 'status' => 'ChannelSettingsItem',
- 'text' => 'ChannelSettingsItem',
- 'product' => 'ChannelSettingsItem',
- 'order' => 'ChannelSettingsItem',
- 'image' => 'ChannelSettingsItem',
- 'file' => 'ChannelSettingsItem'
- ];
+ private $status;
+
+ /**
+ * @var int $spamAllowed
+ *
+ * @Type("int")
+ * @Accessor(getter="getStatus",setter="setStatus")
+ */
+ private $spamAllowed;
+
+ /**
+ * @var ChannelSettingsItem $text
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsItem")
+ * @Accessor(getter="getText",setter="setText")
+ * @SkipWhenEmpty()
+ */
+ private $text;
+
+ /**
+ * @var ChannelSettingsItem $product
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsItem")
+ * @Accessor(getter="getProduct",setter="setProduct")
+ * @SkipWhenEmpty()
+ */
+ private $product;
+
+ /**
+ * @var ChannelSettingsItem $order
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsItem")
+ * @Accessor(getter="getOrder",setter="setOrder")
+ * @SkipWhenEmpty()
+ */
+ private $order;
+
+ /**
+ * @var ChannelSettingsItem $image
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsItem")
+ * @Accessor(getter="getImage",setter="setImage")
+ * @SkipWhenEmpty()
+ */
+ private $image;
+
+ /**
+ * @var ChannelSettingsItem $file
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\ChannelSettingsItem")
+ * @Accessor(getter="getFile",setter="setFile")
+ * @SkipWhenEmpty()
+ */
+ private $file;
+
+ /**
+ * @return ChannelSettingsStatus
+ */
+ public function getStatus(): ChannelSettingsStatus
+ {
+ return $this->status;
+ }
+
+ /**
+ * @param ChannelSettingsStatus $status
+ */
+ public function setStatus(ChannelSettingsStatus $status)
+ {
+ $this->status = $status;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSpamAllowed(): int
+ {
+ return $this->spamAllowed;
+ }
+
+ /**
+ * @param int $spamAllowed
+ */
+ public function setSpamAllowed(int $spamAllowed)
+ {
+ $this->spamAllowed = $spamAllowed;
+ }
+
+ /**
+ * @return ChannelSettingsItem
+ */
+ public function getText(): ChannelSettingsItem
+ {
+ return $this->text;
+ }
+
+ /**
+ * @param ChannelSettingsItem $text
+ */
+ public function setText(ChannelSettingsItem $text)
+ {
+ $this->text = $text;
+ }
+
+ /**
+ * @return ChannelSettingsItem
+ */
+ public function getProduct(): ChannelSettingsItem
+ {
+ return $this->product;
+ }
+
+ /**
+ * @param ChannelSettingsItem $product
+ */
+ public function setProduct(ChannelSettingsItem $product)
+ {
+ $this->product = $product;
+ }
+
+ /**
+ * @return ChannelSettingsItem
+ */
+ public function getOrder(): ChannelSettingsItem
+ {
+ return $this->order;
+ }
+
+ /**
+ * @param ChannelSettingsItem $order
+ */
+ public function setOrder(ChannelSettingsItem $order)
+ {
+ $this->order = $order;
+ }
+
+ /**
+ * @return ChannelSettingsItem
+ */
+ public function getImage(): ChannelSettingsItem
+ {
+ return $this->image;
+ }
+
+ /**
+ * @param ChannelSettingsItem $image
+ */
+ public function setImage(ChannelSettingsItem $image)
+ {
+ $this->image = $image;
+ }
+
+ /**
+ * @return ChannelSettingsItem
+ */
+ public function getFile(): ChannelSettingsItem
+ {
+ return $this->file;
+ }
+
+ /**
+ * @param ChannelSettingsItem $file
+ */
+ public function setFile(ChannelSettingsItem $file)
+ {
+ $this->file = $file;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php
index 408888c..f9f24b9 100644
--- a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php
+++ b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php
@@ -13,62 +13,169 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Channel;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * ChannelSettingsItem class. Schema:
- *
- * | Field name | Data type |
- * |-----------------|-----------|
- * | creating | string |
- * | editing | string |
- * | quoting | string |
- * | deleting | string |
- * | delivered | string |
- * | max_items_count | int |
+ * ChannelSettingsItem class
*
* @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() "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
+class ChannelSettingsItem
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $creating
+ *
+ * @Type("string")
+ * @Accessor(getter="getCreating",setter="setCreating")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'creating' => 'string',
- 'editing' => 'string',
- 'quoting' => 'string',
- 'deleting' => 'string',
- 'delivered' => 'string',
- 'max_items_count' => 'int'
- ];
-}
\ No newline at end of file
+ private $creating;
+
+ /**
+ * @var string $editing
+ *
+ * @Type("string")
+ * @Accessor(getter="getEditing",setter="setEditing")
+ * @SkipWhenEmpty()
+ */
+ private $editing;
+
+ /**
+ * @var string $quoting
+ *
+ * @Type("string")
+ * @Accessor(getter="getQuoting",setter="setQuoting")
+ * @SkipWhenEmpty()
+ */
+ private $quoting;
+
+ /**
+ * @var string $deleting
+ *
+ * @Type("string")
+ * @Accessor(getter="getDeleting",setter="setDeleting")
+ * @SkipWhenEmpty()
+ */
+ private $deleting;
+
+ /**
+ * @var string $delivered
+ *
+ * @Type("string")
+ * @Accessor(getter="getDelivered",setter="setDelivered")
+ * @SkipWhenEmpty()
+ */
+ private $delivered;
+
+ /**
+ * @var int $maxItemsCount
+ *
+ * @Type("int")
+ * @Accessor(getter="getMaxItemsCount",setter="setMaxItemsCount")
+ * @SkipWhenEmpty()
+ */
+ private $maxItemsCount;
+
+ /**
+ * @return string
+ */
+ public function getCreating(): string
+ {
+ return $this->creating;
+ }
+
+ /**
+ * @param string $creating
+ */
+ public function setCreating(string $creating)
+ {
+ $this->creating = $creating;
+ }
+
+ /**
+ * @return string
+ */
+ public function getEditing(): string
+ {
+ return $this->editing;
+ }
+
+ /**
+ * @param string $editing
+ */
+ public function setEditing(string $editing)
+ {
+ $this->editing = $editing;
+ }
+
+ /**
+ * @return string
+ */
+ public function getQuoting(): string
+ {
+ return $this->quoting;
+ }
+
+ /**
+ * @param string $quoting
+ */
+ public function setQuoting(string $quoting)
+ {
+ $this->quoting = $quoting;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDeleting(): string
+ {
+ return $this->deleting;
+ }
+
+ /**
+ * @param string $deleting
+ */
+ public function setDeleting(string $deleting)
+ {
+ $this->deleting = $deleting;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDelivered(): string
+ {
+ return $this->delivered;
+ }
+
+ /**
+ * @param string $delivered
+ */
+ public function setDelivered(string $delivered)
+ {
+ $this->delivered = $delivered;
+ }
+
+ /**
+ * @return int
+ */
+ public function getMaxItemsCount(): int
+ {
+ return $this->maxItemsCount;
+ }
+
+ /**
+ * @param int $maxItemsCount
+ */
+ public function setMaxItemsCount(int $maxItemsCount)
+ {
+ $this->maxItemsCount = $maxItemsCount;
+ }
+}
diff --git a/src/Bot/Model/Entity/Channel/ChannelSettingsStatus.php b/src/Bot/Model/Entity/Channel/ChannelSettingsStatus.php
new file mode 100644
index 0000000..38f4cff
--- /dev/null
+++ b/src/Bot/Model/Entity/Channel/ChannelSettingsStatus.php
@@ -0,0 +1,81 @@
+
+ * @license https://opensource.org/licenses/MIT MIT License
+ * @link http://help.retailcrm.pro/docs/Developers
+ */
+
+namespace RetailCrm\Mg\Bot\Model\Entity\Channel;
+
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+
+/**
+ * PHP version 7.0
+ *
+ * ChannelSettingsStatus class
+ *
+ * @package RetailCrm\Mg\Bot\Model\Entity\Channel
+ * @author retailCRM
+ * @license https://opensource.org/licenses/MIT MIT License
+ * @link http://help.retailcrm.pro/docs/Developers
+ */
+class ChannelSettingsStatus
+{
+ /**
+ * @var string $delivered
+ *
+ * @Type("string")
+ * @Accessor(getter="getDelivered",setter="setDelivered")
+ * @SkipWhenEmpty()
+ */
+ private $delivered;
+
+ /**
+ * @var string $read
+ *
+ * @Type("string")
+ * @Accessor(getter="getRead",setter="setRead")
+ * @SkipWhenEmpty()
+ */
+ private $read;
+
+ /**
+ * @return string
+ */
+ public function getDelivered(): string
+ {
+ return $this->delivered;
+ }
+
+ /**
+ * @param string $delivered
+ */
+ public function setDelivered(string $delivered)
+ {
+ $this->delivered = $delivered;
+ }
+
+ /**
+ * @return string
+ */
+ public function getRead(): string
+ {
+ return $this->read;
+ }
+
+ /**
+ * @param string $read
+ */
+ public function setRead(string $read)
+ {
+ $this->read = $read;
+ }
+}
diff --git a/src/Bot/Model/Entity/Chat/Chat.php b/src/Bot/Model/Entity/Chat/Chat.php
index 3920fa7..1d12ed4 100644
--- a/src/Bot/Model/Entity/Chat/Chat.php
+++ b/src/Bot/Model/Entity/Chat/Chat.php
@@ -13,70 +13,216 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Chat;
+use RetailCrm\Mg\Bot\Model\Entity\Channel\Channel;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use RetailCrm\Mg\Bot\Model\Entity\Customer;
/**
* PHP version 7.0
*
- * 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 |
+ * Chat class
*
* @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
+class Chat
{
+ use 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" => [...]]);
- * ```
+ * @var string $avatar
+ *
+ * @Type("string")
+ * @Accessor(getter="getAvatar",setter="setAvatar")
*/
- const JSON_PROPERTY_MAP = [
- 'avatar' => 'string',
- 'name' => 'string',
- 'channel' => '\RetailCrm\Mg\Bot\Model\Entity\Channel\Channel',
- 'members' => 'ChatMember[]',
- 'customer' => '\RetailCrm\Mg\Bot\Model\Entity\Customer',
- 'author_id' => 'int',
- 'last_message' => 'ChatLastMessage',
- 'last_activity' => 'string'
- ];
-}
\ No newline at end of file
+ private $avatar;
+
+ /**
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ */
+ private $name;
+
+ /**
+ * @var Channel $channel
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Channel\Channel")
+ * @Accessor(getter="getChannel",setter="setChannel")
+ */
+ private $channel;
+
+ /**
+ * @var array $members
+ *
+ * @Type("array")
+ * @Accessor(getter="getMembers",setter="setMembers")
+ */
+ private $members;
+
+ /**
+ * @var Customer $customer
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Customer")
+ * @Accessor(getter="getCustomer",setter="setCustomer")
+ */
+ private $customer;
+
+ /**
+ * @var int $authorId
+ *
+ * @Type("int")
+ * @Accessor(getter="getAuthorId",setter="setAuthorId")
+ */
+ private $authorId;
+
+ /**
+ * @var ChatLastMessage $lastMessage
+ *
+ * @Type("ChatLastMessage")
+ * @Accessor(getter="getLastMessage",setter="setLastMessage")
+ */
+ private $lastMessage;
+
+ /**
+ * @var \DateTime $lastActivity
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:sP'>")
+ * @Accessor(getter="getLastActivity",setter="setLastActivity")
+ */
+ private $lastActivity;
+
+ /**
+ * @return string
+ */
+ public function getAvatar(): string
+ {
+ return $this->avatar;
+ }
+
+ /**
+ * @param string $avatar
+ */
+ public function setAvatar(string $avatar)
+ {
+ $this->avatar = $avatar;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return Channel
+ */
+ public function getChannel(): Channel
+ {
+ return $this->channel;
+ }
+
+ /**
+ * @param Channel $channel
+ */
+ public function setChannel(Channel $channel)
+ {
+ $this->channel = $channel;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMembers(): array
+ {
+ return $this->members;
+ }
+
+ /**
+ * @param array $members
+ */
+ public function setMembers(array $members)
+ {
+ $this->members = $members;
+ }
+
+ /**
+ * @return Customer
+ */
+ public function getCustomer(): Customer
+ {
+ return $this->customer;
+ }
+
+ /**
+ * @param Customer $customer
+ */
+ public function setCustomer(Customer $customer)
+ {
+ $this->customer = $customer;
+ }
+
+ /**
+ * @return int
+ */
+ public function getAuthorId(): int
+ {
+ return $this->authorId;
+ }
+
+ /**
+ * @param int $authorId
+ */
+ public function setAuthorId(int $authorId)
+ {
+ $this->authorId = $authorId;
+ }
+
+ /**
+ * @return ChatLastMessage
+ */
+ public function getLastMessage(): ChatLastMessage
+ {
+ return $this->lastMessage;
+ }
+
+ /**
+ * @param ChatLastMessage $lastMessage
+ */
+ public function setLastMessage(ChatLastMessage $lastMessage)
+ {
+ $this->lastMessage = $lastMessage;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getLastActivity(): \DateTime
+ {
+ return $this->lastActivity;
+ }
+
+ /**
+ * @param \DateTime $lastActivity
+ */
+ public function setLastActivity(\DateTime $lastActivity)
+ {
+ $this->lastActivity = $lastActivity;
+ }
+}
diff --git a/src/Bot/Model/Entity/Chat/ChatLastMessage.php b/src/Bot/Model/Entity/Chat/ChatLastMessage.php
index f31b338..08b366d 100644
--- a/src/Bot/Model/Entity/Chat/ChatLastMessage.php
+++ b/src/Bot/Model/Entity/Chat/ChatLastMessage.php
@@ -13,51 +13,94 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Chat;
-
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * ChatLastMessage class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | id | int |
- * | time | string |
- * | type | string |
+ * ChatLastMessage class
*
* @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() "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
+class ChatLastMessage
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $creating
+ *
+ * @Type("int")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'id' => 'int',
- 'time' => 'string',
- 'type' => 'string'
- ];
-}
\ No newline at end of file
+ private $id;
+
+ /**
+ * @var \DateTime $time
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getTime",setter="setTime")
+ * @SkipWhenEmpty()
+ */
+ private $time;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
+ */
+ private $type;
+
+ /**
+ * @return int
+ */
+ public function getId(): int
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param int $id
+ */
+ public function setId(int $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTime(): string
+ {
+ return $this->time;
+ }
+
+ /**
+ * @param string $time
+ */
+ public function setTime(string $time)
+ {
+ $this->time = $time;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
+}
diff --git a/src/Bot/Model/Entity/Chat/ChatMember.php b/src/Bot/Model/Entity/Chat/ChatMember.php
index 380cd5e..6c3d06d 100644
--- a/src/Bot/Model/Entity/Chat/ChatMember.php
+++ b/src/Bot/Model/Entity/Chat/ChatMember.php
@@ -13,54 +13,122 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Chat;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * ChatMember class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | chat_id | int |
- * | user_id | int |
- * | is_author | bool |
- * | state | string |
+ * ChatMember class
*
* @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() "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
+class ChatMember
{
+ use 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" => [...]]);
- * ```
+ * @var int $chatId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChatId",setter="setChatId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'chat_id' => 'int',
- 'user_id' => 'int',
- 'is_author' => 'bool',
- 'state' => 'string'
- ];
-}
\ No newline at end of file
+ private $chatId;
+
+ /**
+ * @var int $userId
+ *
+ * @Type("int")
+ * @Accessor(getter="getUserId",setter="setUserId")
+ * @SkipWhenEmpty()
+ */
+ private $userId;
+
+ /**
+ * @var bool $isAuthor
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsAuthor",setter="setIsAuthor")
+ * @SkipWhenEmpty()
+ */
+ private $isAuthor;
+
+ /**
+ * @var string $creating
+ *
+ * @Type("string")
+ * @Accessor(getter="getState",setter="setState")
+ * @SkipWhenEmpty()
+ */
+ private $state;
+
+ /**
+ * @return int
+ */
+ public function getChatId(): int
+ {
+ return $this->chatId;
+ }
+
+ /**
+ * @param int $chatId
+ */
+ public function setChatId(int $chatId)
+ {
+ $this->chatId = $chatId;
+ }
+
+ /**
+ * @return int
+ */
+ public function getUserId(): int
+ {
+ return $this->userId;
+ }
+
+ /**
+ * @param int $userId
+ */
+ public function setUserId(int $userId)
+ {
+ $this->userId = $userId;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isAuthor(): bool
+ {
+ return $this->isAuthor;
+ }
+
+ /**
+ * @param bool $isAuthor
+ */
+ public function setIsAuthor(bool $isAuthor)
+ {
+ $this->isAuthor = $isAuthor;
+ }
+
+ /**
+ * @return string
+ */
+ public function getState(): string
+ {
+ return $this->state;
+ }
+
+ /**
+ * @param string $state
+ */
+ public function setState(string $state)
+ {
+ $this->state = $state;
+ }
+}
diff --git a/src/Bot/Model/Entity/Command.php b/src/Bot/Model/Entity/Command.php
index 4c3a828..df287f7 100644
--- a/src/Bot/Model/Entity/Command.php
+++ b/src/Bot/Model/Entity/Command.php
@@ -13,44 +13,71 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+
/**
* PHP version 7.0
*
- * Command class. Schema:
- *
- * | Field name | Data type |
- * |-------------|-----------|
- * | name | string |
- * | description | string |
+ * Command class
*
* @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 string getDescription() "Get `description` value"
- * @method $this setDescription(string $value) "Set `description` value"
*/
-class Command extends CommonFields
+class Command
{
+ use 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'name' => 'string',
- 'description' => 'string'
- ];
-}
\ No newline at end of file
+ private $name;
+
+ /**
+ * @var string $description
+ *
+ * @Type("string")
+ * @Accessor(getter="getDescrtiption",setter="setDescription")
+ * @SkipWhenEmpty()
+ */
+ private $description;
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription(): string
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription(string $description)
+ {
+ $this->description = $description;
+ }
+}
diff --git a/src/Bot/Model/Entity/CommonFields.php b/src/Bot/Model/Entity/CommonFields.php
index 1f066d5..f669c31 100644
--- a/src/Bot/Model/Entity/CommonFields.php
+++ b/src/Bot/Model/Entity/CommonFields.php
@@ -13,50 +13,95 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use Symfony\Component\Validator\Constraints\Date;
/**
* PHP version 7.0
*
- * CommonFields trait. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | id | int |
- * | created_at | string |
- * | updated_at | string |
+ * CommonFields trait
*
* @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
+trait 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" => [...]]);
- * ```
+ * @var string $id
+ *
+ * @Type("string")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'id' => 'int',
- 'created_at' => 'string',
- 'updated_at' => 'string'
- ];
+ private $id;
+
+ /**
+ * @var \DateTime $createdAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
+ * @SkipWhenEmpty()
+ */
+ private $createdAt;
+
+ /**
+ * @var \DateTime $createdAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
+ * @SkipWhenEmpty()
+ */
+ private $updatedAt;
+
+ /**
+ * @return string
+ */
+ public function getId(): string
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId(string $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getCreatedAt(): \DateTime
+ {
+ return $this->createdAt;
+ }
+
+ /**
+ * @param \DateTime $createdAt
+ */
+ public function setCreatedAt(\DateTime $createdAt)
+ {
+ $this->createdAt = $createdAt;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getUpdatedAt(): \DateTime
+ {
+ return $this->updatedAt;
+ }
+
+ /**
+ * @param \DateTime $updatedAt
+ */
+ public function setUpdatedAt(\DateTime $updatedAt)
+ {
+ $this->updatedAt = $updatedAt;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Customer.php b/src/Bot/Model/Entity/Customer.php
index c647b98..049b4f3 100644
--- a/src/Bot/Model/Entity/Customer.php
+++ b/src/Bot/Model/Entity/Customer.php
@@ -14,85 +14,322 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * 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 |
+ * Customer class
* | 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() "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
+class Customer
{
+ use 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" => [...]]);
- * ```
+ * @var string $externalId
+ *
+ * @Type("string")
+ * @Accessor(getter="getExternalId",setter="setExternalId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- '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'
- ];
-}
\ No newline at end of file
+ private $externalId;
+
+ /**
+ * @var int $channelId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChannelId",setter="setChannelId")
+ * @SkipWhenEmpty()
+ */
+ private $channelId;
+
+ /**
+ * @var string $username
+ *
+ * @Type("string")
+ * @Accessor(getter="getUsername",setter="setUsername")
+ * @SkipWhenEmpty()
+ */
+ private $username;
+
+ /**
+ * @var string $firstName
+ *
+ * @Type("string")
+ * @Accessor(getter="getFirstName",setter="setFirstName")
+ * @SkipWhenEmpty()
+ */
+ private $firstName;
+
+ /**
+ * @var string $lastName
+ *
+ * @Type("string")
+ * @Accessor(getter="getLastName",setter="setLastName")
+ * @SkipWhenEmpty()
+ */
+ private $lastName;
+
+ /**
+ * @var string $avatarUrl
+ *
+ * @Type("string")
+ * @Accessor(getter="getAvatarUrl",setter="setAvatarUrl")
+ * @SkipWhenEmpty()
+ */
+ private $avatarUrl;
+
+ /**
+ * @var string $profileUrl
+ *
+ * @Type("string")
+ * @Accessor(getter="getProfileUrl",setter="setProfileUrl")
+ * @SkipWhenEmpty()
+ */
+ private $profileUrl;
+
+ /**
+ * @var string $revokedAt
+ *
+ * @Type("string")
+ * @Accessor(getter="getRevokedAt",setter="setRevokedAt")
+ * @SkipWhenEmpty()
+ */
+ private $revokedAt;
+
+ /**
+ * @var string $country
+ *
+ * @Type("string")
+ * @Accessor(getter="getCountry",setter="setCountry")
+ * @SkipWhenEmpty()
+ */
+ private $country;
+
+ /**
+ * @var string $language
+ *
+ * @Type("string")
+ * @Accessor(getter="getLanguage",setter="setLanguage")
+ * @SkipWhenEmpty()
+ */
+ private $language;
+
+ /**
+ * @var string $phone
+ *
+ * @Type("string")
+ * @Accessor(getter="getPhone",setter="setPhone")
+ * @SkipWhenEmpty()
+ */
+ private $phone;
+
+ /**
+ * @var string $email
+ *
+ * @Type("string")
+ * @Accessor(getter="getEmail",setter="setEmail")
+ * @SkipWhenEmpty()
+ */
+ private $email;
+
+ /**
+ * @return string
+ */
+ public function getExternalId(): string
+ {
+ return $this->externalId;
+ }
+
+ /**
+ * @param string $externalId
+ */
+ public function setExternalId(string $externalId)
+ {
+ $this->externalId = $externalId;
+ }
+
+ /**
+ * @return int
+ */
+ public function getChannelId(): int
+ {
+ return $this->channelId;
+ }
+
+ /**
+ * @param int $channelId
+ */
+ public function setChannelId(int $channelId)
+ {
+ $this->channelId = $channelId;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUsername(): string
+ {
+ return $this->username;
+ }
+
+ /**
+ * @param string $username
+ */
+ public function setUsername(string $username)
+ {
+ $this->username = $username;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFirstName(): string
+ {
+ return $this->firstName;
+ }
+
+ /**
+ * @param string $firstName
+ */
+ public function setFirstName(string $firstName)
+ {
+ $this->firstName = $firstName;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLastName(): string
+ {
+ return $this->lastName;
+ }
+
+ /**
+ * @param string $lastName
+ */
+ public function setLastName(string $lastName)
+ {
+ $this->lastName = $lastName;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAvatarUrl(): string
+ {
+ return $this->avatarUrl;
+ }
+
+ /**
+ * @param string $avatarUrl
+ */
+ public function setAvatarUrl(string $avatarUrl)
+ {
+ $this->avatarUrl = $avatarUrl;
+ }
+
+ /**
+ * @return string
+ */
+ public function getProfileUrl(): string
+ {
+ return $this->profileUrl;
+ }
+
+ /**
+ * @param string $profileUrl
+ */
+ public function setProfileUrl(string $profileUrl)
+ {
+ $this->profileUrl = $profileUrl;
+ }
+
+ /**
+ * @return string
+ */
+ public function getRevokedAt(): string
+ {
+ return $this->revokedAt;
+ }
+
+ /**
+ * @param string $revokedAt
+ */
+ public function setRevokedAt(string $revokedAt)
+ {
+ $this->revokedAt = $revokedAt;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCountry(): string
+ {
+ return $this->country;
+ }
+
+ /**
+ * @param string $country
+ */
+ public function setCountry(string $country)
+ {
+ $this->country = $country;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLanguage(): string
+ {
+ return $this->language;
+ }
+
+ /**
+ * @param string $language
+ */
+ public function setLanguage(string $language)
+ {
+ $this->language = $language;
+ }
+
+ /**
+ * @return string
+ */
+ public function getPhone(): string
+ {
+ return $this->phone;
+ }
+
+ /**
+ * @param string $phone
+ */
+ public function setPhone(string $phone)
+ {
+ $this->phone = $phone;
+ }
+
+ /**
+ * @return string
+ */
+ public function getEmail(): string
+ {
+ return $this->email;
+ }
+
+ /**
+ * @param string $email
+ */
+ public function setEmail(string $email)
+ {
+ $this->email = $email;
+ }
+}
diff --git a/src/Bot/Model/Entity/Dialog.php b/src/Bot/Model/Entity/Dialog.php
index b4b11b6..5110df3 100644
--- a/src/Bot/Model/Entity/Dialog.php
+++ b/src/Bot/Model/Entity/Dialog.php
@@ -14,69 +14,221 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * 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 |
+ * Dialog class
*
* @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() "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
+class Dialog
{
+ use 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" => [...]]);
- * ```
+ * @var int $botId
+ *
+ * @Type("int")
+ * @Accessor(getter="getBotId",setter="setBotId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- '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'
- ];
-}
\ No newline at end of file
+ private $botId;
+
+ /**
+ * @var int $chatId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChatId",setter="setChatId")
+ * @SkipWhenEmpty()
+ */
+ private $chatId;
+
+ /**
+ * @var int $beginMessageId
+ *
+ * @Type("int")
+ * @Accessor(getter="getBeginMessageId",setter="setBeginMessageId")
+ * @SkipWhenEmpty()
+ */
+ private $beginMessageId;
+
+ /**
+ * @var int $endingMessageId
+ *
+ * @Type("int")
+ * @Accessor(getter="getEndingMessageId",setter="setEndingMessageId")
+ * @SkipWhenEmpty()
+ */
+ private $endingMessageId;
+
+ /**
+ * @var \DateTime $closedAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getClosedAt",setter="setClosedAt")
+ * @SkipWhenEmpty()
+ */
+ private $closedAt;
+
+ /**
+ * @var bool $isAssigned
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsAssigned",setter="setIsAssigned")
+ * @SkipWhenEmpty()
+ */
+ private $isAssigned;
+
+ /**
+ * @var Responsible $responsible
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\Responsible")
+ * @Accessor(getter="getResponsible",setter="setResponsible")
+ * @SkipWhenEmpty()
+ */
+ private $responsible;
+
+ /**
+ * @var bool $isActive
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsActive",setter="setIsActive")
+ * @SkipWhenEmpty()
+ */
+ private $isActive;
+
+ /**
+ * @return int
+ */
+ public function getBotId(): int
+ {
+ return $this->botId;
+ }
+
+ /**
+ * @param int $botId
+ */
+ public function setBotId(int $botId)
+ {
+ $this->botId = $botId;
+ }
+
+ /**
+ * @return int
+ */
+ public function getChatId(): int
+ {
+ return $this->chatId;
+ }
+
+ /**
+ * @param int $chatId
+ */
+ public function setChatId(int $chatId)
+ {
+ $this->chatId = $chatId;
+ }
+
+ /**
+ * @return int
+ */
+ public function getBeginMessageId(): int
+ {
+ return $this->beginMessageId;
+ }
+
+ /**
+ * @param int $beginMessageId
+ */
+ public function setBeginMessageId(int $beginMessageId)
+ {
+ $this->beginMessageId = $beginMessageId;
+ }
+
+ /**
+ * @return int
+ */
+ public function getEndingMessageId(): int
+ {
+ return $this->endingMessageId;
+ }
+
+ /**
+ * @param int $endingMessageId
+ */
+ public function setEndingMessageId(int $endingMessageId)
+ {
+ $this->endingMessageId = $endingMessageId;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getClosedAt(): \DateTime
+ {
+ return $this->closedAt;
+ }
+
+ /**
+ * @param \DateTime $closedAt
+ */
+ public function setClosedAt(\DateTime $closedAt)
+ {
+ $this->closedAt = $closedAt;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isAssigned(): bool
+ {
+ return $this->isAssigned;
+ }
+
+ /**
+ * @param bool $isAssigned
+ */
+ public function setIsAssigned(bool $isAssigned)
+ {
+ $this->isAssigned = $isAssigned;
+ }
+
+ /**
+ * @return Responsible
+ */
+ public function getResponsible(): Responsible
+ {
+ return $this->responsible;
+ }
+
+ /**
+ * @param Responsible $responsible
+ */
+ public function setResponsible(Responsible $responsible)
+ {
+ $this->responsible = $responsible;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isActive(): bool
+ {
+ return $this->isActive;
+ }
+
+ /**
+ * @param bool $isActive
+ */
+ public function setIsActive(bool $isActive)
+ {
+ $this->isActive = $isActive;
+ }
+}
diff --git a/src/Bot/Model/Entity/FileMeta.php b/src/Bot/Model/Entity/FileMeta.php
index 9fb480c..56b0b24 100644
--- a/src/Bot/Model/Entity/FileMeta.php
+++ b/src/Bot/Model/Entity/FileMeta.php
@@ -13,46 +13,69 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * FileMeta class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | height | int |
- * | width | int |
+ * FileMeta class
*
* @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
+class FileMeta
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $height
+ *
+ * @Type("int")
+ * @Accessor(getter="getHeight",setter="setHeight")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'height' => 'int',
- 'width' => 'int'
- ];
-}
\ No newline at end of file
+ private $height;
+
+ /**
+ * @var int $width
+ *
+ * @Type("int")
+ * @Accessor(getter="getWidth",setter="setWidth")
+ * @SkipWhenEmpty()
+ */
+ private $width;
+
+ /**
+ * @return int
+ */
+ public function getHeight(): int
+ {
+ return $this->height;
+ }
+
+ /**
+ * @param int $height
+ */
+ public function setHeight(int $height)
+ {
+ $this->height = $height;
+ }
+
+ /**
+ * @return int
+ */
+ public function getWidth(): int
+ {
+ return $this->width;
+ }
+
+ /**
+ * @param int $width
+ */
+ public function setWidth(int $width)
+ {
+ $this->width = $width;
+ }
+}
diff --git a/src/Bot/Model/Entity/Message/Item.php b/src/Bot/Model/Entity/Message/Item.php
index 61a0e68..fe3b0b5 100644
--- a/src/Bot/Model/Entity/Message/Item.php
+++ b/src/Bot/Model/Entity/Message/Item.php
@@ -13,50 +13,94 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * Item class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | id | int |
- * | size | int |
- * | caption | string |
+ * Item class
*
* @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() "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
+class Item
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $id
+ *
+ * @Type("string")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'id' => 'int',
- 'size' => 'int',
- 'caption' => 'string'
- ];
+ private $id;
+
+ /**
+ * @var int $size
+ *
+ * @Type("int")
+ * @Accessor(getter="getSize",setter="setSize")
+ * @SkipWhenEmpty()
+ */
+ private $size;
+
+ /**
+ * @var string $caption
+ *
+ * @Type("string")
+ * @Accessor(getter="getCaption",setter="setCaption")
+ * @SkipWhenEmpty()
+ */
+ private $caption;
+
+ /**
+ * @return string
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId(string $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSize(): int
+ {
+ return $this->size;
+ }
+
+ /**
+ * @param int $size
+ */
+ public function setSize(int $size)
+ {
+ $this->size = $size;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCaption()
+ {
+ return $this->caption;
+ }
+
+ /**
+ * @param string $caption
+ */
+ public function setCaption(string $caption)
+ {
+ $this->caption = $caption;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/Message.php b/src/Bot/Model/Entity/Message/Message.php
index b335e07..acc5563 100644
--- a/src/Bot/Model/Entity/Message/Message.php
+++ b/src/Bot/Model/Entity/Message/Message.php
@@ -14,105 +14,448 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use RetailCrm\Mg\Bot\Model\Entity\Dialog;
+use RetailCrm\Mg\Bot\Model\Entity\User;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * 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 |
+ * Message class
*
* @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 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
+class Message
{
+ use 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" => [...]]);
- * ```
+ * @var string $actions
+ *
+ * @Type("string")
+ * @Accessor(getter="getActions",setter="setActions")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'actions' => '[]',
- 'items' => 'Item[]',
- 'from' => '\RetailCrm\Mg\Bot\Model\Entity\User',
- 'time' => 'string',
- 'type' => 'string',
- 'scope' => 'string',
- 'chat_id' => 'int',
- 'content' => 'string',
- 'is_read' => 'bool',
- 'is_edit' => 'bool',
- 'status' => 'string',
- 'action' => 'string',
- 'dialog' => '\RetailCrm\Mg\Bot\Model\Entity\Dialog',
- 'channel_id' => 'int',
- 'channel_sent_at' => 'string',
- 'order' => 'MessageOrder',
- 'product' => 'MessageProduct',
- ];
+ private $actions;
+
+ /**
+ * @var array $items
+ *
+ * @Type("array")
+ * @Accessor(getter="getItems",setter="setItems")
+ * @SkipWhenEmpty()
+ */
+ private $items;
+
+ /**
+ * @var User $from
+ *
+ * @Type("RetailCrm\Mg\Bot\Model\Entity\User")
+ * @Accessor(getter="getFrom",setter="setFrom")
+ * @SkipWhenEmpty()
+ */
+ private $from;
+
+ /**
+ * @var \DateTime $time
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:sP'>")
+ * @Accessor(getter="getTime",setter="setTime")
+ * @SkipWhenEmpty()
+ */
+ private $time;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
+ */
+ private $type;
+
+ /**
+ * @var string $scope
+ *
+ * @Type("string")
+ * @Accessor(getter="getScope",setter="setScope")
+ * @SkipWhenEmpty()
+ */
+ private $scope;
+
+ /**
+ * @var int $chatId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChatId",setter="setChatId")
+ * @SkipWhenEmpty()
+ */
+ private $chatId;
+
+ /**
+ * @var string $content
+ *
+ * @Type("string")
+ * @Accessor(getter="getContent",setter="setContent")
+ * @SkipWhenEmpty()
+ */
+ private $content;
+
+ /**
+ * @var bool $isRead
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsRead",setter="setIsRead")
+ * @SkipWhenEmpty()
+ */
+ private $isRead;
+
+ /**
+ * @var bool $isEdit
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsEdit",setter="setIsEdit")
+ * @SkipWhenEmpty()
+ */
+ private $isEdit;
+
+ /**
+ * @var string $status
+ *
+ * @Type("string")
+ * @Accessor(getter="getStatus",setter="setStatus")
+ * @SkipWhenEmpty()
+ */
+ private $status;
+
+ /**
+ * @var string $action
+ *
+ * @Type("string")
+ * @Accessor(getter="getAction",setter="setAction")
+ * @SkipWhenEmpty()
+ */
+ private $action;
+
+ /**
+ * @var Dialog $dialog
+ *
+ * @Type("Dialog")
+ * @Accessor(getter="getDialog",setter="setDialog")
+ * @SkipWhenEmpty()
+ */
+ private $dialog;
+
+ /**
+ * @var int $channelId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChannelId",setter="setChannelId")
+ * @SkipWhenEmpty()
+ */
+ private $channelId;
+
+ /**
+ * @var \DateTime $channelSentAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getChannelSentAt",setter="setChannelSentAt")
+ * @SkipWhenEmpty()
+ */
+ private $channelSentAt;
+
+ /**
+ * @var MessageOrder $order
+ *
+ * @Type("MessageOrder")
+ * @Accessor(getter="getOrder",setter="setOrder")
+ * @SkipWhenEmpty()
+ */
+ private $order;
+
+ /**
+ * @var MessageProduct $product
+ *
+ * @Type("MessageProduct")
+ * @Accessor(getter="getProduct",setter="setProduct")
+ * @SkipWhenEmpty()
+ */
+ private $product;
+
+ /**
+ * @return string
+ */
+ public function getActions(): string
+ {
+ return $this->actions;
+ }
+
+ /**
+ * @param string $actions
+ */
+ public function setActions(string $actions)
+ {
+ $this->actions = $actions;
+ }
+
+ /**
+ * @return array
+ */
+ public function getItems(): array
+ {
+ return $this->items;
+ }
+
+ /**
+ * @param array $items
+ */
+ public function setItems(array $items)
+ {
+ $this->items = $items;
+ }
+
+ /**
+ * @return User
+ */
+ public function getFrom(): User
+ {
+ return $this->from;
+ }
+
+ /**
+ * @param User $from
+ */
+ public function setFrom(User $from)
+ {
+ $this->from = $from;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getTime(): \DateTime
+ {
+ return $this->time;
+ }
+
+ /**
+ * @param \DateTime $time
+ */
+ public function setTime(\DateTime $time)
+ {
+ $this->time = $time;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getScope(): string
+ {
+ return $this->scope;
+ }
+
+ /**
+ * @param string $scope
+ */
+ public function setScope(string $scope)
+ {
+ $this->scope = $scope;
+ }
+
+ /**
+ * @return int
+ */
+ public function getChatId(): int
+ {
+ return $this->chatId;
+ }
+
+ /**
+ * @param int $chatId
+ */
+ public function setChatId(int $chatId)
+ {
+ $this->chatId = $chatId;
+ }
+
+ /**
+ * @return string
+ */
+ public function getContent(): string
+ {
+ return $this->content;
+ }
+
+ /**
+ * @param string $content
+ */
+ public function setContent(string $content)
+ {
+ $this->content = $content;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isRead(): bool
+ {
+ return $this->isRead;
+ }
+
+ /**
+ * @param bool $isRead
+ */
+ public function setIsRead(bool $isRead)
+ {
+ $this->isRead = $isRead;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isEdit(): bool
+ {
+ return $this->isEdit;
+ }
+
+ /**
+ * @param bool $isEdit
+ */
+ public function setIsEdit(bool $isEdit)
+ {
+ $this->isEdit = $isEdit;
+ }
+
+ /**
+ * @return string
+ */
+ public function getStatus(): string
+ {
+ return $this->status;
+ }
+
+ /**
+ * @param string $status
+ */
+ public function setStatus(string $status)
+ {
+ $this->status = $status;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAction(): string
+ {
+ return $this->action;
+ }
+
+ /**
+ * @param string $action
+ */
+ public function setAction(string $action)
+ {
+ $this->action = $action;
+ }
+
+ /**
+ * @return Dialog
+ */
+ public function getDialog(): Dialog
+ {
+ return $this->dialog;
+ }
+
+ /**
+ * @param Dialog $dialog
+ */
+ public function setDialog(Dialog $dialog)
+ {
+ $this->dialog = $dialog;
+ }
+
+ /**
+ * @return int
+ */
+ public function getChannelId(): int
+ {
+ return $this->channelId;
+ }
+
+ /**
+ * @param int $channelId
+ */
+ public function setChannelId(int $channelId)
+ {
+ $this->channelId = $channelId;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getChannelSentAt(): \DateTime
+ {
+ return $this->channelSentAt;
+ }
+
+ /**
+ * @param \DateTime $channelSentAt
+ */
+ public function setChannelSentAt(\DateTime $channelSentAt)
+ {
+ $this->channelSentAt = $channelSentAt;
+ }
+
+ /**
+ * @return MessageOrder
+ */
+ public function getOrder(): MessageOrder
+ {
+ return $this->order;
+ }
+
+ /**
+ * @param MessageOrder $order
+ */
+ public function setOrder(MessageOrder $order)
+ {
+ $this->order = $order;
+ }
+
+ /**
+ * @return MessageProduct
+ */
+ public function getProduct(): MessageProduct
+ {
+ return $this->product;
+ }
+
+ /**
+ * @param MessageProduct $product
+ */
+ public function setProduct(MessageProduct $product)
+ {
+ $this->product = $product;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageCost.php b/src/Bot/Model/Entity/Message/MessageCost.php
index cbc2835..86030a6 100644
--- a/src/Bot/Model/Entity/Message/MessageCost.php
+++ b/src/Bot/Model/Entity/Message/MessageCost.php
@@ -13,46 +13,70 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessageCost class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | currency | string |
- * | value | float |
+ * MessageCost class
*
* @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() "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
+class MessageCost
{
/**
- * 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" => [...]]);
- * ```
+ * @var float $value
+ *
+ * @Type("float")
+ * @Accessor(getter="getValue",setter="setValue")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'currency' => 'string',
- 'value' => 'float'
- ];
+ private $value;
+
+ /**
+ * @var string $currency
+ *
+ * @Type("string")
+ * @Accessor(getter="getCurrency",setter="setCurrency")
+ *
+ * @Assert\Currency
+ */
+ private $currency;
+
+ /**
+ * @return float
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * @param float $value
+ */
+ public function setValue(float $value)
+ {
+ $this->value = $value;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCurrency()
+ {
+ return $this->currency;
+ }
+
+ /**
+ * @param string $currency
+ */
+ public function setCurrency(string $currency)
+ {
+ $this->currency = $currency;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageDelivery.php b/src/Bot/Model/Entity/Message/MessageDelivery.php
index 6769dcc..3e0b052 100644
--- a/src/Bot/Model/Entity/Message/MessageDelivery.php
+++ b/src/Bot/Model/Entity/Message/MessageDelivery.php
@@ -13,55 +13,122 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use LazyJsonMapper\LazyJsonMapper;
-use Symfony\Component\Validator\Validation;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use RetailCrm\Mg\Bot\Model\Entity\Message\MessageCost;
/**
* PHP version 7.0
*
- * MessageDelivery class. Schema:
- *
- * | Field name | Data type |
- * |------------|-------------|
- * | address | string |
- * | comment | string |
- * | name | string |
- * | price | MessageCost |
+ * MessageDelivery class
*
* @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() "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
+class MessageDelivery
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ *
+ * @Assert\NotBlank
*/
- const JSON_PROPERTY_MAP = [
- 'address' => 'string',
- 'comment' => 'string',
- 'name' => 'string',
- 'price' => 'MessageCost'
- ];
+ private $name;
+
+ /**
+ * @var MessageCost $price
+ *
+ * @Type("Cost")
+ * @Accessor(getter="getPrice",setter="setPrice")
+ *
+ * @Assert\Currency
+ */
+ private $price;
+
+ /**
+ * @var string $address
+ *
+ * @Type("string")
+ * @Accessor(getter="getAddress",setter="setAddress")
+ * @SkipWhenEmpty()
+ */
+ private $address;
+
+ /**
+ * @var string $comment
+ *
+ * @Type("string")
+ * @Accessor(getter="getComment",setter="setComment")
+ * @SkipWhenEmpty()
+ */
+ private $comment;
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return MessageCost
+ */
+ public function getPrice()
+ {
+ return $this->price;
+ }
+
+ /**
+ * @param MessageCost $price
+ */
+ public function setPrice(MessageCost $price)
+ {
+ $this->price = $price;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAddress()
+ {
+ return $this->address;
+ }
+
+ /**
+ * @param string $address
+ */
+ public function setAddress(string $address)
+ {
+ $this->address = $address;
+ }
+
+ /**
+ * @return string
+ */
+ public function getComment()
+ {
+ return $this->comment;
+ }
+
+ /**
+ * @param string $comment
+ */
+ public function setComment(string $comment)
+ {
+ $this->comment = $comment;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageOrder.php b/src/Bot/Model/Entity/Message/MessageOrder.php
index 870fc42..66106f8 100644
--- a/src/Bot/Model/Entity/Message/MessageOrder.php
+++ b/src/Bot/Model/Entity/Message/MessageOrder.php
@@ -13,66 +13,232 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use RetailCrm\Mg\Bot\Model\Entity\Cost;
+use RetailCrm\Mg\Bot\Model\Entity\Delivery;
+use RetailCrm\Mg\Bot\Model\Entity\Status;
/**
* PHP version 7.0
*
- * MessageOrder class. Schema:
- *
- * | Field name | Data type |
- * |------------|--------------------|
- * | cost | MessageCost |
- * | date | string |
- * | delivery | MessageDelivery |
- * | items | array |
- * | number | string |
- * | payments | array |
- * | status | MessageStatus |
+ * MessageOrder class
*
* @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() "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
+class MessageOrder
{
+// const JSON_PROPERTY_MAP = [
+// 'cost' => 'MessageCost',
+// 'date' => 'string',
+// 'delivery' => 'MessageDelivery',
+// 'items' => 'MessageOrderItem[]',
+// 'number' => 'string',
+// 'payments' => 'MessagePayment[]',
+// 'status' => 'MessageStatus'
+// ];
+
/**
- * 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" => [...]]);
- * ```
+ * @var string $number
+ *
+ * @Type("string")
+ * @Accessor(getter="getNumber",setter="setNumber")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'cost' => 'MessageCost',
- 'date' => 'string',
- 'delivery' => 'MessageDelivery',
- 'items' => 'MessageOrderItem[]',
- 'number' => 'string',
- 'payments' => 'MessagePayment[]',
- 'status' => 'MessageStatus'
- ];
+ private $number;
+
+ /**
+ * @var string $url
+ *
+ * @Type("string")
+ * @Accessor(getter="getUrl",setter="setUrl")
+ * @SkipWhenEmpty()
+ */
+ private $url;
+
+ /**
+ * @var string $date
+ *
+ * @Type("string")
+ * @Accessor(getter="getDate",setter="setDate")
+ * @SkipWhenEmpty()
+ */
+ private $date;
+
+ /**
+ * @var MessageCost $cost
+ *
+ * @Type("MessageCost")
+ * @Accessor(getter="getCost",setter="setCost")
+ * @SkipWhenEmpty()
+ */
+ private $cost;
+
+ /**
+ * @var MessageStatus $status
+ *
+ * @Type("MessageStatus")
+ * @Accessor(getter="getStatus",setter="setStatus")
+ * @SkipWhenEmpty()
+ */
+ private $status;
+
+ /**
+ * @var MessageDelivery $delivery
+ *
+ * @Type("MessageDelivery")
+ * @Accessor(getter="getDelivery",setter="setDelivery")
+ * @SkipWhenEmpty()
+ */
+ private $delivery;
+
+ /**
+ * @var array $items
+ *
+ * @Type("array")
+ * @Accessor(getter="getItems",setter="setItems")
+ * @SkipWhenEmpty()
+ */
+ private $items;
+
+ /**
+ * @var array $payments
+ *
+ * @Type("array")
+ * @Accessor(getter="getPayments",setter="setPayments")
+ * @SkipWhenEmpty()
+ */
+ private $payments;
+
+ /**
+ * @return string
+ */
+ public function getNumber()
+ {
+ return $this->number;
+ }
+
+ /**
+ * @param string $number
+ */
+ public function setNumber(string $number)
+ {
+ $this->number = $number;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUrl()
+ {
+ return $this->url;
+ }
+
+ /**
+ * @param string $url
+ */
+ public function setUrl(string $url)
+ {
+ $this->url = $url;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDate()
+ {
+ return $this->date;
+ }
+
+ /**
+ * @param string $date
+ */
+ public function setDate(string $date)
+ {
+ $this->date = $date;
+ }
+
+ /**
+ * @return MessageCost
+ */
+ public function getCost()
+ {
+ return $this->cost;
+ }
+
+ /**
+ * @param MessageCost $cost
+ */
+ public function setCost(MessageCost $cost)
+ {
+ $this->cost = $cost;
+ }
+
+ /**
+ * @return MessageStatus
+ */
+ public function getStatus()
+ {
+ return $this->status;
+ }
+
+ /**
+ * @param MessageStatus $status
+ */
+ public function setStatus(MessageStatus $status)
+ {
+ $this->status = $status;
+ }
+
+ /**
+ * @return MessageDelivery
+ */
+ public function getDelivery()
+ {
+ return $this->delivery;
+ }
+
+ /**
+ * @param MessageDelivery $delivery
+ */
+ public function setDelivery(MessageDelivery $delivery)
+ {
+ $this->delivery = $delivery;
+ }
+
+ /**
+ * @return array
+ */
+ public function getItems()
+ {
+ return $this->items;
+ }
+
+ /**
+ * @param array $items
+ */
+ public function setItems(array $items)
+ {
+ $this->items = $items;
+ }
+
+ /**
+ * @return array
+ */
+ public function getPayments()
+ {
+ return $this->payments;
+ }
+
+ /**
+ * @param array $payments
+ */
+ public function setPayments(array $payments)
+ {
+ $this->payments = $payments;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageOrderItem.php b/src/Bot/Model/Entity/Message/MessageOrderItem.php
index bd2a76f..e1d7d6c 100644
--- a/src/Bot/Model/Entity/Message/MessageOrderItem.php
+++ b/src/Bot/Model/Entity/Message/MessageOrderItem.php
@@ -13,58 +13,144 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessageOrderItem class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------------|
- * | img | string |
- * | name | string |
- * | price | MessageCost |
- * | quantity | MessageQuantity |
- * | url | string |
+ * MessageOrderItem class
*
* @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() "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
+class MessageOrderItem
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'img' => 'string',
- 'name' => 'string',
- 'price' => 'MessageCost',
- 'quantity' => 'MessageQuantity',
- 'url' => 'string'
- ];
+ private $name;
+
+ /**
+ * @var string $url
+ *
+ * @Type("string")
+ * @Accessor(getter="getUrl",setter="setUrl")
+ * @SkipWhenEmpty()
+ */
+ private $url;
+
+ /**
+ * @var string $img
+ *
+ * @Type("string")
+ * @Accessor(getter="getImg",setter="setImg")
+ * @SkipWhenEmpty()
+ */
+ private $img;
+
+ /**
+ * @var MessageCost $price
+ *
+ * @Type("MessageCost")
+ * @Accessor(getter="getPrice",setter="setPrice")
+ * @SkipWhenEmpty()
+ */
+ private $price;
+
+ /**
+ * @var MessageQuantity $quantity
+ *
+ * @Type("MessageQuantity")
+ * @Accessor(getter="getQuantity",setter="setQuantity)
+ * @SkipWhenEmpty()
+ */
+ private $quantity;
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUrl()
+ {
+ return $this->url;
+ }
+
+ /**
+ * @param string $url
+ */
+ public function setUrl(string $url)
+ {
+ $this->url = $url;
+ }
+
+ /**
+ * @return string
+ */
+ public function getImg()
+ {
+ return $this->img;
+ }
+
+ /**
+ * @param string $img
+ */
+ public function setImg(string $img)
+ {
+ $this->img = $img;
+ }
+
+ /**
+ * @return MessageCost
+ */
+ public function getPrice()
+ {
+ return $this->price;
+ }
+
+ /**
+ * @param MessageCost $price
+ */
+ public function setPrice(MessageCost $price)
+ {
+ $this->price = $price;
+ }
+
+ /**
+ * @return MessageQuantity
+ */
+ public function getQuantity()
+ {
+ return $this->quantity;
+ }
+
+ /**
+ * @param MessageQuantity $quantity
+ */
+ public function setQuantity(MessageQuantity $quantity)
+ {
+ $this->quantity = $quantity;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php
index 7f07c05..15ee079 100644
--- a/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php
+++ b/src/Bot/Model/Entity/Message/MessageOrderPaymentStatus.php
@@ -13,46 +13,72 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
/**
* PHP version 7.0
*
- * MessageOrderPaymentStatus class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | name | string |
- * | payed | bool |
+ * MessageOrderPaymentStatus class
*
* @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() "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
+class MessageOrderPaymentStatus
{
+ use 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'name' => 'string',
- 'payed' => 'bool'
- ];
+ private $name;
+
+ /**
+ * @var bool $name
+ *
+ * @Type("bool")
+ * @Accessor(getter="getPayed",setter="setPayed")
+ * @SkipWhenEmpty()
+ */
+ private $payed;
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isPayed(): bool
+ {
+ return $this->payed;
+ }
+
+ /**
+ * @param bool $payed
+ */
+ public function setPayed(bool $payed)
+ {
+ $this->payed = $payed;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessagePayment.php b/src/Bot/Model/Entity/Message/MessagePayment.php
index 8c702b6..ee9df9e 100644
--- a/src/Bot/Model/Entity/Message/MessagePayment.php
+++ b/src/Bot/Model/Entity/Message/MessagePayment.php
@@ -13,50 +13,94 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessagePayment class. Schema:
- *
- * | Field name | Data type |
- * |------------|---------------------------|
- * | amount | MessageCost |
- * | name | string |
- * | status | MessageOrderPaymentStatus |
+ * MessagePayment class
*
* @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() "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
+class MessagePayment
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'amount' => 'MessageCost',
- 'name' => 'string',
- 'status' => 'MessageOrderPaymentStatus'
- ];
+ private $name;
+
+ /**
+ * @var MessageOrderPaymentStatus $status
+ *
+ * @Type("MessageOrderPaymentStatus")
+ * @Accessor(getter="getStatus",setter="setStatus")
+ * @SkipWhenEmpty()
+ */
+ private $status;
+
+ /**
+ * @var MessageCost $amount
+ *
+ * @Type("MessageCost")
+ * @Accessor(getter="getAmount",setter="setAmount")
+ * @SkipWhenEmpty()
+ */
+ private $amount;
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return MessageOrderPaymentStatus
+ */
+ public function getStatus()
+ {
+ return $this->status;
+ }
+
+ /**
+ * @param MessageOrderPaymentStatus $status
+ */
+ public function setStatus(MessageOrderPaymentStatus $status)
+ {
+ $this->status = $status;
+ }
+
+ /**
+ * @return MessageCost
+ */
+ public function getAmount()
+ {
+ return $this->amount;
+ }
+
+ /**
+ * @param MessageCost $amount
+ */
+ public function setAmount(MessageCost $amount)
+ {
+ $this->amount = $amount;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageProduct.php b/src/Bot/Model/Entity/Message/MessageProduct.php
index 3d9521f..0dac7b9 100644
--- a/src/Bot/Model/Entity/Message/MessageProduct.php
+++ b/src/Bot/Model/Entity/Message/MessageProduct.php
@@ -13,66 +13,194 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessageProduct class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------------|
- * | article | string |
- * | cost | MessageCost |
- * | id | int |
- * | img | string |
- * | name | string |
- * | quantity | MessageQuantity |
- * | url | string |
+ * MessageProduct class
*
* @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() "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
+class MessageProduct
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $id
+ *
+ * @Type("int")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'article' => 'string',
- 'cost' => 'MessageCost',
- 'id' => 'int',
- 'img' => 'string',
- 'name' => 'string',
- 'quantity' => 'MessageQuantity',
- 'url' => 'string'
- ];
+ private $id;
+
+ /**
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
+ */
+ private $name;
+
+ /**
+ * @var string $article
+ *
+ * @Type("string")
+ * @Accessor(getter="getArticle",setter="setArticle")
+ * @SkipWhenEmpty()
+ */
+ private $article;
+
+ /**
+ * @var string $url
+ *
+ * @Type("string")
+ * @Accessor(getter="getUrl",setter="setUrl")
+ * @SkipWhenEmpty()
+ */
+ private $url;
+
+ /**
+ * @var string $img
+ *
+ * @Type("string")
+ * @Accessor(getter="getImg",setter="setImg")
+ * @SkipWhenEmpty()
+ */
+ private $img;
+
+ /**
+ * @var MessageCost $cost
+ *
+ * @Type("Cost")
+ * @Accessor(getter="getCost",setter="setCost")
+ * @SkipWhenEmpty()
+ */
+ private $cost;
+
+ /**
+ * @var MessageQuantity $quantity
+ *
+ * @Type("MessageQuantity")
+ * @Accessor(getter="getQuantity",setter="setQuantity)
+ * @SkipWhenEmpty()
+ */
+ private $quantity;
+
+ /**
+ * @return int
+ */
+ public function getId(): int
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param int $id
+ */
+ public function setId(int $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getArticle(): string
+ {
+ return $this->article;
+ }
+
+ /**
+ * @param string $article
+ */
+ public function setArticle(string $article)
+ {
+ $this->article = $article;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUrl(): string
+ {
+ return $this->url;
+ }
+
+ /**
+ * @param string $url
+ */
+ public function setUrl(string $url)
+ {
+ $this->url = $url;
+ }
+
+ /**
+ * @return string
+ */
+ public function getImg(): string
+ {
+ return $this->img;
+ }
+
+ /**
+ * @param string $img
+ */
+ public function setImg(string $img)
+ {
+ $this->img = $img;
+ }
+
+ /**
+ * @return MessageCost
+ */
+ public function getCost(): MessageCost
+ {
+ return $this->cost;
+ }
+
+ /**
+ * @param MessageCost $cost
+ */
+ public function setCost(MessageCost $cost)
+ {
+ $this->cost = $cost;
+ }
+
+ /**
+ * @return MessageQuantity
+ */
+ public function getQuantity(): MessageQuantity
+ {
+ return $this->quantity;
+ }
+
+ /**
+ * @param MessageQuantity $quantity
+ */
+ public function setQuantity(MessageQuantity $quantity)
+ {
+ $this->quantity = $quantity;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageQuantity.php b/src/Bot/Model/Entity/Message/MessageQuantity.php
index bd03741..b28a2b3 100644
--- a/src/Bot/Model/Entity/Message/MessageQuantity.php
+++ b/src/Bot/Model/Entity/Message/MessageQuantity.php
@@ -14,45 +14,72 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessageQuantity class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | unit | string |
- * | value | float |
+ * MessageQuantity class
*
* @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() "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
+class MessageQuantity
{
+ use 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" => [...]]);
- * ```
+ * @var float $value
+ *
+ * @Type("float")
+ * @Accessor(getter="getValue",setter="setValue")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'unit' => 'string',
- 'value' => 'float'
- ];
+ private $value;
+
+ /**
+ * @var string $unit
+ *
+ * @Type("string")
+ * @Accessor(getter="getUnit",setter="setUnit")
+ *
+ * @Assert\Currency
+ */
+ private $unit;
+
+ /**
+ * @return float
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * @param float $value
+ */
+ public function setValue(float $value)
+ {
+ $this->value = $value;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUnit()
+ {
+ return $this->unit;
+ }
+
+ /**
+ * @param string $unit
+ */
+ public function setUnit(string $unit)
+ {
+ $this->unit = $unit;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Message/MessageStatus.php b/src/Bot/Model/Entity/Message/MessageStatus.php
index 6668537..a60fc6f 100644
--- a/src/Bot/Model/Entity/Message/MessageStatus.php
+++ b/src/Bot/Model/Entity/Message/MessageStatus.php
@@ -13,46 +13,69 @@
namespace RetailCrm\Mg\Bot\Model\Entity\Message;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessageStatus class. Schema:
- *
- * | Field name | Data type |
- * |------------|-----------|
- * | code | string |
- * | name | string |
+ * MessageStatus class
*
* @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() "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
+class MessageStatus
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $code
+ *
+ * @Type("string")
+ * @Accessor(getter="getCode",setter="setCode")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'code' => 'string',
- 'name' => 'string'
- ];
+ private $code;
+
+ /**
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
+ */
+ private $name;
+
+ /**
+ * @return string
+ */
+ public function getCode(): string
+ {
+ return $this->code;
+ }
+
+ /**
+ * @param string $code
+ */
+ public function setCode(string $code)
+ {
+ $this->code = $code;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
}
\ No newline at end of file
diff --git a/src/Bot/Model/Entity/Responsible.php b/src/Bot/Model/Entity/Responsible.php
index dd7105e..763c59e 100644
--- a/src/Bot/Model/Entity/Responsible.php
+++ b/src/Bot/Model/Entity/Responsible.php
@@ -13,50 +13,94 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * Responsible class. Schema:
- *
- * | Field name | Data type |
- * |-------------|-----------|
- * | assigned_at | string |
- * | id | int |
- * | type | string |
+ * Responsible class
*
* @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
+class Responsible
{
/**
- * 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" => [...]]);
- * ```
+ * @var \DateTime $assignedAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getAssignedAt",setter="setAssignedAt")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'assigned_at' => 'string',
- 'id' => 'int',
- 'type' => 'string'
- ];
+ private $assignedAt;
+
+ /**
+ * @var int $id
+ *
+ * @Type("int")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
+ */
+ private $id;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
+ */
+ private $type;
+
+ /**
+ * @return \DateTime
+ */
+ public function getAssignedAt(): \DateTime
+ {
+ return $this->assignedAt;
+ }
+
+ /**
+ * @param \DateTime $assignedAt
+ */
+ public function setAssignedAt(\DateTime $assignedAt)
+ {
+ $this->assignedAt = $assignedAt;
+ }
+
+ /**
+ * @return int
+ */
+ public function getId(): int
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param int $id
+ */
+ public function setId(int $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
}
diff --git a/src/Bot/Model/Entity/User.php b/src/Bot/Model/Entity/User.php
index 0dc52b0..438483e 100644
--- a/src/Bot/Model/Entity/User.php
+++ b/src/Bot/Model/Entity/User.php
@@ -13,76 +13,271 @@
namespace RetailCrm\Mg\Bot\Model\Entity;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+
/**
* PHP version 7.0
*
- * 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 |
+ * User class
*
* @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() "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
+class User
{
+ use 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" => [...]]);
- * ```
+ * @var string $externalId
+ *
+ * @Type("string")
+ * @Accessor(getter="getExternalId",setter="setExternalId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- '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'
- ];
-}
\ No newline at end of file
+ private $externalId;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
+ */
+ private $type;
+
+ /**
+ * @var string $avatar
+ *
+ * @Type("string")
+ * @Accessor(getter="getAvatar",setter="setAvatar")
+ * @SkipWhenEmpty()
+ */
+ private $avatar;
+
+ /**
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
+ */
+ private $name;
+
+ /**
+ * @var string $username
+ *
+ * @Type("string")
+ * @Accessor(getter="getUsername",setter="setUsername")
+ * @SkipWhenEmpty()
+ */
+ private $username;
+
+ /**
+ * @var string $firstName
+ *
+ * @Type("string")
+ * @Accessor(getter="getFirstName",setter="setFirstName")
+ * @SkipWhenEmpty()
+ */
+ private $firstName;
+
+ /**
+ * @var string $lastName
+ *
+ * @Type("string")
+ * @Accessor(getter="getLastName",setter="setLastName")
+ * @SkipWhenEmpty()
+ */
+ private $lastName;
+
+ /**
+ * @var bool $isActive
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsActive",setter="setIsActive")
+ * @SkipWhenEmpty()
+ */
+ private $isActive;
+
+ /**
+ * @var bool $isOnline
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsOnline",setter="setIsOnline")
+ * @SkipWhenEmpty()
+ */
+ private $isOnline;
+
+ /**
+ * @var \DateTime $revokedAt
+ *
+ * @Type("DateTime<'Y-m-d\TH:i:s\.u\Z'>")
+ * @Accessor(getter="getRevokedAt",setter="setRevokedAt")
+ * @SkipWhenEmpty()
+ */
+ private $revokedAt;
+
+ /**
+ * @return string
+ */
+ public function getExternalId(): string
+ {
+ return $this->externalId;
+ }
+
+ /**
+ * @param string $externalId
+ */
+ public function setExternalId(string $externalId)
+ {
+ $this->externalId = $externalId;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAvatar(): string
+ {
+ return $this->avatar;
+ }
+
+ /**
+ * @param string $avatar
+ */
+ public function setAvatar(string $avatar)
+ {
+ $this->avatar = $avatar;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName(string $name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUsername(): string
+ {
+ return $this->username;
+ }
+
+ /**
+ * @param string $username
+ */
+ public function setUsername(string $username)
+ {
+ $this->username = $username;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFirstName(): string
+ {
+ return $this->firstName;
+ }
+
+ /**
+ * @param string $firstName
+ */
+ public function setFirstName(string $firstName)
+ {
+ $this->firstName = $firstName;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLastName(): string
+ {
+ return $this->lastName;
+ }
+
+ /**
+ * @param string $lastName
+ */
+ public function setLastName(string $lastName)
+ {
+ $this->lastName = $lastName;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isActive(): bool
+ {
+ return $this->isActive;
+ }
+
+ /**
+ * @param bool $isActive
+ */
+ public function setIsActive(bool $isActive)
+ {
+ $this->isActive = $isActive;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isOnline(): bool
+ {
+ return $this->isOnline;
+ }
+
+ /**
+ * @param bool $isOnline
+ */
+ public function setIsOnline(bool $isOnline)
+ {
+ $this->isOnline = $isOnline;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getRevokedAt(): \DateTime
+ {
+ return $this->revokedAt;
+ }
+
+ /**
+ * @param \DateTime $revokedAt
+ */
+ public function setRevokedAt(\DateTime $revokedAt)
+ {
+ $this->revokedAt = $revokedAt;
+ }
+}
diff --git a/src/Bot/Model/Request/BotsRequest.php b/src/Bot/Model/Request/BotsRequest.php
index 555d611..6625f1a 100644
--- a/src/Bot/Model/Request/BotsRequest.php
+++ b/src/Bot/Model/Request/BotsRequest.php
@@ -13,48 +13,90 @@
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. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | active | int |
- * | self | int |
- * | roles | array |
+ * BotsRequest class
*
* @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 extends CommonFields
+class BotsRequest
{
+ use 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" => [...]]);
- * ```
+ * @Type("int")
+ * @Accessor(getter="getActive",setter="setActive")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'active' => 'int',
- 'self' => 'int',
- 'roles' => 'string[]'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/ChannelsRequest.php b/src/Bot/Model/Request/ChannelsRequest.php
index 39bbb5a..738f0a4 100644
--- a/src/Bot/Model/Request/ChannelsRequest.php
+++ b/src/Bot/Model/Request/ChannelsRequest.php
@@ -13,44 +13,67 @@
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. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | types | array |
- * | active | int |
+ * ChannelsRequest class
*
* @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 extends CommonFields
+class ChannelsRequest
{
+ use 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" => [...]]);
- * ```
+ * @Type("array")
+ * @Accessor(getter="getTypes",setter="setTypes")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'types' => 'string[]',
- 'active' => 'int'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/ChatsRequest.php b/src/Bot/Model/Request/ChatsRequest.php
index efdc76e..91f1396 100644
--- a/src/Bot/Model/Request/ChatsRequest.php
+++ b/src/Bot/Model/Request/ChatsRequest.php
@@ -13,44 +13,67 @@
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. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | channel_id | int |
- * | channel_type | string |
+ * ChatsRequest class
*
* @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 extends CommonFields
+class ChatsRequest
{
+ use 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" => [...]]);
- * ```
+ * @Type("int")
+ * @Accessor(getter="getChannelId",setter="setChannelId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'channel_id' => 'int',
- 'channel_type' => 'string'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/CommandEditRequest.php b/src/Bot/Model/Request/CommandEditRequest.php
index 98775e1..e95161d 100644
--- a/src/Bot/Model/Request/CommandEditRequest.php
+++ b/src/Bot/Model/Request/CommandEditRequest.php
@@ -13,57 +13,97 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use Symfony\Component\Validator\Constraints as Assert;
/**
* PHP version 7.0
*
- * CommandEditRequest class. Parametres:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | bot_id | int |
- * | name | string |
- * | description | string |
+ * CommandEditRequest class
*
* @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 extends LazyJsonMapper
+class CommandEditRequest
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $botId
+ *
+ * @Type("int")
+ * @Accessor(getter="getBotId",setter="setBotId")
+ *
+ * @Assert\NotBlank
*/
- const JSON_PROPERTY_MAP = [
- 'bot_id' => 'int',
- 'name' => 'string',
- 'description' => 'string'
- ];
+ private $botId;
- public function validate()
+ /**
+ * @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()
{
- if (empty($this->getName())) {
- return 'Empty name';
- }
+ 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;
}
}
diff --git a/src/Bot/Model/Request/CommandsRequest.php b/src/Bot/Model/Request/CommandsRequest.php
index 0216d7a..0a718e7 100644
--- a/src/Bot/Model/Request/CommandsRequest.php
+++ b/src/Bot/Model/Request/CommandsRequest.php
@@ -13,40 +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
*
- * CommandsRequest class. Parametres:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | name | string |
+ * CommandsRequest class
*
* @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 extends CommonFields
+class CommandsRequest
{
+ use 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" => [...]]);
- * ```
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'name' => 'string'
- ];
+ private $name;
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
}
diff --git a/src/Bot/Model/Request/CommonFields.php b/src/Bot/Model/Request/CommonFields.php
index 8664ff3..5ade7d0 100644
--- a/src/Bot/Model/Request/CommonFields.php
+++ b/src/Bot/Model/Request/CommonFields.php
@@ -13,50 +13,88 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * CommonFields class. Parametres:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | id | int |
- * | since | string |
- * | until | string |
+ * CommonFields trait
*
* @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"
*/
-class CommonFields extends LazyJsonMapper
+trait 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" => [...]]);
- * ```
+ * @Type("int")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'id' => 'int',
- 'since' => 'string',
- 'until' => 'string'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/CustomersRequest.php b/src/Bot/Model/Request/CustomersRequest.php
index 51cd4ba..5913b77 100644
--- a/src/Bot/Model/Request/CustomersRequest.php
+++ b/src/Bot/Model/Request/CustomersRequest.php
@@ -13,40 +13,45 @@
namespace RetailCrm\Mg\Bot\Model\Request;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use RetailCrm\Mg\Bot\Model\Request\CommonFields;
+
/**
* PHP version 7.0
*
- * CustomersRequest class. Parametres:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | external_id | string |
+ * CustomersRequest class
*
* @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 extends CommonFields
+class CustomersRequest
{
+ use 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" => [...]]);
- * ```
+ * @Type("string")
+ * @Accessor(getter="getExternalId",setter="setExternalId")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'external_id' => 'string'
- ];
+ private $externalId;
+
+ /**
+ * @return string
+ */
+ public function getExternalId()
+ {
+ return $this->externalId;
+ }
+
+ /**
+ * @param string $externalId
+ */
+ public function setExternalId($externalId)
+ {
+ $this->externalId = $externalId;
+ }
}
diff --git a/src/Bot/Model/Request/DialogAssignRequest.php b/src/Bot/Model/Request/DialogAssignRequest.php
index 4bddd54..3837ee1 100644
--- a/src/Bot/Model/Request/DialogAssignRequest.php
+++ b/src/Bot/Model/Request/DialogAssignRequest.php
@@ -13,50 +13,94 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * DialogAssignRequest class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | dialog_id | int |
- * | user_id | int |
- * | bot_id | int |
+ * DialogAssignRequest class
*
* @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 extends LazyJsonMapper
+class DialogAssignRequest
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $dialogId
+ *
+ * @Type("int")
+ * @Accessor(getter="getDialogId,setter="setDialogId")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'dialog_id' => 'int',
- 'user_id' => 'int',
- 'bot_id' => 'int'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/DialogsRequest.php b/src/Bot/Model/Request/DialogsRequest.php
index ba1baed..e2a6a8b 100644
--- a/src/Bot/Model/Request/DialogsRequest.php
+++ b/src/Bot/Model/Request/DialogsRequest.php
@@ -13,56 +13,146 @@
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. Parametres:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | chat_id | int |
- * | user_id | int |
- * | bot_id | int |
- * | active | int |
- * | assign | int |
+ * DialogsRequest class
*
* @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 extends CommonFields
+class DialogsRequest
{
+ use 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" => [...]]);
- * ```
+ * @var int $chatId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChatId",setter="setChatId")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'chat_id' => 'int',
- 'user_id' => 'int',
- 'bot_id' => 'int',
- 'active' => 'int',
- 'assign' => 'int'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/InfoRequest.php b/src/Bot/Model/Request/InfoRequest.php
index 1cdda08..d4a5d43 100644
--- a/src/Bot/Model/Request/InfoRequest.php
+++ b/src/Bot/Model/Request/InfoRequest.php
@@ -13,50 +13,94 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * InfoRequest class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | name | string |
- * | avatarUrl | string |
- * | roles | array |
+ * InfoRequest class
*
* @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 extends LazyJsonMapper
+class InfoRequest
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $name
+ *
+ * @Type("string")
+ * @Accessor(getter="getName",setter="setName")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'name' => 'string',
- 'avatarUrl' => 'string',
- 'roles' => 'string[]'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/MembersRequest.php b/src/Bot/Model/Request/MembersRequest.php
index e4f1f0c..ea4050b 100644
--- a/src/Bot/Model/Request/MembersRequest.php
+++ b/src/Bot/Model/Request/MembersRequest.php
@@ -13,58 +13,144 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MembersRequest class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | chat_id | int |
- * | user_id | int |
- * | state | string |
- * | since | string |
- * | until | string |
+ * MembersRequest class
*
* @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 extends LazyJsonMapper
+class MembersRequest
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $chatId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChatId",setter="setChatId")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'chat_id' => 'int',
- 'user_id' => 'int',
- 'state' => 'string',
- 'since' => 'string',
- 'until' => 'string'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/MessageEditRequest.php b/src/Bot/Model/Request/MessageEditRequest.php
index 513d020..4cf9baa 100644
--- a/src/Bot/Model/Request/MessageEditRequest.php
+++ b/src/Bot/Model/Request/MessageEditRequest.php
@@ -13,46 +13,69 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * MessageEditRequest class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | id | int |
- * | content | string |
+ * MessageEditRequest class
*
* @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 extends LazyJsonMapper
+class MessageEditRequest
{
/**
- * 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" => [...]]);
- * ```
+ * @var int $id
+ *
+ * @Type("int")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'id' => 'int',
- 'content' => 'string'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/MessageSendRequest.php b/src/Bot/Model/Request/MessageSendRequest.php
index efbba5b..254134f 100644
--- a/src/Bot/Model/Request/MessageSendRequest.php
+++ b/src/Bot/Model/Request/MessageSendRequest.php
@@ -13,72 +13,227 @@
namespace RetailCrm\Mg\Bot\Model\Request;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use Symfony\Component\Validator\Constraints as Assert;
use RetailCrm\Mg\Bot\Model\Entity\Order;
use RetailCrm\Mg\Bot\Model\Entity\Product;
/**
* PHP version 7.0
*
- * 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 |
+ * MessageSendRequest class
*
* @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 extends LazyJsonMapper
+class MessageSendRequest
{
/**
- * 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" => [...]]);
- * ```
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
*/
- 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'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/MessagesRequest.php b/src/Bot/Model/Request/MessagesRequest.php
index 7a6c9f0..a32e243 100644
--- a/src/Bot/Model/Request/MessagesRequest.php
+++ b/src/Bot/Model/Request/MessagesRequest.php
@@ -13,72 +13,246 @@
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. 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 |
+ * MessagesRequest class
*
* @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 extends CommonFields
+class MessagesRequest
{
+ use 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" => [...]]);
- * ```
+ * @var int $chatId
+ *
+ * @Type("int")
+ * @Accessor(getter="getChatId",setter="setChatId")
+ * @SkipWhenEmpty
*/
- 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'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Request/UsersRequest.php b/src/Bot/Model/Request/UsersRequest.php
index c38ffc3..3bd40fd 100644
--- a/src/Bot/Model/Request/UsersRequest.php
+++ b/src/Bot/Model/Request/UsersRequest.php
@@ -13,48 +13,90 @@
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. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | external_id | string |
- * | active | int |
- * | online | int |
+ * UsersRequest class
*
* @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 extends CommonFields
+class UsersRequest
{
+ use 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" => [...]]);
- * ```
+ * @Type("string")
+ * @Accessor(getter="getExternalId",setter="setExternalId")
+ * @SkipWhenEmpty
*/
- const JSON_PROPERTY_MAP = [
- 'external_id' => 'string',
- 'active' => 'int',
- 'online' => 'int'
- ];
+ 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;
+ }
}
diff --git a/src/Bot/Model/Response/AssignResponse.php b/src/Bot/Model/Response/AssignResponse.php
index 9830fd3..fd7b0c6 100644
--- a/src/Bot/Model/Response/AssignResponse.php
+++ b/src/Bot/Model/Response/AssignResponse.php
@@ -13,54 +13,122 @@
namespace RetailCrm\Mg\Bot\Model\Response;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\Entity\Responsible;
/**
* PHP version 7.0
*
- * AssignResponse class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------------|-------------|
- * | is_reassign | bool |
- * | left_manager_id | int |
- * | previous_responsible | Responsible |
- * | responsible | Responsible |
+ * AssignResponse class
*
* @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() "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
+class AssignResponse
{
+ use 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" => [...]]);
- * ```
+ * @var bool $isReassign
+ *
+ * @Type("bool")
+ * @Accessor(getter="getIsReassign",setter="setIsReassign")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'is_reassign' => 'bool',
- 'left_manager_id' => 'int',
- 'previous_responsible' => 'Responsible',
- 'responsible' => 'Responsible'
- ];
-}
\ No newline at end of file
+ private $isReassign;
+
+ /**
+ * @var int $leftManagerId
+ *
+ * @Type("int")
+ * @Accessor(getter="getLeftManagerId",setter="setLeftManagerId")
+ * @SkipWhenEmpty()
+ */
+ private $leftManagerId;
+
+ /**
+ * @var Responsible $previousResponsible
+ *
+ * @Type("Responsible")
+ * @Accessor(getter="getPreviousResponsible",setter="setPreviousResponsible")
+ * @SkipWhenEmpty()
+ */
+ private $previousResponsible;
+
+ /**
+ * @var Responsible $responsible
+ *
+ * @Type("Responsible")
+ * @Accessor(getter="getResponsible",setter="setResponsible")
+ * @SkipWhenEmpty()
+ */
+ private $responsible;
+
+ /**
+ * @return bool
+ */
+ public function isReassign(): bool
+ {
+ return $this->isReassign;
+ }
+
+ /**
+ * @param bool $isReassign
+ */
+ public function setIsReassign(bool $isReassign)
+ {
+ $this->isReassign = $isReassign;
+ }
+
+ /**
+ * @return int
+ */
+ public function getLeftManagerId(): int
+ {
+ return $this->leftManagerId;
+ }
+
+ /**
+ * @param int $leftManagerId
+ */
+ public function setLeftManagerId(int $leftManagerId)
+ {
+ $this->leftManagerId = $leftManagerId;
+ }
+
+ /**
+ * @return Responsible
+ */
+ public function getPreviousResponsible(): Responsible
+ {
+ return $this->previousResponsible;
+ }
+
+ /**
+ * @param Responsible $previousResponsible
+ */
+ public function setPreviousResponsible(Responsible $previousResponsible)
+ {
+ $this->previousResponsible = $previousResponsible;
+ }
+
+ /**
+ * @return Responsible
+ */
+ public function getResponsible(): Responsible
+ {
+ return $this->responsible;
+ }
+
+ /**
+ * @param Responsible $responsible
+ */
+ public function setResponsible(Responsible $responsible)
+ {
+ $this->responsible = $responsible;
+ }
+}
diff --git a/src/Bot/Model/Response/CommonFields.php b/src/Bot/Model/Response/CommonFields.php
index de38933..72891d6 100644
--- a/src/Bot/Model/Response/CommonFields.php
+++ b/src/Bot/Model/Response/CommonFields.php
@@ -13,51 +13,52 @@
namespace RetailCrm\Mg\Bot\Model\Response;
-use LazyJsonMapper\LazyJsonMapper;
-use RetailCrm\Mg\Bot\Model\Entity\Error;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
/**
* PHP version 7.0
*
- * Error trait. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | errors | array |
+ * CommonFields trait
*
* @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() "Get `errors` value"
- * @method $this setErrors(array $value) "Set `errors` value"
*/
-class CommonFields extends LazyJsonMapper
+trait 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" => [...]]);
- * ```
+ * @var array $errors
+ *
+ * @Type("array")
+ * @Accessor(getter="getErrors",setter="setErrors")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'errors' => 'string[]'
- ];
+ private $errors;
+
+ /**
+ * @return array
+ */
+ public function getErrors(): array
+ {
+ return $this->errors;
+ }
+
+ /**
+ * @param array $errors
+ */
+ public function setErrors(array $errors)
+ {
+ $this->errors = $errors;
+ }
/**
* @return bool
*/
- public function isError()
+ public function isSuccessful()
{
- return (bool) !empty($this->getErrors());
+ return (bool) empty($this->getErrors());
}
-}
\ No newline at end of file
+}
diff --git a/src/Bot/Model/Response/ErrorOnlyResponse.php b/src/Bot/Model/Response/ErrorOnlyResponse.php
index 62adb6f..82307a1 100644
--- a/src/Bot/Model/Response/ErrorOnlyResponse.php
+++ b/src/Bot/Model/Response/ErrorOnlyResponse.php
@@ -23,4 +23,6 @@ namespace RetailCrm\Mg\Bot\Model\Response;
* @license https://opensource.org/licenses/MIT MIT License
* @link http://help.retailcrm.pro/docs/Developers
*/
-class ErrorOnlyResponse extends CommonFields {}
\ No newline at end of file
+class ErrorOnlyResponse {
+ use CommonFields;
+}
diff --git a/src/Bot/Model/Response/FullFileResponse.php b/src/Bot/Model/Response/FullFileResponse.php
index 53ce746..bc876a6 100644
--- a/src/Bot/Model/Response/FullFileResponse.php
+++ b/src/Bot/Model/Response/FullFileResponse.php
@@ -13,52 +13,121 @@
namespace RetailCrm\Mg\Bot\Model\Response;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+
/**
* PHP version 7.0
*
- * FullFileResponse class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | id | string |
- * | size | int |
- * | type | string |
- * | url | string |
+ * FullFileResponse class
*
* @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() "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
+class FullFileResponse
{
+ use 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" => [...]]);
- * ```
+ * @var string $id
+ *
+ * @Type("string")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'id' => 'string',
- 'size' => 'int',
- 'type' => 'string',
- 'url' => 'string'
- ];
-}
\ No newline at end of file
+ private $id;
+
+ /**
+ * @var int $size
+ *
+ * @Type("int")
+ * @Accessor(getter="getSize",setter="setSize")
+ * @SkipWhenEmpty()
+ */
+ private $size;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
+ */
+ private $type;
+
+ /**
+ * @var string $url
+ *
+ * @Type("string")
+ * @Accessor(getter="getUrl",setter="setUrl")
+ * @SkipWhenEmpty()
+ */
+ private $url;
+
+ /**
+ * @return string
+ */
+ public function getId(): string
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId(string $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSize(): int
+ {
+ return $this->size;
+ }
+
+ /**
+ * @param int $size
+ */
+ public function setSize(int $size)
+ {
+ $this->size = $size;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUrl(): string
+ {
+ return $this->url;
+ }
+
+ /**
+ * @param string $url
+ */
+ public function setUrl(string $url)
+ {
+ $this->url = $url;
+ }
+}
diff --git a/src/Bot/Model/Response/ListResponse.php b/src/Bot/Model/Response/ListResponse.php
index 8f48551..721cb3d 100644
--- a/src/Bot/Model/Response/ListResponse.php
+++ b/src/Bot/Model/Response/ListResponse.php
@@ -13,32 +13,13 @@
namespace RetailCrm\Mg\Bot\Model\Response;
+use RetailCrm\Common\Serializer;
+
/**
* PHP version 7.0
*
- * 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] |
+ * ListResponse class. Used to store multiple objects at once.
+ * Implements `Iterator`, `ArrayAccess` and `Countable`.
*
* @package RetailCrm\Mg\Bot\Model\Response
* @author retailCRM
@@ -73,7 +54,11 @@ class ListResponse implements \Iterator, \ArrayAccess, \Countable {
$this->errors = $data['errors'];
} else {
foreach($data as $item) {
- $this->items[] = new $responseType($item);
+ if (substr($responseType, 0, 1) == '\\') {
+ $responseType = substr($responseType, 1);
+ }
+
+ $this->items[] = Serializer::deserialize($item, $responseType, Serializer::S_ARRAY);
}
}
}
@@ -219,4 +204,4 @@ class ListResponse implements \Iterator, \ArrayAccess, \Countable {
public function valid() {
return isset($this->items[$this->position]);
}
-}
\ No newline at end of file
+}
diff --git a/src/Bot/Model/Response/MessageSendResponse.php b/src/Bot/Model/Response/MessageSendResponse.php
index e392ccb..ea8c5e0 100644
--- a/src/Bot/Model/Response/MessageSendResponse.php
+++ b/src/Bot/Model/Response/MessageSendResponse.php
@@ -13,44 +13,71 @@
namespace RetailCrm\Mg\Bot\Model\Response;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+
/**
* PHP version 7.0
*
- * MessageSendResponse class. Parameters:
- *
- * | Parameter name | Data type |
- * |----------------|-----------|
- * | message_id | int |
- * | time | string |
+ * MessageSendResponse class
*
* @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() "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
+class MessageSendResponse
{
+ use 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" => [...]]);
- * ```
+ * @var int $messageId
+ *
+ * @Type("int")
+ * @Accessor(getter="getMessageId",setter="setMessageId")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'message_id' => 'int',
- 'time' => 'string'
- ];
-}
\ No newline at end of file
+ private $messageId;
+
+ /**
+ * @var string $time
+ *
+ * @Type("string")
+ * @Accessor(getter="getTime",setter="setTime")
+ * @SkipWhenEmpty()
+ */
+ private $time;
+
+ /**
+ * @return int
+ */
+ public function getMessageId(): int
+ {
+ return $this->messageId;
+ }
+
+ /**
+ * @param int $messageId
+ */
+ public function setMessageId(int $messageId)
+ {
+ $this->messageId = $messageId;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTime(): string
+ {
+ return $this->time;
+ }
+
+ /**
+ * @param string $time
+ */
+ public function setTime(string $time)
+ {
+ $this->time = $time;
+ }
+}
diff --git a/src/Bot/Model/Response/UploadFileResponse.php b/src/Bot/Model/Response/UploadFileResponse.php
index 6f9032f..75cda42 100644
--- a/src/Bot/Model/Response/UploadFileResponse.php
+++ b/src/Bot/Model/Response/UploadFileResponse.php
@@ -13,70 +13,222 @@
namespace RetailCrm\Mg\Bot\Model\Response;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
use RetailCrm\Mg\Bot\Model\Entity\FileMeta;
/**
* PHP version 7.0
*
- * 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 |
+ * UploadFileResponse class
*
* @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() "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
+class UploadFileResponse
{
+ use 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" => [...]]);
- * ```
+ * @var string $createdAt
+ *
+ * @Type("string")
+ * @Accessor(getter="getCreatedAt",setter="setCreatedAt")
+ * @SkipWhenEmpty()
*/
- const JSON_PROPERTY_MAP = [
- 'created_at' => 'string',
- 'hash' => 'string',
- 'id' => 'string',
- 'meta' => 'FileMeta',
- 'mime_type' => 'string',
- 'size' => 'int',
- 'source_url' => 'string',
- 'type' => 'string'
- ];
-}
\ No newline at end of file
+ private $createdAt;
+
+ /**
+ * @var string $hash
+ *
+ * @Type("string")
+ * @Accessor(getter="getHash",setter="setHash")
+ * @SkipWhenEmpty()
+ */
+ private $hash;
+
+ /**
+ * @var string $id
+ *
+ * @Type("string")
+ * @Accessor(getter="getId",setter="setId")
+ * @SkipWhenEmpty()
+ */
+ private $id;
+
+ /**
+ * @var FileMeta $meta
+ *
+ * @Type("FileMeta")
+ * @Accessor(getter="getMeta",setter="setMeta")
+ * @SkipWhenEmpty()
+ */
+ private $meta;
+
+ /**
+ * @var string $mimeType
+ *
+ * @Type("string")
+ * @Accessor(getter="getMimeType",setter="setMimeType")
+ * @SkipWhenEmpty()
+ */
+ private $mimeType;
+
+ /**
+ * @var int $size
+ *
+ * @Type("int")
+ * @Accessor(getter="getSize",setter="setSize")
+ * @SkipWhenEmpty()
+ */
+ private $size;
+
+ /**
+ * @var string $time
+ *
+ * @Type("string")
+ * @Accessor(getter="getSourceUrl",setter="setSourceUrl")
+ * @SkipWhenEmpty()
+ */
+ private $sourceUrl;
+
+ /**
+ * @var string $type
+ *
+ * @Type("string")
+ * @Accessor(getter="getType",setter="setType")
+ * @SkipWhenEmpty()
+ */
+ private $type;
+
+ /**
+ * @return string
+ */
+ public function getCreatedAt(): string
+ {
+ return $this->createdAt;
+ }
+
+ /**
+ * @param string $createdAt
+ */
+ public function setCreatedAt(string $createdAt)
+ {
+ $this->createdAt = $createdAt;
+ }
+
+ /**
+ * @return string
+ */
+ public function getHash(): string
+ {
+ return $this->hash;
+ }
+
+ /**
+ * @param string $hash
+ */
+ public function setHash(string $hash)
+ {
+ $this->hash = $hash;
+ }
+
+ /**
+ * @return string
+ */
+ public function getId(): string
+ {
+ return $this->id;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId(string $id)
+ {
+ $this->id = $id;
+ }
+
+ /**
+ * @return FileMeta
+ */
+ public function getMeta(): FileMeta
+ {
+ return $this->meta;
+ }
+
+ /**
+ * @param FileMeta $meta
+ */
+ public function setMeta(FileMeta $meta)
+ {
+ $this->meta = $meta;
+ }
+
+ /**
+ * @return string
+ */
+ public function getMimeType(): string
+ {
+ return $this->mimeType;
+ }
+
+ /**
+ * @param string $mimeType
+ */
+ public function setMimeType(string $mimeType)
+ {
+ $this->mimeType = $mimeType;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSize(): int
+ {
+ return $this->size;
+ }
+
+ /**
+ * @param int $size
+ */
+ public function setSize(int $size)
+ {
+ $this->size = $size;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSourceUrl(): string
+ {
+ return $this->sourceUrl;
+ }
+
+ /**
+ * @param string $sourceUrl
+ */
+ public function setSourceUrl(string $sourceUrl)
+ {
+ $this->sourceUrl = $sourceUrl;
+ }
+
+ /**
+ * @return string
+ */
+ public function getType(): string
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType(string $type)
+ {
+ $this->type = $type;
+ }
+}
diff --git a/src/Register.php b/src/Register.php
index 9d3d6b7..27d36a1 100644
--- a/src/Register.php
+++ b/src/Register.php
@@ -13,71 +13,334 @@
namespace RetailCrm\Common;
-use LazyJsonMapper\LazyJsonMapper;
+use JMS\Serializer\Annotation\Accessor;
+use JMS\Serializer\Annotation\SkipWhenEmpty;
+use JMS\Serializer\Annotation\Type;
+use Symfony\Component\Validator\Constraints as Assert;
/**
* PHP version 7.0
*
- * 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 |
+ * RequestHelper class
*
* @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 extends LazyJsonMapper
+class Register
{
/**
- * @internal
+ * @var string $code
+ *
+ * @Type("string")
+ * @Accessor(getter="getCode",setter="setCode")
+ *
+ * @Assert\NotBlank
*/
- 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'
- ];
+ 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);
+ }
}
diff --git a/src/Serializer.php b/src/Serializer.php
index 290d267..25244c7 100644
--- a/src/Serializer.php
+++ b/src/Serializer.php
@@ -13,6 +13,10 @@
namespace RetailCrm\Common;
+use JMS\Serializer\DeserializationContext;
+use JMS\Serializer\SerializationContext;
+use JMS\Serializer\SerializerBuilder;
+
/**
* PHP version 7.0
*
@@ -25,15 +29,8 @@ namespace RetailCrm\Common;
*/
class Serializer
{
- /**
- * Serialization flag: serialize object to PHP Array
- */
- const S_ARRAY = 0;
-
- /**
- * Serialization flag: serialize object to JSON string
- */
- const S_JSON = 1;
+ const S_ARRAY = 'array';
+ const S_JSON = 'json';
/**
* Serialize given object to JSON or Array
@@ -46,17 +43,64 @@ class Serializer
public static function serialize($request, $serialize = self::S_JSON)
{
$serialized = null;
+ $serializer = SerializerBuilder::create()->build();
+ $context = self::getContext();
switch ($serialize) {
case self::S_ARRAY:
- $serialized = $request->asArray();
+ $serialized = $serializer->toArray($request, $context);
break;
case self::S_JSON:
default:
- $serialized = $request->asJson();
+ $serialized = $serializer->serialize($request, $serialize, $context);
break;
}
return $serialized;
}
+
+ /**
+ * Deserialize given array or JSON to object
+ *
+ * @param $data
+ * @param $entityType
+ * @param string $from
+ *
+ * @return array|object|null
+ */
+ public static function deserialize($data, $entityType, $from = self::S_JSON)
+ {
+ $deserialized = null;
+ $serializer = SerializerBuilder::create()->build();
+ $context = self::getContext(true);
+
+ switch ($from) {
+ case self::S_ARRAY:
+ $deserialized = $serializer->fromArray(array_filter($data), $entityType, $context);
+ break;
+ case self::S_JSON:
+ $deserialized = $serializer->deserialize($data, $entityType, $from, $context);
+ break;
+ }
+
+ return $deserialized;
+ }
+
+ /**
+ * @param bool $deserialization (default: false)
+ *
+ * @return DeserializationContext|SerializationContext
+ */
+ private static function getContext(bool $deserialization = false)
+ {
+ if ($deserialization) {
+ $context = new DeserializationContext();
+ } else {
+ $context = new SerializationContext();
+ }
+
+ $context->setSerializeNull(false);
+
+ return $context;
+ }
}