diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc0e01e..0f69316b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # bitrix24-php-sdk change log -## 2.0-beta.3 — 1.07.2024 +## 2.0-beta.3 — 15.08.2024 ### Added @@ -10,6 +10,7 @@ * `symfony/filesystem` version `^6 || ^7` * `symfony/mime` version `^6 || ^7` * `nesbot/carbon` version `3.3.*` + * `mesilov/moneyphp-percentage` version `0.2.*` * add scope `bizproc` and [services](https://github.com/mesilov/bitrix24-php-sdk/issues/376) for work with workflows: * `Activity` – service for work with application activities: * `add` – adds new activity to a workflow @@ -44,7 +45,7 @@ * add `Bitrix24\SDK\Infrastructure\Filesystem\Base64Encoder` for work with base64 encoding * add `Bitrix24\SDK\Core\Exceptions\FileNotFoundException` if file not found * add `Bitrix24\SDK\Core\Exceptions\MethodConfirmWaitingException` if api call waiting for confirm -* add `Bitrix24\SDK\Core\Exceptions\UserNotFoundOrIsNotActiveException` exception if user not found, or it is not active +* add `Bitrix24\SDK\Core\Exceptions\UserNotFoundOrIsNotActiveException` exception if user not found, or it is not active * add `Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult` result of call UI * add `Bitrix24\SDK\Core\Result\EmptyResult` empty result * add `IncomingRobotRequest` wrapper for data from crm-robot request @@ -54,13 +55,25 @@ * add method `Bitrix24\SDK\Application\Requests\Events\AbstractEventRequest::getAuth` - get event auth token * add method `Bitrix24\SDK\Application\Requests\Events\EventAuthItem` - event auth token * add method `Bitrix24\SDK\Application\Requests\Events\EventInterface` - for event fabrics -* add method `Bitrix24\SDK\Infrastructure\Filesystem\Base64Encoder::encodeCallRecord(string $filename): string` - for work with call records +* add method `Bitrix24\SDK\Infrastructure\Filesystem\Base64Encoder::encodeCallRecord(string $filename): string` - for + work with call records * add class `Bitrix24\SDK\Services\Main\Service\EventManager` - improve DX for work with events lifecycle bind or unbind * add method `Bitrix24\SDK\Services\Main\Common\EventHandlerMetadata` - improve DX for work with install events -* improve DX - add [Rector](https://github.com/rectorphp/rector) for improve code quality and speed up releases cycle +* add enum `Bitrix24\SDK\Services\CRM\Common\Result\DiscountType` +* add exception `Bitrix24\SDK\Core\Exceptions\WrongAuthTypeException` – if you use wrong auth type. +* add class fields filter `Bitrix24\SDK\Core\Fields\FieldsFilter` for fields filtration in result array. +* improve DX – add [Rector](https://github.com/rectorphp/rector) for improve code quality and speed up releases cycle +* improve DX – add attributes for generate documentation and calculate methods coverage. + * command for generate documentation +```shell + php bin/console b24:util:generate-coverage-documentation +``` +* improve DX – add [internal documentation](/docs/EN/documentation.md). ### Changed + * ❗️ migrate from `ramsey/uuid` to `symfony/uid` +* ❗️ migrate from `DateTimeImmutable` to `CarbonImmutable` from [carbon](https://github.com/briannesbitt/carbon) * ❗️ refactor `Bitrix24\SDK\Application\Contracts`: * ❗️ update scope `telephony`, scope fully rewritten @@ -95,34 +108,52 @@ * `get` - method returns user settings * `Voices` - work with voximplant tts voices * `get` - method returns all voximplant voices - * `Line` - work with voximplant sip lines - * `outgoingSipSet` - method sets the selected SIP line as an outgoing line by default. - * `get` - returns list of all of the available outgoing lines - * `outgoingGet` - returns the currently selected line as an outgoing line by default. - * `outgoingSet` - sets the selected line as an outgoing line by default. - * `InfoCall` - work with voximplant info call functional - * `startWithText` - method performs the call to the specified number with automatic voiceover of specified - text - * `startWithSound` - method makes a call to the specified number with playback of .mp3 format file by URL. - * `Url` - work with links for browsing telephony scope pages - * `get` - returns a set of links for browsing telephony scope pages. + * `Line` - work with voximplant sip lines + * `outgoingSipSet` - method sets the selected SIP line as an outgoing line by default. + * `get` - returns list of all of the available outgoing lines + * `outgoingGet` - returns the currently selected line as an outgoing line by default. + * `outgoingSet` - sets the selected line as an outgoing line by default. + * `InfoCall` - work with voximplant info call functional + * `startWithText` - method performs the call to the specified number with automatic voiceover of + specified + text + * `startWithSound` - method makes a call to the specified number with playback of .mp3 format file by + URL. + * `Url` - work with links for browsing telephony scope pages + * `get` - returns a set of links for browsing telephony scope pages. * add events with payload and `TelephonyEventsFabric`: - * `OnExternalCallBackStart` - It is called when a visitor fills out a CRM form for callback. Your application shall be selected in the form settings as the line that to be used for a callback. - * `OnExternalCallStart` - The event handler is called whenever a user clicks a phone number in CRM object to initiate an outbound call. - * `OnVoximplantCallEnd` - The event is raised when conversation ends (history entry). - * `OnVoximplantCallInit` - The event is raised when a call is being initialized (regarding the entry or start of an outbound call). - * `OnVoximplantCallStart` - The event is raised when a conversation starts (operator responds to an inbound call; call recipient responds to an outbound call). + * `OnExternalCallBackStart` - It is called when a visitor fills out a CRM form for callback. Your application + shall be selected in the form settings as the line that to be used for a callback. + * `OnExternalCallStart` - The event handler is called whenever a user clicks a phone number in CRM object to + initiate an outbound call. + * `OnVoximplantCallEnd` - The event is raised when conversation ends (history entry). + * `OnVoximplantCallInit` - The event is raised when a call is being initialized (regarding the entry or start of + an outbound call). + * `OnVoximplantCallStart` - The event is raised when a conversation starts (operator responds to an inbound + call; call recipient responds to an outbound call). * add `TranscriptMessage` – data structure for transcript message item * add `TranscriptMessageSide` – enum for describe side of diarization * add `CallType` – call types enum * add `CrmEntityType` – crm entity type enum * add `PbxType` – pbx type enum * add `SipRegistrationStatus` – pbx sip line registration status -* change signature `Bitrix24\SDK\Core\Credentials\AccessToken::getRefreshToken()?string;` - add nullable option for event tokens +* ❗️ update scope `im`, add service `Notify`: + * `fromSystem` - Sending system notification + * `fromPersonal` - Sending personal notification + * `delete` – Deleting notification + * `markAsRead` - Cancels notification for read messages. + * `markMessagesAsRead` – "Read" the list of notifications, excluding CONFIRM notification type. + * `markMessagesAsUnread` – "Unread" the list of notifications, excluding CONFIRM notification type. + * `confirm` – Interaction with notification buttons + * `answer` – Response to notification, supporting quick reply +* change signature `Bitrix24\SDK\Core\Credentials\AccessToken::getRefreshToken()?string;` - add nullable option for + event tokens * change signature `Bitrix24\SDK\Core\Commands\Command::getName():?string` renamed to `getId():string` - +* add fields and change return types in `Bitrix24\SDK\Services\CRM\Deal\Result\DealProductRowItemResult` +* change typehints in `Bitrix24\SDK\Services\CRM\Activity\Service\Activity::add` ### Deleted + * remove class `Bitrix24\SDK\Application\Requests\Events\OnApplicationInstall\Auth` * remove class `Bitrix24\SDK\Application\Requests\Events\OnApplicationUninstall\Auth` * remove method `Bitrix24\SDK\Core\Response\Response::__destruct` @@ -132,9 +163,9 @@ ### Bugfix -* fix [typehint for Bitrix24 User entity with field ID](https://github.com/mesilov/bitrix24-php-sdk/issues/382) -* fix [default arguments for Bitrix24 User get method](https://github.com/mesilov/bitrix24-php-sdk/issues/381) -* fix [limit argument not worked in batch list and read model](https://github.com/mesilov/bitrix24-php-sdk/issues/389) +* fix [typehint for Bitrix24 User entity with field ID](https://github.com/mesilov/bitrix24-php-sdk/issues/382) +* fix [default arguments for Bitrix24 User get method](https://github.com/mesilov/bitrix24-php-sdk/issues/381) +* fix [limit argument not worked in batch list and read model](https://github.com/mesilov/bitrix24-php-sdk/issues/389) ## 2.0-beta.2 — 1.04.2024 @@ -220,7 +251,8 @@ * fix [typehint at ContactItemResult](https://github.com/mesilov/bitrix24-php-sdk/issues/320) * fix [return types in DealCategoryItemResult](https://github.com/mesilov/bitrix24-php-sdk/issues/322) * fix [add auth node in telephony voximplant events requests](https://github.com/mesilov/bitrix24-php-sdk/issues/331) -* fix [add helper metods isError for registerCallResult fortelephony](https://github.com/mesilov/bitrix24-php-sdk/issues/335) +* +fix [add helper metods isError for registerCallResult fortelephony](https://github.com/mesilov/bitrix24-php-sdk/issues/335) * fix [add return type for crm multifields phone, email, im](https://github.com/mesilov/bitrix24-php-sdk/issues/338) * fix errors in `ShowFieldsDescriptionCommand` metadata reader CLI command * fix errors for `ApplicationProfile` with empty scope @@ -294,11 +326,13 @@ , `createFromPlacementRequest` * -❗️deleted [unused class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `Bitrix24\SDK\Core\Response\DTO\ResponseDataCollection` +❗️deleted [unused class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) +`Bitrix24\SDK\Core\Response\DTO\ResponseDataCollection` * -❗️deleted [redundant class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `Bitrix24\SDK\Core\Response\DTO\Result` +❗️deleted [redundant class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) +`Bitrix24\SDK\Core\Response\DTO\Result` * ❗️deleted [method](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `CoreBuilder::withWebhookUrl`, use method `CoreBuilder::withCredentials` diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index 109e678b..ab879502 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,4 +1,4 @@ -Copyright 2022 Maxim Mesilov +Copyright 2024 Maksim Mesilov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/Makefile b/Makefile index c03dbefd..963281b6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,29 @@ +# This file is part of the bitrix24-php-sdk package. +# +# © Maksim Mesilov +# +# For the full copyright and license information, please view the MIT-LICENSE.txt +# file that was distributed with this source code. + default: @echo "make needs target:" @egrep -e '^\S+' ./Makefile | grep -v default | sed -r 's/://' | sed -r 's/^/ - /' +# load default and personal env-variables +ENV := $(PWD)/tests/.env +ENV_LOCAL := $(PWD)/tests/.env.local +include $(ENV) +include $(ENV_LOCAL) + +debug-show-env: + @echo BITRIX24_WEBHOOK $(BITRIX24_WEBHOOK) + @echo DOCUMENTATION_DEFAULT_TARGET_BRANCH $(DOCUMENTATION_DEFAULT_TARGET_BRANCH) + +# build documentation +build-documentation: + php bin/console b24:util:generate-coverage-documentation --webhook=$(BITRIX24_WEBHOOK) --repository-url=https://github.com/mesilov/bitrix24-php-sdk --repository-branch=$(DOCUMENTATION_DEFAULT_TARGET_BRANCH) --file=docs/EN/Services/bitrix24-php-sdk-methods.md + +# linters lint-phpstan: vendor/bin/phpstan --memory-limit=1G analyse lint-rector: @@ -9,6 +31,7 @@ lint-rector: lint-rector-fix: vendor/bin/rector process +# unit tests test-unit: vendor/bin/phpunit --testsuite unit_tests --display-warnings @@ -17,7 +40,15 @@ test-integration-scope-telephony: vendor/bin/phpunit --testsuite integration_tests_scope_telephony test-integration-scope-workflows: vendor/bin/phpunit --testsuite integration_tests_scope_workflows +test-integration-scope-im: + vendor/bin/phpunit --testsuite integration_tests_scope_im +test-integration-scope-placement: + vendor/bin/phpunit --testsuite integration_tests_scope_placement +test-integration-scope-im-open-lines: + vendor/bin/phpunit --testsuite integration_tests_scope_im_open_lines test-integration-scope-user: vendor/bin/phpunit --testsuite integration_tests_scope_user +test-integration-scope-user-consent: + vendor/bin/phpunit --testsuite integration_tests_scope_user_consent test-integration-core: vendor/bin/phpunit --testsuite integration_tests_core \ No newline at end of file diff --git a/README.md b/README.md index c6dc69ad..920713ba 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ API - level features Performance improvements 🚀 -- [x] Batch queries implemented with [PHP Generators](https://www.php.net/manual/en/language.generators.overview.php) – constant low memory and low CPI usage: +- [x] Batch queries implemented with [PHP Generators](https://www.php.net/manual/en/language.generators.overview.php) – + constant low memory and low CPI usage: - [x] batch read data from bitrix24 - [x] batch write data to bitrix24 - [x] read without count flag @@ -78,9 +79,10 @@ Performance improvements 🚀 process: b24 entities, operate with immutable objects ``` -## Sponsors +## Documentation -Help bitrix24-php-sdk by [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk) +- [Bitrix24 API documentation - English](https://training.bitrix24.com/rest_help/) +- [Internal documentation](docs/EN/documentation.md) for bitrix24-php-sdk ## Requirements @@ -96,28 +98,143 @@ Add `"mesilov/bitrix24-php-sdk": "2.x"` to `composer.json` of your application. ### Work with webhook +1. Go to `/examples/webhook` folder +2. Open console and install dependencies + +```shell +composer install +``` + +3. Open Bitrix24 portal: Developer resources → Other → Inbound webhook +4. Open example file and insert webhook url into `$webhookUrl` + +
+ see example.php file + ```php declare(strict_types=1); use Bitrix24\SDK\Services\ServiceBuilderFactory; -use Monolog\Logger; use Symfony\Component\EventDispatcher\EventDispatcher; +use Monolog\Logger; +use Monolog\Handler\StreamHandler; +use Monolog\Processor\MemoryUsageProcessor; -require_once 'vendor/autoload.php'; +require_once 'vendor/autoload.php'; $webhookUrl = 'INSERT_HERE_YOUR_WEBHOOK_URL'; $log = new Logger('bitrix24-php-sdk'); -$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); +$log->pushHandler(new StreamHandler('bitrix24-php-sdk.log')); +$log->pushProcessor(new MemoryUsageProcessor(true, true)); -// init bitrix24-php-sdk service +// create service builder factory +$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); +// init bitrix24-php-sdk service from webhook $b24Service = $b24ServiceFactory->initFromWebhook($webhookUrl); // work with interested scope var_dump($b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()); -var_dump($b24Service->getCRMScope()->lead()->list([],[],['ID','TITLE'])->getLeads()[0]->TITLE); +// get deals list and address to first element +var_dump($b24Service->getCRMScope()->lead()->list([], [], ['ID', 'TITLE'])->getLeads()[0]->TITLE); +``` + +
+ +5. Call php file in shell + +```shell +php -f example.php +``` + +### Work with local application + +1. Go to `/examples/local-application` folder +2. Open console and install dependencies + +```shell +composer install +``` + +3. Start local development server + +```shell +sudo php -S 127.0.0.1:80 +``` + +4. Expose local server to public via [ngrok](https://ngrok.com/) and remember temporally public url – + `https://****.ngrok-free.app` + +```shell +ngrok http 127.0.0.1 +``` + +5. Check public url from ngrok and see `x-powered-by` header with **200** status-code. + +```shell +curl https://****.ngrok-free.app -I +HTTP/2 200 +content-type: text/html; charset=UTF-8 +date: Mon, 26 Aug 2024 19:09:24 GMT +host: ****.ngrok-free.app +x-powered-by: PHP/8.3.8 +``` + +6. Open Bitrix24 portal: Developer resources → Other → Local application and create new local application: + - `type`: server + - `handler path`: `https://****.ngrok-free.app/index.php` + - `Initial installation path`: `https://****.ngrok-free.app/install.php` + - `Menu item text`: `Test local app` + - `scope`: `crm` +7. Save application parameters in `index.php` file: + - `Application ID (client_id)` — `BITRIX24_PHP_SDK_APPLICATION_CLIENT_ID` + - `Application key (client_secret)` — `BITRIX24_PHP_SDK_APPLICATION_CLIENT_SECRET` + - `Assing permitions (scope)` — `BITRIX24_PHP_SDK_APPLICATION_SCOPE` +
+ see index.php file + +```php +declare(strict_types=1); + +use Bitrix24\SDK\Core\Credentials\AuthToken; +use Bitrix24\SDK\Core\Credentials\ApplicationProfile; +use Bitrix24\SDK\Services\ServiceBuilderFactory; +use Monolog\Handler\StreamHandler; +use Monolog\Logger; +use Monolog\Processor\MemoryUsageProcessor; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; + +require_once 'vendor/autoload.php'; +?> +
+    Application is worked, auth tokens from bitrix24:
+    
+
+pushHandler(new StreamHandler('bitrix24-php-sdk.log')); +$log->pushProcessor(new MemoryUsageProcessor(true, true)); + +$b24ServiceBuilderFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); +$appProfile = ApplicationProfile::initFromArray([ + 'BITRIX24_PHP_SDK_APPLICATION_CLIENT_ID' => 'INSERT_HERE_YOUR_DATA', + 'BITRIX24_PHP_SDK_APPLICATION_CLIENT_SECRET' => 'INSERT_HERE_YOUR_DATA', + 'BITRIX24_PHP_SDK_APPLICATION_SCOPE' => 'INSERT_HERE_YOUR_DATA' +]); +$b24Service = $b24ServiceBuilderFactory->initFromRequest($appProfile, AuthToken::initFromPlacementRequest($request), $request->get('DOMAIN')); + +var_dump($b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()); +// get deals list and address to first element +var_dump($b24Service->getCRMScope()->lead()->list([], [], ['ID', 'TITLE'])->getLeads()[0]->TITLE); ``` +
+8. Save local application in Bitrix24 tab and press «OPEN APPLICATION» button. + + ### Create application for Bitrix24 marketplace if you want to create application you can use production-ready contracts in namespace @@ -126,16 +243,22 @@ if you want to create application you can use production-ready contracts in name - `Bitrix24Accounts` — Store auth tokens and provides [methods](src/Application/Contracts/Bitrix24Accounts/Docs/Bitrix24Accounts.md) for work with Bitrix24 account. -- `ApplicationInstallations` — Store information about [application installation](src/Application/Contracts/ApplicationInstallations/Docs/ApplicationInstallations.md), linked with Bitrix24 Account with auth +- `ApplicationInstallations` — Store information + about [application installation](src/Application/Contracts/ApplicationInstallations/Docs/ApplicationInstallations.md), + linked with Bitrix24 Account with auth tokens. Optional can store links to: - Client contact person: client person who responsible for application usage - Bitrix24 Partner contact person: partner contact person who supports client and configure application - Bitrix24 Partner: partner who supports client portal -- `ContactPersons` – Store information [about person](src/Application/Contracts/ContactPersons/Docs/ContactPersons.md) who installed application. -- `Bitrix24Partners` – Store information about [Bitrix24 Partner](src/Application/Contracts/Bitrix24Partners/Docs/Bitrix24Partners.md) who supports client portal and install or configure application. +- `ContactPersons` – Store information [about person](src/Application/Contracts/ContactPersons/Docs/ContactPersons.md) + who installed application. +- `Bitrix24Partners` – Store information + about [Bitrix24 Partner](src/Application/Contracts/Bitrix24Partners/Docs/Bitrix24Partners.md) who supports client + portal and install or configure application. Steps: -1. Create own entity of this bounded contexts. + +1. Create own entity of this bounded contexts. 2. Implement all methods in contract interfaces. 3. Test own implementation behavior with contract-tests `tests/Unit/Application/Contracts/*` – examples. @@ -151,6 +274,7 @@ Call in command line ```shell make lint-phpstan ``` + ### PHP Static Analysis Tool – rector Call in command line for validate @@ -158,6 +282,7 @@ Call in command line for validate ```shell make lint-rector ``` + Call in command line for fix codebase ```shell @@ -218,10 +343,10 @@ Maksim Mesilov - mesilov.maxim@gmail.com See also the list of [contributors](https://github.com/mesilov/bitrix24-php-sdk/graphs/contributors) which participated in this project. -## Need custom Bitrix24 application? +## Sponsors -mesilov.maxim@gmail.com for private consultations or dedicated support +Help bitrix24-php-sdk by [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk) -## Documentation +## Need custom Bitrix24 application? -[Bitrix24 API documentation - English](https://training.bitrix24.com/rest_help/) +Email to mesilov.maxim@gmail.com for private consultations or dedicated support. \ No newline at end of file diff --git a/bin/console b/bin/console index 5a561cd4..b94007cc 100644 --- a/bin/console +++ b/bin/console @@ -1,8 +1,20 @@ #!/usr/bin/env php + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +use Bitrix24\SDK\Attributes\Services\AttributesParser; +use Bitrix24\SDK\Services\ServiceBuilderFactory; use Bitrix24\SDK\Tools\Commands\CopyPropertyValues; use Bitrix24\SDK\Tools\Commands\GenerateContactsCommand; +use Bitrix24\SDK\Infrastructure\Console\Commands; use Bitrix24\SDK\Tools\Commands\PerformanceBenchmarks\ListCommand; use Bitrix24\SDK\Tools\Commands\ShowFieldsDescriptionCommand; use Monolog\Handler\StreamHandler; @@ -12,6 +24,8 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\ErrorHandler\Debug; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Typhoon\Reflection\TyphoonReflector; if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL; @@ -55,4 +69,10 @@ $application->add(new GenerateContactsCommand($log)); $application->add(new ListCommand($log)); $application->add(new ShowFieldsDescriptionCommand($log)); $application->add(new CopyPropertyValues($log)); +$application->add(new Commands\GenerateCoverageDocumentationCommand( + new AttributesParser(TyphoonReflector::build(), new Symfony\Component\Filesystem\Filesystem()), + new ServiceBuilderFactory(new EventDispatcher(), $log), + new Symfony\Component\Finder\Finder(), + new Symfony\Component\Filesystem\Filesystem(), + $log)); $application->run($input); \ No newline at end of file diff --git a/composer.json b/composer.json index 5ec8df5b..36f3e0d1 100644 --- a/composer.json +++ b/composer.json @@ -33,11 +33,13 @@ "darsyn/ip": "^4 || ^5", "nesbot/carbon": "^3", "moneyphp/money": "^3 || ^4", + "mesilov/moneyphp-percentage": "^0.2", "symfony/http-client": "^6 || ^7", "symfony/console": "^6 || ^7", "symfony/dotenv": "^6 || ^7", "symfony/filesystem": "^6 || ^7", "symfony/mime": "^6 || ^7", + "symfony/finder": "^6 || ^7", "symfony/http-client-contracts": "^2 || ^3", "symfony/http-foundation": "^6 || ^7", "symfony/event-dispatcher": "^6 || ^7", @@ -53,7 +55,8 @@ "rector/rector": "^1", "roave/security-advisories": "dev-master", "symfony/debug-bundle": "^6 || ^7", - "symfony/stopwatch": "^6 || ^7" + "symfony/stopwatch": "^6 || ^7", + "typhoon/reflection": "^0.4" }, "autoload": { "psr-4": { diff --git a/docs/EN/Development/dev.md b/docs/EN/Development/dev.md new file mode 100644 index 00000000..2e35896c --- /dev/null +++ b/docs/EN/Development/dev.md @@ -0,0 +1,17 @@ +# How to build bitrix24-php-sdk + +## How to rebuild documentation + +Use cli-command + +```shell +make build-documentation +``` + +## How to add new scope + +1. Add new scope in scope enum `src/Core/Credentials/Scope.php`. +2. Add new scope folder in `src/Services/` folder and add services. +3. Add new integration tests in mirror scope folder in `tests/Integration/Services`. +4. Add new scope support in phpunit `phpunit.xml.dist` testsuite list +5. Add new scope support in `Makefile` \ No newline at end of file diff --git a/docs/EN/Services/bitrix24-php-sdk-methods.md b/docs/EN/Services/bitrix24-php-sdk-methods.md new file mode 100644 index 00000000..1ce25734 --- /dev/null +++ b/docs/EN/Services/bitrix24-php-sdk-methods.md @@ -0,0 +1,164 @@ +## All bitrix24-php-sdk methods + +| **Scope** | **API method with documentation** | **Description** | Method in SDK | +|-----------|----------------------------------------|------------------|----------------| +|`–`|[server.time](https://training.bitrix24.com/rest_help/general/server_time.php)|Method returns current server time in the format YYYY-MM-DDThh:mm:ss±hh:mm.|[`Bitrix24\SDK\Services\Main\Service\Main::getServerTime`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L44-L47)
Return type
[`Bitrix24\SDK\Services\Main\Result\ServerTimeResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/ServerTimeResult.php)| +|`–`|[profile](https://training.bitrix24.com/rest_help/general/profile.php)|Allows to return basic Information about the current user without any scopes, in contrast to user.current.|[`Bitrix24\SDK\Services\Main\Service\Main::getCurrentUserProfile`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L61-L64)
Return type
[`Bitrix24\SDK\Services\Main\Result\UserProfileResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/UserProfileResult.php)| +|`–`|[access.name](https://training.bitrix24.com/rest_help/general/access_name.php)|Returns access permission names.|[`Bitrix24\SDK\Services\Main\Service\Main::getAccessName`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L79-L84)
Return type
[`Bitrix24\SDK\Core\Response\Response`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Response/Response.php)| +|`–`|[user.access](https://training.bitrix24.com/rest_help/general/user_access.php)|Checks if the current user has at least one permission of those specified by the ACCESS parameter.|[`Bitrix24\SDK\Services\Main\Service\Main::checkUserAccess`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L99-L104)
Return type
[`Bitrix24\SDK\Core\Response\Response`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Response/Response.php)| +|`–`|[method.get](https://training.bitrix24.com/rest_help/general/method_get.php)|Method returns 2 parameters - isExisting and isAvailable|[`Bitrix24\SDK\Services\Main\Service\Main::getMethodAffordability`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L119-L126)
Return type
[`Bitrix24\SDK\Services\Main\Result\MethodAffordabilityResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/MethodAffordabilityResult.php)| +|`–`|[scope](https://training.bitrix24.com/rest_help/general/scope.php)|Method will return a list of all possible permissions.|[`Bitrix24\SDK\Services\Main\Service\Main::getAvailableScope`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L157-L160)
Return type
[`Bitrix24\SDK\Core\Response\Response`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Response/Response.php)| +|`–`|[methods](https://training.bitrix24.com/rest_help/general/methods.php)|Returns the methods available to the current application|[`Bitrix24\SDK\Services\Main\Service\Main::getMethodsByScope`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L212-L215)
Return type
[`Bitrix24\SDK\Core\Response\Response`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Response/Response.php)| +|`–`|[app.info](https://training.bitrix24.com/rest_help/general/app_info.php)|Displays application information. The method supports secure calling convention.|[`Bitrix24\SDK\Services\Main\Service\Main::getApplicationInfo`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L229-L232)
Return type
[`Bitrix24\SDK\Services\Main\Result\ApplicationInfoResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/ApplicationInfoResult.php)| +|`–`|[user.admin](https://training.bitrix24.com/rest_help/general/user_admin.php)|Checks if a current user has permissions to manage application parameters.|[`Bitrix24\SDK\Services\Main\Service\Main::isCurrentUserHasAdminRights`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Main.php#L246-L249)
Return type
[`Bitrix24\SDK\Services\Main\Result\IsUserAdminResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/IsUserAdminResult.php)| +|`catalog`|[catalog.catalog.get](https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_get.php)|The method gets field values of commercial catalog by ID.|[`Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Catalog/Service/Catalog.php#L41-L44)
Return type
[`Bitrix24\SDK\Services\Catalog\Catalog\Result\CatalogResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Catalog/Result/CatalogResult.php)| +|`catalog`|[catalog.catalog.list](https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_list.php)|The method gets field value of commercial catalog product list|[`Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Catalog/Service/Catalog.php#L58-L66)
Return type
[`Bitrix24\SDK\Services\Catalog\Catalog\Result\CatalogsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Catalog/Result/CatalogsResult.php)| +|`catalog`|[catalog.catalog.getFields](https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_getfields.php)|Retrieves the fields for the catalog.|[`Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Catalog/Service/Catalog.php#L81-L84)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`catalog`|[catalog.product.get](https://training.bitrix24.com/rest_help/catalog/product/catalog_product_get.php)|The method gets field value of commercial catalog product by ID.|[`Bitrix24\SDK\Services\Catalog\Product\Service\Product::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Service/Product.php#L55-L58)
Return type
[`Bitrix24\SDK\Services\Catalog\Product\Result\ProductResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Result/ProductResult.php)| +|`catalog`|[catalog.product.add](https://training.bitrix24.com/rest_help/catalog/product/catalog_product_add.php)|The method adds a commercial catalog product.|[`Bitrix24\SDK\Services\Catalog\Product\Service\Product::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Service/Product.php#L72-L78)
Return type
[`Bitrix24\SDK\Services\Catalog\Product\Result\ProductResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Result/ProductResult.php)| +|`catalog`|[catalog.product.delete](https://training.bitrix24.com/rest_help/catalog/product/catalog_product_delete.php)|The method deletes commercial catalog product by ID|[`Bitrix24\SDK\Services\Catalog\Product\Service\Product::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Service/Product.php#L92-L95)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`catalog`|[catalog.product.list](https://training.bitrix24.com/rest_help/catalog/product/catalog_product_list.php)|The method gets list of commercial catalog products by filter.|[`Bitrix24\SDK\Services\Catalog\Product\Service\Product::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Service/Product.php#L109-L117)
Return type
[`Bitrix24\SDK\Services\Catalog\Product\Result\ProductsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Result/ProductsResult.php)| +|`catalog`|[catalog.product.getFieldsByFilter](https://training.bitrix24.com/rest_help/catalog/product/catalog_product_getfieldsbyfilter.php)|The method returns commercial catalog product fields by filter.|[`Bitrix24\SDK\Services\Catalog\Product\Service\Product::fieldsByFilter`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Catalog/Product/Service/Product.php#L131-L142)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.settings.mode.get](https://training.bitrix24.com/rest_help/crm/mode/crm_settings_mode_get.php)|The method returns current settings for CRM mode|[`Bitrix24\SDK\Services\CRM\Settings\Service\Settings::modeGet`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Settings/Service/Settings.php#L37-L40)
Return type
[`Bitrix24\SDK\Services\CRM\Settings\Result\SettingsModeResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Settings/Result/SettingsModeResult.php)| +|`crm`|[crm.userfield.types](https://training.bitrix24.com/rest_help/crm/userfields/crm_userfield_types.php)|Returns list of user field types.|[`Bitrix24\SDK\Services\CRM\Userfield\Service\Userfield::types`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Userfield/Service/Userfield.php#L41-L44)
Return type
[`Bitrix24\SDK\Services\CRM\Userfield\Result\UserfieldTypesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Userfield/Result/UserfieldTypesResult.php)| +|`crm`|[crm.userfield.fields](https://training.bitrix24.com/rest_help/crm/userfields/crm_userfield_fields.php)|Returns field description for user fields.|[`Bitrix24\SDK\Services\CRM\Userfield\Service\Userfield::enumerationFields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Userfield/Service/Userfield.php#L77-L80)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.dealcategory.add](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_add.php)|Add new deal category|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L55-L65)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`crm`|[crm.dealcategory.delete](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_delete.php)|Delete deal category|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L83-L93)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.dealcategory.fields](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_fields.php)|Returns field description for deal categories|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L109-L112)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.dealcategory.default.get](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_default_get.php)|he method reads settings for general deal category|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::getDefaultCategorySettings`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L127-L130)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealCategoryResult.php)| +|`crm`|[crm.dealcategory.default.set](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_default_set.php)|The method writes settings for general deal category.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::setDefaultCategorySettings`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L150-L153)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.dealcategory.get](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_get.php)|Returns deal category by the ID|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L172-L182)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealCategoryResult.php)| +|`crm`|[crm.dealcategory.list](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_status.php)|Returns directory type ID for storage deal categories by the ID.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::getStatus`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L234-L244)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryStatusResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealCategoryStatusResult.php)| +|`crm`|[crm.dealcategory.update](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_update.php)|Updates an existing category.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategory::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategory.php#L269-L280)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.dealcategory.stage.list](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_stage_list.php)|Returns list of deal stages for category by the ID. Equivalent to calling crm.status.list method with parameter ENTITY_ID equal to the result of calling crm.dealcategory.status method.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealCategoryStage::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealCategoryStage.php#L38-L48)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryStagesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealCategoryStagesResult.php)| +|`crm`|[crm.deal.add](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_add.php)|Add new deal|[`Bitrix24\SDK\Services\CRM\Deal\Service\Deal::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/Deal.php#L105-L116)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.deal.delete](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_delete.php)|Delete deal|[`Bitrix24\SDK\Services\CRM\Deal\Service\Deal::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/Deal.php#L134-L144)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.deal.fields](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_get.php)|Get deal by id|[`Bitrix24\SDK\Services\CRM\Deal\Service\Deal::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/Deal.php#L181-L184)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealResult.php)| +|`crm`|[crm.deal.list](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_list.php)|Get deal list by filter|[`Bitrix24\SDK\Services\CRM\Deal\Service\Deal::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/Deal.php#L205-L218)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealsResult.php)

⚡️Batch methods:
| +|`crm`|[crm.deal.update](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_update.php)|Update deal list by filter|[`Bitrix24\SDK\Services\CRM\Deal\Service\Deal::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/Deal.php#L277-L289)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.deal.productrows.get](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_productrows_get.php)|Returns products inside the specified deal.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealProductRows::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealProductRows.php#L45-L68)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealProductRowItemsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealProductRowItemsResult.php)| +|`crm`|[crm.deal.productrows.set](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_productrows_set.php)|Creates or updates product entries inside the specified deal.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealProductRows::set`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealProductRows.php#L108-L119)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.deal.userfield.list](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_list.php)|Returns list of user deal fields by filter.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealUserfield::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealUserfield.php#L87-L98)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealUserfieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealUserfieldsResult.php)| +|`crm`|[crm.deal.userfield.add](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_add.php)|Created new user field for deals.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealUserfield::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealUserfield.php#L139-L159)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`crm`|[crm.deal.userfield.delete](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_delete.php)|Deleted userfield for deals|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealUserfield::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealUserfield.php#L177-L187)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.deal.userfield.get](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_get.php)|Returns a userfield for deal by ID.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealUserfield::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealUserfield.php#L204-L214)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealUserfieldResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealUserfieldResult.php)| +|`crm`|[crm.deal.userfield.update](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_update.php)|Updates an existing user field for deals.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealUserfield::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealUserfield.php#L232-L243)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.deal.contact.add](https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_stage_list.php)|Adds contact to specified deal.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealContact::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealContact.php#L49-L64)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`crm`|[crm.deal.contact.fields](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_fields.php)|Returns field descriptions for the deal-contact link used by methods of family crm.deal.contact.*|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealContact::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealContact.php#L78-L81)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.deal.contact.items.get](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_get.php)|Returns a set of contacts, associated with the specified deal.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealContact::itemsGet`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealContact.php#L99-L109)
Return type
[`Bitrix24\SDK\Services\CRM\Deal\Result\DealContactItemsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Result/DealContactItemsResult.php)| +|`crm`|[crm.deal.contact.items.delete](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_delete.php)|Clears a set of contacts, associated with the specified deal.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealContact::itemsDelete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealContact.php#L127-L137)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.deal.contact.items.set](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_set.php)|Set a set of contacts, associated with the specified seal.|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealContact::itemsSet`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealContact.php#L160-L171)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.deal.contact.delete](https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_set.php)|Deletes contact from a specified deal|[`Bitrix24\SDK\Services\CRM\Deal\Service\DealContact::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Deal/Service/DealContact.php#L190-L203)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.contact.add](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_add.php)|Creates a new contact.|[`Bitrix24\SDK\Services\CRM\Contact\Service\Contact::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/Contact.php#L117-L128)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.contact.delete](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_delete.php)|Delete a contact.|[`Bitrix24\SDK\Services\CRM\Contact\Service\Contact::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/Contact.php#L146-L156)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.contact.fields](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_fields.php)|Returns the description of contact|[`Bitrix24\SDK\Services\CRM\Contact\Service\Contact::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/Contact.php#L172-L175)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.contact.get](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_get.php)|Returns a contact by the specified contact ID|[`Bitrix24\SDK\Services\CRM\Contact\Service\Contact::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/Contact.php#L193-L203)
Return type
[`Bitrix24\SDK\Services\CRM\Contact\Result\ContactResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Result/ContactResult.php)| +|`crm`|[crm.contact.list](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_list.php)|Returns a list of contacts selected by the filter specified as the parameter. |[`Bitrix24\SDK\Services\CRM\Contact\Service\Contact::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/Contact.php#L321-L334)
Return type
[`Bitrix24\SDK\Services\CRM\Contact\Result\ContactsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Result/ContactsResult.php)

⚡️Batch methods:
| +|`crm`|[crm.contact.update](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_update.php)|Update contact by id|[`Bitrix24\SDK\Services\CRM\Contact\Service\Contact::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/Contact.php#L401-L413)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.contact.userfield.list](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_list.php)|Returns list of user custom fields for contacts by filter. Prints information about these fields, only identifier and without a title assigned to the field by the user. |[`Bitrix24\SDK\Services\CRM\Contact\Service\ContactUserfield::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/ContactUserfield.php#L85-L96)
Return type
[`Bitrix24\SDK\Services\CRM\Contact\Result\ContactUserfieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Result/ContactUserfieldsResult.php)| +|`crm`|[crm.contact.userfield.add](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_add.php)|Creates a new user field for contacts.|[`Bitrix24\SDK\Services\CRM\Contact\Service\ContactUserfield::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/ContactUserfield.php#L137-L157)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`crm`|[crm.contact.userfield.delete](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_delete.php)|Delete a user by Id|[`Bitrix24\SDK\Services\CRM\Contact\Service\ContactUserfield::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/ContactUserfield.php#L175-L185)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.contact.userfield.get](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_get.php)|Get a user by Id|[`Bitrix24\SDK\Services\CRM\Contact\Service\ContactUserfield::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/ContactUserfield.php#L202-L212)
Return type
[`Bitrix24\SDK\Services\CRM\Contact\Result\ContactUserfieldResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Result/ContactUserfieldResult.php)| +|`crm`|[crm.contact.userfield.update](https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_update.php)|Update a user by Id|[`Bitrix24\SDK\Services\CRM\Contact\Service\ContactUserfield::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Contact/Service/ContactUserfield.php#L230-L241)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.activity.add](https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_add.php)|Creates and adds a new activity.|[`Bitrix24\SDK\Services\CRM\Activity\Service\Activity::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Service/Activity.php#L110-L120)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.activity.delete](https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_delete.php)|Deletes the specified activity and all the associated objects.|[`Bitrix24\SDK\Services\CRM\Activity\Service\Activity::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Service/Activity.php#L138-L148)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.activity.fields](https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_fields.php)|Returns the description of activity fields|[`Bitrix24\SDK\Services\CRM\Activity\Service\Activity::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Service/Activity.php#L164-L167)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.activity.get](https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_get.php)|Returns activity by the specified activity ID|[`Bitrix24\SDK\Services\CRM\Activity\Service\Activity::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Service/Activity.php#L185-L195)
Return type
[`Bitrix24\SDK\Services\CRM\Activity\Result\ActivityResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Result/ActivityResult.php)| +|`crm`|[crm.activity.list](https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php)|Returns a list of activity selected by the filter specified as the parameter. See the example for the filter notation.|[`Bitrix24\SDK\Services\CRM\Activity\Service\Activity::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Service/Activity.php#L306-L319)
Return type
[`Bitrix24\SDK\Services\CRM\Activity\Result\ActivitiesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Result/ActivitiesResult.php)

⚡️Batch methods:
| +|`crm`|[crm.activity.update](https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_update.php)|Updates the specified (existing) activity.|[`Bitrix24\SDK\Services\CRM\Activity\Service\Activity::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Activity/Service/Activity.php#L382-L393)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.product.add](https://training.bitrix24.com/rest_help/crm/products/crm_product_add.php)|Add new product|[`Bitrix24\SDK\Services\CRM\Product\Service\Product::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Service/Product.php#L87-L97)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.product.delete](https://training.bitrix24.com/rest_help/crm/products/crm_product_delete.php)|Delete product by id|[`Bitrix24\SDK\Services\CRM\Product\Service\Product::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Service/Product.php#L115-L125)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.product.get](https://training.bitrix24.com/rest_help/crm/products/crm_product_get.php)|Returns a product by the product id.|[`Bitrix24\SDK\Services\CRM\Product\Service\Product::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Service/Product.php#L143-L146)
Return type
[`Bitrix24\SDK\Services\CRM\Product\Result\ProductResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Result/ProductResult.php)| +|`crm`|[crm.product.fields](https://training.bitrix24.com/rest_help/crm/products/crm_product_fields.php)|Returns the description of the product fields, including user fields.|[`Bitrix24\SDK\Services\CRM\Product\Service\Product::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Service/Product.php#L162-L165)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.product.list](https://training.bitrix24.com/rest_help/crm/products/crm_product_list.php)|Get list of product items.|[`Bitrix24\SDK\Services\CRM\Product\Service\Product::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Service/Product.php#L186-L199)
Return type
[`Bitrix24\SDK\Services\CRM\Product\Result\ProductsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Result/ProductsResult.php)

⚡️Batch methods:
| +|`crm`|[crm.product.update](https://training.bitrix24.com/rest_help/crm/products/crm_product_update.php)|Updates the specified (existing) product.|[`Bitrix24\SDK\Services\CRM\Product\Service\Product::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Product/Service/Product.php#L240-L251)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.lead.add](https://training.bitrix24.com/rest_help/crm/leads/crm_lead_add.php)|Method adds new lead|[`Bitrix24\SDK\Services\CRM\Lead\Service\Lead::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Service/Lead.php#L124-L135)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.lead.delete](https://training.bitrix24.com/rest_help/crm/leads/crm_lead_delete.php)|Deletes the specified lead and all the associated objects.|[`Bitrix24\SDK\Services\CRM\Lead\Service\Lead::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Service/Lead.php#L153-L163)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.lead.fields](https://training.bitrix24.com/rest_help/crm/leads/crm_lead_fields.php)|Returns the description of the lead fields, including user fields.|[`Bitrix24\SDK\Services\CRM\Lead\Service\Lead::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Service/Lead.php#L179-L182)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.lead.get](https://training.bitrix24.com/rest_help/crm/leads/crm_lead_get.php)|Returns a lead by the lead ID.|[`Bitrix24\SDK\Services\CRM\Lead\Service\Lead::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Service/Lead.php#L200-L203)
Return type
[`Bitrix24\SDK\Services\CRM\Lead\Result\LeadResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Result/LeadResult.php)| +|`crm`|[crm.lead.list](https://training.bitrix24.com/rest_help/crm/leads/crm_lead_list.php)|Get list of lead items.|[`Bitrix24\SDK\Services\CRM\Lead\Service\Lead::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Service/Lead.php#L224-L237)
Return type
[`Bitrix24\SDK\Services\CRM\Lead\Result\LeadsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Result/LeadsResult.php)

⚡️Batch methods:
| +|`crm`|[crm.lead.update](https://training.bitrix24.com/rest_help/crm/leads/crm_lead_update.php)|Updates the specified (existing) lead.|[`Bitrix24\SDK\Services\CRM\Lead\Service\Lead::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Lead/Service/Lead.php#L316-L328)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.item.add](https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_add.php)|Method creates new SPA item with entityTypeId.|[`Bitrix24\SDK\Services\CRM\Item\Service\Item::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Service/Item.php#L58-L69)
Return type
[`Bitrix24\SDK\Services\CRM\Item\Result\ItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Result/ItemResult.php)

⚡️Batch methods:
| +|`crm`|[crm.item.delete](https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_delete.php)|Deletes item with id for SPA with entityTypeId.|[`Bitrix24\SDK\Services\CRM\Item\Service\Item::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Service/Item.php#L88-L95)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`crm`|[crm.item.fields](https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_fields.php)|Returns the fields data with entityTypeId.|[`Bitrix24\SDK\Services\CRM\Item\Service\Item::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Service/Item.php#L112-L115)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`crm`|[crm.item.get](https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_get.php)|Returns item data with id for SPA with entityTypeId.|[`Bitrix24\SDK\Services\CRM\Item\Service\Item::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Service/Item.php#L130-L133)
Return type
[`Bitrix24\SDK\Services\CRM\Item\Result\ItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Result/ItemResult.php)| +|`crm`|[crm.item.list](https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_list.php)|Returns array with SPA items with entityTypeId|[`Bitrix24\SDK\Services\CRM\Item\Service\Item::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Service/Item.php#L148-L162)
Return type
[`Bitrix24\SDK\Services\CRM\Item\Result\ItemsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Result/ItemsResult.php)

⚡️Batch methods:
| +|`crm`|[crm.item.update](https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_update.php)|Updates the specified (existing) item.|[`Bitrix24\SDK\Services\CRM\Item\Service\Item::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Item/Service/Item.php#L177-L189)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`crm`|[crm.duplicate.findbycomm](https://training.bitrix24.com/rest_help/crm/auxiliary/duplicates/crm.duplicate.findbycomm.php)|The method returns IDs for leads, contacts or companies that contain the specified phone numbers or e-mails.|[`Bitrix24\SDK\Services\CRM\Duplicates\Service\Duplicate::findByEmail`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Duplicates/Service/Duplicate.php#L61-L69)
Return type
[`Bitrix24\SDK\Services\CRM\Duplicates\Result\DuplicateResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/CRM/Duplicates/Result/DuplicateResult.php)| +|`bizproc`|[bizproc.activity.log](https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_list.php)|This method records data in the workflow log.|[`Bitrix24\SDK\Services\Workflows\Activity\Service\Activity::log`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Service/Activity.php#L55-L61)
Return type
[`Bitrix24\SDK\Services\Workflows\Activity\Result\AddedMessageToLogResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Result/AddedMessageToLogResult.php)| +|`bizproc`|[bizproc.activity.list](https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_list.php)|This method returns list of activities, installed by the application.|[`Bitrix24\SDK\Services\Workflows\Activity\Service\Activity::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Service/Activity.php#L75-L78)
Return type
[`Bitrix24\SDK\Services\Workflows\Activity\Result\WorkflowActivitiesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Result/WorkflowActivitiesResult.php)| +|`bizproc`|[bizproc.activity.add](https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_add.php)|Adds new activity to a workflow.|[`Bitrix24\SDK\Services\Workflows\Activity\Service\Activity::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Service/Activity.php#L105-L132)
Return type
[`Bitrix24\SDK\Services\Workflows\Activity\Result\AddedActivityResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Result/AddedActivityResult.php)| +|`bizproc`|[bizproc.activity.delete](https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_delete.php)|This method deletes an activity.|[`Bitrix24\SDK\Services\Workflows\Activity\Service\Activity::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Service/Activity.php#L147-L153)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`bizproc`|[bizproc.activity.update](https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_update.php)|This method allows to update activity fields. Method parameters are similar to bizproc.activity.add.|[`Bitrix24\SDK\Services\Workflows\Activity\Service\Activity::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Service/Activity.php#L180-L234)
Return type
[`Bitrix24\SDK\Services\Workflows\Activity\Result\UpdateActivityResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Activity/Result/UpdateActivityResult.php)| +|`bizproc`|[bizproc.workflow.template.add](https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_add.php)|Add a workflow template, requires administrator access permissions|[`Bitrix24\SDK\Services\Workflows\Template\Service\Template::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Template/Service/Template.php#L57-L72)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`bizproc`|[bizproc.workflow.template.update](https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_update.php)|Update workflow template|[`Bitrix24\SDK\Services\Workflows\Template\Service\Template::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Template/Service/Template.php#L92-L127)
Return type
[``](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/)| +|`bizproc`|[bizproc.workflow.template.delete](https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_delete.php)|The method deletes workflow template. Requires the administrator access permissions.|[`Bitrix24\SDK\Services\Workflows\Template\Service\Template::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Template/Service/Template.php#L145-L150)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`bizproc`|[bizproc.workflow.template.list](https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_list.php)|The method bizproc.workflow.template.list returns list of workflow templates, specified for a site. |[`Bitrix24\SDK\Services\Workflows\Template\Service\Template::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Template/Service/Template.php#L164-L177)
Return type
[`Bitrix24\SDK\Services\Workflows\Template\Result\WorkflowTemplatesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Template/Result/WorkflowTemplatesResult.php)| +|`bizproc`|[bizproc.robot.add](https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_add.php)|Registers new automation rule.|[`Bitrix24\SDK\Services\Workflows\Robot\Service\Robot::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Service/Robot.php#L57-L78)
Return type
[`Bitrix24\SDK\Services\Workflows\Robot\Result\AddedRobotResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Result/AddedRobotResult.php)| +|`bizproc`|[bizproc.robot.list](https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_list.php)|This method returns list of automation rules, registered by the application.|[`Bitrix24\SDK\Services\Workflows\Robot\Service\Robot::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Service/Robot.php#L92-L95)
Return type
[`Bitrix24\SDK\Services\Workflows\Robot\Result\WorkflowRobotsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Result/WorkflowRobotsResult.php)| +|`bizproc`|[bizproc.robot.delete](https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_delete.php)|This method deletes registered automation rule.|[`Bitrix24\SDK\Services\Workflows\Robot\Service\Robot::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Service/Robot.php#L110-L116)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`bizproc`|[bizproc.robot.update](https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_update.php)|updates fields of automation rules|[`Bitrix24\SDK\Services\Workflows\Robot\Service\Robot::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Service/Robot.php#L133-L175)
Return type
[`Bitrix24\SDK\Services\Workflows\Robot\Result\UpdateRobotResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Robot/Result/UpdateRobotResult.php)| +|`bizproc`|[bizproc.workflow.kill](https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_kill.php)|Deletes a launched workflow|[`Bitrix24\SDK\Services\Workflows\Workflow\Service\Workflow::kill`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Service/Workflow.php#L52-L57)
Return type
[`Bitrix24\SDK\Services\Workflows\Workflow\Result\WorkflowKillResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Result/WorkflowKillResult.php)| +|`bizproc`|[bizproc.workflow.terminate](https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_terminate.php)|Stops an active workflow.|[`Bitrix24\SDK\Services\Workflows\Workflow\Service\Workflow::terminate`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Service/Workflow.php#L70-L76)
Return type
[`Bitrix24\SDK\Services\Workflows\Workflow\Result\WorkflowTerminationResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Result/WorkflowTerminationResult.php)| +|`bizproc`|[bizproc.workflow.start](https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_start.php)|Launches a workflow|[`Bitrix24\SDK\Services\Workflows\Workflow\Service\Workflow::start`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Service/Workflow.php#L92-L144)
Return type
[`Bitrix24\SDK\Services\Workflows\Workflow\Result\WorkflowInstanceStartResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Result/WorkflowInstanceStartResult.php)| +|`bizproc`|[bizproc.workflow.instances](https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_instances.php)|returns list of launched workflows|[`Bitrix24\SDK\Services\Workflows\Workflow\Service\Workflow::instances`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Service/Workflow.php#L159-L174)
Return type
[`Bitrix24\SDK\Services\Workflows\Workflow\Result\WorkflowInstancesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Workflow/Result/WorkflowInstancesResult.php)| +|`bizproc`|[bizproc.task.complete](https://training.bitrix24.com/rest_help/workflows/workflows_tasks/bizproc_task_complete.php)|Complete workflow task|[`Bitrix24\SDK\Services\Workflows\Task\Service\Task::complete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Task/Service/Task.php#L63-L71)
Return type
[`Bitrix24\SDK\Services\Workflows\Task\Result\WorkflowTaskCompleteResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Task/Result/WorkflowTaskCompleteResult.php)| +|`bizproc`|[bizproc.task.list](https://training.bitrix24.com/rest_help/workflows/workflows_tasks/bizproc_task_list.php)|List of workflow tasks|[`Bitrix24\SDK\Services\Workflows\Task\Service\Task::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Task/Service/Task.php#L133-L143)
Return type
[`Bitrix24\SDK\Services\Workflows\Task\Result\WorkflowTasksResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Task/Result/WorkflowTasksResult.php)| +|`bizproc`|[bizproc.event.send](https://training.bitrix24.com/rest_help/workflows/workflows_events/bizproc_event_send.php)|returns output parameters to an activity. Parameters are specified in the activity description.|[`Bitrix24\SDK\Services\Workflows\Event\Service\Event::send`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Event/Service/Event.php#L50-L64)
Return type
[`Bitrix24\SDK\Services\Workflows\Event\Result\EventSendResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Workflows/Event/Result/EventSendResult.php)| +|`user`|[user.fields](https://training.bitrix24.com/rest_help/users/user_fields.php)|Get user entity fields|[`Bitrix24\SDK\Services\User\Service\User::fields`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Service/User.php#L43-L46)
Return type
[`Bitrix24\SDK\Core\Result\FieldsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/FieldsResult.php)| +|`user`|[user.current](https://training.bitrix24.com/rest_help/users/user_current.php)|Get current user|[`Bitrix24\SDK\Services\User\Service\User::current`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Service/User.php#L59-L62)
Return type
[`Bitrix24\SDK\Services\User\Result\UserResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Result/UserResult.php)| +|`user`|[user.add](https://training.bitrix24.com/rest_help/users/user_add.php)|Invites a user. Available only for users with invitation permissions, usually an administrator. Sends a standard account invitation to the user on success.|[`Bitrix24\SDK\Services\User\Service\User::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Service/User.php#L77-L92)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`user`|[user.get](https://training.bitrix24.com/rest_help/users/user_get.php)|Get user by id|[`Bitrix24\SDK\Services\User\Service\User::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Service/User.php#L104-L116)
Return type
[`Bitrix24\SDK\Services\User\Result\UsersResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Result/UsersResult.php)| +|`user`|[user.update](https://training.bitrix24.com/rest_help/users/user_get.php)|Updates user information. Available only for users with invitation permissions.|[`Bitrix24\SDK\Services\User\Service\User::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Service/User.php#L129-L137)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`user`|[user.search](https://training.bitrix24.com/rest_help/users/user_search.php)|This method is used to retrieve list of users with expedited personal data search.|[`Bitrix24\SDK\Services\User\Service\User::search`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Service/User.php#L151-L154)
Return type
[`Bitrix24\SDK\Services\User\Result\UsersResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/User/Result/UsersResult.php)| +|`telephony`|[voximplant.user.deactivatePhone](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_deactivatePhone.php)|This method disables an indicator of SIP-phone availability. Method checks the availability of the access permissions to modify users.|[`Bitrix24\SDK\Services\Telephony\Voximplant\User\Service\User::deactivatePhone`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/User/Service/User.php#L52-L57)
Return type
[`Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UserInterfaceDialogCallResult.php)| +|`telephony`|[voximplant.user.activatePhone](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_activatePhone.php)|This method raises the event of SIP-phone availability for an employee. Method checks the availability of the access permissions to modify users.|[`Bitrix24\SDK\Services\Telephony\Voximplant\User\Service\User::activatePhone`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/User/Service/User.php#L73-L78)
Return type
[`Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UserInterfaceDialogCallResult.php)| +|`telephony`|[voximplant.user.get](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_get.php)|This method returns user settings.|[`Bitrix24\SDK\Services\Telephony\Voximplant\User\Service\User::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/User/Service/User.php#L95-L102)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\User\Result\VoximplantUserSettingsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsResult.php)| +|`telephony`|[voximplant.url.get](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_url_get.php)|Returns a set of links for browsing telephony scope pages.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Url\Service\Url::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Url/Service/Url.php#L50-L53)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Url\Result\VoximplantPagesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesResult.php)| +|`telephony`|[voximplant.line.outgoing.sip.set](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_sip_set.php)|Sets the selected SIP line as an outgoing line by default.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Line\Service\Line::outgoingSipSet`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Line/Service/Line.php#L50-L55)
Return type
[`Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UserInterfaceDialogCallResult.php)| +|`telephony`|[voximplant.line.get](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_get.php)|Returns list of all of the available outgoing lines.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Line\Service\Line::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Line/Service/Line.php#L67-L70)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result\VoximplantLinesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Line/Result/VoximplantLinesResult.php)| +|`telephony`|[voximplant.line.outgoing.get](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_get.php)|Returns the currently selected line as an outgoing line by default.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Line\Service\Line::outgoingGet`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Line/Service/Line.php#L84-L87)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result\VoximplantLineIdResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdResult.php)| +|`telephony`|[voximplant.line.outgoing.set](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_set.php)|Sets the selected line as an outgoing line by default.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Line\Service\Line::outgoingSet`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Line/Service/Line.php#L103-L108)
Return type
[`Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UserInterfaceDialogCallResult.php)| +|`telephony`|[voximplant.tts.voices.get](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_tts_voices.get.php)|Returns an array of available voices for generation of speech in the format of voice ID => voice name.|[`Bitrix24\SDK\Services\Telephony\Voximplant\TTS\Voices\Service\Voices::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/TTS/Voices/Service/Voices.php#L52-L55)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\TTS\Voices\Result\VoximplantVoicesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoicesResult.php)| +|`telephony`|[voximplant.sip.connector.status](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_connector_status.php)|Returns the current status of the SIP Connector.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service\Sip::getConnectorStatus`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Service/Sip.php#L57-L60)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipConnectorStatusResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusResult.php)| +|`telephony`|[voximplant.sip.add](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_add.php)|Сreates a new SIP line linked to the application. Once created, this line becomes an outbound line by default.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service\Sip::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Service/Sip.php#L74-L89)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLineAddedResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Result/SipLineAddedResult.php)| +|`telephony`|[voximplant.sip.delete](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_delete.php)|Deletes the current SIP line (created by the application).|[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service\Sip::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Service/Sip.php#L105-L110)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`telephony`|[voximplant.sip.get](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_get.php)|Returns the list of all SIP lines created by the application. It is a list method.|[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service\Sip::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Service/Sip.php#L125-L128)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLinesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Result/SipLinesResult.php)| +|`telephony`|[voximplant.sip.status](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_status.php)|Returns the current status of the SIP registration (for cloud hosted PBX only).|[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service\Sip::status`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Service/Sip.php#L145-L150)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLineStatusResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusResult.php)| +|`telephony`|[voximplant.sip.update](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_update.php)|Updates the existing SIP line (created by the application).|[`Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service\Sip::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/Sip/Service/Sip.php#L165-L200)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`telephony`|[voximplant.infocall.startwithtext](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_infocall_startwithtext.php)|method performs the call to the specified number with automatic voiceover of specified text|[`Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Service\InfoCall::startWithText`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/InfoCall/Service/InfoCall.php#L56-L64)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Result\VoximplantInfoCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallResult.php)| +|`telephony`|[voximplant.infocall.startwithsound](https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_infocall_startwithsound.php)|Makes a call to the specified number with playback of .mp3 format file by URL.|[`Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Service\InfoCall::startWithSound`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/InfoCall/Service/InfoCall.php#L71-L78)
Return type
[`Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Result\VoximplantInfoCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallResult.php)| +|`telephony`|[telephony.call.attachTranscription](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_call_attachtranscription.php)|The method adds a call transcript.|[`Bitrix24\SDK\Services\Telephony\Call\Service\Call::attachTranscription`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Call/Service/Call.php#L54-L76)
Return type
[`Bitrix24\SDK\Services\Telephony\Call\Result\TranscriptAttachedResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/Call/Result/TranscriptAttachedResult.php)| +|`telephony`|[telephony.externalCall.attachRecord](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_attachRecord.php)|This method connects a record to a finished call and to the call Activity.|[`Bitrix24\SDK\Services\Telephony\ExternalCall\Service\ExternalCall::attachCallRecordInBase64`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Service/ExternalCall.php#L96-L107)
Return type
[`Bitrix24\SDK\Services\Telephony\ExternalCall\Result\CallRecordFileUploadedResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedResult.php)| +|`telephony`|[telephony.externalcall.register](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_register.php)|Method registers a call in Bitrix24. For this purpose, it searches an object that corresponds to the number in CRM.|[`Bitrix24\SDK\Services\Telephony\ExternalCall\Service\ExternalCall::register`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Service/ExternalCall.php#L156-L188)
Return type
[`Bitrix24\SDK\Services\Telephony\ExternalCall\Result\ExternalCallRegisteredResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredResult.php)| +|`telephony`|[telephony.externalCall.searchCrmEntities](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_searchCrmEntities.php)|This method allows to retrieve information about a client from CRM by a telephone number via single request.|[`Bitrix24\SDK\Services\Telephony\ExternalCall\Service\ExternalCall::searchCrmEntities`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Service/ExternalCall.php#L220-L226)
Return type
[`Bitrix24\SDK\Services\Telephony\ExternalCall\Result\SearchCrmEntitiesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesResult.php)| +|`telephony`|[telephony.externalcall.finish](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_finish.php)|This method allows to retrieve information about a client from CRM by a telephone number via single request.|[`Bitrix24\SDK\Services\Telephony\ExternalCall\Service\ExternalCall::finishForUserId`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Service/ExternalCall.php#L285-L308)
Return type
[`Bitrix24\SDK\Services\Telephony\ExternalCall\Result\ExternalCallFinishedResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedResult.php)| +|`telephony`|[telephony.externalcall.show](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_show.php)|The method displays a call ID screen to the user.|[`Bitrix24\SDK\Services\Telephony\ExternalCall\Service\ExternalCall::show`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Service/ExternalCall.php#L324-L331)
Return type
[`Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UserInterfaceDialogCallResult.php)| +|`telephony`|[telephony.externalcall.hide](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_hide.php)| This method hides call information window.|[`Bitrix24\SDK\Services\Telephony\ExternalCall\Service\ExternalCall::hide`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalCall/Service/ExternalCall.php#L347-L354)
Return type
[`Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UserInterfaceDialogCallResult.php)| +|`telephony`|[telephony.externalLine.add](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_add.php)|Method adds an external line|[`Bitrix24\SDK\Services\Telephony\ExternalLine\Service\ExternalLine::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalLine/Service/ExternalLine.php#L55-L62)
Return type
[`Bitrix24\SDK\Services\Telephony\ExternalLine\Result\ExternalLineAddedResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalLine/Result/ExternalLineAddedResult.php)| +|`telephony`|[telephony.externalLine.delete](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_delete.php)|Method for deleting an external line.|[`Bitrix24\SDK\Services\Telephony\ExternalLine\Service\ExternalLine::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalLine/Service/ExternalLine.php#L76-L81)
Return type
[`Bitrix24\SDK\Core\Result\EmptyResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/EmptyResult.php)| +|`telephony`|[telephony.externalLine.get](https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_delete.php)|Method allows to retrieve the list of external lines of an application.|[`Bitrix24\SDK\Services\Telephony\ExternalLine\Service\ExternalLine::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalLine/Service/ExternalLine.php#L95-L98)
Return type
[`Bitrix24\SDK\Services\Telephony\ExternalLine\Result\ExternalLinesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Telephony/ExternalLine/Result/ExternalLinesResult.php)| +|`im`|[im.notify.system.add](https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23904&LESSON_PATH=9691.9805.11585.23904)|Sending system notification|[`Bitrix24\SDK\Services\IM\Notify\Service\Notify::fromSystem`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IM/Notify/Service/Notify.php#L44-L64)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`im`|[im.notify.personal.add](https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23904&LESSON_PATH=9691.9805.11585.23904)|Sending personal notification|[`Bitrix24\SDK\Services\IM\Notify\Service\Notify::fromPersonal`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IM/Notify/Service/Notify.php#L71-L91)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`im`|[im.notify.delete](https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23906&LESSON_PATH=9691.9805.11585.23906)|Deleting notification|[`Bitrix24\SDK\Services\IM\Notify\Service\Notify::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IM/Notify/Service/Notify.php#L98-L112)
Return type
[`Bitrix24\SDK\Core\Result\DeletedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/DeletedItemResult.php)| +|`im`|[im.notify.read](https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23908&LESSON_PATH=9691.9805.11585.23908)|"Unread" the list of notifications, excluding CONFIRM notification type|[`Bitrix24\SDK\Services\IM\Notify\Service\Notify::markMessagesAsUnread`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IM/Notify/Service/Notify.php#L156-L167)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`im`|[im.notify.confirm](https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23912&LESSON_PATH=9691.9805.11585.23912)|Interaction with notification buttons|[`Bitrix24\SDK\Services\IM\Notify\Service\Notify::confirm`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IM/Notify/Service/Notify.php#L174-L186)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`im`|[im.notify.answer](https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23910&LESSON_PATH=9691.9805.11585.23910)|Response to notification, supporting quick reply|[`Bitrix24\SDK\Services\IM\Notify\Service\Notify::answer`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IM/Notify/Service/Notify.php#L193-L205)
Return type
[`Bitrix24\SDK\Core\Result\UpdatedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/UpdatedItemResult.php)| +|`userconsent`|[userconsent.consent.add](https://training.bitrix24.com/rest_help/userconsent/userconsent_consent_add.php)|Add the received user agreement consent|[`Bitrix24\SDK\Services\UserConsent\Service\UserConsent::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/UserConsent/Service/UserConsent.php#L40-L43)
Return type
[`Bitrix24\SDK\Core\Result\AddedItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Result/AddedItemResult.php)| +|`userconsent`|[userconsent.agreement.list](https://training.bitrix24.com/rest_help/userconsent/userconsent_consent_add.php)|Add the received user agreement consent|[`Bitrix24\SDK\Services\UserConsent\Service\UserConsentAgreement::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/UserConsent/Service/UserConsentAgreement.php#L39-L42)
Return type
[`Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementsResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/UserConsent/Result/UserConsentAgreementsResult.php)| +|`userconsent`|[userconsent.agreement.text](https://training.bitrix24.com/rest_help/userconsent/userconsent_agreement_text.php)|This method gets the agreement text|[`Bitrix24\SDK\Services\UserConsent\Service\UserConsentAgreement::text`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/UserConsent/Service/UserConsentAgreement.php#L54-L70)
Return type
[`Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementTextResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/UserConsent/Result/UserConsentAgreementTextResult.php)| +|`imopenlines`|[imopenlines.network.join](https://training.bitrix24.com/support/training/course/?COURSE_ID=115&LESSON_ID=25016)|Connecting an open channel by code|[`Bitrix24\SDK\Services\IMOpenLines\Service\Network::join`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IMOpenLines/Service/Network.php#L38-L48)
Return type
[`Bitrix24\SDK\Services\IMOpenLines\Result\JoinOpenLineResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IMOpenLines/Result/JoinOpenLineResult.php)| +|`imopenlines`|[imopenlines.network.message.add](https://training.bitrix24.com/support/training/course/?COURSE_ID=115&LESSON_ID=25018&LESSON_PATH=9691.9833.20331.25014.25018)|Sending Open Channel message to selected user|[`Bitrix24\SDK\Services\IMOpenLines\Service\Network::messageAdd`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IMOpenLines/Service/Network.php#L58-L80)
Return type
[`Bitrix24\SDK\Services\IMOpenLines\Result\AddedMessageItemResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/IMOpenLines/Result/AddedMessageItemResult.php)| +|`–`|[events](https://training.bitrix24.com/rest_help/general/events_method/events.php)|Displays events from the general list of events.|[`Bitrix24\SDK\Services\Main\Service\Event::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Event.php#L46-L54)
Return type
[`Bitrix24\SDK\Services\Main\Result\EventListResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/EventListResult.php)| +|`–`|[event.bind](https://training.bitrix24.com/rest_help/general/events_method/event_bind.php)|Installs a new event handler.|[`Bitrix24\SDK\Services\Main\Service\Event::bind`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Event.php#L69-L85)
Return type
[`Bitrix24\SDK\Services\Main\Result\EventHandlerBindResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/EventHandlerBindResult.php)| +|`–`|[event.unbind](https://training.bitrix24.com/rest_help/general/events_method/event_unbind.php)|Uninstalls a previously installed event handler.|[`Bitrix24\SDK\Services\Main\Service\Event::unbind`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Event.php#L100-L112)
Return type
[`Bitrix24\SDK\Services\Main\Result\EventHandlerUnbindResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/EventHandlerUnbindResult.php)| +|`–`|[event.test](https://training.bitrix24.com/rest_help/rest_sum/test_handler.php)|Test events|[`Bitrix24\SDK\Services\Main\Service\Event::test`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Event.php#L125-L128)
Return type
[`Bitrix24\SDK\Core\Response\Response`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Core/Response/Response.php)| +|`–`|[event.get](https://training.bitrix24.com/rest_help/general/events_method/event_get.php)|Obtaining a list of registered event handlers.|[`Bitrix24\SDK\Services\Main\Service\Event::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Service/Event.php#L142-L145)
Return type
[`Bitrix24\SDK\Services\Main\Result\EventHandlersResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Main/Result/EventHandlersResult.php)| +|`placement`|[userfieldtype.add](https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_add.php)|Registration of new type of user fields. This method returns true or an error with description.|[`Bitrix24\SDK\Services\Placement\Service\UserFieldType::add`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/UserFieldType.php#L45-L58)
Return type
[`Bitrix24\SDK\Services\Placement\Result\RegisterUserTypeResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/RegisterUserTypeResult.php)| +|`placement`|[userfieldtype.list](https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_list.php)|Retrieves list of user field types, registrered by the application. List method. Results in the list of field types with page-by-page navigation.|[`Bitrix24\SDK\Services\Placement\Service\UserFieldType::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/UserFieldType.php#L72-L77)
Return type
[`Bitrix24\SDK\Services\Placement\Result\UserFieldTypesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/UserFieldTypesResult.php)| +|`placement`|[userfieldtype.update](https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_update.php)|Modifies settings of user field types, registered by the application. This method returns true or an error with description.|[`Bitrix24\SDK\Services\Placement\Service\UserFieldType::update`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/UserFieldType.php#L96-L109)
Return type
[`Bitrix24\SDK\Services\Placement\Result\RegisterUserTypeResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/RegisterUserTypeResult.php)| +|`placement`|[userfieldtype.delete](https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_delete.php)|Deletes user field type, registered by the application. This method returns true or an error with description.|[`Bitrix24\SDK\Services\Placement\Service\UserFieldType::delete`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/UserFieldType.php#L125-L135)
Return type
[`Bitrix24\SDK\Services\Placement\Result\DeleteUserTypeResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/DeleteUserTypeResult.php)| +|`placement`|[placement.bind](https://training.bitrix24.com/rest_help/application_embedding/metods/placement_bind.php)|Installs the embedding location handler|[`Bitrix24\SDK\Services\Placement\Service\Placement::bind`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/Placement.php#L42-L54)
Return type
[`Bitrix24\SDK\Services\Placement\Result\PlacementBindResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/PlacementBindResult.php)| +|`placement`|[placement.unbind](https://training.bitrix24.com/rest_help/application_embedding/metods/placement_unbind.php)|Deletes the registered embedding location handler. Shall be executed with the available account administrative privileges.|[`Bitrix24\SDK\Services\Placement\Service\Placement::unbind`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/Placement.php#L68-L79)
Return type
[`Bitrix24\SDK\Services\Placement\Result\PlacementUnbindResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/PlacementUnbindResult.php)| +|`placement`|[placement.list](https://training.bitrix24.com/rest_help/application_embedding/metods/placement_list.php)|This method is used to retrieve the list of embedding locations, available to the application.|[`Bitrix24\SDK\Services\Placement\Service\Placement::list`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/Placement.php#L93-L100)
Return type
[`Bitrix24\SDK\Services\Placement\Result\PlacementLocationCodesResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/PlacementLocationCodesResult.php)| +|`placement`|[placement.get](https://training.bitrix24.com/rest_help/application_embedding/metods/placement_get.php)|This method is used to retrieve the list of registered handlers for embedding locations.|[`Bitrix24\SDK\Services\Placement\Service\Placement::get`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Service/Placement.php#L114-L117)
Return type
[`Bitrix24\SDK\Services\Placement\Result\PlacementsLocationInformationResult`](https://github.com/mesilov/bitrix24-php-sdk/blob/feature/390-prepare-publish-2-0/src/Services/Placement/Result/PlacementsLocationInformationResult.php)| \ No newline at end of file diff --git a/docs/EN/documentation.md b/docs/EN/documentation.md index f1db542e..1cea59bd 100644 --- a/docs/EN/documentation.md +++ b/docs/EN/documentation.md @@ -2,4 +2,18 @@ bitrix24-php-sdk documentation ============================================= ## Authorisation -- use [incoming webhooks](Core/Auth/auth.md) +- use [incoming webhooks](Core/Auth/auth.md). +- use OAuth2.0 for applications. + +## List of all supported methods +[All methods list](Services/bitrix24-php-sdk-methods.md), this list build automatically. + +## Application development +If you build application based on bitrix24-php-sdk You can use some domain contracts for interoperability. +They store in folder `src/Application/Contracts`. + +Available contracts +- [Bitrix24Accounts](/src/Application/Contracts/Bitrix24Accounts/Docs/Bitrix24Accounts.md) – store auth tokens and provides methods for work with Bitrix24 account. +- [ApplicationInstallations](/src/Application/Contracts/ApplicationInstallations/Docs/ApplicationInstallations.md) – Store information about application installation, linked with Bitrix24 Account with auth tokens. +- [ContactPersons](/src/Application/Contracts/ContactPersons/Docs/ContactPersons.md) – Store information about person who installed application. +- [Bitrix24Partners](/src/Application/Contracts/Bitrix24Partners/Docs/Bitrix24Partners.md) – Store information about Bitrix24 Partner who supports client portal and install or configure application. \ No newline at end of file diff --git a/examples/LoggerFactory.php b/examples/LoggerFactory.php deleted file mode 100644 index bb18fcdb..00000000 --- a/examples/LoggerFactory.php +++ /dev/null @@ -1,22 +0,0 @@ -pushHandler(new StreamHandler($_ENV['LOGS_FILE_NAME'], (int)$_ENV['LOGS_LEVEL'])); - $log->pushProcessor(new MemoryUsageProcessor(true, true)); - $log->pushProcessor(new IntrospectionProcessor((int)$_ENV['LOGS_LEVEL'])); - - return $log; - } -} \ No newline at end of file diff --git a/examples/application/local/.env b/examples/application/local/.env deleted file mode 100644 index ef1ad926..00000000 --- a/examples/application/local/.env +++ /dev/null @@ -1,8 +0,0 @@ -# monolog -LOGS_LEVEL=100 -LOGS_FILE_NAME=bitrix24-php-sdk.log - -# local application secret parameters -BITRIX24_PHP_SDK_APPLICATION_CLIENT_ID= -BITRIX24_PHP_SDK_APPLICATION_CLIENT_SECRET= -BITRIX24_PHP_SDK_APPLICATION_SCOPE= \ No newline at end of file diff --git a/examples/application/local/activity-handler.php b/examples/application/local/activity-handler.php deleted file mode 100644 index fbb6af41..00000000 --- a/examples/application/local/activity-handler.php +++ /dev/null @@ -1,156 +0,0 @@ - -
-    Приложение работает, получили токены от Битрикс24:
-    
-
-bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - - -try { - $log = new Logger('bitrix24-php-sdk-cli'); - $log->pushHandler(new StreamHandler($_ENV['LOGS_FILE_NAME'], (int)$_ENV['LOGS_LEVEL'])); - $log->pushProcessor(new MemoryUsageProcessor(true, true)); - - $req = Request::createFromGlobals(); - $log->debug('incoming request', [ - 'payload' => $req->request->all() - ]); - - $workflowReq = IncomingRobotRequest::initFromRequest($req); - - print_r($workflowReq); - - $b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); - $appProfile = ApplicationProfile::initFromArray($_ENV); - - //AccessToken::initFromWorkflowRequest($req), - $b24Service = $b24ServiceFactory->initFromRequest( - $appProfile, - $workflowReq->auth->accessToken, - $workflowReq->auth->domain - ); - - $returnProp = [ - 'result_sum' => 5555 - ]; - - print('PROP' . PHP_EOL); - print_r($workflowReq->properties); - print_r($b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()); - - $b24Service->getBizProcScope()->activity()->log( - $workflowReq->eventToken, - 'hello from activity handler' - ); - - $res = $b24Service->getBizProcScope()->event()->send( - $workflowReq->eventToken, - $returnProp, - sprintf('debug result %s', print_r($returnProp, true)) - ); - $log->debug('ffffffff', [ - 'res' => $res->isSuccess() - ]); - -} catch (Throwable $exception) { - - $log->error(sprintf('error: %s', $exception->getMessage()), [ - 'trace' => $exception->getTraceAsString() - ]); - - print('ERRRRRRRRRORRRR!!!!'); - print($exception->getMessage() . PHP_EOL); - print_r($exception->getTraceAsString()); - -} - - -// Array -// ( -// [workflow_id] => 664fa13bbbb410.99176768 -// [code] => test_activity -// [document_id] => Array -// ( -// [0] => crm -// [1] => CCrmDocumentContact -// [2] => CONTACT_109286 -// ) -// -// [document_type] => Array -// ( -// [0] => crm -// [1] => CCrmDocumentContact -// [2] => CONTACT -// ) -// -// [event_token] => 664fa13bbbb410.99176768|A40364_79843_85254_57332|MS1ekdI0CvXi8ycL8qNIn96hak8JEndG.54020ce210345fb6eb12a79d75316d9430b42ccd9c1d82ab1a3bf8b064ec50e9 -// [properties] => Array -// ( -// [comment] => дефолтная строка - значение -// [amount] => 333 -// ) -// -// [use_subscription] => Y -// [timeout_duration] => 660 -// [ts] => 1716494651 - -// [auth] => Array -// ( - -// access token -// [access_token] => 4baf4f66006e13540058f18a000000100000009b41bce7ec85f07c3646c07e6d629e7c -// [refresh_token] => 3b2e7766006e13540058f18a000000100000003b31a96730e79dc7561c1d7d0b33933f -// [expires] => 1716498251 - -// endpoints -// [server_endpoint] => https://oauth.bitrix.info/rest/ -// [client_endpoint] => https://bitrix24-php-sdk-playground.bitrix24.ru/rest/ - -// scope -// [scope] => crm,bizproc,appform,baas,placement,user_brief,call,telephony - -// application status -// [status] => L - - -// [application_token] => f9ac5db5ad4adbdee13eb034207d8fbd -// [expires_in] => 3600 -// [domain] => bitrix24-php-sdk-playground.bitrix24.ru -// [member_id] => 010b6886ebc205e43ae65000ee00addb -// [user_id] => 16 -// ) -//) diff --git a/examples/application/local/bp-82.bpt b/examples/application/local/bp-82.bpt deleted file mode 100644 index 227b054c..00000000 Binary files a/examples/application/local/bp-82.bpt and /dev/null differ diff --git a/examples/application/local/index.php b/examples/application/local/index.php deleted file mode 100644 index 6a6e55d3..00000000 --- a/examples/application/local/index.php +++ /dev/null @@ -1,254 +0,0 @@ - -
-    Приложение работает, получили токены от Битрикс24:
-    
-
-bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - -$request = Request::createFromGlobals(); - - -$log = new Logger('bitrix24-php-sdk-cli'); -$log->pushHandler(new StreamHandler($_ENV['LOGS_FILE_NAME'], (int)$_ENV['LOGS_LEVEL'])); -$log->pushProcessor(new MemoryUsageProcessor(true, true)); - -$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); -$appProfile = ApplicationProfile::initFromArray($_ENV); -$b24Service = $b24ServiceFactory->initFromRequest($appProfile, AuthToken::initFromPlacementRequest($request), $_REQUEST['DOMAIN']); - - -var_dump('Hello world'); - -var_dump(Bitrix24\SDK\Core\Credentials\Credentials::createFromPlacementRequest( - new \Bitrix24\SDK\Application\Requests\Placement\PlacementRequest($request), - $appProfile -)->getAuthToken()); -// -//$b64 = new \Symfony\Component\Mime\Encoder\Base64Encoder(); -//$str = $b64->encodeString(file_get_contents('bp-82.bpt')); - - -// run workflow -//var_dump($b24Service->getBizProcScope()->template()->delete(82)); - -//$templateId = $b24Service->getBizProcScope()->template()->add( -// WorkflowDocumentType::buildForContact(), -// 'Test template', -// 'Test template description', -// WorkflowAutoExecutionType::withoutAutoExecution, -// 'bp-82.bpt' -//)->getId(); -// -//$updateResult = $b24Service->getBizProcScope()->template()->update( -// $templateId, -// null, -// 'updated name', -// null, -// null, -// 'bp-82.bpt' -//)->isSuccess(); -// -//var_dump($updateResult); - - -// -// -//foreach ($b24Service->getBizProcScope()->activity()->list()->getActivities() as $activityCode) { -// var_dump($activityCode); -// var_dump($b24Service->getBizProcScope()->activity()->delete($activityCode)->isSuccess()); -//} -//$activityCode = 'test_activity'; -//$handlerUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/activity-handler.php'; -//$b24AdminUserId = $b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()->ID; -//$activityName = [ -// 'ru' => 'Название активити', -// 'en' => 'activity name' -//]; -//$activityDescription = [ -// 'ru' => 'Описание активити', -// 'en' => 'Activity description' -//]; -//$activityProperties = [ -// 'comment' => [ -// 'Name' => [ -// 'ru' => 'строка desc', -// 'en' => 'string desc' -// ], -// 'Description' => [ -// 'ru' => 'строка desc', -// 'en' => 'string desc' -// ], -// 'Type' => WorkflowPropertyType::string->name, -// 'Options' => null, -// 'Required' => 'N', -// 'Multiple' => 'N', -// 'Default' => 'дефолтная строка - значение' -// -// ], -// 'amount' => [ -// 'Name' => [ -// 'ru' => 'int значение', -// 'en' => 'int value' -// ], -// 'Description' => [ -// 'ru' => 'int значение пример', -// 'en' => 'int value example' -// ], -// 'Type' => WorkflowPropertyType::int->name, -// 'Options' => null, -// 'Required' => 'N', -// 'Multiple' => 'N', -// 'Default' => 333 -// ] -//]; -// -//$activityReturnProperties = [ -// 'result_sum' => [ -// 'Name' => [ -// 'ru' => 'int значение', -// 'en' => 'int value' -// ], -// 'Description' => [ -// 'ru' => 'int', -// 'en' => 'int' -// ], -// 'Type' => WorkflowPropertyType::int->name, -// 'Options' => null, -// 'Required' => 'N', -// 'Multiple' => 'N', -// 'Default' => 444 -// ] -//]; -// -// -//$addActivityResult = $b24Service->getBizProcScope()->activity()->add( -// $activityCode, -// $handlerUrl, -// $b24AdminUserId, -// $activityName, -// $activityDescription, -// true, -// $activityProperties, -// false, -// $activityReturnProperties, -// WorkflowDocumentType::buildForLead(), -// [] -//); -// -//var_dump($addActivityResult->getCoreResponse()->getResponseData()->getResult()); -// -// -// -//print('delete robots...' . PHP_EOL); -//foreach ($b24Service->getBizProcScope()->robot()->list()->getRobots() as $robotCode) { -// print_r($b24Service->getBizProcScope()->robot()->delete($robotCode)->isSuccess()); -//} -// -// -//$robotProperties = [ -// 'comment' => [ -// 'Name' => [ -// 'ru' => 'строка desc', -// 'en' => 'string desc' -// ], -// 'Description' => [ -// 'ru' => 'строка desc', -// 'en' => 'string desc' -// ], -// 'Type' => WorkflowPropertyType::string->name, -// 'Options' => null, -// 'Required' => 'N', -// 'Multiple' => 'N', -// 'Default' => 'дефолтная строка - значение' -// -// ], -// 'amount' => [ -// 'Name' => [ -// 'ru' => 'int значение', -// 'en' => 'int value' -// ], -// 'Description' => [ -// 'ru' => 'int значение пример', -// 'en' => 'int value example' -// ], -// 'Type' => WorkflowPropertyType::int->name, -// 'Options' => null, -// 'Required' => 'N', -// 'Multiple' => 'N', -// 'Default' => 333 -// ] -//]; -// -//$robotReturnProperties = [ -// 'result_sum' => [ -// 'Name' => [ -// 'ru' => 'int значение', -// 'en' => 'int value' -// ], -// 'Description' => [ -// 'ru' => 'int', -// 'en' => 'int' -// ], -// 'Type' => WorkflowPropertyType::int->name, -// 'Options' => null, -// 'Required' => 'N', -// 'Multiple' => 'N', -// 'Default' => 'дефолтная строка - значение' -// ] -//]; -// -//$handlerUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/robot-handler.php'; -//var_dump($handlerUrl); -//print('install robots...' . PHP_EOL); -//$addResult = $b24Service->getBizProcScope()->robot()->add('test_r_1', $handlerUrl, -// 1, -// [ -// 'ru' => 'РОБОТ 1', -// 'en' => 'robot 1', -// ], -// true, -// $robotProperties, -// false, -// $robotReturnProperties -//); -// -//var_dump($addResult->isSuccess()); -//// -//var_dump($b24Service->getBizProcScope()->robot()->list()->getRobots()); -//// -// diff --git a/examples/application/local/install.php b/examples/application/local/install.php deleted file mode 100644 index 31cd5b2a..00000000 --- a/examples/application/local/install.php +++ /dev/null @@ -1,14 +0,0 @@ - -
-    Установка приложения, получили токены от Битрикс24:
-    
-
- - \ No newline at end of file diff --git a/examples/application/local/robot-handler.php b/examples/application/local/robot-handler.php deleted file mode 100644 index ab923878..00000000 --- a/examples/application/local/robot-handler.php +++ /dev/null @@ -1,87 +0,0 @@ - -
-    Приложение работает, получили токены от Битрикс24:
-    
-
-bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - - -try { - $log = new Logger('bitrix24-php-sdk-cli'); - $log->pushHandler(new StreamHandler($_ENV['LOGS_FILE_NAME'], (int)$_ENV['LOGS_LEVEL'])); - $log->pushProcessor(new MemoryUsageProcessor(true, true)); - - $req = Request::createFromGlobals(); - $log->debug('incoming request', [ - 'payload' => $req->request->all() - ]); - - $b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); - $appProfile = ApplicationProfile::initFromArray($_ENV); - - - $rr = IncomingRobotRequest::initFromRequest($req); - - $b24Service = $b24ServiceFactory->initFromRequest( - $appProfile, - $rr->auth->accessToken, - $rr->auth->domain - ); - - $returnProp = [ - 'result_sum' => 5555 - ]; - - $res = $b24Service->getBizProcScope()->event()->send( - $rr->eventToken, - $returnProp, - sprintf('debug result %s', print_r($returnProp, true)) - ); - $log->debug('ffffffff', [ - 'res' => $res->isSuccess() - ]); - -} catch (Throwable $exception) { - - $log->error(sprintf('error: %s', $exception->getMessage()), [ - 'trace' => $exception->getTraceAsString() - ]); - - -} - - diff --git a/examples/core/webhook/.env b/examples/core/webhook/.env deleted file mode 100644 index 1355fb8e..00000000 --- a/examples/core/webhook/.env +++ /dev/null @@ -1,5 +0,0 @@ -# bitrix24 webhook url -BITRIX24_WEBHOOK_URL= -# monolog -LOG_LEVEL=100 -LOG_FILE_NAME=bitrix24-php-sdk.log diff --git a/examples/core/webhook/example.php b/examples/core/webhook/example.php deleted file mode 100644 index 03e40fd2..00000000 --- a/examples/core/webhook/example.php +++ /dev/null @@ -1,30 +0,0 @@ -loadEnv('.env'); -$webhookUrl = $_ENV['BITRIX24_WEBHOOK_URL']; - -// configure logger for debug queries -$log = new Logger('bitrix24-php-sdk'); -$log->pushHandler(new StreamHandler($_ENV['LOG_FILE_NAME'], (int)$_ENV['LOG_LEVEL'])); -$log->pushProcessor(new MemoryUsageProcessor(true, true)); -$log->pushProcessor(new IntrospectionProcessor()); - -// create factory for build service from multiple sources: webhook, request, bitrix24 account with oauth2.0 tokens -$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); -// init bitrix24-php-sdk service with webhook credentials -$b24Service = $b24ServiceFactory->initFromWebhook($webhookUrl); - -$deal = $b24Service->getCRMScope()->deal()->get(1)->deal(); -var_dump($deal->TITLE); \ No newline at end of file diff --git a/examples/core/webhook/composer.json b/examples/local-application/composer.json similarity index 74% rename from examples/core/webhook/composer.json rename to examples/local-application/composer.json index 11c0dc0c..f8462c44 100644 --- a/examples/core/webhook/composer.json +++ b/examples/local-application/composer.json @@ -10,10 +10,9 @@ } ], "require": { - "mesilov/bitrix24-php-sdk": "dev-371-publish-b24-php-sdk-beta-2", - "monolog/monolog": "3.5.*", - "symfony/dotenv": "7.0.*", - + "mesilov/bitrix24-php-sdk": "dev-feature/390-prepare-publish-2-0", + "monolog/monolog": "^3", + "symfony/dotenv": "^7" }, "require-dev": { "roave/security-advisories": "dev-latest" diff --git a/examples/local-application/index.php b/examples/local-application/index.php new file mode 100644 index 00000000..a5f7fe27 --- /dev/null +++ b/examples/local-application/index.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +use Bitrix24\SDK\Core\Credentials\AuthToken; +use Bitrix24\SDK\Core\Credentials\ApplicationProfile; +use Bitrix24\SDK\Services\ServiceBuilderFactory; +use Monolog\Handler\StreamHandler; +use Monolog\Logger; +use Monolog\Processor\MemoryUsageProcessor; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; + +require_once 'vendor/autoload.php'; +?> +
+    Application is worked, auth tokens from bitrix24:
+    
+
+pushHandler(new StreamHandler('bitrix24-php-sdk.log')); +$log->pushProcessor(new MemoryUsageProcessor(true, true)); + +$b24ServiceBuilderFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); +$appProfile = ApplicationProfile::initFromArray([ + 'BITRIX24_PHP_SDK_APPLICATION_CLIENT_ID' => 'INSERT_HERE_YOUR_DATA', + 'BITRIX24_PHP_SDK_APPLICATION_CLIENT_SECRET' => 'INSERT_HERE_YOUR_DATA', + 'BITRIX24_PHP_SDK_APPLICATION_SCOPE' => 'INSERT_HERE_YOUR_DATA' +]); +$b24Service = $b24ServiceBuilderFactory->initFromRequest($appProfile, AuthToken::initFromPlacementRequest($request), $request->get('DOMAIN')); + +var_dump($b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()); +// get deals list and address to first element +var_dump($b24Service->getCRMScope()->lead()->list([], [], ['ID', 'TITLE'])->getLeads()[0]->TITLE); \ No newline at end of file diff --git a/examples/local-application/install.php b/examples/local-application/install.php new file mode 100644 index 00000000..93388018 --- /dev/null +++ b/examples/local-application/install.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); +?> +
+    Application installation started, tokens from Bitrix24:
+    
+
+ + \ No newline at end of file diff --git a/examples/services/telephony/.env b/examples/services/telephony/.env deleted file mode 100644 index a15fc445..00000000 --- a/examples/services/telephony/.env +++ /dev/null @@ -1,9 +0,0 @@ -# monolog -LOGS_LEVEL=100 -LOGS_FILE_NAME=bitrix24-php-sdk.log - -# local application secret parameters -BITRIX24_PHP_SDK_APPLICATION_CLIENT_ID= -BITRIX24_PHP_SDK_APPLICATION_CLIENT_SECRET= -BITRIX24_PHP_SDK_APPLICATION_SCOPE= -BITRIX24_PHP_SDK_APPLICATION_DOMAIN_URL= \ No newline at end of file diff --git a/examples/services/telephony/events-handler.php b/examples/services/telephony/events-handler.php deleted file mode 100644 index cfd23535..00000000 --- a/examples/services/telephony/events-handler.php +++ /dev/null @@ -1,122 +0,0 @@ -bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - -try { - - $log = LoggerFactory::get(); - - $request = Request::createFromGlobals(); - $log->debug('incoming request', [ - 'payload' => $request->request->all() - ]); - - // create telephony event - $event = (new TelephonyEventsFabric())->create($request); - if ($event === null) { - throw new \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException('unknown event code'); - } - $log->debug('received event', [ - 'code' => $event->getEventCode(), - 'payload' => $event->getEventPayload(), - ]); - - // init service builder with auth token from event - $serviceBuilder = (new ServiceBuilderFactory(new EventDispatcher(), $log))->initFromRequest( - ApplicationProfile::initFromArray($_ENV), - AuthToken::initFromEventRequest($request), - $event->getAuth()->client_endpoint - ); - - $curUser = $serviceBuilder->getMainScope()->main()->getCurrentUserProfile()->getUserProfile(); - $log->debug('current user profile', [ - 'id' => $curUser->ID - ]); - $currentB24UserId = $serviceBuilder->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()->ID; - $innerPhoneNumber = '123'; - // set inner phone number for user - $serviceBuilder->getUserScope()->user()->update( - $currentB24UserId, - [ - 'UF_PHONE_INNER' => $innerPhoneNumber - ] - ); - - if ($event instanceof Bitrix24\SDK\Services\Telephony\Events\OnExternalCallBackStart\OnExternalCallBackStart) { - // start call - $phoneNumber = '7978' . random_int(1000000, 9999999); - $b24CallId = $serviceBuilder->getTelephonyScope()->externalCall()->register( - $innerPhoneNumber, - $currentB24UserId, - $phoneNumber, - CarbonImmutable::now(), - CallType::outbound, - true, - true, - '3333', - null, - CrmEntityType::contact - )->getExternalCallRegistered()->CALL_ID; - - //emulate work with external pbx and make real call - sleep(3); - - // finish call - $money = new Money(10000, new Currency('USD')); - $duration = 100; - $finishResult = $serviceBuilder->getTelephonyScope()->externalCall()->finishForUserId( - $b24CallId, - $currentB24UserId, - $duration, - $money, - TelephonyCallStatusCode::successful, - true - ); - } - if ($event instanceof Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallEnd\OnVoximplantCallEnd) { - $log->debug('OnVoximplantCallEnd event payload', [ - 'paylload' => $event->getEventPayload() - ]); - } -} catch (Throwable $exception) { - - $log->error(sprintf('error: %s', $exception->getMessage()), [ - 'trace' => $exception->getTraceAsString() - ]); - - -} - - diff --git a/examples/services/telephony/index.php b/examples/services/telephony/index.php deleted file mode 100644 index e26e5007..00000000 --- a/examples/services/telephony/index.php +++ /dev/null @@ -1,63 +0,0 @@ - -
-bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - -$request = Request::createFromGlobals(); - -$log = LoggerFactory::get(); - -$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); -$appProfile = ApplicationProfile::initFromArray($_ENV); -$accessToken = AuthToken::initFromPlacementRequest($request); -$b24Service = $b24ServiceFactory->initFromRequest($appProfile, $accessToken, $_REQUEST['DOMAIN']); - - -// subscribe to all events -$handlerUrl = 'https://' . $request->getHost() . '/events-handler.php'; -$b24UserId = $b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()->ID; -$eventHandlers = [ - new EventHandlerMetadata(OnExternalCallBackStart::CODE, $handlerUrl, $b24UserId), - new EventHandlerMetadata(OnExternalCallStart::CODE, $handlerUrl, $b24UserId), - new EventHandlerMetadata(OnVoximplantCallInit::CODE, $handlerUrl, $b24UserId), - new EventHandlerMetadata(OnVoximplantCallEnd::CODE, $handlerUrl, $b24UserId), - new EventHandlerMetadata(OnVoximplantCallStart::CODE, $handlerUrl, $b24UserId) -]; - - -$b24Service->getMainScope()->eventManager()->bindEventHandlers($eventHandlers); diff --git a/examples/services/telephony/install.php b/examples/services/telephony/install.php deleted file mode 100644 index eae01705..00000000 --- a/examples/services/telephony/install.php +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/examples/services/workflows/.env b/examples/services/workflows/.env deleted file mode 100644 index 24a48adf..00000000 --- a/examples/services/workflows/.env +++ /dev/null @@ -1,5 +0,0 @@ -# bitrix24 webhook url -BITRIX24_WEBHOOK= -# monolog -LOGS_LEVEL=100 -LOGS_FILE_NAME=bitrix24-php-sdk.log \ No newline at end of file diff --git a/examples/services/workflows/task.php b/examples/services/workflows/task.php deleted file mode 100644 index 7f476f6d..00000000 --- a/examples/services/workflows/task.php +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/env php -getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -(new Dotenv())->bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - -$log = new Logger('bitrix24-php-sdk-cli'); -$log->pushHandler(new StreamHandler($_ENV['LOGS_FILE_NAME'], (int)$_ENV['LOGS_LEVEL'])); -$log->pushProcessor(new MemoryUsageProcessor(true, true)); - -$webhookUrl = $_ENV['BITRIX24_WEBHOOK']; -$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); -// init bitrix24-php-sdk service with webhook credentials -$b24Service = $b24ServiceFactory->initFromWebhook($webhookUrl); - -#[AsCommand( - name: 'bitrix24-php-sdk:examples:workflows:task', - hidden: false -)] -class task extends Command -{ - private LoggerInterface $log; - private ServiceBuilder $serviceBuilder; - - public function __construct(ServiceBuilder $serviceBuilder, LoggerInterface $logger) - { - // best practices recommend to call the parent constructor first and - // then set your own properties. That wouldn't work in this case - // because configure() needs the properties set in this constructor - $this->log = $logger; - $this->serviceBuilder = $serviceBuilder; - parent::__construct(); - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $output->writeln([ - 'Work with workflow task example', - ]); - - - var_dump($this->serviceBuilder->getBizProcScope()->task()->list( - [], - [], - [ - 'ID', - 'WORKFLOW_ID', - 'DOCUMENT_NAME', - 'DESCRIPTION', - 'NAME', - 'MODIFIED', - 'WORKFLOW_STARTED', - 'WORKFLOW_STARTED_BY', - 'OVERDUE_DATE', - 'WORKFLOW_TEMPLATE_ID', - 'WORKFLOW_TEMPLATE_NAME', - 'WORKFLOW_STATE', - 'STATUS', - 'USER_ID', - 'USER_STATUS', - 'MODULE_ID', - 'ENTITY', - 'DOCUMENT_ID', - 'ACTIVITY', - 'PARAMETERS' - ])->getTasks()); - - $this->serviceBuilder->getBizProcScope()->task()->complete( - 2, - \Bitrix24\SDK\Services\Workflows\Common\WorkflowTaskCompleteStatusType::approved, - 'oook' - ); - - - return 0; - } -} - -$application = new Application(); -$application->add(new task($b24Service, $log)); -$application->run($input); diff --git a/examples/services/workflows/workflow.php b/examples/services/workflows/workflow.php deleted file mode 100644 index 776c1eaf..00000000 --- a/examples/services/workflows/workflow.php +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/env php -getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); -} - -if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); -} - -(new Dotenv())->bootEnv('.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - if (class_exists( - Debug::class - )) { - Debug::enable(); - } -} - -$log = new Logger('bitrix24-php-sdk-cli'); -$log->pushHandler(new StreamHandler($_ENV['LOGS_FILE_NAME'], (int)$_ENV['LOGS_LEVEL'])); -$log->pushProcessor(new MemoryUsageProcessor(true, true)); - -$webhookUrl = $_ENV['BITRIX24_WEBHOOK']; -$b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); -// init bitrix24-php-sdk service with webhook credentials -$b24Service = $b24ServiceFactory->initFromWebhook($webhookUrl); - -#[AsCommand( - name: 'bitrix24-php-sdk:examples:workflows:workflow', - hidden: false -)] -class workflow extends Command -{ - private LoggerInterface $log; - private ServiceBuilder $serviceBuilder; - - public function __construct(ServiceBuilder $serviceBuilder, LoggerInterface $logger) - { - // best practices recommend to call the parent constructor first and - // then set your own properties. That wouldn't work in this case - // because configure() needs the properties set in this constructor - $this->log = $logger; - $this->serviceBuilder = $serviceBuilder; - parent::__construct(); - } - - protected function configure(): void - { - $this - ->setDescription('Example of work with workflows') - ->setHelp('Run workflow for contact') - ->addOption( - 'workflow-template-id', - null, - InputOption::VALUE_REQUIRED, - 'workflow template id', - ) - ->addOption( - 'contact-id', - null, - InputOption::VALUE_REQUIRED, - 'Bitrix24 contact id', - ); - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $workflowTemplateId = $input->getOption('workflow-template-id'); - $contactId = $input->getOption('contact-id'); - if ($workflowTemplateId === null) { - throw new InvalidArgumentException('Missing workflow template id, you must set workflow-template-id'); - } - if ($contactId === null) { - throw new InvalidArgumentException('Missing contact id, you must set contact-id'); - } - $output->writeln([ - 'Work with workflow example', - '', - sprintf('workflow template id: %s', $workflowTemplateId), - sprintf('contact id: %s', $contactId), - '', - 'run workflow for contact...' - ]); - - // run workflow - $workflowInstanceId = $this->serviceBuilder->getBizProcScope()->workflow()->start( - DocumentType::crmContact, - $workflowTemplateId, - $contactId, - )->getRunningWorkflowInstanceId(); - $output->writeln(sprintf('running workflow instance id: %s', $workflowInstanceId)); - - // get running workflow instance list - $workflowInstances = $this->serviceBuilder->getBizProcScope()->workflow()->instances( - [], - [], - [ - 'ENTITY' => DocumentType::crmContact->value - ] - )->getInstances(); - var_dump($workflowInstances); - - - // try to terminate workflow - $terminationResult = $this->serviceBuilder->getBizProcScope()->workflow()->terminate( - $workflowInstanceId, - 'terminated!' - ); - - var_dump($terminationResult->isSuccess()); - - - return 0; - } -} - -$application = new Application(); -$application->add(new workflow($b24Service, $log)); -$application->run($input); diff --git a/examples/webhook/.env b/examples/webhook/.env deleted file mode 100644 index 1355fb8e..00000000 --- a/examples/webhook/.env +++ /dev/null @@ -1,5 +0,0 @@ -# bitrix24 webhook url -BITRIX24_WEBHOOK_URL= -# monolog -LOG_LEVEL=100 -LOG_FILE_NAME=bitrix24-php-sdk.log diff --git a/examples/webhook/composer.json b/examples/webhook/composer.json index 03105bc5..f8462c44 100644 --- a/examples/webhook/composer.json +++ b/examples/webhook/composer.json @@ -10,9 +10,9 @@ } ], "require": { - "mesilov/bitrix24-php-sdk": "dev-371-publish-b24-php-sdk-beta-2", - "monolog/monolog": "3.5.*", - "symfony/dotenv": "7.0.*" + "mesilov/bitrix24-php-sdk": "dev-feature/390-prepare-publish-2-0", + "monolog/monolog": "^3", + "symfony/dotenv": "^7" }, "require-dev": { "roave/security-advisories": "dev-latest" diff --git a/examples/webhook/example.php b/examples/webhook/example.php index bc3098ac..446fb703 100644 --- a/examples/webhook/example.php +++ b/examples/webhook/example.php @@ -1,30 +1,36 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); use Bitrix24\SDK\Services\ServiceBuilderFactory; -use Monolog\Handler\StreamHandler; +use Symfony\Component\EventDispatcher\EventDispatcher; use Monolog\Logger; -use Monolog\Processor\IntrospectionProcessor; +use Monolog\Handler\StreamHandler; use Monolog\Processor\MemoryUsageProcessor; -use Symfony\Component\Dotenv\Dotenv; -use Symfony\Component\EventDispatcher\EventDispatcher; -require_once 'vendor/autoload.php'; +require_once 'vendor/autoload.php'; -// load credentials for work with bitrix24 portal -(new Dotenv())->loadEnv('.env'); -$webhookUrl = $_ENV['BITRIX24_WEBHOOK_URL']; +$webhookUrl = 'INSERT_HERE_YOUR_WEBHOOK_URL'; -// configure logger for debug queries $log = new Logger('bitrix24-php-sdk'); -$log->pushHandler(new StreamHandler($_ENV['LOG_FILE_NAME'], (int)$_ENV['LOG_LEVEL'])); +$log->pushHandler(new StreamHandler('bitrix24-php-sdk.log')); $log->pushProcessor(new MemoryUsageProcessor(true, true)); -$log->pushProcessor(new IntrospectionProcessor()); -// create factory for build service from multiple sources: webhook, request, bitrix24 account with oauth2.0 tokens +// create service builder factory $b24ServiceFactory = new ServiceBuilderFactory(new EventDispatcher(), $log); -// init bitrix24-php-sdk service with webhook credentials +// init bitrix24-php-sdk service from webhook $b24Service = $b24ServiceFactory->initFromWebhook($webhookUrl); -$deal = $b24Service->getCRMScope()->deal()->get(1)->deal(); -var_dump($deal->TITLE); \ No newline at end of file +// work with interested scope +var_dump($b24Service->getMainScope()->main()->getCurrentUserProfile()->getUserProfile()); +// get deals list and address to first element +var_dump($b24Service->getCRMScope()->lead()->list([], [], ['ID', 'TITLE'])->getLeads()[0]->TITLE); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c46a4832..1da108fb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,9 +2,15 @@ parameters: level: 5 paths: - src/ + - tests/Unit/ - tests/Integration/Services/Telephony - tests/Integration/Services/User - - tests/Unit/ + - tests/Integration/Services/UserConsent + - tests/Integration/Services/IM + - tests/Integration/Services/Catalog + - tests/Integration/Services/IMOpenLines + - tests/Integration/Services/Main + - tests/Integration/Services/Placement bootstrapFiles: - tests/bootstrap.php parallel: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 171b2a98..9976fd86 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,8 @@ + bootstrap="tests/bootstrap.php" failOnRisky="true" failOnWarning="true" + displayDetailsOnTestsThatTriggerWarnings="true"> @@ -18,9 +19,21 @@ ./tests/Integration/Services/Telephony/ + + ./tests/Integration/Services/IM/ + + + ./tests/Integration/Services/IMOpenLines/ + + + ./tests/Integration/Services/Placement/ + ./tests/Integration/Services/User/ + + ./tests/Integration/Services/UserConsent/ + ./tests/Integration/Services/Workflows/ diff --git a/rector.php b/rector.php index 15a6dad1..a7f6568e 100644 --- a/rector.php +++ b/rector.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); use Rector\Config\RectorConfig; @@ -13,8 +22,20 @@ __DIR__ . '/src/Application/', __DIR__ . '/src/Services/Telephony', __DIR__ . '/tests/Integration/Services/Telephony', + __DIR__ . '/src/Services/Catalog', + __DIR__ . '/tests/Integration/Services/Catalog', __DIR__ . '/src/Services/User', __DIR__ . '/tests/Integration/Services/User', + __DIR__ . '/src/Services/UserConsent', + __DIR__ . '/tests/Integration/Services/UserConsent', + __DIR__ . '/src/Services/IM', + __DIR__ . '/tests/Integration/Services/IM', + __DIR__ . '/src/Services/IMOpenLines', + __DIR__ . '/tests/Integration/Services/IMOpenLines', + __DIR__ . '/src/Services/Main', + __DIR__ . '/tests/Integration/Services/Main', + __DIR__ . '/src/Services/Placement', + __DIR__ . '/tests/Integration/Services/Placement', __DIR__ . '/tests/Unit/', ]) ->withCache(cacheDirectory: __DIR__ . '.cache/rector') diff --git a/src/Application/ApplicationStatus.php b/src/Application/ApplicationStatus.php index a6cc86a1..d5cdbbaa 100644 --- a/src/Application/ApplicationStatus.php +++ b/src/Application/ApplicationStatus.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application; diff --git a/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterface.php b/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterface.php index 4e89f926..2113d6da 100644 --- a/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterface.php +++ b/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterface.php @@ -1,5 +1,15 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Entity; diff --git a/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationStatus.php b/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationStatus.php index 66f6d43f..985e0927 100644 --- a/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationStatus.php +++ b/src/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationStatus.php @@ -1,5 +1,15 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Entity; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationApplicationStatusChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationApplicationStatusChangedEvent.php index 8da8046f..19f00de5 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationApplicationStatusChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationApplicationStatusChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerChangedEvent.php index b86d95d8..1b5fdaa3 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerContactPersonChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerContactPersonChangedEvent.php index 7d6e8898..1569a932 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerContactPersonChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBitrix24PartnerContactPersonChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBlockedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBlockedEvent.php index 36ecd6fe..c0df86e9 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBlockedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationBlockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationContactPersonChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationContactPersonChangedEvent.php index c4ba7c18..1b3b7861 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationContactPersonChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationContactPersonChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationCreatedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationCreatedEvent.php index 39e81e5e..b3498a2c 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationCreatedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationCreatedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationExternalIdChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationExternalIdChangedEvent.php index a3db2852..68faf3c5 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationExternalIdChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationExternalIdChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationFinishedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationFinishedEvent.php index 7cb872a7..191d99be 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationFinishedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationFinishedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalLicenseFamilyChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalLicenseFamilyChangedEvent.php index ec203e88..18931dd3 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalLicenseFamilyChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalLicenseFamilyChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalUsersCountChangedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalUsersCountChangedEvent.php index 9ba74712..bdb6695e 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalUsersCountChangedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationPortalUsersCountChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUnblockedEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUnblockedEvent.php index a473b030..91788c03 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUnblockedEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUnblockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUninstalledEvent.php b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUninstalledEvent.php index bc100a67..06256df8 100644 --- a/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUninstalledEvent.php +++ b/src/Application/Contracts/ApplicationInstallations/Events/ApplicationInstallationUninstalledEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Events; diff --git a/src/Application/Contracts/ApplicationInstallations/Exceptions/ApplicationInstallationNotFoundException.php b/src/Application/Contracts/ApplicationInstallations/Exceptions/ApplicationInstallationNotFoundException.php index 99e3b6a0..a25bce8e 100644 --- a/src/Application/Contracts/ApplicationInstallations/Exceptions/ApplicationInstallationNotFoundException.php +++ b/src/Application/Contracts/ApplicationInstallations/Exceptions/ApplicationInstallationNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Exceptions; diff --git a/src/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterface.php b/src/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterface.php index d08160e7..51e9c786 100644 --- a/src/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterface.php +++ b/src/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ApplicationInstallations\Repository; diff --git a/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterface.php b/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterface.php index cf6a9b4e..9a978e79 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterface.php +++ b/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity; diff --git a/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountStatus.php b/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountStatus.php index 97f16cb5..52c871d1 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountStatus.php +++ b/src/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountStatus.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationInstalledEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationInstalledEvent.php index f3fabff9..67c03e01 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationInstalledEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationInstalledEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationUninstalledEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationUninstalledEvent.php index 6aa4fa9f..2928b59b 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationUninstalledEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationUninstalledEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationVersionUpdatedEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationVersionUpdatedEvent.php index c2a2d4f8..fe98e4a4 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationVersionUpdatedEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountApplicationVersionUpdatedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountBlockedEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountBlockedEvent.php index c80c6a38..4a397dc6 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountBlockedEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountBlockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountCreatedEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountCreatedEvent.php index be4079a9..8458ecce 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountCreatedEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountCreatedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDeletedEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDeletedEvent.php index ab5bbb98..a2ab5139 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDeletedEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDeletedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDomainUrlChangedEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDomainUrlChangedEvent.php index ebd52953..2be28c02 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDomainUrlChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountDomainUrlChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountUnblockedEvent.php b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountUnblockedEvent.php index 8915f472..3227745e 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountUnblockedEvent.php +++ b/src/Application/Contracts/Bitrix24Accounts/Events/Bitrix24AccountUnblockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Events; diff --git a/src/Application/Contracts/Bitrix24Accounts/Exceptions/Bitrix24AccountNotFoundException.php b/src/Application/Contracts/Bitrix24Accounts/Exceptions/Bitrix24AccountNotFoundException.php index c785f261..9ff84446 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Exceptions/Bitrix24AccountNotFoundException.php +++ b/src/Application/Contracts/Bitrix24Accounts/Exceptions/Bitrix24AccountNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Exceptions; diff --git a/src/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterface.php b/src/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterface.php index e0d01d56..50d48fa8 100644 --- a/src/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterface.php +++ b/src/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Repository; diff --git a/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterface.php b/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterface.php index cb652fe6..21f90883 100644 --- a/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterface.php +++ b/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Entity; diff --git a/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerStatus.php b/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerStatus.php index f7126467..0071a2d7 100644 --- a/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerStatus.php +++ b/src/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerStatus.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Entity; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerBlockedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerBlockedEvent.php index e19607fd..ce1e7495 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerBlockedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerBlockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerCreatedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerCreatedEvent.php index 9f1e234b..60752b94 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerCreatedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerCreatedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerDeletedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerDeletedEvent.php index 3052f5a8..ead49c4e 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerDeletedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerDeletedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerEmailChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerEmailChangedEvent.php index 411de5ae..c9d76fb2 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerEmailChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerEmailChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerExternalIdChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerExternalIdChangedEvent.php index 3f0355af..295d7ba2 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerExternalIdChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerExternalIdChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerOpenLineIdChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerOpenLineIdChangedEvent.php index a782312a..a6c7d916 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerOpenLineIdChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerOpenLineIdChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPartnerIdChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPartnerIdChangedEvent.php index 6b85cfc1..697282e7 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPartnerIdChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPartnerIdChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPhoneChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPhoneChangedEvent.php index dcf26f55..97948095 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPhoneChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerPhoneChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerSiteChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerSiteChangedEvent.php index eb6e29ff..7477c907 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerSiteChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerSiteChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerTitleChangedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerTitleChangedEvent.php index 48d87a76..50cae9dd 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerTitleChangedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerTitleChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerUnblockedEvent.php b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerUnblockedEvent.php index 084d6a7b..84d01860 100644 --- a/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerUnblockedEvent.php +++ b/src/Application/Contracts/Bitrix24Partners/Events/Bitrix24PartnerUnblockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Events; diff --git a/src/Application/Contracts/Bitrix24Partners/Exceptions/Bitrix24PartnerNotFoundException.php b/src/Application/Contracts/Bitrix24Partners/Exceptions/Bitrix24PartnerNotFoundException.php index 682d5753..47bee12a 100644 --- a/src/Application/Contracts/Bitrix24Partners/Exceptions/Bitrix24PartnerNotFoundException.php +++ b/src/Application/Contracts/Bitrix24Partners/Exceptions/Bitrix24PartnerNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Exceptions; diff --git a/src/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterface.php b/src/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterface.php index 7b9a7ea3..7b78fbbb 100644 --- a/src/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterface.php +++ b/src/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Bitrix24Partners\Repository; diff --git a/src/Application/Contracts/ContactPersons/Entity/ContactPersonInterface.php b/src/Application/Contracts/ContactPersons/Entity/ContactPersonInterface.php index a2a7c7c3..384c97f8 100644 --- a/src/Application/Contracts/ContactPersons/Entity/ContactPersonInterface.php +++ b/src/Application/Contracts/ContactPersons/Entity/ContactPersonInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Entity; diff --git a/src/Application/Contracts/ContactPersons/Entity/ContactPersonStatus.php b/src/Application/Contracts/ContactPersons/Entity/ContactPersonStatus.php index f437a292..25ebd80b 100644 --- a/src/Application/Contracts/ContactPersons/Entity/ContactPersonStatus.php +++ b/src/Application/Contracts/ContactPersons/Entity/ContactPersonStatus.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Entity; diff --git a/src/Application/Contracts/ContactPersons/Entity/FullName.php b/src/Application/Contracts/ContactPersons/Entity/FullName.php index 18892be2..e1e3c6b4 100644 --- a/src/Application/Contracts/ContactPersons/Entity/FullName.php +++ b/src/Application/Contracts/ContactPersons/Entity/FullName.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Entity; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonBlockedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonBlockedEvent.php index 43ca80ef..ec909b0a 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonBlockedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonBlockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonCreatedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonCreatedEvent.php index 5c1e5ff2..f1735cfb 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonCreatedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonCreatedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonDeletedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonDeletedEvent.php index 1fceaeef..473ac0c4 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonDeletedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonDeletedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailChangedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailChangedEvent.php index a8c008e2..49e4688e 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailChangedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailVerifiedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailVerifiedEvent.php index 3158378d..081bdafc 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailVerifiedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonEmailVerifiedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonFullNameChangedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonFullNameChangedEvent.php index 78a86705..8f75e03f 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonFullNameChangedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonFullNameChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonLinkedToExternalEntityEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonLinkedToExternalEntityEvent.php index fb01330a..cc4c8b86 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonLinkedToExternalEntityEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonLinkedToExternalEntityEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneChangedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneChangedEvent.php index c67da565..af5594a8 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneChangedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneVerifiedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneVerifiedEvent.php index 47f73e1a..2a990d69 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneVerifiedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonMobilePhoneVerifiedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Events/ContactPersonUnblockedEvent.php b/src/Application/Contracts/ContactPersons/Events/ContactPersonUnblockedEvent.php index 158bff3e..2f3b0e7b 100644 --- a/src/Application/Contracts/ContactPersons/Events/ContactPersonUnblockedEvent.php +++ b/src/Application/Contracts/ContactPersons/Events/ContactPersonUnblockedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Events; diff --git a/src/Application/Contracts/ContactPersons/Exceptions/ContactPersonNotFoundException.php b/src/Application/Contracts/ContactPersons/Exceptions/ContactPersonNotFoundException.php index d6842524..94d9fc20 100644 --- a/src/Application/Contracts/ContactPersons/Exceptions/ContactPersonNotFoundException.php +++ b/src/Application/Contracts/ContactPersons/Exceptions/ContactPersonNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Exceptions; diff --git a/src/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterface.php b/src/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterface.php index 0042e73e..880c7299 100644 --- a/src/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterface.php +++ b/src/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\ContactPersons\Repository; diff --git a/src/Application/Contracts/Events/AggregateRootEventsEmitterInterface.php b/src/Application/Contracts/Events/AggregateRootEventsEmitterInterface.php index 5dbdbc45..15ee1d3b 100644 --- a/src/Application/Contracts/Events/AggregateRootEventsEmitterInterface.php +++ b/src/Application/Contracts/Events/AggregateRootEventsEmitterInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Contracts\Events; diff --git a/src/Application/PortalLicenseFamily.php b/src/Application/PortalLicenseFamily.php index cd286022..718fa953 100644 --- a/src/Application/PortalLicenseFamily.php +++ b/src/Application/PortalLicenseFamily.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application; diff --git a/src/Application/Requests/AbstractRequest.php b/src/Application/Requests/AbstractRequest.php index 1adcb543..e5d39aba 100644 --- a/src/Application/Requests/AbstractRequest.php +++ b/src/Application/Requests/AbstractRequest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests; diff --git a/src/Application/Requests/Events/AbstractEventRequest.php b/src/Application/Requests/Events/AbstractEventRequest.php index ba207e3b..f2ea13c8 100644 --- a/src/Application/Requests/Events/AbstractEventRequest.php +++ b/src/Application/Requests/Events/AbstractEventRequest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events; diff --git a/src/Application/Requests/Events/EventAuthItem.php b/src/Application/Requests/Events/EventAuthItem.php index f6b44103..57438567 100644 --- a/src/Application/Requests/Events/EventAuthItem.php +++ b/src/Application/Requests/Events/EventAuthItem.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events; diff --git a/src/Application/Requests/Events/EventInterface.php b/src/Application/Requests/Events/EventInterface.php index 6358564e..c425937e 100644 --- a/src/Application/Requests/Events/EventInterface.php +++ b/src/Application/Requests/Events/EventInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events; diff --git a/src/Application/Requests/Events/OnApplicationInstall/ApplicationData.php b/src/Application/Requests/Events/OnApplicationInstall/ApplicationData.php index a63186a0..b60af89c 100644 --- a/src/Application/Requests/Events/OnApplicationInstall/ApplicationData.php +++ b/src/Application/Requests/Events/OnApplicationInstall/ApplicationData.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events\OnApplicationInstall; diff --git a/src/Application/Requests/Events/OnApplicationInstall/OnApplicationInstall.php b/src/Application/Requests/Events/OnApplicationInstall/OnApplicationInstall.php index 64b9999d..283b5b47 100644 --- a/src/Application/Requests/Events/OnApplicationInstall/OnApplicationInstall.php +++ b/src/Application/Requests/Events/OnApplicationInstall/OnApplicationInstall.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events\OnApplicationInstall; diff --git a/src/Application/Requests/Events/OnApplicationUninstall/ApplicationData.php b/src/Application/Requests/Events/OnApplicationUninstall/ApplicationData.php index bc49fb2e..72069390 100644 --- a/src/Application/Requests/Events/OnApplicationUninstall/ApplicationData.php +++ b/src/Application/Requests/Events/OnApplicationUninstall/ApplicationData.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events\OnApplicationUninstall; diff --git a/src/Application/Requests/Events/OnApplicationUninstall/OnApplicationUninstall.php b/src/Application/Requests/Events/OnApplicationUninstall/OnApplicationUninstall.php index a90450a1..96855e9e 100644 --- a/src/Application/Requests/Events/OnApplicationUninstall/OnApplicationUninstall.php +++ b/src/Application/Requests/Events/OnApplicationUninstall/OnApplicationUninstall.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Events\OnApplicationUninstall; diff --git a/src/Application/Requests/Placement/PlacementRequest.php b/src/Application/Requests/Placement/PlacementRequest.php index 9873ed46..0896fc0e 100644 --- a/src/Application/Requests/Placement/PlacementRequest.php +++ b/src/Application/Requests/Placement/PlacementRequest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Application\Requests\Placement; diff --git a/src/Attributes/ApiBatchMethodMetadata.php b/src/Attributes/ApiBatchMethodMetadata.php new file mode 100644 index 00000000..08c765da --- /dev/null +++ b/src/Attributes/ApiBatchMethodMetadata.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Attributes; + +use Attribute; + +#[Attribute(Attribute::TARGET_METHOD)] +class ApiBatchMethodMetadata +{ + public function __construct( + public string $name, + public string $documentationUrl, + public ?string $description = null, + public bool $isDeprecated = false, + public ?string $deprecationMessage = null + ) + { + } +} \ No newline at end of file diff --git a/src/Attributes/ApiBatchServiceMetadata.php b/src/Attributes/ApiBatchServiceMetadata.php new file mode 100644 index 00000000..90b4bb47 --- /dev/null +++ b/src/Attributes/ApiBatchServiceMetadata.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Attributes; + +use Attribute; +use Bitrix24\SDK\Core\Credentials\Scope; + +#[Attribute(Attribute::TARGET_CLASS)] +class ApiBatchServiceMetadata +{ + public function __construct( + public Scope $scope, + public ?string $documentationUrl = null, + public ?string $description = null, + public bool $isDeprecated = false, + public ?string $deprecationMessage = null + ) + { + } +} \ No newline at end of file diff --git a/src/Attributes/ApiEndpointMetadata.php b/src/Attributes/ApiEndpointMetadata.php new file mode 100644 index 00000000..d7d433b8 --- /dev/null +++ b/src/Attributes/ApiEndpointMetadata.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Attributes; + +use Attribute; + +#[Attribute(Attribute::TARGET_METHOD)] +class ApiEndpointMetadata +{ + public function __construct( + public string $name, + public string $documentationUrl, + public ?string $description = null, + public bool $isDeprecated = false, + public ?string $deprecationMessage = null + ) + { + } +} \ No newline at end of file diff --git a/src/Attributes/ApiServiceMetadata.php b/src/Attributes/ApiServiceMetadata.php new file mode 100644 index 00000000..1ca6a15b --- /dev/null +++ b/src/Attributes/ApiServiceMetadata.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Attributes; + +use Attribute; +use Bitrix24\SDK\Core\Credentials\Scope; + +#[Attribute(Attribute::TARGET_CLASS)] +class ApiServiceMetadata +{ + public function __construct( + public Scope $scope, + public ?string $documentationUrl = null, + public ?string $description = null, + public bool $isDeprecated = false, + public ?string $deprecationMessage = null + ) + { + } +} \ No newline at end of file diff --git a/src/Attributes/Services/AttributesParser.php b/src/Attributes/Services/AttributesParser.php new file mode 100644 index 00000000..af8cb17c --- /dev/null +++ b/src/Attributes/Services/AttributesParser.php @@ -0,0 +1,150 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Attributes\Services; + + +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use ReflectionClass; +use Symfony\Component\Filesystem\Filesystem; +use Typhoon\Reflection\TyphoonReflector; +use function Typhoon\Type\stringify; + +readonly class AttributesParser +{ + public function __construct( + private TyphoonReflector $typhoonReflector, + private Filesystem $filesystem, + ) + { + } + + /** + * @param class-string[] $sdkClassNames + * @return array + */ + public function getSupportedInSdkApiMethods(array $sdkClassNames, string $sdkBaseDir): array + { + $supportedInSdkMethods = []; + foreach ($sdkClassNames as $className) { + $reflectionServiceClass = new ReflectionClass($className); + $apiServiceAttribute = $reflectionServiceClass->getAttributes(ApiServiceMetadata::class); + if ($apiServiceAttribute === []) { + continue; + } + $apiServiceAttribute = $apiServiceAttribute[0]; + /** + * @var ApiServiceMetadata $apiServiceAttrInstance + */ + $apiServiceAttrInstance = $apiServiceAttribute->newInstance(); + // process api service + $serviceMethods = $reflectionServiceClass->getMethods(); + foreach ($serviceMethods as $method) { + $attributes = $method->getAttributes(ApiEndpointMetadata::class); + foreach ($attributes as $attribute) { + /** + * @var ApiEndpointMetadata $instance + */ + $instance = $attribute->newInstance(); + + // find return type file name + $returnTypeFileName = null; + if ($method->getReturnType() !== null) { + /** @var @phpstan-ignore-next-line */ + $returnTypeName = $method->getReturnType()->getName(); + if (class_exists($returnTypeName)) { + $reflectionReturnType = new ReflectionClass($returnTypeName); + $returnTypeFileName = substr($this->filesystem->makePathRelative($reflectionReturnType->getFileName(), $sdkBaseDir), 0, -1); + } + } + + $supportedInSdkMethods[$instance->name] = [ + 'sdk_scope' => $apiServiceAttrInstance->scope->getScopeCodes() === [] ? '' : $apiServiceAttrInstance->scope->getScopeCodes()[0], + 'name' => $instance->name, + 'documentation_url' => $instance->documentationUrl, + 'description' => $instance->description, + 'is_deprecated' => $instance->isDeprecated, + 'deprecation_message' => $instance->deprecationMessage, + 'sdk_method_name' => $method->getName(), + 'sdk_method_file_name' => substr($this->filesystem->makePathRelative($method->getFileName(), $sdkBaseDir), 0, -1), + 'sdk_method_file_start_line' => $method->getStartLine(), + 'sdk_method_file_end_line' => $method->getEndLine(), + 'sdk_class_name' => $className, + /** @var @phpstan-ignore-next-line */ + 'sdk_return_type_class' => $method->getReturnType()?->getName(), + 'sdk_return_type_file_name' => $returnTypeFileName + ]; + } + } + } + return $supportedInSdkMethods; + } + + /** + * @param class-string[] $sdkClassNames + * @return array + */ + public function getSupportedInSdkBatchMethods(array $sdkClassNames): array + { + $supportedInSdkMethods = []; + foreach ($sdkClassNames as $className) { + $reflectionServiceClass = new ReflectionClass($className); + $apiServiceAttribute = $reflectionServiceClass->getAttributes(ApiBatchServiceMetadata::class); + if ($apiServiceAttribute === []) { + continue; + } + //try to get type information from phpdoc annotations + $typhoonClassMeta = $this->typhoonReflector->reflectClass($className); + /** + * @var ApiBatchServiceMetadata $apiServiceAttrInstance + */ + $apiServiceAttribute = $apiServiceAttribute[0]; + $apiServiceAttrInstance = $apiServiceAttribute->newInstance(); + // process api service + $serviceMethods = $reflectionServiceClass->getMethods(); + foreach ($serviceMethods as $method) { + $attributes = $method->getAttributes(ApiBatchMethodMetadata::class); + foreach ($attributes as $attribute) { + /** + * @var ApiBatchMethodMetadata $instance + */ + $instance = $attribute->newInstance(); + $sdkReturnTypeTyphoon = null; + if ($method->getReturnType() !== null) { + // get return type from phpdoc annotation + $sdkReturnTypeTyphoon = stringify($typhoonClassMeta->methods()[$method->getName()]->returnType()); + } + + $supportedInSdkMethods[$instance->name][] = [ + 'sdk_scope' => $apiServiceAttrInstance->scope->getScopeCodes()[0], + 'name' => $instance->name, + 'documentation_url' => $instance->documentationUrl, + 'description' => $instance->description, + 'is_deprecated' => $instance->isDeprecated, + 'deprecation_message' => $instance->deprecationMessage, + 'sdk_method_name' => $method->getName(), + 'sdk_method_file_name' => $method->getFileName(), + 'sdk_method_file_start_line' => $method->getStartLine(), + 'sdk_method_file_end_line' => $method->getEndLine(), + 'sdk_method_return_type_typhoon' => $sdkReturnTypeTyphoon, + 'sdk_class_name' => $className, + ]; + } + } + } + return $supportedInSdkMethods; + } +} \ No newline at end of file diff --git a/src/Core/ApiClient.php b/src/Core/ApiClient.php index dc1f6b69..9f1df967 100644 --- a/src/Core/ApiClient.php +++ b/src/Core/ApiClient.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core; diff --git a/src/Core/ApiLevelErrorHandler.php b/src/Core/ApiLevelErrorHandler.php index 1ce16ca2..e5fad9cb 100644 --- a/src/Core/ApiLevelErrorHandler.php +++ b/src/Core/ApiLevelErrorHandler.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core; @@ -11,6 +20,7 @@ use Bitrix24\SDK\Core\Exceptions\OperationTimeLimitExceededException; use Bitrix24\SDK\Core\Exceptions\QueryLimitExceededException; use Bitrix24\SDK\Core\Exceptions\UserNotFoundOrIsNotActiveException; +use Bitrix24\SDK\Core\Exceptions\WrongAuthTypeException; use Bitrix24\SDK\Services\Workflows\Exceptions\ActivityOrRobotAlreadyInstalledException; use Bitrix24\SDK\Services\Workflows\Exceptions\ActivityOrRobotValidationFailureException; use Bitrix24\SDK\Services\Workflows\Exceptions\WorkflowTaskAlreadyCompletedException; @@ -118,6 +128,8 @@ private function handleError(array $responseBody, ?string $batchCommandId = null throw new ActivityOrRobotValidationFailureException(sprintf('%s - %s', $errorCode, $errorDescription)); case 'user_not_found_or_is_not_active': throw new UserNotFoundOrIsNotActiveException(sprintf('%s - %s', $errorCode, $errorDescription)); + case 'wrong_auth_type': + throw new WrongAuthTypeException(sprintf('%s - %s', $errorCode, $errorDescription)); default: throw new BaseException(sprintf('%s - %s %s', $errorCode, $errorDescription, $batchErrorPrefix)); } diff --git a/src/Core/Batch.php b/src/Core/Batch.php index 04314109..8fd250a1 100644 --- a/src/Core/Batch.php +++ b/src/Core/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core; @@ -524,7 +533,7 @@ public function getTraversableList( [ 'batchCommandItemNumber' => $queryCnt, 'nextItem' => $queryResultData->getPagination()->getNextItem(), - 'durationTime' => $queryResultData->getTime()->getDuration(), + 'durationTime' => $queryResultData->getTime()->duration, ] ); @@ -691,7 +700,7 @@ public function getTraversableListWithCount( [ 'batchCommandItemNumber' => $queryCnt, 'nextItem' => $queryResultData->getPagination()->getNextItem(), - 'durationTime' => $queryResultData->getTime()->getDuration(), + 'durationTime' => $queryResultData->getTime()->duration, ] ); // iterate items in batch query result diff --git a/src/Core/BulkItemsReader/BulkItemsReader.php b/src/Core/BulkItemsReader/BulkItemsReader.php index fa6f7d7b..d91a1fff 100644 --- a/src/Core/BulkItemsReader/BulkItemsReader.php +++ b/src/Core/BulkItemsReader/BulkItemsReader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\BulkItemsReader; diff --git a/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php b/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php index 84da8de9..449eaa42 100644 --- a/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php +++ b/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\BulkItemsReader; diff --git a/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php b/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php index cfe7f243..b0cf76da 100644 --- a/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php +++ b/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\BulkItemsReader\ReadStrategies; diff --git a/src/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrder.php b/src/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrder.php index cdcf43d0..97a10e48 100644 --- a/src/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrder.php +++ b/src/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\BulkItemsReader\ReadStrategies; @@ -113,7 +122,7 @@ public function getTraversableList(string $apiMethod, array $order, array $filte } $this->log->debug('FilterWithoutBatchWithoutCountOrder.step', [ - 'duration' => $resultPage->getResponseData()->getTime()->getDuration(), + 'duration' => $resultPage->getResponseData()->getTime()->duration, 'currentElementId' => $currentElementId, 'lastElementId' => $lastElementId, ]); diff --git a/src/Core/Commands/Command.php b/src/Core/Commands/Command.php index 1a36caba..96139aa4 100644 --- a/src/Core/Commands/Command.php +++ b/src/Core/Commands/Command.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Commands; diff --git a/src/Core/Commands/CommandCollection.php b/src/Core/Commands/CommandCollection.php index 01930847..17f2a7b9 100644 --- a/src/Core/Commands/CommandCollection.php +++ b/src/Core/Commands/CommandCollection.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Commands; diff --git a/src/Core/Contracts/AddedItemIdResultInterface.php b/src/Core/Contracts/AddedItemIdResultInterface.php index 465bd43c..41808b4a 100644 --- a/src/Core/Contracts/AddedItemIdResultInterface.php +++ b/src/Core/Contracts/AddedItemIdResultInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Contracts/ApiClientInterface.php b/src/Core/Contracts/ApiClientInterface.php index f1e52855..748bbfb6 100644 --- a/src/Core/Contracts/ApiClientInterface.php +++ b/src/Core/Contracts/ApiClientInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Contracts/BatchOperationsInterface.php b/src/Core/Contracts/BatchOperationsInterface.php index e11c804b..e79b415c 100644 --- a/src/Core/Contracts/BatchOperationsInterface.php +++ b/src/Core/Contracts/BatchOperationsInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Contracts/BulkItemsReaderInterface.php b/src/Core/Contracts/BulkItemsReaderInterface.php index 9c3ee383..c9d8145d 100644 --- a/src/Core/Contracts/BulkItemsReaderInterface.php +++ b/src/Core/Contracts/BulkItemsReaderInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Contracts/CoreInterface.php b/src/Core/Contracts/CoreInterface.php index d58ccf33..d3d232d0 100644 --- a/src/Core/Contracts/CoreInterface.php +++ b/src/Core/Contracts/CoreInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Contracts/DeletedItemResultInterface.php b/src/Core/Contracts/DeletedItemResultInterface.php index 053bf8c7..868f541e 100644 --- a/src/Core/Contracts/DeletedItemResultInterface.php +++ b/src/Core/Contracts/DeletedItemResultInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Contracts/UpdatedItemResultInterface.php b/src/Core/Contracts/UpdatedItemResultInterface.php index 7e95eda2..7dc006c2 100644 --- a/src/Core/Contracts/UpdatedItemResultInterface.php +++ b/src/Core/Contracts/UpdatedItemResultInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Contracts; diff --git a/src/Core/Core.php b/src/Core/Core.php index 169d1020..345b61e1 100644 --- a/src/Core/Core.php +++ b/src/Core/Core.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core; diff --git a/src/Core/CoreBuilder.php b/src/Core/CoreBuilder.php index 96572cc1..a83eeac1 100644 --- a/src/Core/CoreBuilder.php +++ b/src/Core/CoreBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core; diff --git a/src/Core/Credentials/ApplicationProfile.php b/src/Core/Credentials/ApplicationProfile.php index dbad55ab..f8b0a39f 100644 --- a/src/Core/Credentials/ApplicationProfile.php +++ b/src/Core/Credentials/ApplicationProfile.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Credentials; diff --git a/src/Core/Credentials/AuthToken.php b/src/Core/Credentials/AuthToken.php index 9ea72d7d..407cb50e 100644 --- a/src/Core/Credentials/AuthToken.php +++ b/src/Core/Credentials/AuthToken.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Credentials; diff --git a/src/Core/Credentials/Credentials.php b/src/Core/Credentials/Credentials.php index 3398104a..5a17e3d2 100644 --- a/src/Core/Credentials/Credentials.php +++ b/src/Core/Credentials/Credentials.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Credentials; diff --git a/src/Core/Credentials/Endpoints.php b/src/Core/Credentials/Endpoints.php index 6429ed02..a5dcb86f 100644 --- a/src/Core/Credentials/Endpoints.php +++ b/src/Core/Credentials/Endpoints.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + namespace Bitrix24\SDK\Core\Credentials; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; diff --git a/src/Core/Credentials/Scope.php b/src/Core/Credentials/Scope.php index ca7671e0..1fabfac8 100644 --- a/src/Core/Credentials/Scope.php +++ b/src/Core/Credentials/Scope.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Credentials; diff --git a/src/Core/Credentials/WebhookUrl.php b/src/Core/Credentials/WebhookUrl.php index 8d7a8769..f45d513e 100644 --- a/src/Core/Credentials/WebhookUrl.php +++ b/src/Core/Credentials/WebhookUrl.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Credentials; diff --git a/src/Core/Exceptions/AuthForbiddenException.php b/src/Core/Exceptions/AuthForbiddenException.php index 2d444876..77bdb342 100644 --- a/src/Core/Exceptions/AuthForbiddenException.php +++ b/src/Core/Exceptions/AuthForbiddenException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/BaseException.php b/src/Core/Exceptions/BaseException.php index bb5fe834..a0a94c2e 100644 --- a/src/Core/Exceptions/BaseException.php +++ b/src/Core/Exceptions/BaseException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/FileNotFoundException.php b/src/Core/Exceptions/FileNotFoundException.php index 315dd5a6..1f592d6e 100644 --- a/src/Core/Exceptions/FileNotFoundException.php +++ b/src/Core/Exceptions/FileNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/ImmutableResultViolationException.php b/src/Core/Exceptions/ImmutableResultViolationException.php index 1765180c..78f43671 100644 --- a/src/Core/Exceptions/ImmutableResultViolationException.php +++ b/src/Core/Exceptions/ImmutableResultViolationException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/InvalidArgumentException.php b/src/Core/Exceptions/InvalidArgumentException.php index 84c810ce..d891da52 100644 --- a/src/Core/Exceptions/InvalidArgumentException.php +++ b/src/Core/Exceptions/InvalidArgumentException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/MethodConfirmWaitingException.php b/src/Core/Exceptions/MethodConfirmWaitingException.php index 94141e00..8018452a 100644 --- a/src/Core/Exceptions/MethodConfirmWaitingException.php +++ b/src/Core/Exceptions/MethodConfirmWaitingException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/MethodNotFoundException.php b/src/Core/Exceptions/MethodNotFoundException.php index 892684b2..858b0ed7 100644 --- a/src/Core/Exceptions/MethodNotFoundException.php +++ b/src/Core/Exceptions/MethodNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/OperationTimeLimitExceededException.php b/src/Core/Exceptions/OperationTimeLimitExceededException.php index 6311730e..2a1ef6f8 100644 --- a/src/Core/Exceptions/OperationTimeLimitExceededException.php +++ b/src/Core/Exceptions/OperationTimeLimitExceededException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/QueryLimitExceededException.php b/src/Core/Exceptions/QueryLimitExceededException.php index 7bd280d5..9ba9b4c8 100644 --- a/src/Core/Exceptions/QueryLimitExceededException.php +++ b/src/Core/Exceptions/QueryLimitExceededException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/TransportException.php b/src/Core/Exceptions/TransportException.php index d5c02064..4701cbaa 100644 --- a/src/Core/Exceptions/TransportException.php +++ b/src/Core/Exceptions/TransportException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/UnknownScopeCodeException.php b/src/Core/Exceptions/UnknownScopeCodeException.php index bd2e0973..e6af1e15 100644 --- a/src/Core/Exceptions/UnknownScopeCodeException.php +++ b/src/Core/Exceptions/UnknownScopeCodeException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/UserNotFoundOrIsNotActiveException.php b/src/Core/Exceptions/UserNotFoundOrIsNotActiveException.php index fbaefb1b..567ddcbd 100644 --- a/src/Core/Exceptions/UserNotFoundOrIsNotActiveException.php +++ b/src/Core/Exceptions/UserNotFoundOrIsNotActiveException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Exceptions; diff --git a/src/Core/Exceptions/WrongAuthTypeException.php b/src/Core/Exceptions/WrongAuthTypeException.php new file mode 100644 index 00000000..72bad354 --- /dev/null +++ b/src/Core/Exceptions/WrongAuthTypeException.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Core\Exceptions; +class WrongAuthTypeException extends BaseException +{ +} \ No newline at end of file diff --git a/src/Core/Fields/FieldsFilter.php b/src/Core/Fields/FieldsFilter.php new file mode 100644 index 00000000..be27dba5 --- /dev/null +++ b/src/Core/Fields/FieldsFilter.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Core\Fields; + +class FieldsFilter +{ + public function filterSystemFields(array $fieldCodes): array + { + $res = []; + foreach ($fieldCodes as $fieldCode) { + if (!str_starts_with((string) $fieldCode, 'UF_CRM_')) { + $res[] = $fieldCode; + } + } + + return $res; + } +} diff --git a/src/Core/Response/DTO/Pagination.php b/src/Core/Response/DTO/Pagination.php index 12a7d78e..8d158ea8 100644 --- a/src/Core/Response/DTO/Pagination.php +++ b/src/Core/Response/DTO/Pagination.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Response\DTO; diff --git a/src/Core/Response/DTO/RenewedAuthToken.php b/src/Core/Response/DTO/RenewedAuthToken.php index 88c6ce88..8b4ed1a6 100644 --- a/src/Core/Response/DTO/RenewedAuthToken.php +++ b/src/Core/Response/DTO/RenewedAuthToken.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Response\DTO; diff --git a/src/Core/Response/DTO/ResponseData.php b/src/Core/Response/DTO/ResponseData.php index 481defa0..cbcec359 100644 --- a/src/Core/Response/DTO/ResponseData.php +++ b/src/Core/Response/DTO/ResponseData.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Response\DTO; diff --git a/src/Core/Response/DTO/Time.php b/src/Core/Response/DTO/Time.php index cfaaca27..d87f3814 100644 --- a/src/Core/Response/DTO/Time.php +++ b/src/Core/Response/DTO/Time.php @@ -1,73 +1,42 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Response\DTO; -use DateTimeImmutable; +use Carbon\CarbonImmutable; use Exception; readonly class Time { public function __construct( - private float $start, - private float $finish, - private float $duration, - private float $processing, + public float $start, + public float $finish, + public float $duration, + public float $processing, /** * @see https://training.bitrix24.com/rest_help/rest_sum/operating.php */ - private float $operating, - private DateTimeImmutable $dateStart, - private DateTimeImmutable $dateFinish, + public float $operating, + public CarbonImmutable $dateStart, + public CarbonImmutable $dateFinish, /** * @see https://training.bitrix24.com/rest_help/rest_sum/operating.php */ - private ?int $operatingResetAt + public ?int $operatingResetAt ) { } - public function getStart(): float - { - return $this->start; - } - - public function getFinish(): float - { - return $this->finish; - } - - public function getDuration(): float - { - return $this->duration; - } - - public function getProcessing(): float - { - return $this->processing; - } - - public function getOperating(): float - { - return $this->operating; - } - - public function getOperatingResetAt(): ?int - { - return $this->operatingResetAt; - } - - public function getDateStart(): DateTimeImmutable - { - return $this->dateStart; - } - - public function getDateFinish(): DateTimeImmutable - { - return $this->dateFinish; - } - /** * @throws Exception */ @@ -79,8 +48,8 @@ public static function initFromResponse(array $response): self (float)$response['duration'], (float)$response['processing'], array_key_exists('operating', $response) ? (float)$response['operating'] : 0, - new DateTimeImmutable($response['date_start']), - new DateTimeImmutable($response['date_finish']), + new CarbonImmutable($response['date_start']), + new CarbonImmutable($response['date_finish']), $response['operating_reset_at'] ?? null ); } diff --git a/src/Core/Response/Response.php b/src/Core/Response/Response.php index 13cb3ac1..1f0efb2c 100644 --- a/src/Core/Response/Response.php +++ b/src/Core/Response/Response.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Response; diff --git a/src/Core/Result/AbstractItem.php b/src/Core/Result/AbstractItem.php index 4d13d439..7daec5f3 100644 --- a/src/Core/Result/AbstractItem.php +++ b/src/Core/Result/AbstractItem.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/AbstractResult.php b/src/Core/Result/AbstractResult.php index b3fae786..a9c0171c 100644 --- a/src/Core/Result/AbstractResult.php +++ b/src/Core/Result/AbstractResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/AddedItemBatchResult.php b/src/Core/Result/AddedItemBatchResult.php index eb765e6f..0babf68b 100644 --- a/src/Core/Result/AddedItemBatchResult.php +++ b/src/Core/Result/AddedItemBatchResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/AddedItemResult.php b/src/Core/Result/AddedItemResult.php index 509d0e4d..73ae94fa 100644 --- a/src/Core/Result/AddedItemResult.php +++ b/src/Core/Result/AddedItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/DeletedItemBatchResult.php b/src/Core/Result/DeletedItemBatchResult.php index 1d06b6f6..6e17d9c6 100644 --- a/src/Core/Result/DeletedItemBatchResult.php +++ b/src/Core/Result/DeletedItemBatchResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/DeletedItemResult.php b/src/Core/Result/DeletedItemResult.php index 75f599a2..76a9d49d 100644 --- a/src/Core/Result/DeletedItemResult.php +++ b/src/Core/Result/DeletedItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/EmptyResult.php b/src/Core/Result/EmptyResult.php index faccdbec..7119a7cc 100644 --- a/src/Core/Result/EmptyResult.php +++ b/src/Core/Result/EmptyResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/FieldsResult.php b/src/Core/Result/FieldsResult.php index d1069c82..3b0799ea 100644 --- a/src/Core/Result/FieldsResult.php +++ b/src/Core/Result/FieldsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/UpdatedItemBatchResult.php b/src/Core/Result/UpdatedItemBatchResult.php index 67250b73..7456934c 100644 --- a/src/Core/Result/UpdatedItemBatchResult.php +++ b/src/Core/Result/UpdatedItemBatchResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/UpdatedItemResult.php b/src/Core/Result/UpdatedItemResult.php index 0ebd4d07..9656dddc 100644 --- a/src/Core/Result/UpdatedItemResult.php +++ b/src/Core/Result/UpdatedItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Core/Result/UserInterfaceDialogCallResult.php b/src/Core/Result/UserInterfaceDialogCallResult.php index 35ca3f0d..a5a19c66 100644 --- a/src/Core/Result/UserInterfaceDialogCallResult.php +++ b/src/Core/Result/UserInterfaceDialogCallResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Core\Result; diff --git a/src/Events/AuthTokenRenewedEvent.php b/src/Events/AuthTokenRenewedEvent.php index b3cab82a..985b9ba7 100644 --- a/src/Events/AuthTokenRenewedEvent.php +++ b/src/Events/AuthTokenRenewedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Events; diff --git a/src/Events/PortalDomainUrlChangedEvent.php b/src/Events/PortalDomainUrlChangedEvent.php index dc948537..928b85d8 100644 --- a/src/Events/PortalDomainUrlChangedEvent.php +++ b/src/Events/PortalDomainUrlChangedEvent.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Events; diff --git a/src/Infrastructure/Console/Commands/GenerateCoverageDocumentationCommand.php b/src/Infrastructure/Console/Commands/GenerateCoverageDocumentationCommand.php new file mode 100644 index 00000000..026be74e --- /dev/null +++ b/src/Infrastructure/Console/Commands/GenerateCoverageDocumentationCommand.php @@ -0,0 +1,245 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Infrastructure\Console\Commands; + +use Bitrix24\SDK\Attributes\Services\AttributesParser; +use Bitrix24\SDK\Services\ServiceBuilderFactory; +use InvalidArgumentException; +use Psr\Log\LoggerInterface; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Finder\Finder; +use Throwable; + +#[AsCommand( + name: 'b24:util:generate-coverage-documentation', + description: 'generate coverage documentation for all api commands', + hidden: false +)] +class GenerateCoverageDocumentationCommand extends Command +{ + private const WEBHOOK_URL = 'webhook'; + private const PUBLIC_REPO_URL = 'repository-url'; + private const TARGET_BRANCH = 'repository-branch'; + private const TARGET_FILE = 'file'; + + public function __construct( + private readonly AttributesParser $attributesParser, + private readonly ServiceBuilderFactory $serviceBuilderFactory, + private readonly Finder $finder, + private readonly Filesystem $filesystem, + private readonly LoggerInterface $logger) + { + // best practices recommend to call the parent constructor first and + // then set your own properties. That wouldn't work in this case + // because configure() needs the properties set in this constructor + parent::__construct(); + } + + protected function configure(): void + { + $this + ->setHelp('generate coverage report for all api commands based on actual methods list from api and api service attributes') + ->addOption( + self::WEBHOOK_URL, + null, + InputOption::VALUE_REQUIRED, + 'bitrix24 incoming webhook', + '' + ) + ->addOption( + self::PUBLIC_REPO_URL, + null, + InputOption::VALUE_REQUIRED, + 'public repository url', + '' + ) + ->addOption( + self::TARGET_BRANCH, + null, + InputOption::VALUE_REQUIRED, + 'target branch name', + '' + ) + ->addOption( + self::TARGET_FILE, + null, + InputOption::VALUE_REQUIRED, + 'file for generated documentation', + '' + ); + } + + private function loadAllServiceClasses(): void + { + $directory = 'src/Services'; + $this->finder->files()->in($directory)->name('*.php'); + foreach ($this->finder as $file) { + if ($file->isDir()) { + continue; + } + + $absoluteFilePath = $file->getRealPath(); + require_once $absoluteFilePath; + } + } + + /** + * @param non-empty-string $namespace + * @return array + */ + private function getAllSdkClassNames(string $namespace): array + { + $allClasses = get_declared_classes(); + return array_filter($allClasses, static function ($class) use ($namespace) { + return strncmp($class, $namespace, 12) === 0; + }); + } + + private function createTableInMarkdownFormat( + array $supportedInSdkMethods, + array $supportedInSdkBatchMethods, + string $publicRepoUrl, + string $publicRepoBranch + ): string + { + $tableHeader = <<`%s`
", + $method['sdk_class_name'] . '::' . $method['sdk_method_name']); + $batchMethodsHint .= sprintf("Return type: `%s`", $method['sdk_method_return_type_typhoon']); + } + $batchMethodsHint .= ""; + } + + $sdkMethodPublicUrl = sprintf('%s/%s/%s#L%s-L%s', + $publicRepoUrl, + $publicRepoBranch, + $apiMethod['sdk_method_file_name'], + $apiMethod['sdk_method_file_start_line'], + $apiMethod['sdk_method_file_end_line'], + ); + $sdkMethodReturnTypePublicUrl = sprintf('%s/%s/%s', + $publicRepoUrl, + $publicRepoBranch, + $apiMethod['sdk_return_type_file_name']); + + $table .= sprintf("\n|`%s`|[%s](%s)|%s|[`%s`](%s)
Return type
[`%s`](%s)%s|", + $apiMethod['sdk_scope'] === '' ? '–' : $apiMethod['sdk_scope'], + $apiMethod['name'], + $apiMethod['documentation_url'], + $apiMethod['description'], + $apiMethod['sdk_class_name'] . '::' . $apiMethod['sdk_method_name'], + $sdkMethodPublicUrl, + $apiMethod['sdk_return_type_class'], + $sdkMethodReturnTypePublicUrl, + $batchMethodsHint + ); + } + + return $table; + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new SymfonyStyle($input, $output); + try { + $b24Webhook = (string)$input->getOption(self::WEBHOOK_URL); + if ($b24Webhook === '') { + throw new InvalidArgumentException('you must provide a webhook url in argument «webhook»'); + } + $publicRepoUrl = (string)$input->getOption(self::PUBLIC_REPO_URL); + if ($publicRepoUrl === '') { + throw new InvalidArgumentException('you must provide a public repository url in argument «repository-url»'); + } + $targetRepoBranch = (string)$input->getOption(self::TARGET_BRANCH); + if ($targetRepoBranch === '') { + throw new InvalidArgumentException('you must provide a target repository branch name in argument «repository-branch»'); + } + $targetFile = (string)$input->getOption(self::TARGET_FILE); + if ($targetFile === '') { + throw new InvalidArgumentException('you must provide a file to save generated documentation «file»'); + } + $this->logger->debug('GenerateCoverageDocumentationCommand.start', [ + 'b24Webhook' => $b24Webhook, + 'publicRepoUrl' => $publicRepoUrl, + 'targetRepoBranch' => $targetRepoBranch, + 'targetFile' => $targetFile + ]); + + $io->info('Generate api coverage report'); + // get all available api methods + $sb = $this->serviceBuilderFactory->initFromWebhook($b24Webhook); + $allApiMethods = $sb->getMainScope()->main()->getAvailableMethods()->getResponseData()->getResult(); + + // load and filter classes in namespace Bitrix24\SDK from folder src/Services + $this->loadAllServiceClasses(); + $sdkClassNames = $this->getAllSdkClassNames('Bitrix24\SDK'); + // get sdk root path, change magic number if move current file to another folder depth + $sdkBasePath = dirname(__FILE__, 5) . '/'; + + $supportedInSdkMethods = $this->attributesParser->getSupportedInSdkApiMethods($sdkClassNames, $sdkBasePath); + $supportedInSdkBatchMethods = $this->attributesParser->getSupportedInSdkBatchMethods($sdkClassNames); + + $allApiMethodsCnt = count($allApiMethods); + $supportedInSdkMethodsCnt = count($supportedInSdkMethods); + $supportedInSdkBatchMethodsCnt = count($supportedInSdkBatchMethods); + + // build coverage documentation in Markdown format + $mdTable = $this->createTableInMarkdownFormat( + $supportedInSdkMethods, + $supportedInSdkBatchMethods, + $publicRepoUrl, + $targetRepoBranch + ); + // save documentation to file + if ($this->filesystem->exists($targetFile)) { + $this->filesystem->remove($targetFile); + } + $this->filesystem->dumpFile($targetFile, $mdTable); + + $output->writeln([ + sprintf('Bitrix24 API-methods count: %d', $allApiMethodsCnt), + sprintf('Supported in bitrix24-php-sdk methods count: %d', $supportedInSdkMethodsCnt), + sprintf('Coverage percentage: %s%% 🚀', round(($supportedInSdkMethodsCnt * 100) / $allApiMethodsCnt, 2)), + '', + sprintf('Supported in bitrix24-php-sdk methods with batch wrapper count: %d', $supportedInSdkBatchMethodsCnt), + '' + ]); + + } catch (Throwable $exception) { + $io->error(sprintf('runtime error: %s', $exception->getMessage())); + $io->info($exception->getTraceAsString()); + + return self::INVALID; + } + return self::SUCCESS; + } +} \ No newline at end of file diff --git a/src/Infrastructure/Filesystem/Base64Encoder.php b/src/Infrastructure/Filesystem/Base64Encoder.php index a13387bb..efa46705 100644 --- a/src/Infrastructure/Filesystem/Base64Encoder.php +++ b/src/Infrastructure/Filesystem/Base64Encoder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + namespace Bitrix24\SDK\Infrastructure\Filesystem; use Bitrix24\SDK\Core\Exceptions\FileNotFoundException; diff --git a/src/Infrastructure/HttpClient/RequestId/DefaultRequestIdGenerator.php b/src/Infrastructure/HttpClient/RequestId/DefaultRequestIdGenerator.php index 84defcd0..846df54a 100644 --- a/src/Infrastructure/HttpClient/RequestId/DefaultRequestIdGenerator.php +++ b/src/Infrastructure/HttpClient/RequestId/DefaultRequestIdGenerator.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Infrastructure\HttpClient\RequestId; diff --git a/src/Infrastructure/HttpClient/RequestId/RequestIdGeneratorInterface.php b/src/Infrastructure/HttpClient/RequestId/RequestIdGeneratorInterface.php index 77ba06b2..acddc679 100644 --- a/src/Infrastructure/HttpClient/RequestId/RequestIdGeneratorInterface.php +++ b/src/Infrastructure/HttpClient/RequestId/RequestIdGeneratorInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Infrastructure\HttpClient\RequestId; diff --git a/src/Infrastructure/HttpClient/TransportLayer/NetworkTimingsParser.php b/src/Infrastructure/HttpClient/TransportLayer/NetworkTimingsParser.php index 093f2a62..51fd9c4c 100644 --- a/src/Infrastructure/HttpClient/TransportLayer/NetworkTimingsParser.php +++ b/src/Infrastructure/HttpClient/TransportLayer/NetworkTimingsParser.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Infrastructure\HttpClient\TransportLayer; diff --git a/src/Infrastructure/HttpClient/TransportLayer/ResponseInfoParser.php b/src/Infrastructure/HttpClient/TransportLayer/ResponseInfoParser.php index 386ba8e9..328af11d 100644 --- a/src/Infrastructure/HttpClient/TransportLayer/ResponseInfoParser.php +++ b/src/Infrastructure/HttpClient/TransportLayer/ResponseInfoParser.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Infrastructure\HttpClient\TransportLayer; diff --git a/src/Services/AbstractBatchService.php b/src/Services/AbstractBatchService.php index c62a6b69..f4eafe95 100644 --- a/src/Services/AbstractBatchService.php +++ b/src/Services/AbstractBatchService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services; diff --git a/src/Services/AbstractService.php b/src/Services/AbstractService.php index a2ee2cfa..9d71d95c 100644 --- a/src/Services/AbstractService.php +++ b/src/Services/AbstractService.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services; diff --git a/src/Services/AbstractServiceBuilder.php b/src/Services/AbstractServiceBuilder.php index 36c97565..33edbf89 100644 --- a/src/Services/AbstractServiceBuilder.php +++ b/src/Services/AbstractServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services; diff --git a/src/Services/CRM/Activity/ActivityContentType.php b/src/Services/CRM/Activity/ActivityContentType.php new file mode 100644 index 00000000..57273409 --- /dev/null +++ b/src/Services/CRM/Activity/ActivityContentType.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Activity; + +/** + * @see https://training.bitrix24.com/rest_help/crm/auxiliary/enum/crm_enum_contenttype.php + */ +enum ActivityContentType: int +{ + case default = 0; + case plainText = 1; + case bbCode = 2; + case html = 3; +} \ No newline at end of file diff --git a/src/Services/CRM/Activity/ActivityDirectionType.php b/src/Services/CRM/Activity/ActivityDirectionType.php new file mode 100644 index 00000000..94b893b8 --- /dev/null +++ b/src/Services/CRM/Activity/ActivityDirectionType.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Activity; + +/** + * @see https://training.bitrix24.com/rest_help/crm/auxiliary/enum/crm_enum-activitydirection.php + */ +enum ActivityDirectionType: int +{ + case default = 0; + case incoming = 1; + case outgoing = 2; +} \ No newline at end of file diff --git a/src/Services/CRM/Activity/ActivityFetcherBuilder.php b/src/Services/CRM/Activity/ActivityFetcherBuilder.php index e4508320..f21ab419 100644 --- a/src/Services/CRM/Activity/ActivityFetcherBuilder.php +++ b/src/Services/CRM/Activity/ActivityFetcherBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity; diff --git a/src/Services/CRM/Activity/ActivityNotifyType.php b/src/Services/CRM/Activity/ActivityNotifyType.php new file mode 100644 index 00000000..6ecbd718 --- /dev/null +++ b/src/Services/CRM/Activity/ActivityNotifyType.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Activity; + +/** + * @see https://training.bitrix24.com/rest_help/crm/auxiliary/enum/crm_enumactivitynotifytype.php + */ +enum ActivityNotifyType: int +{ + case default = 0; + case minutes = 1; + case hours = 2; + case days = 3; +} \ No newline at end of file diff --git a/src/Services/CRM/Activity/ActivityPriority.php b/src/Services/CRM/Activity/ActivityPriority.php new file mode 100644 index 00000000..dec4d9de --- /dev/null +++ b/src/Services/CRM/Activity/ActivityPriority.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Activity; + +/** + * @see https://training.bitrix24.com/rest_help/crm/auxiliary/enum/crm_enum_activitypriority.php + */ +enum ActivityPriority: int +{ + case default = 0; + case low = 1; + case medium = 2; + case high = 3; +} \ No newline at end of file diff --git a/src/Services/CRM/Activity/ActivityStatus.php b/src/Services/CRM/Activity/ActivityStatus.php new file mode 100644 index 00000000..2678b8ca --- /dev/null +++ b/src/Services/CRM/Activity/ActivityStatus.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Activity; + +/** + * @see https://training.bitrix24.com/rest_help/crm/auxiliary/enum/crm_enum_activitystatus.php + */ +enum ActivityStatus: int +{ + case default = 0; + case waiting = 1; + case finished = 2; + case finishedAutomatically = 3; +} \ No newline at end of file diff --git a/src/Services/CRM/Activity/ActivityType.php b/src/Services/CRM/Activity/ActivityType.php new file mode 100644 index 00000000..46e96a59 --- /dev/null +++ b/src/Services/CRM/Activity/ActivityType.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Activity; + +/** + * @see https://training.bitrix24.com/rest_help/crm/auxiliary/enum/crm_enum_activitytype.php + */ +enum ActivityType: int +{ + case default = 0; + case meeting = 1; + case call = 2; + case task = 3; + case letter = 4; + case action = 5; + case userAction = 6; +} \ No newline at end of file diff --git a/src/Services/CRM/Activity/ReadModel/EmailFetcher.php b/src/Services/CRM/Activity/ReadModel/EmailFetcher.php index 2b42e249..0d535df5 100644 --- a/src/Services/CRM/Activity/ReadModel/EmailFetcher.php +++ b/src/Services/CRM/Activity/ReadModel/EmailFetcher.php @@ -1,20 +1,34 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\ReadModel; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Services\CRM\Activity\Result\Email\EmailActivityItemResult; use Generator; +#[ApiBatchServiceMetadata(new Scope(['crm']))] class EmailFetcher { private BulkItemsReaderInterface $bulkItemsReader; /** - * @param \Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface $bulkItemsReader + * @param BulkItemsReaderInterface $bulkItemsReader */ public function __construct(BulkItemsReaderInterface $bulkItemsReader) { @@ -22,18 +36,18 @@ public function __construct(BulkItemsReaderInterface $bulkItemsReader) } /** - * @param array $order - * @param array $filter - * @param array $select - * @param int|null $limit - * - * @return EmailActivityItemResult[]|Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.list', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php', + 'Returns in batch mode a list of activity where provider id is an a EMAIL' + )] public function getList(array $order, array $filter, array $select, ?int $limit = null): Generator { $filter = array_merge($filter, [ - 'PROVIDER_ID' => 'CRM_EMAIL', + 'PROVIDER_ID' => 'CRM_EMAIL', 'PROVIDER_TYPE_ID' => 'EMAIL', ]); diff --git a/src/Services/CRM/Activity/ReadModel/OpenLineFetcher.php b/src/Services/CRM/Activity/ReadModel/OpenLineFetcher.php index baa946be..c371b266 100644 --- a/src/Services/CRM/Activity/ReadModel/OpenLineFetcher.php +++ b/src/Services/CRM/Activity/ReadModel/OpenLineFetcher.php @@ -1,20 +1,34 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\ReadModel; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Services\CRM\Activity\Result\OpenLine\OpenLineActivityItemResult; use Generator; +#[ApiBatchServiceMetadata(new Scope(['crm']))] class OpenLineFetcher { private BulkItemsReaderInterface $bulkItemsReader; /** - * @param \Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface $bulkItemsReader + * @param BulkItemsReaderInterface $bulkItemsReader */ public function __construct(BulkItemsReaderInterface $bulkItemsReader) { @@ -22,20 +36,19 @@ public function __construct(BulkItemsReaderInterface $bulkItemsReader) } /** - * @param array $order - * @param array $filter - * @param array $select - * @param int|null $openLineTypeId - * @param int|null $limit - * - * @return OpenLineActivityItemResult[]|Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.list', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php', + 'Returns in batch mode a list of activity where provider id is an a IMOPENLINES_SESSION' + )] public function getList(array $order, array $filter, array $select, ?int $openLineTypeId = null, ?int $limit = null): Generator { if ($openLineTypeId !== null) { $filter = array_merge($filter, [ - 'PROVIDER_ID' => 'IMOPENLINES_SESSION', + 'PROVIDER_ID' => 'IMOPENLINES_SESSION', 'PROVIDER_TYPE_ID' => $openLineTypeId, ]); } else { diff --git a/src/Services/CRM/Activity/ReadModel/VoximplantFetcher.php b/src/Services/CRM/Activity/ReadModel/VoximplantFetcher.php index 1ed02368..9ffffa82 100644 --- a/src/Services/CRM/Activity/ReadModel/VoximplantFetcher.php +++ b/src/Services/CRM/Activity/ReadModel/VoximplantFetcher.php @@ -1,20 +1,34 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\ReadModel; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Services\CRM\Activity\Result\ActivityItemResult; +use Bitrix24\SDK\Services\CRM\Activity\Result\OpenLine\OpenLineActivityItemResult; use Generator; +#[ApiBatchServiceMetadata(new Scope(['crm']))] class VoximplantFetcher { private BulkItemsReaderInterface $bulkItemsReader; /** - * @param \Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface $bulkItemsReader + * @param BulkItemsReaderInterface $bulkItemsReader */ public function __construct(BulkItemsReaderInterface $bulkItemsReader) { @@ -22,18 +36,18 @@ public function __construct(BulkItemsReaderInterface $bulkItemsReader) } /** - * @param array $order - * @param array $filter - * @param array $select - * @param int|null $limit - * - * @return \Bitrix24\SDK\Services\CRM\Activity\Result\ActivityItemResult[]|Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.list', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php', + 'Returns in batch mode a list of activity where provider id is an a VOXIMPLANT_CALL' + )] public function getList(array $order, array $filter, array $select, ?int $limit = null): Generator { $filter = array_merge($filter, [ - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', ]); diff --git a/src/Services/CRM/Activity/ReadModel/WebFormFetcher.php b/src/Services/CRM/Activity/ReadModel/WebFormFetcher.php index 5d4c0662..b9b205be 100644 --- a/src/Services/CRM/Activity/ReadModel/WebFormFetcher.php +++ b/src/Services/CRM/Activity/ReadModel/WebFormFetcher.php @@ -1,20 +1,34 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\ReadModel; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Services\CRM\Activity\Result\ActivityItemResult; use Bitrix24\SDK\Services\CRM\Activity\Result\WebForm\WebFormActivityItemResult; use Generator; +#[ApiBatchServiceMetadata(new Scope(['crm']))] class WebFormFetcher { private BulkItemsReaderInterface $bulkItemsReader; /** - * @param \Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface $bulkItemsReader + * @param BulkItemsReaderInterface $bulkItemsReader */ public function __construct(BulkItemsReaderInterface $bulkItemsReader) { @@ -22,20 +36,20 @@ public function __construct(BulkItemsReaderInterface $bulkItemsReader) } /** - * @param array $order - * @param array $filter - * @param array $select - * @param int|null $webFormId - * @param int|null $limit + * @return Generator * - * @return WebFormActivityItemResult[]|Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.list', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php', + 'Returns in batch mode a list of activity where provider id is an a CRM_WEBFORM' + )] public function getList(array $order, array $filter, array $select, ?int $webFormId = null, ?int $limit = null): Generator { if ($webFormId !== null) { $filter = array_merge($filter, [ - 'PROVIDER_ID' => 'CRM_WEBFORM', + 'PROVIDER_ID' => 'CRM_WEBFORM', 'PROVIDER_TYPE_ID' => $webFormId, ]); } else { diff --git a/src/Services/CRM/Activity/Result/ActivitiesResult.php b/src/Services/CRM/Activity/Result/ActivitiesResult.php index ce52ce3d..214f5271 100644 --- a/src/Services/CRM/Activity/Result/ActivitiesResult.php +++ b/src/Services/CRM/Activity/Result/ActivitiesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Result/ActivityItemResult.php b/src/Services/CRM/Activity/Result/ActivityItemResult.php index 72062fd8..8e819f40 100644 --- a/src/Services/CRM/Activity/Result/ActivityItemResult.php +++ b/src/Services/CRM/Activity/Result/ActivityItemResult.php @@ -1,57 +1,74 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Result; +use Bitrix24\SDK\Services\CRM\Activity\ActivityContentType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityDirectionType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityNotifyType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityPriority; +use Bitrix24\SDK\Services\CRM\Activity\ActivityStatus; +use Bitrix24\SDK\Services\CRM\Activity\ActivityType; use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem; -use DateTimeInterface; +use Carbon\CarbonImmutable; +use Money\Currency; +use Money\Money; /** * @see https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_fields.php * - * @property-read int $ID // Activity ID - * @property-read int $OWNER_ID + * @property-read int $ID // Activity ID + * @property-read int $OWNER_ID * @property-read string $OWNER_TYPE_ID - * @property-read string $TYPE_ID + * @property-read ActivityType $TYPE_ID * @property-read string $PROVIDER_ID * @property-read string $PROVIDER_TYPE_ID * @property-read string $PROVIDER_GROUP_ID - * @property-read int $ASSOCIATED_ENTITY_ID // ID of an entity associated with the activity + * @property-read int $ASSOCIATED_ENTITY_ID // ID of an entity associated with the activity * @property-read string $SUBJECT * @property-read string $START_TIME * @property-read string $END_TIME // Completion time - * @property-read string $DEADLINE // Deadline - * @property-read string $COMPLETED // Completed - * @property-read string $STATUS - * @property-read string $RESPONSIBLE_ID - * @property-read string $PRIORITY - * @property-read string $NOTIFY_TYPE // Notification type with crm_enum_activitynotifytype type - * @property-read int $NOTIFY_VALUE + * @property-read CarbonImmutable $DEADLINE // Deadline + * @property-read boolean $COMPLETED // Completed + * @property-read ActivityStatus $STATUS + * @property-read int $RESPONSIBLE_ID + * @property-read ActivityPriority $PRIORITY + * @property-read ActivityNotifyType $NOTIFY_TYPE // Notification type with crm_enum_activitynotifytype type + * @property-read int $NOTIFY_VALUE * @property-read string $DESCRIPTION // Description - * @property-read string $DESCRIPTION_TYPE // Description type with crm_enum_contenttype type - * @property-read string $DIRECTION // with crm_enum_activitydirection type - * @property-read string $LOCATION // Location - * @property-read string $CREATED - * @property-read string $AUTHOR_ID // Activity author ID - * @property-read string $LAST_UPDATED // Date of the last update date - * @property-read string $EDITOR_ID // Editor - * @property-read array $SETTINGS - * @property-read string $ORIGIN_ID - * @property-read string $ORIGINATOR_ID - * @property-read int $RESULT_STATUS - * @property-read int $RESULT_STREAM - * @property-read string $RESULT_SOURCE_ID - * @property-read array $PROVIDER_PARAMS - * @property-read string $PROVIDER_DATA - * @property-read int $RESULT_MARK - * @property-read string $RESULT_VALUE - * @property-read string $RESULT_SUM - * @property-read string $RESULT_CURRENCY_ID - * @property-read int $AUTOCOMPLETE_RULE // Autocompletion + * @property-read ActivityContentType $DESCRIPTION_TYPE // Description type with crm_enum_contenttype type + * @property-read ActivityDirectionType $DIRECTION // with crm_enum_activity direction type + * @property-read string|null $LOCATION // Location + * @property-read CarbonImmutable $CREATED + * @property-read int $AUTHOR_ID // Activity author ID + * @property-read CarbonImmutable $LAST_UPDATED // Date of the last update date + * @property-read int $EDITOR_ID // Editor + * @property-read array $SETTINGS + * @property-read string|null $ORIGIN_ID + * @property-read string|null $ORIGINATOR_ID + * @property-read int $RESULT_STATUS + * @property-read int $RESULT_STREAM + * @property-read string|null $RESULT_SOURCE_ID + * @property-read array $PROVIDER_PARAMS + * @property-read string|null $PROVIDER_DATA + * @property-read int $RESULT_MARK + * @property-read string|null $RESULT_VALUE + * @property-read Money|null $RESULT_SUM + * @property-read Currency|null $RESULT_CURRENCY_ID + * @property-read int $AUTOCOMPLETE_RULE // Autocompletion * @property-read string $BINDINGS // Bindings - * @property-read array $COMMUNICATIONS // type crm_activity_communication - * @property-read array $FILES // Added files with diskfile type + * @property-read array $COMMUNICATIONS // type crm_activity_communication + * @property-read array $FILES // Added files with diskfile type * @property-read string $WEBDAV_ELEMENTS */ class ActivityItemResult extends AbstractCrmItem diff --git a/src/Services/CRM/Activity/Result/ActivityResult.php b/src/Services/CRM/Activity/Result/ActivityResult.php index 4b17e7ef..c15dcc3c 100644 --- a/src/Services/CRM/Activity/Result/ActivityResult.php +++ b/src/Services/CRM/Activity/Result/ActivityResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Result/Email/EmailActivityItemResult.php b/src/Services/CRM/Activity/Result/Email/EmailActivityItemResult.php index c3056932..77b9fc53 100644 --- a/src/Services/CRM/Activity/Result/Email/EmailActivityItemResult.php +++ b/src/Services/CRM/Activity/Result/Email/EmailActivityItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Result\Email; diff --git a/src/Services/CRM/Activity/Result/Email/EmailMeta.php b/src/Services/CRM/Activity/Result/Email/EmailMeta.php index 939672b8..bb890e6e 100644 --- a/src/Services/CRM/Activity/Result/Email/EmailMeta.php +++ b/src/Services/CRM/Activity/Result/Email/EmailMeta.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Result\Email; diff --git a/src/Services/CRM/Activity/Result/Email/EmailSettings.php b/src/Services/CRM/Activity/Result/Email/EmailSettings.php index 4562ec2b..8e3a1029 100644 --- a/src/Services/CRM/Activity/Result/Email/EmailSettings.php +++ b/src/Services/CRM/Activity/Result/Email/EmailSettings.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Result\Email; diff --git a/src/Services/CRM/Activity/Result/OpenLine/OpenLineActivityItemResult.php b/src/Services/CRM/Activity/Result/OpenLine/OpenLineActivityItemResult.php index caa83230..5fec9612 100644 --- a/src/Services/CRM/Activity/Result/OpenLine/OpenLineActivityItemResult.php +++ b/src/Services/CRM/Activity/Result/OpenLine/OpenLineActivityItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Result\OpenLine; diff --git a/src/Services/CRM/Activity/Result/OpenLine/OpenLineProviderParams.php b/src/Services/CRM/Activity/Result/OpenLine/OpenLineProviderParams.php index 5920829f..8ca1c3f9 100644 --- a/src/Services/CRM/Activity/Result/OpenLine/OpenLineProviderParams.php +++ b/src/Services/CRM/Activity/Result/OpenLine/OpenLineProviderParams.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Result/WebForm/VisitedPageItem.php b/src/Services/CRM/Activity/Result/WebForm/VisitedPageItem.php index c479f8f7..16b20878 100644 --- a/src/Services/CRM/Activity/Result/WebForm/VisitedPageItem.php +++ b/src/Services/CRM/Activity/Result/WebForm/VisitedPageItem.php @@ -1,5 +1,13 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Result/WebForm/WebFormActivityItemResult.php b/src/Services/CRM/Activity/Result/WebForm/WebFormActivityItemResult.php index e9b0742e..d36cc0df 100644 --- a/src/Services/CRM/Activity/Result/WebForm/WebFormActivityItemResult.php +++ b/src/Services/CRM/Activity/Result/WebForm/WebFormActivityItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Result\WebForm; diff --git a/src/Services/CRM/Activity/Result/WebForm/WebFormFieldItem.php b/src/Services/CRM/Activity/Result/WebForm/WebFormFieldItem.php index 1fc1572e..715459d2 100644 --- a/src/Services/CRM/Activity/Result/WebForm/WebFormFieldItem.php +++ b/src/Services/CRM/Activity/Result/WebForm/WebFormFieldItem.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Result/WebForm/WebFormMetadata.php b/src/Services/CRM/Activity/Result/WebForm/WebFormMetadata.php index 29568019..c1a9c457 100644 --- a/src/Services/CRM/Activity/Result/WebForm/WebFormMetadata.php +++ b/src/Services/CRM/Activity/Result/WebForm/WebFormMetadata.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Result/WebForm/WebFormProviderParams.php b/src/Services/CRM/Activity/Result/WebForm/WebFormProviderParams.php index d61998a1..e8c8d572 100644 --- a/src/Services/CRM/Activity/Result/WebForm/WebFormProviderParams.php +++ b/src/Services/CRM/Activity/Result/WebForm/WebFormProviderParams.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Activity/Service/Activity.php b/src/Services/CRM/Activity/Service/Activity.php index 9ccde4f7..6ef0993d 100644 --- a/src/Services/CRM/Activity/Service/Activity.php +++ b/src/Services/CRM/Activity/Service/Activity.php @@ -1,10 +1,23 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Service; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -16,11 +29,7 @@ use Bitrix24\SDK\Services\CRM\Activity\Result\ActivityResult; use Psr\Log\LoggerInterface; -/** - * Class Activity - * - * @package Bitrix24\SDK\Services\CRM\Activity\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class Activity extends AbstractService { public Batch $batch; @@ -28,8 +37,8 @@ class Activity extends AbstractService /** * Contact constructor. * - * @param Batch $batch - * @param CoreInterface $core + * @param Batch $batch + * @param CoreInterface $core * @param LoggerInterface $log */ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $log) @@ -46,8 +55,8 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @param array{ * ID?: int, * OWNER_ID?: int, - * OWNER_TYPE_ID?: string, - * TYPE_ID?: string, + * OWNER_TYPE_ID?: int, + * TYPE_ID?: int, * PROVIDER_ID?: string, * PROVIDER_TYPE_ID?: string, * PROVIDER_GROUP_ID?: string, @@ -93,6 +102,11 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.activity.add', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_add.php', + 'Creates and adds a new activity.' + )] public function add(array $fields): AddedItemResult { return new AddedItemResult( @@ -116,6 +130,11 @@ public function add(array $fields): AddedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.activity.delete', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_delete.php', + 'Deletes the specified activity and all the associated objects.' + )] public function delete(int $itemId): DeletedItemResult { return new DeletedItemResult( @@ -137,6 +156,11 @@ public function delete(int $itemId): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.activity.fields', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_fields.php', + 'Returns the description of activity fields' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.activity.fields')); @@ -153,6 +177,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.activity.get', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_get.php', + 'Returns activity by the specified activity ID' + )] public function get(int $entityId): ActivityResult { return new ActivityResult( @@ -214,7 +243,7 @@ public function get(int $entityId): ActivityResult * COMMUNICATIONS?: string, * FILES?: string, * WEBDAV_ELEMENTS?: string, - * } $order + * } $order * * @param array{ * ID?: int, @@ -260,25 +289,30 @@ public function get(int $entityId): ActivityResult * COMMUNICATIONS?: string, * FILES?: string, * WEBDAV_ELEMENTS?: string, - * } $filter + * } $filter * * @param array $select = ['ID','OWNER_ID','OWNER_TYPE_ID','TYPE_ID','PROVIDER_ID','PROVIDER_TYPE_ID','PROVIDER_GROUP_ID','ASSOCIATED_ENTITY_ID','SUBJECT','START_TIME','END_TIME','DEADLINE','COMPLETED','STATUS','RESPONSIBLE_ID','PRIORITY','NOTIFY_TYPE','NOTIFY_VALUE','DESCRIPTION','DESCRIPTION_TYPE','DIRECTION','LOCATION','CREATED','AUTHOR_ID','LAST_UPDATED','EDITOR_ID','SETTINGS','ORIGIN_ID','ORIGINATOR_ID','RESULT_STATUS','RESULT_STREAM','RESULT_SOURCE_ID','PROVIDER_PARAMS','PROVIDER_DATA','RESULT_MARK','RESULT_VALUE','RESULT_SUM','RESULT_CURRENCY_ID','AUTOCOMPLETE_RULE','BINDINGS','COMMUNICATIONS','FILES','WEBDAV_ELEMENTS','COMMUNICATIONS'] - * @param int $start + * @param int $start * * @return ActivitiesResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.activity.list', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php', + 'Returns a list of activity selected by the filter specified as the parameter. See the example for the filter notation.' + )] public function list(array $order, array $filter, array $select, int $start): ActivitiesResult { return new ActivitiesResult( $this->core->call( 'crm.activity.list', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, 'select' => $select, - 'start' => $start, + 'start' => $start, ] ) ); @@ -334,19 +368,24 @@ public function list(array $order, array $filter, array $select, int $start): Ac * COMMUNICATIONS?: string, * FILES?: string, * WEBDAV_ELEMENTS?: string, - * } $fields + * } $fields * * @return UpdatedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.activity.update', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_update.php', + 'Updates the specified (existing) activity.' + )] public function update(int $itemId, array $fields): UpdatedItemResult { return new UpdatedItemResult( $this->core->call( 'crm.activity.update', [ - 'id' => $itemId, + 'id' => $itemId, 'fields' => $fields, ] ) @@ -403,8 +442,8 @@ public function update(int $itemId, array $fields): UpdatedItemResult * } $filter * * @return int - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function countByFilter(array $filter = []): int { diff --git a/src/Services/CRM/Activity/Service/Batch.php b/src/Services/CRM/Activity/Service/Batch.php index d176a977..06dba9b6 100644 --- a/src/Services/CRM/Activity/Service/Batch.php +++ b/src/Services/CRM/Activity/Service/Batch.php @@ -1,9 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Activity\Service; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; +use Bitrix24\SDK\Core\Contracts\DeletedItemResultInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; @@ -11,11 +24,7 @@ use Bitrix24\SDK\Services\CRM\Activity\Result\ActivityItemResult; use Generator; -/** - * Class Batch - * - * @package Bitrix24\SDK\Services\CRM\Activity\Service - */ +#[ApiBatchServiceMetadata(new Scope(['crm']))] class Batch extends AbstractBatchService { /** @@ -65,7 +74,7 @@ class Batch extends AbstractBatchService * COMMUNICATIONS?: string, * FILES?: string, * WEBDAV_ELEMENTS?: string, - * } $order + * } $order * * @param array{ * ID?: int, @@ -111,22 +120,27 @@ class Batch extends AbstractBatchService * COMMUNICATIONS?: string, * FILES?: string, * WEBDAV_ELEMENTS?: string, - * } $filter - * @param array $select = ['ID','OWNER_ID','OWNER_TYPE_ID','TYPE_ID','PROVIDER_ID','PROVIDER_TYPE_ID','PROVIDER_GROUP_ID','ASSOCIATED_ENTITY_ID','SUBJECT','START_TIME','END_TIME','DEADLINE','COMPLETED','STATUS','RESPONSIBLE_ID','PRIORITY','NOTIFY_TYPE','NOTIFY_VALUE','DESCRIPTION','DESCRIPTION_TYPE','DIRECTION','LOCATION','CREATED','AUTHOR_ID','LAST_UPDATED','EDITOR_ID','SETTINGS','ORIGIN_ID','ORIGINATOR_ID','RESULT_STATUS','RESULT_STREAM','RESULT_SOURCE_ID','PROVIDER_PARAMS','PROVIDER_DATA','RESULT_MARK','RESULT_VALUE','RESULT_SUM','RESULT_CURRENCY_ID','AUTOCOMPLETE_RULE','BINDINGS','COMMUNICATIONS','FILES','WEBDAV_ELEMENTS','COMMUNICATIONS'] + * } $filter + * @param array $select = ['ID','OWNER_ID','OWNER_TYPE_ID','TYPE_ID','PROVIDER_ID','PROVIDER_TYPE_ID','PROVIDER_GROUP_ID','ASSOCIATED_ENTITY_ID','SUBJECT','START_TIME','END_TIME','DEADLINE','COMPLETED','STATUS','RESPONSIBLE_ID','PRIORITY','NOTIFY_TYPE','NOTIFY_VALUE','DESCRIPTION','DESCRIPTION_TYPE','DIRECTION','LOCATION','CREATED','AUTHOR_ID','LAST_UPDATED','EDITOR_ID','SETTINGS','ORIGIN_ID','ORIGINATOR_ID','RESULT_STATUS','RESULT_STREAM','RESULT_SOURCE_ID','PROVIDER_PARAMS','PROVIDER_DATA','RESULT_MARK','RESULT_VALUE','RESULT_SUM','RESULT_CURRENCY_ID','AUTOCOMPLETE_RULE','BINDINGS','COMMUNICATIONS','FILES','WEBDAV_ELEMENTS','COMMUNICATIONS'] * @param int|null $limit * - * @return Generator|ActivityItemResult[] + * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.list', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_list.php', + 'Returns in batch mode a list of activity' + )] public function list(array $order, array $filter, array $select, ?int $limit = null): Generator { $this->log->debug( 'list', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, 'select' => $select, - 'limit' => $limit, + 'limit' => $limit, ] ); foreach ($this->batch->getTraversableList('crm.activity.list', $order, $filter, $select, $limit) as $key => $value) { @@ -183,9 +197,14 @@ public function list(array $order, array $filter, array $select, ?int $limit = n * WEBDAV_ELEMENTS?: string, * }> $activities * - * @return \Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.add', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_add.php', + 'Adds in batch mode a new activity' + )] public function add(array $activities): Generator { $items = []; @@ -204,9 +223,14 @@ public function add(array $activities): Generator * * @param int[] $itemId * - * @return \Generator|\Bitrix24\SDK\Core\Contracts\DeletedItemResultInterface[] - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.activity.delete', + 'https://training.bitrix24.com/rest_help/crm/rest_activity/crm_activity_delete.php', + 'Delete in batch mode activity' + )] public function delete(array $itemId): Generator { foreach ($this->batch->deleteEntityItems('crm.activity.delete', $itemId) as $key => $item) { diff --git a/src/Services/CRM/CRMServiceBuilder.php b/src/Services/CRM/CRMServiceBuilder.php index 49678877..b3eb8964 100644 --- a/src/Services/CRM/CRMServiceBuilder.php +++ b/src/Services/CRM/CRMServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM; diff --git a/src/Services/CRM/Common/Result/AbstractCrmItem.php b/src/Services/CRM/Common/Result/AbstractCrmItem.php index dafb3540..a2542cbf 100644 --- a/src/Services/CRM/Common/Result/AbstractCrmItem.php +++ b/src/Services/CRM/Common/Result/AbstractCrmItem.php @@ -1,10 +1,25 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result; use Bitrix24\SDK\Core\Result\AbstractItem; +use Bitrix24\SDK\Services\CRM\Activity\ActivityContentType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityDirectionType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityNotifyType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityPriority; +use Bitrix24\SDK\Services\CRM\Activity\ActivityStatus; +use Bitrix24\SDK\Services\CRM\Activity\ActivityType; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Email; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\InstantMessenger; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Phone; @@ -12,46 +27,32 @@ use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Website; use Bitrix24\SDK\Services\CRM\Deal\Result\DealSemanticStage; use Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNotFoundException; -use DateTimeImmutable; +use Carbon\CarbonImmutable; use Money\Currency; use Money\Money; +use MoneyPHP\Percentage\Percentage; class AbstractCrmItem extends AbstractItem { - private const CRM_USERFIELD_PREFIX = 'UF_CRM_'; - - /** - * @var Currency - */ private Currency $currency; - - public function __construct(array $data, Currency $currency = null) - { - parent::__construct($data); - if ($currency !== null) { - $this->currency = $currency; - } - } + private const CRM_USERFIELD_PREFIX = 'UF_CRM_'; /** * @param int|string $offset * - * @return bool|DateTimeImmutable|int|mixed|null + * @return bool|CarbonImmutable|int|mixed|null */ - public function __get($offset) { - // todo унести в отдельный класс и покрыть тестами - // учитывать требования - // - поддержка пользовательских полей с пользовательскими типами - // - поддержка пользовательских полей со встроенными типами - // - расширяемость для пользовательских полей в клиентском коде - // - хранение связи поле-тип в аннотациях? - - // приведение полей к реальным типам данных для основных сущностей CRM + // todo move to separate service + // + // - add user fields with custom user types + // - add inheritance for user types + switch ($offset) { case 'ID': case 'ASSIGNED_BY_ID': + case 'RESPONSIBLE_ID': case 'CREATED_BY_ID': case 'MODIFY_BY_ID': case 'createdBy': @@ -63,13 +64,10 @@ public function __get($offset) case 'opportunityAccount': case 'taxValueAccount': case 'taxValue': - // deal case 'LEAD_ID': case 'CONTACT_ID': case 'QUOTE_ID': - // productRow case 'OWNER_ID': - // DealCategoryItem case 'SORT': case 'id': case 'categoryId': @@ -77,6 +75,13 @@ public function __get($offset) case 'assignedById': case 'contactId': case 'lastActivityBy': + case 'AUTHOR_ID': + case 'EDITOR_ID': + case 'RESULT_MARK': + case 'RESULT_STATUS': + case 'RESULT_STREAM': + case 'LAST_ACTIVITY_BY': + case 'ADDRESS_LOC_ADDR_ID': if ($this->data[$offset] !== '' && $this->data[$offset] !== null) { return (int)$this->data[$offset]; } @@ -89,7 +94,6 @@ public function __get($offset) return (int)$this->data[$offset]; } return null; - // contact case 'EXPORT': case 'HAS_PHONE': case 'HAS_EMAIL': @@ -104,9 +108,15 @@ public function __get($offset) case 'IS_RECURRING': case 'IS_RETURN_CUSTOMER': case 'IS_REPEATED_APPROACH': + case 'TAX_INCLUDED': + case 'CUSTOMIZED': + case 'COMPLETED': return $this->data[$offset] === 'Y'; case 'DATE_CREATE': case 'CREATED_DATE': + case 'CREATED': + case 'DEADLINE': + case 'LAST_UPDATED': case 'DATE_MODIFY': case 'BIRTHDATE': case 'BEGINDATE': @@ -115,21 +125,28 @@ public function __get($offset) case 'updatedTime': case 'movedTime': case 'lastActivityTime': + case 'LAST_ACTIVITY_TIME': if ($this->data[$offset] !== '') { - return DateTimeImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); + return CarbonImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); } return null; - // deal case 'PRICE_EXCLUSIVE': case 'PRICE_NETTO': case 'PRICE_BRUTTO': case 'PRICE': + case 'DISCOUNT_SUM': + case 'RESULT_SUM': if ($this->data[$offset] !== '' && $this->data[$offset] !== null) { $var = $this->data[$offset] * 100; return new Money((string)$var, new Currency($this->currency->getCode())); } return null; + case 'RESULT_CURRENCY_ID': + if ($this->data[$offset] !== '' && $this->data[$offset] !== null) { + return new Currency($this->data[$offset]); + } + return null; case 'PHONE': if (!$this->isKeyExists($offset)) { return []; @@ -172,12 +189,29 @@ public function __get($offset) return $items; case 'currencyId': case 'accountCurrencyId': + case 'CURRENCY_ID': return new Currency($this->data[$offset]); case 'STAGE_SEMANTIC_ID': if ($this->data[$offset] !== null) { return DealSemanticStage::from($this->data[$offset]); } return null; + case 'DISCOUNT_TYPE_ID': + return DiscountType::from($this->data[$offset]); + case 'DISCOUNT_RATE': + return new Percentage((string)$this->data[$offset]); + case 'TYPE_ID': + return ActivityType::from((int)$this->data[$offset]); + case 'STATUS': + return ActivityStatus::from((int)$this->data[$offset]); + case 'PRIORITY': + return ActivityPriority::from((int)$this->data[$offset]); + case 'NOTIFY_TYPE': + return ActivityNotifyType::from((int)$this->data[$offset]); + case 'DESCRIPTION_TYPE': + return ActivityContentType::from((int)$this->data[$offset]); + case 'DIRECTION': + return ActivityDirectionType::from((int)$this->data[$offset]); default: return $this->data[$offset] ?? null; } @@ -191,7 +225,7 @@ public function __get($offset) * @return mixed|null * @throws UserfieldNotFoundException */ - protected function getKeyWithUserfieldByFieldName(string $fieldName) + protected function getKeyWithUserfieldByFieldName(string $fieldName): mixed { if (!str_starts_with($fieldName, self::CRM_USERFIELD_PREFIX)) { $fieldName = self::CRM_USERFIELD_PREFIX . $fieldName; @@ -202,4 +236,12 @@ protected function getKeyWithUserfieldByFieldName(string $fieldName) return $this->$fieldName; } + + public function __construct(array $data, Currency $currency = null) + { + parent::__construct($data); + if ($currency !== null) { + $this->currency = $currency; + } + } } \ No newline at end of file diff --git a/src/Services/CRM/Common/Result/DiscountType.php b/src/Services/CRM/Common/Result/DiscountType.php new file mode 100644 index 00000000..3b915fa0 --- /dev/null +++ b/src/Services/CRM/Common/Result/DiscountType.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\CRM\Common\Result; + +enum DiscountType: int +{ + case monetary = 1; + case percentage = 2; +} \ No newline at end of file diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/Email.php b/src/Services/CRM/Common/Result/SystemFields/Types/Email.php index 603cdae9..0dc80e13 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/Email.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/Email.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/EmailValueType.php b/src/Services/CRM/Common/Result/SystemFields/Types/EmailValueType.php index 5f3bc5b2..083e3d0d 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/EmailValueType.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/EmailValueType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessenger.php b/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessenger.php index 35d92d0a..76fd1419 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessenger.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessenger.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessengerValueType.php b/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessengerValueType.php index 87b5c223..43e57385 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessengerValueType.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/InstantMessengerValueType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/Phone.php b/src/Services/CRM/Common/Result/SystemFields/Types/Phone.php index 73763cba..e981762d 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/Phone.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/Phone.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/PhoneValueType.php b/src/Services/CRM/Common/Result/SystemFields/Types/PhoneValueType.php index 8d9636b4..04c010dc 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/PhoneValueType.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/PhoneValueType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/Website.php b/src/Services/CRM/Common/Result/SystemFields/Types/Website.php index e3a03600..bd533bba 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/Website.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/Website.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Common/Result/SystemFields/Types/WebsiteValueType.php b/src/Services/CRM/Common/Result/SystemFields/Types/WebsiteValueType.php index dd9f322d..229b905b 100644 --- a/src/Services/CRM/Common/Result/SystemFields/Types/WebsiteValueType.php +++ b/src/Services/CRM/Common/Result/SystemFields/Types/WebsiteValueType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types; diff --git a/src/Services/CRM/Contact/Result/ContactItemResult.php b/src/Services/CRM/Contact/Result/ContactItemResult.php index fb316cd5..357de417 100644 --- a/src/Services/CRM/Contact/Result/ContactItemResult.php +++ b/src/Services/CRM/Contact/Result/ContactItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Result; @@ -10,58 +19,59 @@ use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Phone; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Website; use Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNotFoundException; -use DateTimeInterface; +use Carbon\CarbonImmutable; /** - * Class ContactItemResult - * - * @property-read int $ID - * @property-read string $HONORIFIC - * @property-read string $NAME - * @property-read string $SECOND_NAME - * @property-read string $LAST_NAME - * @property-read string $PHOTO - * @property-read null|DateTimeInterface $BIRTHDATE - * @property-read string $TYPE_ID - * @property-read string $SOURCE_ID - * @property-read string $SOURCE_DESCRIPTION - * @property-read string $POST - * @property-read string $ADDRESS - * @property-read string $ADDRESS_2 - * @property-read string $ADDRESS_CITY - * @property-read string $ADDRESS_POSTAL_CODE - * @property-read string $ADDRESS_REGION - * @property-read string $ADDRESS_PROVINCE - * @property-read string $ADDRESS_COUNTRY - * @property-read string $ADDRESS_COUNTRY_CODE - * @property-read int $ADDRESS_LOC_ADDR_ID - * @property-read string $COMMENTS - * @property-read string $OPENED - * @property-read bool $EXPORT - * @property-read string $HAS_PHONE - * @property-read string $HAS_EMAIL - * @property-read string $HAS_IMOL - * @property-read int $ASSIGNED_BY_ID - * @property-read int $CREATED_BY_ID - * @property-read int $MODIFY_BY_ID - * @property-read DateTimeInterface $DATE_CREATE - * @property-read DateTimeInterface $DATE_MODIFY - * @property-read string $COMPANY_ID - * @property-read string $COMPANY_IDS - * @property-read int $LEAD_ID - * @property-read string $ORIGINATOR_ID - * @property-read string $ORIGIN_ID - * @property-read string $ORIGIN_VERSION - * @property-read int $FACE_ID - * @property-read string $UTM_SOURCE - * @property-read string $UTM_MEDIUM - * @property-read string $UTM_CAMPAIGN - * @property-read string $UTM_CONTENT - * @property-read string $UTM_TERM - * @property-read Phone[] $PHONE - * @property-read Email[] $EMAIL - * @property-read Website[] $WEB - * @property-read InstantMessenger[] $IM + * @property-read int $ADDRESS_LOC_ADDR_ID + * @property-read string|null $ADDRESS + * @property-read string|null $ADDRESS_2 + * @property-read string|null $ADDRESS_CITY + * @property-read string|null $ADDRESS_COUNTRY + * @property-read string|null $ADDRESS_COUNTRY_CODE + * @property-read string|null $ADDRESS_POSTAL_CODE + * @property-read string|null $ADDRESS_PROVINCE + * @property-read string|null $ADDRESS_REGION + * @property-read int $ASSIGNED_BY_ID + * @property-read CarbonImmutable|null $BIRTHDATE + * @property-read string|null $COMMENTS + * @property-read int|null $COMPANY_ID + * @property-read array|null $COMPANY_IDS + * @property-read int $CREATED_BY_ID + * @property-read CarbonImmutable $DATE_CREATE + * @property-read CarbonImmutable $DATE_MODIFY + * @property-read int|null $FACE_ID + * @property-read bool $EXPORT + * @property-read Email[] $EMAIL + * @property-read int $ID + * @property-read bool $HAS_EMAIL + * @property-read bool $HAS_IMOL + * @property-read bool $HAS_PHONE + * @property-read string|null $HONORIFIC + * @property-read InstantMessenger[] $IM + * @property-read int|null $LEAD_ID + * @property-read CarbonImmutable $LAST_ACTIVITY_TIME + * @property-read int $LAST_ACTIVITY_BY + * @property-read string|null $LAST_NAME + * @property-read string|null $LINK + * @property-read int $MODIFY_BY_ID + * @property-read string $NAME + * @property-read string|null $ORIGIN_ID + * @property-read string|null $ORIGINATOR_ID + * @property-read string|null $ORIGIN_VERSION + * @property-read string $OPENED + * @property-read Phone[] $PHONE + * @property-read string|null $POST + * @property-read string|null $PHOTO + * @property-read string|null $SECOND_NAME + * @property-read string|null $SOURCE_DESCRIPTION + * @property-read string|null $SOURCE_ID + * @property-read string|null $TYPE_ID + * @property-read string|null $UTM_CAMPAIGN + * @property-read string|null $UTM_CONTENT + * @property-read string|null $UTM_MEDIUM + * @property-read string|null $UTM_SOURCE + * @property-read string|null $UTM_TERM + * @property-read Website[] $WEB */ class ContactItemResult extends AbstractCrmItem { @@ -71,7 +81,7 @@ class ContactItemResult extends AbstractCrmItem * @return mixed|null * @throws UserfieldNotFoundException */ - public function getUserfieldByFieldName(string $userfieldName) + public function getUserfieldByFieldName(string $userfieldName): mixed { return $this->getKeyWithUserfieldByFieldName($userfieldName); } diff --git a/src/Services/CRM/Contact/Result/ContactResult.php b/src/Services/CRM/Contact/Result/ContactResult.php index 4999cbdc..79a15253 100644 --- a/src/Services/CRM/Contact/Result/ContactResult.php +++ b/src/Services/CRM/Contact/Result/ContactResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Contact/Result/ContactUserfieldItemResult.php b/src/Services/CRM/Contact/Result/ContactUserfieldItemResult.php index 06058da6..310915e2 100644 --- a/src/Services/CRM/Contact/Result/ContactUserfieldItemResult.php +++ b/src/Services/CRM/Contact/Result/ContactUserfieldItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Result; diff --git a/src/Services/CRM/Contact/Result/ContactUserfieldResult.php b/src/Services/CRM/Contact/Result/ContactUserfieldResult.php index d1b50369..95f89f53 100644 --- a/src/Services/CRM/Contact/Result/ContactUserfieldResult.php +++ b/src/Services/CRM/Contact/Result/ContactUserfieldResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Result; diff --git a/src/Services/CRM/Contact/Result/ContactUserfieldsResult.php b/src/Services/CRM/Contact/Result/ContactUserfieldsResult.php index 30dbc44f..c5a1ff95 100644 --- a/src/Services/CRM/Contact/Result/ContactUserfieldsResult.php +++ b/src/Services/CRM/Contact/Result/ContactUserfieldsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Result; diff --git a/src/Services/CRM/Contact/Result/ContactsResult.php b/src/Services/CRM/Contact/Result/ContactsResult.php index 82a0b2a4..120a2fc3 100644 --- a/src/Services/CRM/Contact/Result/ContactsResult.php +++ b/src/Services/CRM/Contact/Result/ContactsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Contact/Service/Batch.php b/src/Services/CRM/Contact/Service/Batch.php index 0d929947..9c280a92 100644 --- a/src/Services/CRM/Contact/Service/Batch.php +++ b/src/Services/CRM/Contact/Service/Batch.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Service; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; @@ -12,11 +24,7 @@ use Bitrix24\SDK\Services\CRM\Contact\Result\ContactItemResult; use Generator; -/** - * Class Batch - * - * @package Bitrix24\SDK\Services\CRM\Contact\Service - */ +#[ApiBatchServiceMetadata(new Scope(['crm']))] class Batch extends AbstractBatchService { /** @@ -127,6 +135,11 @@ class Batch extends AbstractBatchService * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.contact.list', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_list.php', + 'Returns in batch mode a list of contacts' + )] public function list(array $order, array $filter, array $select, ?int $limit = null): Generator { $this->log->debug( @@ -196,8 +209,14 @@ public function list(array $order, array $filter, array $select, ?int $limit = n * IM?: string, * }> $contacts * - * @return Generator|AddedItemBatchResult[] + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.contact.add', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_add.php', + 'Add in batch mode a list of contacts' + )] public function add(array $contacts): Generator { $items = []; @@ -221,9 +240,14 @@ public function add(array $contacts): Generator * ] * * @param array $entityItems - * @return Generator + * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.contact.update', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_update.php', + 'Update in batch mode a list of contacts' + )] public function update(array $entityItems): Generator { foreach ($this->batch->updateEntityItems('crm.contact.update', $entityItems) as $key => $item) { @@ -236,9 +260,14 @@ public function update(array $entityItems): Generator * * @param int[] $contactId * - * @return \Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.contact.delete', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_delete.php', + 'Delete in batch mode a list of contacts' + )] public function delete(array $contactId): Generator { foreach ($this->batch->deleteEntityItems('crm.contact.delete', $contactId) as $key => $item) { diff --git a/src/Services/CRM/Contact/Service/Contact.php b/src/Services/CRM/Contact/Service/Contact.php index 6776dac6..2a74c331 100644 --- a/src/Services/CRM/Contact/Service/Contact.php +++ b/src/Services/CRM/Contact/Service/Contact.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -16,11 +28,7 @@ use Bitrix24\SDK\Services\CRM\Contact\Result\ContactsResult; use Psr\Log\LoggerInterface; -/** - * Class Contact - * - * @package Bitrix24\SDK\Services\CRM\Contact\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class Contact extends AbstractService { public Batch $batch; @@ -28,8 +36,8 @@ class Contact extends AbstractService /** * Contact constructor. * - * @param Batch $batch - * @param CoreInterface $core + * @param Batch $batch + * @param CoreInterface $core * @param LoggerInterface $log */ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $log) @@ -101,6 +109,11 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.add', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_add.php', + 'Creates a new contact.' + )] public function add(array $fields, array $params = ['REGISTER_SONET_EVENT' => 'N']): AddedItemResult { return new AddedItemResult( @@ -125,6 +138,11 @@ public function add(array $fields, array $params = ['REGISTER_SONET_EVENT' => 'N * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.delete', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_delete.php', + 'Delete a contact.' + )] public function delete(int $contactId): DeletedItemResult { return new DeletedItemResult( @@ -146,6 +164,11 @@ public function delete(int $contactId): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.fields', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_fields.php', + 'Returns the description of contact' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.contact.fields')); @@ -162,6 +185,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.get', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_get.php', + 'Returns a contact by the specified contact ID' + )] public function get(int $contactId): ContactResult { return new ContactResult( @@ -279,22 +307,27 @@ public function get(int $contactId): ContactResult * IM?: string, * } $filter * @param array $select = ['ID','HONORIFIC','NAME','SECOND_NAME','LAST_NAME','PHOTO','BIRTHDATE','TYPE_ID','SOURCE_ID','SOURCE_DESCRIPTION','POST','ADDRESS','ADDRESS_2','ADDRESS_CITY','ADDRESS_POSTAL_CODE','ADDRESS_REGION','ADDRESS_PROVINCE','ADDRESS_COUNTRY','ADDRESS_COUNTRY_CODE','ADDRESS_LOC_ADDR_ID','COMMENTS','OPENED','EXPORT','HAS_PHONE','HAS_EMAIL','HAS_IMOL','ASSIGNED_BY_ID','CREATED_BY_ID','MODIFY_BY_ID','DATE_CREATE','DATE_MODIFY','COMPANY_ID','COMPANY_IDS','LEAD_ID','ORIGINATOR_ID','ORIGIN_ID','ORIGIN_VERSION','FACE_ID','UTM_SOURCE','UTM_MEDIUM','UTM_CAMPAIGN','UTM_CONTENT','UTM_TERM','PHONE','EMAIL','WEB','IM'] - * @param int $start + * @param int $start * * @return ContactsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.list', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_list.php', + 'Returns a list of contacts selected by the filter specified as the parameter. ' + )] public function list(array $order, array $filter, array $select, int $start): ContactsResult { return new ContactsResult( $this->core->call( 'crm.contact.list', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, 'select' => $select, - 'start' => $start, + 'start' => $start, ] ) ); @@ -360,13 +393,18 @@ public function list(array $order, array $filter, array $select, int $start): Co * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.update', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_update.php', + 'Update contact by id' + )] public function update(int $contactId, array $fields, array $params = []): UpdatedItemResult { return new UpdatedItemResult( $this->core->call( 'crm.contact.update', [ - 'id' => $contactId, + 'id' => $contactId, 'fields' => $fields, 'params' => $params, ] diff --git a/src/Services/CRM/Contact/Service/ContactUserfield.php b/src/Services/CRM/Contact/Service/ContactUserfield.php index 4b873c17..1b5a2639 100644 --- a/src/Services/CRM/Contact/Service/ContactUserfield.php +++ b/src/Services/CRM/Contact/Service/ContactUserfield.php @@ -1,9 +1,23 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Contact\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; use Bitrix24\SDK\Core\Result\DeletedItemResult; use Bitrix24\SDK\Core\Result\UpdatedItemResult; @@ -12,6 +26,7 @@ use Bitrix24\SDK\Services\CRM\Contact\Result\ContactUserfieldsResult; use Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNameIsTooLongException; +#[ApiServiceMetadata(new Scope(['crm']))] class ContactUserfield extends AbstractService { /** @@ -58,17 +73,22 @@ class ContactUserfield extends AbstractService * SETTINGS?: string, * } $filter * - * @return \Bitrix24\SDK\Services\CRM\Contact\Result\ContactUserfieldsResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @return ContactUserfieldsResult + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.contact.userfield.list', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_list.php', + 'Returns list of user custom fields for contacts by filter. Prints information about these fields, only identifier and without a title assigned to the field by the user. ' + )] public function list(array $order, array $filter): ContactUserfieldsResult { return new ContactUserfieldsResult( $this->core->call( 'crm.contact.userfield.list', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, ] ) @@ -102,13 +122,18 @@ public function list(array $order, array $filter): ContactUserfieldsResult * SETTINGS?: string, * } $userfieldItemFields * - * @return \Bitrix24\SDK\Core\Result\AddedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @return AddedItemResult + * @throws BaseException + * @throws TransportException * @throws UserfieldNameIsTooLongException * @link https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_add.php * */ + #[ApiEndpointMetadata( + 'crm.contact.userfield.add', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_add.php', + 'Creates a new user field for contacts.' + )] public function add(array $userfieldItemFields): AddedItemResult { if (strlen($userfieldItemFields['FIELD_NAME']) > 13) { @@ -137,11 +162,16 @@ public function add(array $userfieldItemFields): AddedItemResult * @param int $userfieldId * * @return \Bitrix24\SDK\Core\Result\DeletedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_delete.php * */ + #[ApiEndpointMetadata( + 'crm.contact.userfield.delete', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_delete.php', + 'Delete a user by Id' + )] public function delete(int $userfieldId): DeletedItemResult { return new DeletedItemResult( @@ -159,11 +189,16 @@ public function delete(int $userfieldId): DeletedItemResult * * @param int $contactUserfieldItemId * - * @return \Bitrix24\SDK\Services\CRM\Contact\Result\ContactUserfieldResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @return ContactUserfieldResult + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_get.php */ + #[ApiEndpointMetadata( + 'crm.contact.userfield.get', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_get.php', + 'Get a user by Id' + )] public function get(int $contactUserfieldItemId): ContactUserfieldResult { return new ContactUserfieldResult( @@ -179,21 +214,26 @@ public function get(int $contactUserfieldItemId): ContactUserfieldResult /** * Updates an existing user field for contacts. * - * @param int $contactUserfieldItemId + * @param int $contactUserfieldItemId * @param array $userfieldFieldsToUpdate * - * @return \Bitrix24\SDK\Core\Result\UpdatedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @return UpdatedItemResult + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_update.php */ + #[ApiEndpointMetadata( + 'crm.contact.userfield.update', + 'https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_userfield_update.php', + 'Update a user by Id' + )] public function update(int $contactUserfieldItemId, array $userfieldFieldsToUpdate): UpdatedItemResult { return new UpdatedItemResult( $this->core->call( 'crm.contact.userfield.update', [ - 'id' => $contactUserfieldItemId, + 'id' => $contactUserfieldItemId, 'fields' => $userfieldFieldsToUpdate, ] ) diff --git a/src/Services/CRM/Deal/DealStageSemanticId.php b/src/Services/CRM/Deal/DealStageSemanticId.php index e591b956..f0bf7850 100644 --- a/src/Services/CRM/Deal/DealStageSemanticId.php +++ b/src/Services/CRM/Deal/DealStageSemanticId.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal; diff --git a/src/Services/CRM/Deal/Result/DealCategoriesResult.php b/src/Services/CRM/Deal/Result/DealCategoriesResult.php index 9d90c2bc..92667c28 100644 --- a/src/Services/CRM/Deal/Result/DealCategoriesResult.php +++ b/src/Services/CRM/Deal/Result/DealCategoriesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealCategoryItemResult.php b/src/Services/CRM/Deal/Result/DealCategoryItemResult.php index 46d4c239..02f430da 100644 --- a/src/Services/CRM/Deal/Result/DealCategoryItemResult.php +++ b/src/Services/CRM/Deal/Result/DealCategoryItemResult.php @@ -1,17 +1,26 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem; -use DateTimeImmutable; +use Carbon\CarbonImmutable; /** * Class DealItemResult * * @property int $ID - * @property DateTimeImmutable $CREATED_DATE + * @property CarbonImmutable $CREATED_DATE * @property string $NAME * @property bool $IS_LOCKED * @property int $SORT diff --git a/src/Services/CRM/Deal/Result/DealCategoryResult.php b/src/Services/CRM/Deal/Result/DealCategoryResult.php index 53d6867e..021f8420 100644 --- a/src/Services/CRM/Deal/Result/DealCategoryResult.php +++ b/src/Services/CRM/Deal/Result/DealCategoryResult.php @@ -1,5 +1,13 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealCategoryStageItemResult.php b/src/Services/CRM/Deal/Result/DealCategoryStageItemResult.php index 50ca80ff..b8c198a6 100644 --- a/src/Services/CRM/Deal/Result/DealCategoryStageItemResult.php +++ b/src/Services/CRM/Deal/Result/DealCategoryStageItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; diff --git a/src/Services/CRM/Deal/Result/DealCategoryStagesResult.php b/src/Services/CRM/Deal/Result/DealCategoryStagesResult.php index c4f9ce82..0c421122 100644 --- a/src/Services/CRM/Deal/Result/DealCategoryStagesResult.php +++ b/src/Services/CRM/Deal/Result/DealCategoryStagesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; diff --git a/src/Services/CRM/Deal/Result/DealCategoryStatusResult.php b/src/Services/CRM/Deal/Result/DealCategoryStatusResult.php index 4236ec4b..0f9166f5 100644 --- a/src/Services/CRM/Deal/Result/DealCategoryStatusResult.php +++ b/src/Services/CRM/Deal/Result/DealCategoryStatusResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealContactItemResult.php b/src/Services/CRM/Deal/Result/DealContactItemResult.php index 58a13ed6..010ddc11 100644 --- a/src/Services/CRM/Deal/Result/DealContactItemResult.php +++ b/src/Services/CRM/Deal/Result/DealContactItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; diff --git a/src/Services/CRM/Deal/Result/DealContactItemsResult.php b/src/Services/CRM/Deal/Result/DealContactItemsResult.php index 6f8a40c1..af24d8b1 100644 --- a/src/Services/CRM/Deal/Result/DealContactItemsResult.php +++ b/src/Services/CRM/Deal/Result/DealContactItemsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; diff --git a/src/Services/CRM/Deal/Result/DealItemResult.php b/src/Services/CRM/Deal/Result/DealItemResult.php index 601e527e..9cd56c1c 100644 --- a/src/Services/CRM/Deal/Result/DealItemResult.php +++ b/src/Services/CRM/Deal/Result/DealItemResult.php @@ -1,15 +1,24 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem; -use DateTimeInterface; +use Carbon\CarbonImmutable; +use Money\Currency; /** * Class DealItemResult - * * @property-read int $ID * @property-read string|null $TITLE deal title * @property-read string|null $TYPE_ID @@ -19,16 +28,16 @@ * @property-read bool|null $IS_NEW * @property-read bool|null $IS_RECURRING * @property-read string|null $PROBABILITY - * @property-read string|null $CURRENCY_ID + * @property-read Currency|null $CURRENCY_ID * @property-read string|null $OPPORTUNITY * @property-read bool|null $IS_MANUAL_OPPORTUNITY * @property-read string|null $TAX_VALUE * @property-read int|null $LEAD_ID * @property-read int|null $COMPANY_ID - * @property-read int|null $CONTACT_ID + * @property-read int|null $CONTACT_ID deprecated * @property-read int|null $QUOTE_ID - * @property-read DateTimeInterface|null $BEGINDATE - * @property-read DateTimeInterface|null $CLOSEDATE + * @property-read CarbonImmutable|null $BEGINDATE + * @property-read CarbonImmutable|null $CLOSEDATE * @property-read bool|null $OPENED * @property-read bool|null $CLOSED * @property-read string|null $COMMENTS diff --git a/src/Services/CRM/Deal/Result/DealProductRowItemResult.php b/src/Services/CRM/Deal/Result/DealProductRowItemResult.php index 51af99eb..2d97529e 100644 --- a/src/Services/CRM/Deal/Result/DealProductRowItemResult.php +++ b/src/Services/CRM/Deal/Result/DealProductRowItemResult.php @@ -1,39 +1,53 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Result; - -use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem; -use Money\Currency; use Money\Money; +use MoneyPHP\Percentage\Percentage; +use Bitrix24\SDK\Services\CRM\Common\Result\DiscountType; +use Carbon\CarbonImmutable; +use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem; /** - * Class DealProductRowItemResult - * * @property-read int $ID * @property-read int $OWNER_ID * @property-read string $OWNER_TYPE * @property-read int $PRODUCT_ID * @property-read string $PRODUCT_NAME - * @property-read Money $PRICE - * @property-read Money $PRICE_EXCLUSIVE - * @property-read Money $PRICE_NETTO - * @property-read Money $PRICE_BRUTTO + * @property-read string|null $ORIGINAL_PRODUCT_NAME + * @property-read string|null $PRODUCT_DESCRIPTION + * @property-read Money $PRICE price with taxes and discounts + * @property-read Money $PRICE_EXCLUSIVE without taxes but with discounts + * @property-read Money $PRICE_NETTO without taxes and discounts + * @property-read Money $PRICE_BRUTTO without discounts but with taxes + * @property-read Money $PRICE_ACCOUNT formatted price * @property-read string $QUANTITY - * @property-read int $DISCOUNT_TYPE_ID - * @property-read string $DISCOUNT_RATE - * @property-read string $DISCOUNT_SUM + * @property-read DiscountType $DISCOUNT_TYPE_ID + * @property-read Percentage $DISCOUNT_RATE + * @property-read Money $DISCOUNT_SUM * @property-read string $TAX_RATE - * @property-read string $TAX_INCLUDED + * @property-read bool $TAX_INCLUDED * @property-read string $CUSTOMIZED * @property-read int $MEASURE_CODE * @property-read string $MEASURE_NAME - * @property-read int $RESERVE_ID - * @property-read int $RESERVE_QUANTITY * @property-read int $SORT + * @property-read string|null $XML_ID + * @property-read int $TYPE + * @property-read int|null $STORE_ID + * @property-read int|null $RESERVE_ID + * @property-read CarbonImmutable|null $DATE_RESERVE_END + * @property-read int|null $RESERVE_QUANTITY */ class DealProductRowItemResult extends AbstractCrmItem { - } \ No newline at end of file diff --git a/src/Services/CRM/Deal/Result/DealProductRowItemsResult.php b/src/Services/CRM/Deal/Result/DealProductRowItemsResult.php index 9cf683aa..f0b1a69f 100644 --- a/src/Services/CRM/Deal/Result/DealProductRowItemsResult.php +++ b/src/Services/CRM/Deal/Result/DealProductRowItemsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealResult.php b/src/Services/CRM/Deal/Result/DealResult.php index 4e9e01c3..d865b66d 100644 --- a/src/Services/CRM/Deal/Result/DealResult.php +++ b/src/Services/CRM/Deal/Result/DealResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealSemanticStage.php b/src/Services/CRM/Deal/Result/DealSemanticStage.php index 7fc7dde6..c913171c 100644 --- a/src/Services/CRM/Deal/Result/DealSemanticStage.php +++ b/src/Services/CRM/Deal/Result/DealSemanticStage.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealUserfieldItemResult.php b/src/Services/CRM/Deal/Result/DealUserfieldItemResult.php index 7531eae9..84642c84 100644 --- a/src/Services/CRM/Deal/Result/DealUserfieldItemResult.php +++ b/src/Services/CRM/Deal/Result/DealUserfieldItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealUserfieldResult.php b/src/Services/CRM/Deal/Result/DealUserfieldResult.php index 4358c882..9a75284d 100644 --- a/src/Services/CRM/Deal/Result/DealUserfieldResult.php +++ b/src/Services/CRM/Deal/Result/DealUserfieldResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealUserfieldsResult.php b/src/Services/CRM/Deal/Result/DealUserfieldsResult.php index 2aa60219..cc8c4701 100644 --- a/src/Services/CRM/Deal/Result/DealUserfieldsResult.php +++ b/src/Services/CRM/Deal/Result/DealUserfieldsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Result/DealsResult.php b/src/Services/CRM/Deal/Result/DealsResult.php index 3fdaa070..22fbd428 100644 --- a/src/Services/CRM/Deal/Result/DealsResult.php +++ b/src/Services/CRM/Deal/Result/DealsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Deal/Service/Batch.php b/src/Services/CRM/Deal/Service/Batch.php index c7234694..62bc9134 100644 --- a/src/Services/CRM/Deal/Service/Batch.php +++ b/src/Services/CRM/Deal/Service/Batch.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; @@ -13,11 +25,7 @@ use Generator; use Psr\Log\LoggerInterface; -/** - * Class Batch - * - * @package Bitrix24\SDK\Services\CRM\Deal\Service - */ +#[ApiBatchServiceMetadata(new Scope(['crm']))] class Batch { protected BatchOperationsInterface $batch; @@ -27,7 +35,7 @@ class Batch * Batch constructor. * * @param BatchOperationsInterface $batch - * @param LoggerInterface $log + * @param LoggerInterface $log */ public function __construct(BatchOperationsInterface $batch, LoggerInterface $log) { @@ -125,21 +133,26 @@ public function __construct(BatchOperationsInterface $batch, LoggerInterface $lo * UTM_CONTENT?: string, * UTM_TERM?: string, * } $filter - * @param array $select = ['ID','TITLE','TYPE_ID','CATEGORY_ID','STAGE_ID','STAGE_SEMANTIC_ID','IS_NEW','IS_RECURRING','IS_RETURN_CUSTOMER','IS_REPEATED_APPROACH','PROBABILITY','CURRENCY_ID','OPPORTUNITY','IS_MANUAL_OPPORTUNITY','TAX_VALUE','COMPANY_ID','CONTACT_ID','CONTACT_IDS','QUOTE_ID','BEGINDATE','CLOSEDATE','OPENED','CLOSED','COMMENTS','ASSIGNED_BY_ID','CREATED_BY_ID','MODIFY_BY_ID','DATE_CREATE','DATE_MODIFY','SOURCE_ID','SOURCE_DESCRIPTION','LEAD_ID','ADDITIONAL_INFO','LOCATION_ID','ORIGINATOR_ID','ORIGIN_ID','UTM_SOURCE','UTM_MEDIUM','UTM_CAMPAIGN','UTM_CONTENT','UTM_TERM'] - * @param int|null $limit + * @param array $select = ['ID','TITLE','TYPE_ID','CATEGORY_ID','STAGE_ID','STAGE_SEMANTIC_ID','IS_NEW','IS_RECURRING','IS_RETURN_CUSTOMER','IS_REPEATED_APPROACH','PROBABILITY','CURRENCY_ID','OPPORTUNITY','IS_MANUAL_OPPORTUNITY','TAX_VALUE','COMPANY_ID','CONTACT_ID','CONTACT_IDS','QUOTE_ID','BEGINDATE','CLOSEDATE','OPENED','CLOSED','COMMENTS','ASSIGNED_BY_ID','CREATED_BY_ID','MODIFY_BY_ID','DATE_CREATE','DATE_MODIFY','SOURCE_ID','SOURCE_DESCRIPTION','LEAD_ID','ADDITIONAL_INFO','LOCATION_ID','ORIGINATOR_ID','ORIGIN_ID','UTM_SOURCE','UTM_MEDIUM','UTM_CAMPAIGN','UTM_CONTENT','UTM_TERM'] + * @param int|null $limit * * @return Generator|DealItemResult[] * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.deal.list', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_list.php', + 'Returns in batch mode a list of deals' + )] public function list(array $order, array $filter, array $select, ?int $limit = null): Generator { $this->log->debug( 'batchList', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, 'select' => $select, - 'limit' => $limit, + 'limit' => $limit, ] ); foreach ($this->batch->getTraversableList('crm.deal.list', $order, $filter, $select, $limit) as $key => $value) { @@ -194,9 +207,14 @@ public function list(array $order, array $filter, array $select, ?int $limit = n * UTM_TERM?: string, * }> $deals * - * @return Generator|AddedItemBatchResult[] - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.deal.add', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_add.php', + 'Add in batch mode a list of deals' + )] public function add(array $deals): Generator { $items = []; @@ -215,9 +233,14 @@ public function add(array $deals): Generator * * @param int[] $dealId * - * @return \Generator|\Bitrix24\SDK\Core\Contracts\DeletedItemResultInterface[] - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.deal.delete', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_delete.php', + 'Delete in batch mode a list of deals' + )] public function delete(array $dealId): Generator { foreach ($this->batch->deleteEntityItems('crm.deal.delete', $dealId) as $key => $item) { @@ -234,11 +257,16 @@ public function delete(array $dealId): Generator * 'params' => [] * ] * - * @param array $entityItems + * @param array $entityItems * - * @return \Generator - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.deal.update', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_update.php', + 'Update in batch mode a list of deals' + )] public function update(array $entityItems): Generator { foreach ($this->batch->updateEntityItems('crm.deal.update', $entityItems) as $key => $item) { diff --git a/src/Services/CRM/Deal/Service/Deal.php b/src/Services/CRM/Deal/Service/Deal.php index 5f37aa57..0f602bab 100644 --- a/src/Services/CRM/Deal/Service/Deal.php +++ b/src/Services/CRM/Deal/Service/Deal.php @@ -1,10 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -15,12 +26,9 @@ use Bitrix24\SDK\Services\CRM\Deal\Result\DealResult; use Bitrix24\SDK\Services\CRM\Deal\Result\DealsResult; use Psr\Log\LoggerInterface; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; -/** - * Class Deals - * - * @package Bitrix24\SDK\Services\CRM\Deals\Client - */ +#[ApiServiceMetadata(new Scope(['crm']))] class Deal extends AbstractService { public Batch $batch; @@ -28,8 +36,8 @@ class Deal extends AbstractService /** * Deal constructor. * - * @param Batch $batch - * @param CoreInterface $core + * @param Batch $batch + * @param CoreInterface $core * @param LoggerInterface $log */ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $log) @@ -89,6 +97,11 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.add', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_add.php', + 'Add new deal' + )] public function add(array $fields, array $params = []): AddedItemResult { return new AddedItemResult( @@ -113,6 +126,11 @@ public function add(array $fields, array $params = []): AddedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.delete', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_delete.php', + 'Delete deal' + )] public function delete(int $id): DeletedItemResult { return new DeletedItemResult( @@ -134,6 +152,11 @@ public function delete(int $id): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.fields', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_fields.php', + 'Get fields of deal' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.deal.fields')); @@ -150,6 +173,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.fields', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_get.php', + 'Get deal by id' + )] public function get(int $id): DealResult { return new DealResult($this->core->call('crm.deal.get', ['id' => $id])); @@ -160,25 +188,30 @@ public function get(int $id): DealResult * * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_list.php * - * @param array $order - order of deal items - * @param array $filter - filter array - * @param array $select = ['ID','TITLE','TYPE_ID','CATEGORY_ID','STAGE_ID','STAGE_SEMANTIC_ID','IS_NEW','IS_RECURRING','PROBABILITY', 'CURRENCY_ID', 'OPPORTUNITY','IS_MANUAL_OPPORTUNITY','TAX_VALUE','LEAD_ID','COMPANY_ID','CONTACT_ID','QUOTE_ID','BEGINDATE','CLOSEDATE','OPENED','CLOSED','COMMENTS','ADDITIONAL_INFO','LOCATION_ID','IS_RETURN_CUSTOMER','IS_REPEATED_APPROACH','SOURCE_ID','SOURCE_DESCRIPTION','ORIGINATOR_ID','ORIGIN_ID','UTM_SOURCE','UTM_MEDIUM','UTM_CAMPAIGN','UTM_CONTENT','UTM_TERM'] + * @param array $order - order of deal items + * @param array $filter - filter array + * @param array $select = ['ID','TITLE','TYPE_ID','CATEGORY_ID','STAGE_ID','STAGE_SEMANTIC_ID','IS_NEW','IS_RECURRING','PROBABILITY', 'CURRENCY_ID', 'OPPORTUNITY','IS_MANUAL_OPPORTUNITY','TAX_VALUE','LEAD_ID','COMPANY_ID','CONTACT_ID','QUOTE_ID','BEGINDATE','CLOSEDATE','OPENED','CLOSED','COMMENTS','ADDITIONAL_INFO','LOCATION_ID','IS_RETURN_CUSTOMER','IS_REPEATED_APPROACH','SOURCE_ID','SOURCE_DESCRIPTION','ORIGINATOR_ID','ORIGIN_ID','UTM_SOURCE','UTM_MEDIUM','UTM_CAMPAIGN','UTM_CONTENT','UTM_TERM'] * @param integer $startItem - entity number to start from (usually returned in 'next' field of previous 'crm.deal.list' API call) * * @throws BaseException * @throws TransportException * @return DealsResult */ + #[ApiEndpointMetadata( + 'crm.deal.list', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_list.php', + 'Get deal list by filter' + )] public function list(array $order, array $filter, array $select, int $startItem = 0): DealsResult { return new DealsResult( $this->core->call( 'crm.deal.list', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, 'select' => $select, - 'start' => $startItem, + 'start' => $startItem, ] ) ); @@ -236,13 +269,18 @@ public function list(array $order, array $filter, array $select, int $startItem * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.update', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_update.php', + 'Update deal list by filter' + )] public function update(int $id, array $fields, array $params = []): UpdatedItemResult { return new UpdatedItemResult( $this->core->call( 'crm.deal.update', [ - 'id' => $id, + 'id' => $id, 'fields' => $fields, 'params' => $params, ] @@ -292,8 +330,8 @@ public function update(int $id, array $fields, array $params = []): UpdatedItemR * } $filter * * @return int - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function countByFilter(array $filter = []): int { diff --git a/src/Services/CRM/Deal/Service/DealCategory.php b/src/Services/CRM/Deal/Service/DealCategory.php index bdda858d..da8908ae 100644 --- a/src/Services/CRM/Deal/Service/DealCategory.php +++ b/src/Services/CRM/Deal/Service/DealCategory.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -15,11 +27,7 @@ use Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryResult; use Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryStatusResult; -/** - * Class DealCategory - * - * @package Bitrix24\SDK\Services\CRM\Deal\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class DealCategory extends AbstractService { /** @@ -39,6 +47,11 @@ class DealCategory extends AbstractService * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.add', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_add.php', + 'Add new deal category' + )] public function add(array $fields): AddedItemResult { return new AddedItemResult( @@ -62,6 +75,11 @@ public function add(array $fields): AddedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.delete', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_delete.php', + 'Delete deal category' + )] public function delete(int $categoryId): DeletedItemResult { return new DeletedItemResult( @@ -83,6 +101,11 @@ public function delete(int $categoryId): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.fields', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_fields.php', + 'Returns field description for deal categories' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.dealcategory.fields')); @@ -96,6 +119,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.default.get', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_default_get.php', + 'he method reads settings for general deal category' + )] public function getDefaultCategorySettings(): DealCategoryResult { return new DealCategoryResult($this->core->call('crm.dealcategory.default.get')); @@ -114,6 +142,11 @@ public function getDefaultCategorySettings(): DealCategoryResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.default.set', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_default_set.php', + 'The method writes settings for general deal category.' + )] public function setDefaultCategorySettings(array $parameters): UpdatedItemResult { return new UpdatedItemResult($this->core->call('crm.dealcategory.default.set', $parameters)); @@ -131,6 +164,11 @@ public function setDefaultCategorySettings(array $parameters): UpdatedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.get', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_get.php', + 'Returns deal category by the ID' + )] public function get(int $categoryId): DealCategoryResult { return new DealCategoryResult( @@ -151,22 +189,27 @@ public function get(int $categoryId): DealCategoryResult * @param array $order * @param array $filter * @param array $select - * @param int $start + * @param int $start * * @return DealCategoriesResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.list', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_list.php', + 'Returns a list of deal categories by the filter.' + )] public function list(array $order, array $filter, array $select, int $start): DealCategoriesResult { return new DealCategoriesResult( $this->core->call( 'crm.dealcategory.list', [ - 'order' => $order, + 'order' => $order, 'filter' => $filter, 'select' => $select, - 'start' => $start, + 'start' => $start, ] ) ); @@ -183,6 +226,11 @@ public function list(array $order, array $filter, array $select, int $start): De * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.list', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_status.php', + 'Returns directory type ID for storage deal categories by the ID.' + )] public function getStatus(int $categoryId): DealCategoryStatusResult { return new DealCategoryStatusResult( @@ -213,13 +261,18 @@ public function getStatus(int $categoryId): DealCategoryStatusResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.update', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_update.php', + 'Updates an existing category.' + )] public function update(int $categoryId, array $fields): UpdatedItemResult { return new UpdatedItemResult( $this->core->call( 'crm.dealcategory.update', [ - 'id' => $categoryId, + 'id' => $categoryId, 'fields' => $fields, ] ) diff --git a/src/Services/CRM/Deal/Service/DealCategoryStage.php b/src/Services/CRM/Deal/Service/DealCategoryStage.php index 5eb05e5d..b9cb019c 100644 --- a/src/Services/CRM/Deal/Service/DealCategoryStage.php +++ b/src/Services/CRM/Deal/Service/DealCategoryStage.php @@ -1,28 +1,40 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\CRM\Deal\Result\DealCategoryStagesResult; -/** - * Class DealCategoryStage - * - * @package Bitrix24\SDK\Services\CRM\Deal\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class DealCategoryStage extends AbstractService { /** - * @param int $categoryId + * @param int $categoryId Category ID. When ID = 0 or null is specified , returns "default" category statuses. When ID > 0 for nonexistent category , returns nothing. * - * @return DealCategoryStagesResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.dealcategory.stage.list', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_stage_list.php', + 'Returns list of deal stages for category by the ID. Equivalent to calling crm.status.list method with parameter ENTITY_ID equal to the result of calling crm.dealcategory.status method.' + )] public function list(int $categoryId): DealCategoryStagesResult { return new DealCategoryStagesResult( diff --git a/src/Services/CRM/Deal/Service/DealContact.php b/src/Services/CRM/Deal/Service/DealContact.php index c5c8a0f5..0e5eb038 100644 --- a/src/Services/CRM/Deal/Service/DealContact.php +++ b/src/Services/CRM/Deal/Service/DealContact.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -13,11 +25,7 @@ use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\CRM\Deal\Result\DealContactItemsResult; -/** - * Class DealContact - * - * @package Bitrix24\SDK\Services\CRM\Deal\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class DealContact extends AbstractService { /** @@ -25,15 +33,19 @@ class DealContact extends AbstractService * * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_add.php * - * @param int $dealId - * @param int $contactId + * @param int $dealId + * @param int $contactId * @param bool $isPrimary - * @param int $sort + * @param int $sort * - * @return AddedItemResult - * @throws TransportException * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.contact.add', + 'https://training.bitrix24.com/rest_help/crm/category/crm_dealcategory_stage_list.php', + 'Adds contact to specified deal.' + )] public function add(int $dealId, int $contactId, bool $isPrimary, int $sort = 100): AddedItemResult { return new AddedItemResult( @@ -55,10 +67,14 @@ public function add(int $dealId, int $contactId, bool $isPrimary, int $sort = 10 * Returns field descriptions for the deal-contact link used by methods of family crm.deal.contact.* * * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_fields.php - * @return FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.contact.fields', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_fields.php', + 'Returns field descriptions for the deal-contact link used by methods of family crm.deal.contact.*' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.deal.contact.fields')); @@ -75,6 +91,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.contact.items.get', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_get.php', + 'Returns a set of contacts, associated with the specified deal.' + )] public function itemsGet(int $dealId): DealContactItemsResult { return new DealContactItemsResult( @@ -98,6 +119,11 @@ public function itemsGet(int $dealId): DealContactItemsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.contact.items.delete', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_delete.php', + 'Clears a set of contacts, associated with the specified deal.' + )] public function itemsDelete(int $dealId): DeletedItemResult { return new DeletedItemResult( @@ -126,6 +152,11 @@ public function itemsDelete(int $dealId): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.contact.items.set', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_set.php', + 'Set a set of contacts, associated with the specified seal.' + )] public function itemsSet(int $dealId, array $contactItems): UpdatedItemResult { return new UpdatedItemResult( @@ -151,6 +182,11 @@ public function itemsSet(int $dealId, array $contactItems): UpdatedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.contact.delete', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_contact_items_set.php', + 'Deletes contact from a specified deal' + )] public function delete(int $dealId, int $contactId): DeletedItemResult { return new DeletedItemResult( diff --git a/src/Services/CRM/Deal/Service/DealProductRows.php b/src/Services/CRM/Deal/Service/DealProductRows.php index 42cacb1d..ec6bf9ce 100644 --- a/src/Services/CRM/Deal/Service/DealProductRows.php +++ b/src/Services/CRM/Deal/Service/DealProductRows.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\UpdatedItemResult; @@ -12,11 +24,7 @@ use Bitrix24\SDK\Services\CRM\Deal\Result\DealResult; use Money\Currency; -/** - * Class DealProductRows - * - * @package Bitrix24\SDK\Services\CRM\Deals\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class DealProductRows extends AbstractService { /** @@ -25,11 +33,15 @@ class DealProductRows extends AbstractService * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_productrows_get.php * * @param int $dealId - * @param \Money\Currency|null $currency - * @return \Bitrix24\SDK\Services\CRM\Deal\Result\DealProductRowItemsResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @param Currency|null $currency + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.productrows.get', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_productrows_get.php', + 'Returns products inside the specified deal.' + )] public function get(int $dealId, Currency $currency = null): DealProductRowItemsResult { if ($currency === null) { @@ -88,6 +100,11 @@ public function get(int $dealId, Currency $currency = null): DealProductRowItems * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.deal.productrows.set', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_productrows_set.php', + 'Creates or updates product entries inside the specified deal.' + )] public function set(int $dealId, array $productRows): UpdatedItemResult { return new UpdatedItemResult( diff --git a/src/Services/CRM/Deal/Service/DealUserfield.php b/src/Services/CRM/Deal/Service/DealUserfield.php index e250db76..03080ba2 100644 --- a/src/Services/CRM/Deal/Service/DealUserfield.php +++ b/src/Services/CRM/Deal/Service/DealUserfield.php @@ -1,9 +1,23 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Deal\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; use Bitrix24\SDK\Core\Result\DeletedItemResult; use Bitrix24\SDK\Core\Result\UpdatedItemResult; @@ -11,7 +25,7 @@ use Bitrix24\SDK\Services\CRM\Deal\Result\DealUserfieldResult; use Bitrix24\SDK\Services\CRM\Deal\Result\DealUserfieldsResult; use Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNameIsTooLongException; - +#[ApiServiceMetadata(new Scope(['crm']))] class DealUserfield extends AbstractService { /** @@ -61,10 +75,15 @@ class DealUserfield extends AbstractService * } $filter * * @return \Bitrix24\SDK\Services\CRM\Deal\Result\DealUserfieldsResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_list.php */ + #[ApiEndpointMetadata( + 'crm.deal.userfield.list', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_list.php', + 'Returns list of user deal fields by filter.' + )] public function list(array $order, array $filter): DealUserfieldsResult { return new DealUserfieldsResult( @@ -106,12 +125,17 @@ public function list(array $order, array $filter): DealUserfieldsResult * } $userfieldItemFields * * @return \Bitrix24\SDK\Core\Result\AddedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @throws UserfieldNameIsTooLongException * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_add.php * */ + #[ApiEndpointMetadata( + 'crm.deal.userfield.add', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_add.php', + 'Created new user field for deals.' + )] public function add(array $userfieldItemFields): AddedItemResult { if (strlen($userfieldItemFields['FIELD_NAME']) > 13) { @@ -140,11 +164,16 @@ public function add(array $userfieldItemFields): AddedItemResult * @param int $userfieldId * * @return \Bitrix24\SDK\Core\Result\DeletedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_delete.php * */ + #[ApiEndpointMetadata( + 'crm.deal.userfield.delete', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_delete.php', + 'Deleted userfield for deals' + )] public function delete(int $userfieldId): DeletedItemResult { return new DeletedItemResult( @@ -162,11 +191,16 @@ public function delete(int $userfieldId): DeletedItemResult * * @param int $userfieldItemId * - * @return \Bitrix24\SDK\Services\CRM\Deal\Result\DealUserfieldResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @return DealUserfieldResult + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_get.php */ + #[ApiEndpointMetadata( + 'crm.deal.userfield.get', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_get.php', + 'Returns a userfield for deal by ID.' + )] public function get(int $userfieldItemId): DealUserfieldResult { return new DealUserfieldResult( @@ -186,10 +220,15 @@ public function get(int $userfieldItemId): DealUserfieldResult * @param array $userfieldFieldsToUpdate * * @return \Bitrix24\SDK\Core\Result\UpdatedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_update.php */ + #[ApiEndpointMetadata( + 'crm.deal.userfield.update', + 'https://training.bitrix24.com/rest_help/crm/deals/crm_deal_userfield_update.php', + 'Updates an existing user field for deals.' + )] public function update(int $userfieldItemId, array $userfieldFieldsToUpdate): UpdatedItemResult { return new UpdatedItemResult( diff --git a/src/Services/CRM/Duplicates/Result/DuplicateResult.php b/src/Services/CRM/Duplicates/Result/DuplicateResult.php index dffe44ad..3683f454 100644 --- a/src/Services/CRM/Duplicates/Result/DuplicateResult.php +++ b/src/Services/CRM/Duplicates/Result/DuplicateResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Duplicates\Result; diff --git a/src/Services/CRM/Duplicates/Service/Duplicate.php b/src/Services/CRM/Duplicates/Service/Duplicate.php index 9b0b122d..aaf4ea87 100644 --- a/src/Services/CRM/Duplicates/Service/Duplicate.php +++ b/src/Services/CRM/Duplicates/Service/Duplicate.php @@ -1,14 +1,27 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Duplicates\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\CRM\Duplicates\Result\DuplicateResult; +#[ApiServiceMetadata(new Scope(['crm']))] class Duplicate extends AbstractService { /** @@ -18,6 +31,11 @@ class Duplicate extends AbstractService * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.duplicate.findbycomm', + 'https://training.bitrix24.com/rest_help/crm/auxiliary/duplicates/crm.duplicate.findbycomm.php', + 'The method returns IDs for leads, contacts or companies that contain the specified phone numbers or e-mails.' + )] public function findByPhone(array $phones, ?EntityType $entityType = null): mixed { return new DuplicateResult($this->core->call('crm.duplicate.findbycomm', @@ -35,6 +53,11 @@ public function findByPhone(array $phones, ?EntityType $entityType = null): mixe * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.duplicate.findbycomm', + 'https://training.bitrix24.com/rest_help/crm/auxiliary/duplicates/crm.duplicate.findbycomm.php', + 'The method returns IDs for leads, contacts or companies that contain the specified phone numbers or e-mails.' + )] public function findByEmail(array $emails, ?EntityType $entityType = null): DuplicateResult { return new DuplicateResult($this->core->call('crm.duplicate.findbycomm', diff --git a/src/Services/CRM/Duplicates/Service/EntityType.php b/src/Services/CRM/Duplicates/Service/EntityType.php index 3e5583ea..a4165fa9 100644 --- a/src/Services/CRM/Duplicates/Service/EntityType.php +++ b/src/Services/CRM/Duplicates/Service/EntityType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Duplicates\Service; diff --git a/src/Services/CRM/Item/Result/ItemItemResult.php b/src/Services/CRM/Item/Result/ItemItemResult.php index 3d7090a8..5ac66a75 100644 --- a/src/Services/CRM/Item/Result/ItemItemResult.php +++ b/src/Services/CRM/Item/Result/ItemItemResult.php @@ -1,11 +1,20 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Item\Result; use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem; -use DateTimeImmutable; +use Carbon\CarbonImmutable; use Money\Currency; /** @@ -15,14 +24,14 @@ * @property-read int $createdBy * @property-read int $updatedBy * @property-read int $movedBy - * @property-read DateTimeImmutable $createdTime - * @property-read DateTimeImmutable $updatedTime - * @property-read DateTimeImmutable $movedTime + * @property-read CarbonImmutable $createdTime + * @property-read CarbonImmutable $updatedTime + * @property-read CarbonImmutable $movedTime * @property-read int $categoryId * @property-read bool $opened * @property-read string $previousStageId - * @property-read DateTimeImmutable $begindate - * @property-read DateTimeImmutable $closedate + * @property-read CarbonImmutable $begindate + * @property-read CarbonImmutable $closedate * @property-read int $companyId * @property-read int $contactId * @property-read int $opportunity @@ -38,7 +47,7 @@ * @property-read int $webformId * @property-read int $assignedById * @property-read int $lastActivityBy - * @property-read DateTimeImmutable $lastActivityTime + * @property-read CarbonImmutable $lastActivityTime * @property-read string $utmSource * @property-read string $utmMedium * @property-read string $utmCampaign diff --git a/src/Services/CRM/Item/Result/ItemResult.php b/src/Services/CRM/Item/Result/ItemResult.php index 1e6f36ad..d89251cd 100644 --- a/src/Services/CRM/Item/Result/ItemResult.php +++ b/src/Services/CRM/Item/Result/ItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Item/Result/ItemsResult.php b/src/Services/CRM/Item/Result/ItemsResult.php index 978ffc0d..9943e0b0 100644 --- a/src/Services/CRM/Item/Result/ItemsResult.php +++ b/src/Services/CRM/Item/Result/ItemsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Item\Result; diff --git a/src/Services/CRM/Item/Service/Batch.php b/src/Services/CRM/Item/Service/Batch.php index 14ff222b..546765ab 100644 --- a/src/Services/CRM/Item/Service/Batch.php +++ b/src/Services/CRM/Item/Service/Batch.php @@ -1,16 +1,29 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Item\Service; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; use Bitrix24\SDK\Services\CRM\Item\Result\ItemItemResult; use Generator; use Psr\Log\LoggerInterface; +#[ApiBatchServiceMetadata(new Scope(['crm']))] class Batch { protected BatchOperationsInterface $batch; @@ -28,6 +41,11 @@ public function __construct(BatchOperationsInterface $batch, LoggerInterface $lo * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.item.list', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_list.php', + 'Method returns array with SPA items with entityTypeId.' + )] public function list(int $entityTypeId, array $order, array $filter, array $select, ?int $limit = null): Generator { $this->log->debug( @@ -48,10 +66,14 @@ public function list(int $entityTypeId, array $order, array $filter, array $sele /** * Batch adding crm items * - * @return Generator|ItemItemResult[] - * + * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.item.add', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_add.php', + 'Method creates new SPA item with entityTypeId.' + )] public function add(int $entityTypeId, array $items): Generator { $rawItems = []; diff --git a/src/Services/CRM/Item/Service/Item.php b/src/Services/CRM/Item/Service/Item.php index f080641e..5425be81 100644 --- a/src/Services/CRM/Item/Service/Item.php +++ b/src/Services/CRM/Item/Service/Item.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Item\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\DeletedItemResult; @@ -15,6 +27,7 @@ use Bitrix24\SDK\Services\CRM\Item\Result\ItemsResult; use Psr\Log\LoggerInterface; +#[ApiServiceMetadata(new Scope(['crm']))] class Item extends AbstractService { public Batch $batch; @@ -37,6 +50,11 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.item.add', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_add.php', + 'Method creates new SPA item with entityTypeId.' + )] public function add(int $entityTypeId, array $fields): ItemResult { return new ItemResult( @@ -62,6 +80,11 @@ public function add(int $entityTypeId, array $fields): ItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.item.delete', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_delete.php', + 'Deletes item with id for SPA with entityTypeId.' + )] public function delete(int $entityTypeId, int $id): DeletedItemResult { return new DeletedItemResult( @@ -81,6 +104,11 @@ public function delete(int $entityTypeId, int $id): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.item.fields', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_fields.php', + 'Returns the fields data with entityTypeId.' + )] public function fields(int $entityTypeId): FieldsResult { return new FieldsResult($this->core->call('crm.item.fields', ['entityTypeId' => $entityTypeId])); @@ -94,6 +122,11 @@ public function fields(int $entityTypeId): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.item.get', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_get.php', + 'Returns item data with id for SPA with entityTypeId.' + )] public function get(int $entityTypeId, int $id): ItemResult { return new ItemResult($this->core->call('crm.item.get', ['entityTypeId' => $entityTypeId, 'id' => $id])); @@ -107,6 +140,11 @@ public function get(int $entityTypeId, int $id): ItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.item.list', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_list.php', + 'Returns array with SPA items with entityTypeId' + )] public function list(int $entityTypeId, array $order, array $filter, array $select, int $startItem = 0): ItemsResult { return new ItemsResult( @@ -131,6 +169,11 @@ public function list(int $entityTypeId, array $order, array $filter, array $sele * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.item.update', + 'https://training.bitrix24.com/rest_help/crm/dynamic/methodscrmitem/crm_item_update.php', + 'Updates the specified (existing) item.' + )] public function update(int $entityTypeId, int $id, array $fields): UpdatedItemResult { return new UpdatedItemResult( diff --git a/src/Services/CRM/Lead/Result/LeadItemResult.php b/src/Services/CRM/Lead/Result/LeadItemResult.php index 3a2b300c..347ac45e 100644 --- a/src/Services/CRM/Lead/Result/LeadItemResult.php +++ b/src/Services/CRM/Lead/Result/LeadItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Lead\Result; @@ -9,7 +18,7 @@ use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\InstantMessenger; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Phone; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\Website; -use DateTimeInterface; +use Carbon\CarbonImmutable; /** * Class LeadItemResult @@ -20,7 +29,7 @@ * @property-read string $NAME * @property-read string $SECOND_NAME * @property-read string $LAST_NAME - * @property-read DateTimeInterface|null $BIRTHDATE + * @property-read CarbonImmutable|null $BIRTHDATE * @property-read string $COMPANY_TITLE * @property-read string $SOURCE_ID * @property-read string $SOURCE_DESCRIPTION diff --git a/src/Services/CRM/Lead/Result/LeadResult.php b/src/Services/CRM/Lead/Result/LeadResult.php index 5fbfcc91..7f4d0f86 100644 --- a/src/Services/CRM/Lead/Result/LeadResult.php +++ b/src/Services/CRM/Lead/Result/LeadResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Lead/Result/LeadsResult.php b/src/Services/CRM/Lead/Result/LeadsResult.php index 2a2ebef3..203a5b54 100644 --- a/src/Services/CRM/Lead/Result/LeadsResult.php +++ b/src/Services/CRM/Lead/Result/LeadsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Lead/Service/Batch.php b/src/Services/CRM/Lead/Service/Batch.php index e34bdbbb..7b6e546c 100644 --- a/src/Services/CRM/Lead/Service/Batch.php +++ b/src/Services/CRM/Lead/Service/Batch.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Lead\Service; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; @@ -12,11 +24,7 @@ use Generator; use Psr\Log\LoggerInterface; -/** - * Class Batch - * - * @package Bitrix24\SDK\Services\CRM\Lead\Service - */ +#[ApiBatchServiceMetadata(new Scope(['crm']))] class Batch { protected BatchOperationsInterface $batch; @@ -130,6 +138,11 @@ public function __construct(BatchOperationsInterface $batch, LoggerInterface $lo * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.lead.list', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_list.php', + 'Batch list method for leads' + )] public function list(array $order, array $filter, array $select, ?int $limit = null): Generator { $this->log->debug( @@ -193,9 +206,14 @@ public function list(array $order, array $filter, array $select, ?int $limit = n * UTM_TERM?: string, * }> $leads * - * @return Generator|AddedItemBatchResult[] - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.lead.add', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_add.php', + 'Batch adding leads' + )] public function add(array $leads): Generator { $items = []; @@ -214,9 +232,14 @@ public function add(array $leads): Generator * * @param int[] $leadId * - * @return \Generator|\Bitrix24\SDK\Core\Contracts\DeletedItemResultInterface[] - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @return Generator + * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.lead.delete', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_delete.php', + 'Batch delete leads' + )] public function delete(array $leadId): Generator { foreach ($this->batch->deleteEntityItems('crm.lead.delete', $leadId) as $key => $item) { diff --git a/src/Services/CRM/Lead/Service/Lead.php b/src/Services/CRM/Lead/Service/Lead.php index 808a5b63..02d9716c 100644 --- a/src/Services/CRM/Lead/Service/Lead.php +++ b/src/Services/CRM/Lead/Service/Lead.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Lead\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -15,7 +27,7 @@ use Bitrix24\SDK\Services\CRM\Lead\Result\LeadResult; use Bitrix24\SDK\Services\CRM\Lead\Result\LeadsResult; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['crm']))] class Lead extends AbstractService { public Batch $batch; @@ -104,6 +116,11 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.lead.add', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_add.php', + 'Method adds new lead' + )] public function add(array $fields, array $params = []): AddedItemResult { return new AddedItemResult( @@ -128,6 +145,11 @@ public function add(array $fields, array $params = []): AddedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.lead.delete', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_delete.php', + 'Deletes the specified lead and all the associated objects.' + )] public function delete(int $id): DeletedItemResult { return new DeletedItemResult( @@ -149,6 +171,11 @@ public function delete(int $id): DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.lead.fields', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_fields.php', + 'Returns the description of the lead fields, including user fields.' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.lead.fields')); @@ -165,6 +192,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.lead.get', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_get.php', + 'Returns a lead by the lead ID.' + )] public function get(int $id): LeadResult { return new LeadResult($this->core->call('crm.lead.get', ['id' => $id])); @@ -184,6 +216,11 @@ public function get(int $id): LeadResult * @throws TransportException * @return LeadsResult */ + #[ApiEndpointMetadata( + 'crm.lead.list', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_list.php', + 'Get list of lead items.' + )] public function list(array $order, array $filter, array $select, int $startItem = 0): LeadsResult { return new LeadsResult( @@ -271,6 +308,11 @@ public function list(array $order, array $filter, array $select, int $startItem * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.lead.update', + 'https://training.bitrix24.com/rest_help/crm/leads/crm_lead_update.php', + 'Updates the specified (existing) lead.' + )] public function update(int $id, array $fields, array $params = []): UpdatedItemResult { return new UpdatedItemResult( diff --git a/src/Services/CRM/Product/Result/ProductItemResult.php b/src/Services/CRM/Product/Result/ProductItemResult.php index 9d81c9a1..657621a0 100644 --- a/src/Services/CRM/Product/Result/ProductItemResult.php +++ b/src/Services/CRM/Product/Result/ProductItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Product\Result; diff --git a/src/Services/CRM/Product/Result/ProductResult.php b/src/Services/CRM/Product/Result/ProductResult.php index 07ba6828..5cd5457f 100644 --- a/src/Services/CRM/Product/Result/ProductResult.php +++ b/src/Services/CRM/Product/Result/ProductResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Product/Result/ProductsResult.php b/src/Services/CRM/Product/Result/ProductsResult.php index dd8caf80..da840990 100644 --- a/src/Services/CRM/Product/Result/ProductsResult.php +++ b/src/Services/CRM/Product/Result/ProductsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/CRM/Product/Service/Batch.php b/src/Services/CRM/Product/Service/Batch.php index 5858aece..c4f7ac88 100644 --- a/src/Services/CRM/Product/Service/Batch.php +++ b/src/Services/CRM/Product/Service/Batch.php @@ -1,24 +1,32 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Product\Service; +use Bitrix24\SDK\Attributes\ApiBatchMethodMetadata; +use Bitrix24\SDK\Attributes\ApiBatchServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Services\AbstractBatchService; use Bitrix24\SDK\Services\CRM\Product\Result\ProductItemResult; use Generator; -/** - * Class Batch - * - * @package Bitrix24\SDK\Services\CRM\Product\Service - */ +#[ApiBatchServiceMetadata(new Scope(['crm']))] class Batch extends AbstractBatchService { /** - * batch list method + * batch product list method * * @param array{ * ID?: string @@ -33,6 +41,11 @@ class Batch extends AbstractBatchService * @return Generator * @throws BaseException */ + #[ApiBatchMethodMetadata( + 'crm.product.list', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_list.php', + 'batch product list method' + )] public function list(array $order, array $filter, array $select, ?int $limit = null): Generator { $this->log->debug( @@ -76,8 +89,13 @@ public function list(array $order, array $filter, array $select, ?int $limit = n * CREATED_BY?: int * }> $products * - * @return Generator|AddedItemBatchResult[] + * @return Generator */ + #[ApiBatchMethodMetadata( + 'crm.product.add', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_add.php', + 'Batch adding product' + )] public function add(array $products): Generator { $items = []; diff --git a/src/Services/CRM/Product/Service/Product.php b/src/Services/CRM/Product/Service/Product.php index 1a94f095..bf027036 100644 --- a/src/Services/CRM/Product/Service/Product.php +++ b/src/Services/CRM/Product/Service/Product.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Product\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; @@ -16,11 +28,7 @@ use Bitrix24\SDK\Services\CRM\Product\Result\ProductsResult; use Psr\Log\LoggerInterface; -/** - * Class Product - * - * @package Bitrix24\SDK\Services\CRM\Product\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class Product extends AbstractService { public Batch $batch; @@ -71,6 +79,11 @@ public function __construct(Batch $batch, CoreInterface $core, LoggerInterface $ * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.product.add', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_add.php', + 'Add new product' + )] public function add(array $fields): AddedItemResult { return new AddedItemResult( @@ -90,10 +103,15 @@ public function add(array $fields): AddedItemResult * * @param int $productId * - * @return \Bitrix24\SDK\Core\Result\DeletedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @return DeletedItemResult + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.product.delete', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_delete.php', + 'Delete product by id' + )] public function delete(int $productId): DeletedItemResult { return new DeletedItemResult( @@ -113,10 +131,15 @@ public function delete(int $productId): DeletedItemResult * * @param int $id * - * @return \Bitrix24\SDK\Services\CRM\Product\Result\ProductResult + * @return ProductResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.product.get', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_get.php', + 'Returns a product by the product id.' + )] public function get(int $id): ProductResult { return new ProductResult($this->core->call('crm.product.get', ['id' => $id])); @@ -131,6 +154,11 @@ public function get(int $id): ProductResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.product.fields', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_fields.php', + 'Returns the description of the product fields, including user fields.' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.product.fields')); @@ -150,6 +178,11 @@ public function fields(): FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.product.list', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_list.php', + 'Get list of product items.' + )] public function list(array $order, array $filter, array $select, int $startItem = 0): ProductsResult { return new ProductsResult( @@ -199,6 +232,11 @@ public function list(array $order, array $filter, array $select, int $startItem * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.product.update', + 'https://training.bitrix24.com/rest_help/crm/products/crm_product_update.php', + 'Updates the specified (existing) product.' + )] public function update(int $id, array $fields): UpdatedItemResult { return new UpdatedItemResult( @@ -240,8 +278,8 @@ public function update(int $id, array $fields): UpdatedItemResult * } $filter * * @return int - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function countByFilter(array $filter = []): int { diff --git a/src/Services/CRM/Settings/Result/SettingsModeResult.php b/src/Services/CRM/Settings/Result/SettingsModeResult.php index 25167743..cc8642d0 100644 --- a/src/Services/CRM/Settings/Result/SettingsModeResult.php +++ b/src/Services/CRM/Settings/Result/SettingsModeResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Settings\Result; diff --git a/src/Services/CRM/Settings/Service/Settings.php b/src/Services/CRM/Settings/Service/Settings.php index 016acb63..a99a7e1d 100644 --- a/src/Services/CRM/Settings/Service/Settings.php +++ b/src/Services/CRM/Settings/Service/Settings.php @@ -1,19 +1,27 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Settings\Service; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\CRM\Settings\Result\SettingsModeResult; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; -/** - * Class Settings - * - * @package Bitrix24\SDK\Services\CRM\Settings\Service - */ +#[ApiServiceMetadata(new Scope(['crm']))] class Settings extends AbstractService { /** @@ -21,6 +29,11 @@ class Settings extends AbstractService * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.settings.mode.get', + 'https://training.bitrix24.com/rest_help/crm/mode/crm_settings_mode_get.php', + 'The method returns current settings for CRM mode' + )] public function modeGet(): SettingsModeResult { return new SettingsModeResult($this->core->call('crm.settings.mode.get')); diff --git a/src/Services/CRM/Userfield/Exceptions/UserfieldNameIsTooLongException.php b/src/Services/CRM/Userfield/Exceptions/UserfieldNameIsTooLongException.php index 1c637c9e..13d2fc5a 100644 --- a/src/Services/CRM/Userfield/Exceptions/UserfieldNameIsTooLongException.php +++ b/src/Services/CRM/Userfield/Exceptions/UserfieldNameIsTooLongException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Userfield\Exceptions; diff --git a/src/Services/CRM/Userfield/Exceptions/UserfieldNotFoundException.php b/src/Services/CRM/Userfield/Exceptions/UserfieldNotFoundException.php index eb551e77..6205306f 100644 --- a/src/Services/CRM/Userfield/Exceptions/UserfieldNotFoundException.php +++ b/src/Services/CRM/Userfield/Exceptions/UserfieldNotFoundException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Userfield\Exceptions; diff --git a/src/Services/CRM/Userfield/Result/AbstractUserfieldItemResult.php b/src/Services/CRM/Userfield/Result/AbstractUserfieldItemResult.php index 7c876fde..44416332 100644 --- a/src/Services/CRM/Userfield/Result/AbstractUserfieldItemResult.php +++ b/src/Services/CRM/Userfield/Result/AbstractUserfieldItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Userfield\Result; diff --git a/src/Services/CRM/Userfield/Result/UserfieldTypeItemResult.php b/src/Services/CRM/Userfield/Result/UserfieldTypeItemResult.php index 57df56f0..5e697627 100644 --- a/src/Services/CRM/Userfield/Result/UserfieldTypeItemResult.php +++ b/src/Services/CRM/Userfield/Result/UserfieldTypeItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Userfield\Result; diff --git a/src/Services/CRM/Userfield/Result/UserfieldTypesResult.php b/src/Services/CRM/Userfield/Result/UserfieldTypesResult.php index 507caa83..2742b2f7 100644 --- a/src/Services/CRM/Userfield/Result/UserfieldTypesResult.php +++ b/src/Services/CRM/Userfield/Result/UserfieldTypesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Userfield\Result; diff --git a/src/Services/CRM/Userfield/Service/Userfield.php b/src/Services/CRM/Userfield/Service/Userfield.php index 8f436efb..e855723b 100644 --- a/src/Services/CRM/Userfield/Service/Userfield.php +++ b/src/Services/CRM/Userfield/Service/Userfield.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\CRM\Userfield\Service; @@ -9,7 +18,11 @@ use Bitrix24\SDK\Core\Result\FieldsResult; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\CRM\Userfield\Result\UserfieldTypesResult; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +#[ApiServiceMetadata(new Scope(['crm']))] class Userfield extends AbstractService { /** @@ -20,6 +33,11 @@ class Userfield extends AbstractService * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'crm.userfield.types', + 'https://training.bitrix24.com/rest_help/crm/userfields/crm_userfield_types.php', + 'Returns list of user field types.' + )] public function types(): UserfieldTypesResult { return new UserfieldTypesResult($this->core->call('crm.userfield.types')); @@ -33,6 +51,11 @@ public function types(): UserfieldTypesResult * @throws \Bitrix24\SDK\Core\Exceptions\BaseException * @throws \Bitrix24\SDK\Core\Exceptions\TransportException */ + #[ApiEndpointMetadata( + 'crm.userfield.fields', + 'https://training.bitrix24.com/rest_help/crm/userfields/crm_userfield_fields.php', + 'Returns field description for user fields.' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('crm.userfield.fields')); @@ -46,6 +69,11 @@ public function fields(): FieldsResult * @throws \Bitrix24\SDK\Core\Exceptions\BaseException * @throws \Bitrix24\SDK\Core\Exceptions\TransportException */ + #[ApiEndpointMetadata( + 'crm.userfield.fields', + 'https://training.bitrix24.com/rest_help/crm/userfields/crm_userfield_fields.php', + 'Returns field description for user fields.' + )] public function enumerationFields(): FieldsResult { return new FieldsResult($this->core->call('crm.userfield.enumeration.fields')); diff --git a/src/Services/Catalog/Catalog/Result/CatalogItemResult.php b/src/Services/Catalog/Catalog/Result/CatalogItemResult.php index 7a406f88..e62fc7cb 100644 --- a/src/Services/Catalog/Catalog/Result/CatalogItemResult.php +++ b/src/Services/Catalog/Catalog/Result/CatalogItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Catalog\Result; diff --git a/src/Services/Catalog/Catalog/Result/CatalogResult.php b/src/Services/Catalog/Catalog/Result/CatalogResult.php index f4e4adf6..aa468aa8 100644 --- a/src/Services/Catalog/Catalog/Result/CatalogResult.php +++ b/src/Services/Catalog/Catalog/Result/CatalogResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Catalog\Result; diff --git a/src/Services/Catalog/Catalog/Result/CatalogsResult.php b/src/Services/Catalog/Catalog/Result/CatalogsResult.php index 44c9799d..add5f259 100644 --- a/src/Services/Catalog/Catalog/Result/CatalogsResult.php +++ b/src/Services/Catalog/Catalog/Result/CatalogsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Catalog\Result; diff --git a/src/Services/Catalog/Catalog/Service/Catalog.php b/src/Services/Catalog/Catalog/Service/Catalog.php index b09c7e61..d9cb55fe 100644 --- a/src/Services/Catalog/Catalog/Service/Catalog.php +++ b/src/Services/Catalog/Catalog/Service/Catalog.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Catalog\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\FieldsResult; @@ -11,34 +23,38 @@ use Bitrix24\SDK\Services\Catalog\Catalog\Result\CatalogResult; use Bitrix24\SDK\Services\Catalog\Catalog\Result\CatalogsResult; +#[ApiServiceMetadata(new Scope(['catalog']))] class Catalog extends AbstractService { /** * The method gets field values of commercial catalog by ID. * - * @param int $catalogId - * @return CatalogResult * @throws BaseException * @throws TransportException * @see https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_get.php */ + #[ApiEndpointMetadata( + 'catalog.catalog.get', + 'https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_get.php', + 'The method gets field values of commercial catalog by ID.' + )] public function get(int $catalogId): CatalogResult { return new CatalogResult($this->core->call('catalog.catalog.get', ['id' => $catalogId])); } /** - * The method gets field value of commercial catalog product by ID. + * The method gets field value of commercial catalog product list * * @see https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_list.php - * @param array $select - * @param array $filter - * @param array $order - * @param int $start - * @return CatalogsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'catalog.catalog.list', + 'https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_list.php', + 'The method gets field value of commercial catalog product list' + )] public function list(array $select, array $filter, array $order, int $start): CatalogsResult { return new CatalogsResult($this->core->call('catalog.catalog.list', [ @@ -57,6 +73,11 @@ public function list(array $select, array $filter, array $order, int $start): Ca * @throws TransportException Throws a TransportException if there is an error in the transport process. * @see https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_getfields.php */ + #[ApiEndpointMetadata( + 'catalog.catalog.getFields', + 'https://training.bitrix24.com/rest_help/catalog/catalog/catalog_catalog_getfields.php', + 'Retrieves the fields for the catalog.' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('catalog.catalog.getFields')); diff --git a/src/Services/Catalog/CatalogServiceBuilder.php b/src/Services/Catalog/CatalogServiceBuilder.php index 32347b8c..b41933db 100644 --- a/src/Services/Catalog/CatalogServiceBuilder.php +++ b/src/Services/Catalog/CatalogServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog; diff --git a/src/Services/Catalog/Common/ProductType.php b/src/Services/Catalog/Common/ProductType.php index 0972c1a2..0bf8ef09 100644 --- a/src/Services/Catalog/Common/ProductType.php +++ b/src/Services/Catalog/Common/ProductType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Common; diff --git a/src/Services/Catalog/Common/Result/AbstractCatalogItem.php b/src/Services/Catalog/Common/Result/AbstractCatalogItem.php index b1d0138a..7b6da5fd 100644 --- a/src/Services/Catalog/Common/Result/AbstractCatalogItem.php +++ b/src/Services/Catalog/Common/Result/AbstractCatalogItem.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Common\Result; @@ -7,23 +16,19 @@ use Bitrix24\SDK\Core\Result\AbstractItem; use Bitrix24\SDK\Services\Catalog\Common\ProductType; use Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNotFoundException; -use DateTimeImmutable; +use Carbon\CarbonImmutable; use Money\Currency; -use Money\Money; abstract class AbstractCatalogItem extends AbstractItem { private const CRM_USERFIELD_PREFIX = 'UF_CRM_'; - /** - * @var Currency - */ private Currency $currency; public function __construct(array $data, Currency $currency = null) { parent::__construct($data); - if ($currency !== null) { + if ($currency instanceof Currency) { $this->currency = $currency; } } @@ -31,7 +36,7 @@ public function __construct(array $data, Currency $currency = null) /** * @param int|string $offset * - * @return bool|DateTimeImmutable|int|mixed|null + * @return bool|CarbonImmutable|int|mixed|null */ public function __get($offset) @@ -46,6 +51,7 @@ public function __get($offset) if ($this->data[$offset] !== null) { return $this->data[$offset] === 'Y'; } + return null; case 'code': case 'detailText': @@ -66,13 +72,14 @@ public function __get($offset) if ($this->data[$offset] !== '' && $this->data[$offset] !== null) { return (int)$this->data[$offset]; } + break; case 'dateActiveFrom': case 'dateActiveTo': case 'dateCreate': case 'timestampX': if ($this->data[$offset] !== '') { - return DateTimeImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); + return CarbonImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); } return null; @@ -86,7 +93,6 @@ public function __get($offset) /** * get userfield by field name * - * @param string $fieldName * * @return mixed|null * @throws UserfieldNotFoundException @@ -96,6 +102,7 @@ protected function getKeyWithUserfieldByFieldName(string $fieldName) if (!str_starts_with($fieldName, self::CRM_USERFIELD_PREFIX)) { $fieldName = self::CRM_USERFIELD_PREFIX . $fieldName; } + if (!$this->isKeyExists($fieldName)) { throw new UserfieldNotFoundException(sprintf('crm userfield not found by field name %s', $fieldName)); } diff --git a/src/Services/Catalog/Product/Result/ProductItemResult.php b/src/Services/Catalog/Product/Result/ProductItemResult.php index 07349bb3..c576d9b7 100644 --- a/src/Services/Catalog/Product/Result/ProductItemResult.php +++ b/src/Services/Catalog/Product/Result/ProductItemResult.php @@ -1,12 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Product\Result; use Bitrix24\SDK\Services\Catalog\Common\ProductType; use Bitrix24\SDK\Services\Catalog\Common\Result\AbstractCatalogItem; -use DateTimeInterface; +use Carbon\CarbonImmutable; use Money\Currency; use Money\Money; @@ -18,9 +27,9 @@ * @property-read ?bool $canBuyZero Option: Make out-of-stock items available for purchase * @property-read string $code Symbolic code * @property-read int $createdBy Created by (id) - * @property-read DateTimeInterface|null $dateActiveFrom Active from - * @property-read DateTimeInterface|null $dateActiveTo Active till - * @property-read DateTimeInterface $dateCreate Date created + * @property-read CarbonImmutable|null $dateActiveFrom Active from + * @property-read CarbonImmutable|null $dateActiveTo Active till + * @property-read CarbonImmutable $dateCreate Date created * @property-read array|null $detailPicture * @property-read string $detailText * @property-read string $detailTextType @@ -37,7 +46,7 @@ * @property-read string $previewTextType * @property-read ?Currency $purchasingCurrency * @property-read ?Money $purchasingPrice - * @property-read DateTimeInterface $timestampX + * @property-read CarbonImmutable $timestampX * @property-read ProductType $type * @property-read string $xmlId */ diff --git a/src/Services/Catalog/Product/Result/ProductResult.php b/src/Services/Catalog/Product/Result/ProductResult.php index e9aef70e..2751fda8 100644 --- a/src/Services/Catalog/Product/Result/ProductResult.php +++ b/src/Services/Catalog/Product/Result/ProductResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Product\Result; @@ -14,6 +23,7 @@ public function product(): ProductItemResult // fix for catalog.product.add return new ProductItemResult($this->getCoreResponse()->getResponseData()->getResult()['element']); } + return new ProductItemResult($this->getCoreResponse()->getResponseData()->getResult()['product']); } } \ No newline at end of file diff --git a/src/Services/Catalog/Product/Result/ProductsResult.php b/src/Services/Catalog/Product/Result/ProductsResult.php index 9f80be4e..aa644fa3 100644 --- a/src/Services/Catalog/Product/Result/ProductsResult.php +++ b/src/Services/Catalog/Product/Result/ProductsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Product\Result; diff --git a/src/Services/Catalog/Product/Service/Batch.php b/src/Services/Catalog/Product/Service/Batch.php index 1bd42ef6..45dddcb7 100644 --- a/src/Services/Catalog/Product/Service/Batch.php +++ b/src/Services/Catalog/Product/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Product\Service; diff --git a/src/Services/Catalog/Product/Service/Product.php b/src/Services/Catalog/Product/Service/Product.php index afb59635..730fd7c9 100644 --- a/src/Services/Catalog/Product/Service/Product.php +++ b/src/Services/Catalog/Product/Service/Product.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Catalog\Product\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\DeletedItemResult; @@ -16,18 +28,16 @@ use Psr\Log\LoggerInterface; +#[ApiServiceMetadata(new Scope(['catalog']))] class Product extends AbstractService { - public Batch $batch; - public function __construct( - Batch $batch, + public Batch $batch, CoreInterface $core, - LoggerInterface $log + LoggerInterface $logger ) { - parent::__construct($core, $log); - $this->batch = $batch; + parent::__construct($core, $logger); } /** @@ -37,6 +47,11 @@ public function __construct( * @throws TransportException * @throws BaseException */ + #[ApiEndpointMetadata( + 'catalog.product.get', + 'https://training.bitrix24.com/rest_help/catalog/product/catalog_product_get.php', + 'The method gets field value of commercial catalog product by ID.' + )] public function get(int $productId): ProductResult { return new ProductResult($this->core->call('catalog.product.get', ['id' => $productId])); @@ -46,11 +61,14 @@ public function get(int $productId): ProductResult * The method adds a commercial catalog product. * * @see https://training.bitrix24.com/rest_help/catalog/product/catalog_product_add.php - * @param array $productFields - * @return ProductResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'catalog.product.add', + 'https://training.bitrix24.com/rest_help/catalog/product/catalog_product_add.php', + 'The method adds a commercial catalog product.' + )] public function add(array $productFields): ProductResult { return new ProductResult($this->core->call('catalog.product.add', [ @@ -63,11 +81,14 @@ public function add(array $productFields): ProductResult * The method deletes commercial catalog product. * * @see https://training.bitrix24.com/rest_help/catalog/product/catalog_product_delete.php - * @param int $productId - * @return DeletedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'catalog.product.delete', + 'https://training.bitrix24.com/rest_help/catalog/product/catalog_product_delete.php', + 'The method deletes commercial catalog product by ID' + )] public function delete(int $productId): DeletedItemResult { return new DeletedItemResult($this->core->call('catalog.product.delete', ['id' => $productId])); @@ -80,6 +101,11 @@ public function delete(int $productId): DeletedItemResult * @throws TransportException * @throws BaseException */ + #[ApiEndpointMetadata( + 'catalog.product.list', + 'https://training.bitrix24.com/rest_help/catalog/product/catalog_product_list.php', + 'The method gets list of commercial catalog products by filter.' + )] public function list(array $select, array $filter, array $order, int $start): ProductsResult { return new ProductsResult($this->core->call('catalog.product.list', [ @@ -94,13 +120,14 @@ public function list(array $select, array $filter, array $order, int $start): Pr * The method returns commercial catalog product fields by filter. * @see https://training.bitrix24.com/rest_help/catalog/product/catalog_product_getfieldsbyfilter.php * - * @param int $iblockId - * @param ProductType $productType - * @param array|null $additionalFilter - * @return FieldsResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'catalog.product.getFieldsByFilter', + 'https://training.bitrix24.com/rest_help/catalog/product/catalog_product_getfieldsbyfilter.php', + 'The method returns commercial catalog product fields by filter.' + )] public function fieldsByFilter(int $iblockId, ProductType $productType, ?array $additionalFilter = null): FieldsResult { $filter = [ diff --git a/src/Services/IM/IMServiceBuilder.php b/src/Services/IM/IMServiceBuilder.php index 839ec8ed..641eacd4 100644 --- a/src/Services/IM/IMServiceBuilder.php +++ b/src/Services/IM/IMServiceBuilder.php @@ -1,26 +1,27 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\IM; use Bitrix24\SDK\Services\AbstractServiceBuilder; -use Bitrix24\SDK\Services\IM\Service\IM; +use Bitrix24\SDK\Services\IM\Notify\Service\Notify; -/** - * Class IMServiceBuilder - * - * @package Bitrix24\SDK\Services\IM - */ class IMServiceBuilder extends AbstractServiceBuilder { - /** - * @return IM - */ - public function IM(): IM + public function notify(): Notify { if (!isset($this->serviceCache[__METHOD__])) { - $this->serviceCache[__METHOD__] = new IM($this->core, $this->log); + $this->serviceCache[__METHOD__] = new Notify($this->core, $this->log); } return $this->serviceCache[__METHOD__]; diff --git a/src/Services/IM/Notify/Service/Notify.php b/src/Services/IM/Notify/Service/Notify.php new file mode 100644 index 00000000..27deffa7 --- /dev/null +++ b/src/Services/IM/Notify/Service/Notify.php @@ -0,0 +1,206 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Services\IM\Notify\Service; + + +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Core\Result\AddedItemResult; +use Bitrix24\SDK\Core\Result\DeletedItemResult; +use Bitrix24\SDK\Core\Result\UpdatedItemResult; +use Bitrix24\SDK\Services\AbstractService; + +#[ApiServiceMetadata(new Scope(['im']))] +class Notify extends AbstractService +{ + /** + * @param positive-int $userId + * @param non-empty-string $message + * @param non-empty-string|null $forEmailChannelMessage + * @param non-empty-string|null $notificationTag + * @param non-empty-string|null $subTag + * @throws BaseException + * @throws TransportException + */ + #[ApiEndpointMetadata( + 'im.notify.system.add', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23904&LESSON_PATH=9691.9805.11585.23904', + 'Sending system notification' + )] + public function fromSystem( + int $userId, + string $message, + ?string $forEmailChannelMessage = null, + ?string $notificationTag = null, + ?string $subTag = null, + ?array $attachment = null + ): AddedItemResult + { + return new AddedItemResult($this->core->call( + 'im.notify.system.add', + [ + 'USER_ID' => $userId, + 'MESSAGE' => $message, + 'MESSAGE_OUT' => $forEmailChannelMessage, + 'TAG' => $notificationTag, + 'SUB_TAG' => $subTag, + 'ATTACH' => $attachment, + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.personal.add', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23904&LESSON_PATH=9691.9805.11585.23904', + 'Sending personal notification' + )] + public function fromPersonal( + int $userId, + string $message, + ?string $forEmailChannelMessage = null, + ?string $notificationTag = null, + ?string $subTag = null, + ?array $attachment = null + ): AddedItemResult + { + return new AddedItemResult($this->core->call( + 'im.notify.personal.add', + [ + 'USER_ID' => $userId, + 'MESSAGE' => $message, + 'MESSAGE_OUT' => $forEmailChannelMessage, + 'TAG' => $notificationTag, + 'SUB_TAG' => $subTag, + 'ATTACH' => $attachment, + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.delete', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23906&LESSON_PATH=9691.9805.11585.23906', + 'Deleting notification' + )] + public function delete( + int $notificationId, + ?string $notificationTag = null, + ?string $subTag = null, + ): DeletedItemResult + { + return new DeletedItemResult($this->core->call( + 'im.notify.delete', + [ + 'ID' => $notificationId, + 'TAG' => $notificationTag, + 'SUB_TAG' => $subTag + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.read', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=11587&LESSON_PATH=9691.9805.11585.11587', + 'The method cancels notification for read messages.' + )] + public function markAsRead( + int $notificationId, + bool $isOnlyCurrent = true, + ): UpdatedItemResult + { + return new UpdatedItemResult($this->core->call( + 'im.notify.read', + [ + 'ID' => $notificationId, + 'ONLY_CURRENT' => $isOnlyCurrent ? 'Y' : 'N', + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.read', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23908&LESSON_PATH=9691.9805.11585.23908', + '"Read" the list of notifications, excluding CONFIRM notification type' + )] + public function markMessagesAsRead( + array $notificationIds + ): UpdatedItemResult + { + return new UpdatedItemResult($this->core->call( + 'im.notify.read', + [ + 'IDS' => $notificationIds, + 'ACTION' => 'Y', + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.read', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23908&LESSON_PATH=9691.9805.11585.23908', + '"Unread" the list of notifications, excluding CONFIRM notification type' + )] + public function markMessagesAsUnread( + array $notificationIds + ): UpdatedItemResult + { + return new UpdatedItemResult($this->core->call( + 'im.notify.read', + [ + 'IDS' => $notificationIds, + 'ACTION' => 'N', + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.confirm', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23912&LESSON_PATH=9691.9805.11585.23912', + 'Interaction with notification buttons' + )] + public function confirm( + int $notificationId, + bool $isAccept + ): UpdatedItemResult + { + return new UpdatedItemResult($this->core->call( + 'im.notify.confirm', + [ + 'ID' => $notificationId, + 'NOTIFY_VALUE' => $isAccept ? 'Y' : 'N', + ] + )); + } + + #[ApiEndpointMetadata( + 'im.notify.answer', + 'https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=23910&LESSON_PATH=9691.9805.11585.23910', + 'Response to notification, supporting quick reply' + )] + public function answer( + int $notificationId, + string $answerText + ): UpdatedItemResult + { + return new UpdatedItemResult($this->core->call( + 'im.notify.answer', + [ + 'ID' => $notificationId, + 'ANSWER_TEXT' => $answerText, + ] + )); + } +} \ No newline at end of file diff --git a/src/Services/IM/Service/IM.php b/src/Services/IM/Service/IM.php deleted file mode 100644 index bd1ca645..00000000 --- a/src/Services/IM/Service/IM.php +++ /dev/null @@ -1,83 +0,0 @@ -log->debug( - 'notifyFromSystem.start', - [ - 'to' => $userId, - 'message' => $message, - ] - ); - - $result = $this->core->call( - 'im.notify', - [ - 'to' => $userId, - 'message' => $message, - 'type' => 'SYSTEM', - ] - ); - - $this->log->debug('notifyFromSystem.finish'); - - return $result; - } - - /** - * @param int $userId - * @param string $message - * - * @return Response - * @throws BaseException - * @throws TransportException - */ - public function notifyFromUser(int $userId, string $message): Response - { - $this->log->debug( - 'notifyFromUser.start', - [ - 'to' => $userId, - 'message' => $message, - ] - ); - - $result = $this->core->call( - 'im.notify', - [ - 'to' => $userId, - 'message' => $message, - 'type' => 'USER', - ] - ); - - $this->log->debug('notifyFromUser.finish'); - - return $result; - } -} \ No newline at end of file diff --git a/src/Services/IMOpenLines/IMOpenLinesServiceBuilder.php b/src/Services/IMOpenLines/IMOpenLinesServiceBuilder.php index e5e198b8..8218dde8 100644 --- a/src/Services/IMOpenLines/IMOpenLinesServiceBuilder.php +++ b/src/Services/IMOpenLines/IMOpenLinesServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\IMOpenLines; @@ -9,9 +18,6 @@ class IMOpenLinesServiceBuilder extends AbstractServiceBuilder { - /** - * @return \Bitrix24\SDK\Services\IMOpenLines\Service\Network - */ public function Network(): Network { if (!isset($this->serviceCache[__METHOD__])) { diff --git a/src/Services/IMOpenLines/Result/AddedMessageItemResult.php b/src/Services/IMOpenLines/Result/AddedMessageItemResult.php index c9683cc1..c29eb4da 100644 --- a/src/Services/IMOpenLines/Result/AddedMessageItemResult.php +++ b/src/Services/IMOpenLines/Result/AddedMessageItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\IMOpenLines\Result; @@ -11,7 +20,6 @@ class AddedMessageItemResult extends AbstractResult { /** - * @return bool * @throws BaseException */ public function isSuccess(): bool diff --git a/src/Services/IMOpenLines/Result/JoinOpenLineResult.php b/src/Services/IMOpenLines/Result/JoinOpenLineResult.php index 516824ef..a0a13a5e 100644 --- a/src/Services/IMOpenLines/Result/JoinOpenLineResult.php +++ b/src/Services/IMOpenLines/Result/JoinOpenLineResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\IMOpenLines\Result; @@ -10,7 +19,6 @@ class JoinOpenLineResult extends AbstractResult implements AddedItemIdResultInterface { /** - * @return int * @throws \Bitrix24\SDK\Core\Exceptions\BaseException */ public function getId(): int diff --git a/src/Services/IMOpenLines/Service/Network.php b/src/Services/IMOpenLines/Service/Network.php index b99fdfca..8d2c5720 100644 --- a/src/Services/IMOpenLines/Service/Network.php +++ b/src/Services/IMOpenLines/Service/Network.php @@ -1,25 +1,40 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\IMOpenLines\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\IMOpenLines\Result\AddedMessageItemResult; use Bitrix24\SDK\Services\IMOpenLines\Result\JoinOpenLineResult; +#[ApiServiceMetadata(new Scope(['imopenlines']))] class Network extends AbstractService { /** - * Connecting an open channel by code - * - * @param string $openLineCode - * - * @return \Bitrix24\SDK\Services\IMOpenLines\Result\JoinOpenLineResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/support/training/course/?COURSE_ID=115&LESSON_ID=25016 */ + #[ApiEndpointMetadata( + 'imopenlines.network.join', + 'https://training.bitrix24.com/support/training/course/?COURSE_ID=115&LESSON_ID=25016', + 'Connecting an open channel by code' + )] public function join(string $openLineCode): JoinOpenLineResult { return new JoinOpenLineResult( @@ -33,37 +48,32 @@ public function join(string $openLineCode): JoinOpenLineResult } /** - * Sending Open Channel message to selected user - * - * @param string $openLineCode - * @param int $recipientUserId - * @param string $message - * @param bool $isMakeUrlPreview - * @param array|null $attach - * @param array|null $keyboard - * - * @return AddedMessageItemResult * @link https://training.bitrix24.com/support/training/course/?COURSE_ID=115&LESSON_ID=25018&LESSON_PATH=9691.9833.20331.25014.25018 - * */ + #[ApiEndpointMetadata( + 'imopenlines.network.message.add', + 'https://training.bitrix24.com/support/training/course/?COURSE_ID=115&LESSON_ID=25018&LESSON_PATH=9691.9833.20331.25014.25018', + 'Sending Open Channel message to selected user' + )] public function messageAdd( string $openLineCode, - int $recipientUserId, + int $recipientUserId, string $message, - bool $isMakeUrlPreview = true, + bool $isMakeUrlPreview = true, ?array $attach = null, ?array $keyboard = null - ): AddedMessageItemResult { + ): AddedMessageItemResult + { return new AddedMessageItemResult( $this->core->call( 'imopenlines.network.message.add', [ - 'CODE' => $openLineCode, - 'USER_ID' => $recipientUserId, - 'MESSAGE' => $message, + 'CODE' => $openLineCode, + 'USER_ID' => $recipientUserId, + 'MESSAGE' => $message, 'URL_PREVIEW' => $isMakeUrlPreview ? 'Y' : 'N', - 'ATTACH' => $attach, - 'KEYBOARD' => $keyboard, + 'ATTACH' => $attach, + 'KEYBOARD' => $keyboard, ] ) ); diff --git a/src/Services/Main/Common/EventHandlerMetadata.php b/src/Services/Main/Common/EventHandlerMetadata.php index 3c9dd2ca..3b6f6c7e 100644 --- a/src/Services/Main/Common/EventHandlerMetadata.php +++ b/src/Services/Main/Common/EventHandlerMetadata.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + namespace Bitrix24\SDK\Services\Main\Common; use Bitrix24\SDK\Services\Main\Result\EventHandlerItemResult; diff --git a/src/Services/Main/MainServiceBuilder.php b/src/Services/Main/MainServiceBuilder.php index 6a4f525b..b986a3a4 100644 --- a/src/Services/Main/MainServiceBuilder.php +++ b/src/Services/Main/MainServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main; @@ -16,9 +25,6 @@ */ class MainServiceBuilder extends AbstractServiceBuilder { - /** - * @return Main - */ public function main(): Main { if (!isset($this->serviceCache[__METHOD__])) { @@ -28,9 +34,6 @@ public function main(): Main return $this->serviceCache[__METHOD__]; } - /** - * @return Event - */ public function event(): Event { if (!isset($this->serviceCache[__METHOD__])) { diff --git a/src/Services/Main/Result/ApplicationInfoItemResult.php b/src/Services/Main/Result/ApplicationInfoItemResult.php index d76bd1fd..9d621709 100644 --- a/src/Services/Main/Result/ApplicationInfoItemResult.php +++ b/src/Services/Main/Result/ApplicationInfoItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; diff --git a/src/Services/Main/Result/ApplicationInfoResult.php b/src/Services/Main/Result/ApplicationInfoResult.php index b6c61fca..fcd58be8 100644 --- a/src/Services/Main/Result/ApplicationInfoResult.php +++ b/src/Services/Main/Result/ApplicationInfoResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/Main/Result/EventHandlerBindResult.php b/src/Services/Main/Result/EventHandlerBindResult.php index bf511882..85a24630 100644 --- a/src/Services/Main/Result/EventHandlerBindResult.php +++ b/src/Services/Main/Result/EventHandlerBindResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; @@ -10,7 +19,6 @@ class EventHandlerBindResult extends AbstractResult { /** - * @return bool * @throws BaseException */ public function isBinded(): bool diff --git a/src/Services/Main/Result/EventHandlerItemResult.php b/src/Services/Main/Result/EventHandlerItemResult.php index 75c0a8c6..98a994a1 100644 --- a/src/Services/Main/Result/EventHandlerItemResult.php +++ b/src/Services/Main/Result/EventHandlerItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; diff --git a/src/Services/Main/Result/EventHandlerUnbindResult.php b/src/Services/Main/Result/EventHandlerUnbindResult.php index 47aa9136..7c358b10 100644 --- a/src/Services/Main/Result/EventHandlerUnbindResult.php +++ b/src/Services/Main/Result/EventHandlerUnbindResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; @@ -10,7 +19,6 @@ class EventHandlerUnbindResult extends AbstractResult { /** - * @return int * @throws BaseException */ public function getUnbindedHandlersCount(): int diff --git a/src/Services/Main/Result/EventHandlersResult.php b/src/Services/Main/Result/EventHandlersResult.php index 7addf375..77a466ca 100644 --- a/src/Services/Main/Result/EventHandlersResult.php +++ b/src/Services/Main/Result/EventHandlersResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; diff --git a/src/Services/Main/Result/EventListResult.php b/src/Services/Main/Result/EventListResult.php index 695cf217..d7733fc4 100644 --- a/src/Services/Main/Result/EventListResult.php +++ b/src/Services/Main/Result/EventListResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; @@ -10,7 +19,6 @@ class EventListResult extends AbstractResult { /** - * @return array * @throws BaseException */ public function getEvents(): array diff --git a/src/Services/Main/Result/IsUserAdminResult.php b/src/Services/Main/Result/IsUserAdminResult.php index 1bee191b..ef68bc11 100644 --- a/src/Services/Main/Result/IsUserAdminResult.php +++ b/src/Services/Main/Result/IsUserAdminResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; @@ -10,7 +19,6 @@ class IsUserAdminResult extends AbstractResult { /** - * @return bool * @throws BaseException */ public function isAdmin(): bool diff --git a/src/Services/Main/Result/MethodAffordabilityResult.php b/src/Services/Main/Result/MethodAffordabilityResult.php index ad64373c..4ca9c08a 100644 --- a/src/Services/Main/Result/MethodAffordabilityResult.php +++ b/src/Services/Main/Result/MethodAffordabilityResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; @@ -10,7 +19,6 @@ class MethodAffordabilityResult extends AbstractResult { /** - * @return bool * @throws \Bitrix24\SDK\Core\Exceptions\BaseException */ public function isExisting(): bool @@ -19,7 +27,6 @@ public function isExisting(): bool } /** - * @return bool * @throws \Bitrix24\SDK\Core\Exceptions\BaseException */ public function isAvailable(): bool diff --git a/src/Services/Main/Result/ServerTimeResult.php b/src/Services/Main/Result/ServerTimeResult.php index 45d11321..819c3dc6 100644 --- a/src/Services/Main/Result/ServerTimeResult.php +++ b/src/Services/Main/Result/ServerTimeResult.php @@ -1,21 +1,31 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; +use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AbstractResult; -use DateTimeImmutable; +use Carbon\CarbonImmutable; +use Exception; class ServerTimeResult extends AbstractResult { /** - * @return \DateTimeImmutable - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Exception + * @throws BaseException + * @throws Exception */ - public function time(): DateTimeImmutable + public function time(): CarbonImmutable { - return new DateTimeImmutable($this->getCoreResponse()->getResponseData()->getResult()[0]); + return new CarbonImmutable($this->getCoreResponse()->getResponseData()->getResult()[0]); } } \ No newline at end of file diff --git a/src/Services/Main/Result/UserProfileItemResult.php b/src/Services/Main/Result/UserProfileItemResult.php index d5bc4938..250db094 100644 --- a/src/Services/Main/Result/UserProfileItemResult.php +++ b/src/Services/Main/Result/UserProfileItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Result; @@ -29,6 +38,7 @@ public function __get($offset) if ($this->data[$offset] !== '' && $this->data[$offset] !== null) { return (int)$this->data[$offset]; } + return null; default: return parent::__get($offset); diff --git a/src/Services/Main/Result/UserProfileResult.php b/src/Services/Main/Result/UserProfileResult.php index 2885e435..3826967f 100644 --- a/src/Services/Main/Result/UserProfileResult.php +++ b/src/Services/Main/Result/UserProfileResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/Main/Service/Event.php b/src/Services/Main/Service/Event.php index cf5d2fa6..cc733ddb 100644 --- a/src/Services/Main/Service/Event.php +++ b/src/Services/Main/Service/Event.php @@ -1,10 +1,24 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException; use Bitrix24\SDK\Core\Response\Response; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Main\Result\EventHandlerBindResult; @@ -12,19 +26,23 @@ use Bitrix24\SDK\Services\Main\Result\EventHandlerUnbindResult; use Bitrix24\SDK\Services\Main\Result\EventListResult; +#[ApiServiceMetadata(new Scope([]))] class Event extends AbstractService { /** * Displays events from the general list of events. * - * @param string|null $scopeCode * - * @return EventListResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException - * @throws \Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException + * @throws BaseException + * @throws TransportException + * @throws UnknownScopeCodeException * @link https://training.bitrix24.com/rest_help/general/events_method/events.php */ + #[ApiEndpointMetadata( + 'events', + 'https://training.bitrix24.com/rest_help/general/events_method/events.php', + 'Displays events from the general list of events.' + )] public function list(?string $scopeCode = null): EventListResult { return new EventListResult( @@ -38,26 +56,27 @@ public function list(?string $scopeCode = null): EventListResult /** * Installs a new event handler. * - * @param string $eventCode - * @param string $handlerUrl - * @param int|null $userId - * @param array|null $options * - * @return \Bitrix24\SDK\Services\Main\Result\EventHandlerBindResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/events_method/event_bind.php */ + #[ApiEndpointMetadata( + 'event.bind', + 'https://training.bitrix24.com/rest_help/general/events_method/event_bind.php', + 'Installs a new event handler.' + )] public function bind(string $eventCode, string $handlerUrl, ?int $userId = null, ?array $options = null): EventHandlerBindResult { $params = [ - 'event' => $eventCode, - 'handler' => $handlerUrl, + 'event' => $eventCode, + 'handler' => $handlerUrl, 'event_type ' => 'online', ]; if ($userId !== null) { $params['auth_type'] = $userId; } + if (is_array($options)) { $params = array_merge($params, $options); } @@ -68,20 +87,21 @@ public function bind(string $eventCode, string $handlerUrl, ?int $userId = null, /** * Uninstalls a previously installed event handler. * - * @param string $eventCode - * @param string $handlerUrl - * @param int|null $userId * - * @return \Bitrix24\SDK\Services\Main\Result\EventHandlerUnbindResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/events_method/event_unbind.php */ + #[ApiEndpointMetadata( + 'event.unbind', + 'https://training.bitrix24.com/rest_help/general/events_method/event_unbind.php', + 'Uninstalls a previously installed event handler.' + )] public function unbind(string $eventCode, string $handlerUrl, ?int $userId = null): EventHandlerUnbindResult { $params = [ - 'event' => $eventCode, - 'handler' => $handlerUrl, + 'event' => $eventCode, + 'handler' => $handlerUrl, 'event_type ' => 'online', ]; if ($userId !== null) { @@ -92,13 +112,16 @@ public function unbind(string $eventCode, string $handlerUrl, ?int $userId = nul } /** - * @param array $payload * - * @return \Bitrix24\SDK\Core\Response\Response - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/rest_sum/test_handler.php */ + #[ApiEndpointMetadata( + 'event.test', + 'https://training.bitrix24.com/rest_help/rest_sum/test_handler.php', + 'Test events' + )] public function test(array $payload = []): Response { return $this->core->call('event.test', $payload); @@ -107,11 +130,15 @@ public function test(array $payload = []): Response /** * Obtaining a list of registered event handlers. * - * @return \Bitrix24\SDK\Services\Main\Result\EventHandlersResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/events_method/event_get.php */ + #[ApiEndpointMetadata( + 'event.get', + 'https://training.bitrix24.com/rest_help/general/events_method/event_get.php', + 'Obtaining a list of registered event handlers.' + )] public function get(): EventHandlersResult { return new EventHandlersResult($this->core->call('event.get')); diff --git a/src/Services/Main/Service/EventManager.php b/src/Services/Main/Service/EventManager.php index af2cbe58..084e91ba 100644 --- a/src/Services/Main/Service/EventManager.php +++ b/src/Services/Main/Service/EventManager.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Service; @@ -20,7 +29,6 @@ public function __construct( /** * @param EventHandlerMetadata[] $eventHandlerMetadata - * @return void * @throws InvalidArgumentException */ public function bindEventHandlers(array $eventHandlerMetadata): void @@ -31,6 +39,7 @@ public function bindEventHandlers(array $eventHandlerMetadata): void throw new InvalidArgumentException( sprintf('in eventHandlerMetadata we need only EventHandlerMetadata objects, we got an «%s»', gettype($eventHandler))); } + $this->logger->debug('bindEventHandlers.handlerItem', [ 'code' => $eventHandler->code, 'url' => $eventHandler->handlerUrl, @@ -44,13 +53,13 @@ public function bindEventHandlers(array $eventHandlerMetadata): void $alreadyInstalledHandlers = $this->eventService->get()->getEventHandlers(); foreach ($eventHandlerMetadata as $eventHandler) { $isInstalled = false; - foreach ($alreadyInstalledHandlers as $installedHandler) { + foreach ($alreadyInstalledHandlers as $alreadyInstalledHandler) { $this->logger->debug('bindEventHandlers.isHandlerInstalled', [ 'handlerToInstallCode' => $eventHandler->code, 'handlerToInstallUrl' => $eventHandler->handlerUrl, - 'isInstalled' => $eventHandler->isInstalled($installedHandler) + 'isInstalled' => $eventHandler->isInstalled($alreadyInstalledHandler) ]); - if ($eventHandler->isInstalled($installedHandler)) { + if ($eventHandler->isInstalled($alreadyInstalledHandler)) { $this->logger->debug('bindEventHandlers.handlerAlreadyInstalled', [ 'code' => $eventHandler->code, 'handlerUrl' => $eventHandler->handlerUrl @@ -60,6 +69,7 @@ public function bindEventHandlers(array $eventHandlerMetadata): void break; } } + if (!$isInstalled) { $toInstall[] = $eventHandler; $this->logger->debug('bindEventHandlers.handlerAddedToInstallPlan', [ @@ -86,23 +96,24 @@ public function bindEventHandlers(array $eventHandlerMetadata): void public function unbindAllEventHandlers(): EventHandlersResult { - $activeHandlers = $this->eventService->get(); - if (count($activeHandlers->getEventHandlers()) === 0) { - return $activeHandlers; + $eventHandlersResult = $this->eventService->get(); + if ($eventHandlersResult->getEventHandlers() === []) { + return $eventHandlersResult; } - $handlersToUnbind = $activeHandlers->getEventHandlers(); + $handlersToUnbind = $eventHandlersResult->getEventHandlers(); // todo replace to batch call - foreach ($handlersToUnbind as $itemHandler) { + foreach ($handlersToUnbind as $handlerToUnbind) { $this->logger->debug('unbindAllEventHandlers.handler', [ - 'code' => $itemHandler->event, - 'handler' => $itemHandler->handler, + 'code' => $handlerToUnbind->event, + 'handler' => $handlerToUnbind->handler, ]); $this->eventService->unbind( - $itemHandler->event, - $itemHandler->handler + $handlerToUnbind->event, + $handlerToUnbind->handler ); } - return $activeHandlers; + + return $eventHandlersResult; } } \ No newline at end of file diff --git a/src/Services/Main/Service/Main.php b/src/Services/Main/Service/Main.php index 7d4bd720..ad06d9a9 100644 --- a/src/Services/Main/Service/Main.php +++ b/src/Services/Main/Service/Main.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Main\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Response\Response; @@ -14,21 +26,21 @@ use Bitrix24\SDK\Services\Main\Result\ServerTimeResult; use Bitrix24\SDK\Services\Main\Result\UserProfileResult; -/** - * Class Main - * - * @package Bitrix24\SDK\Services - */ +#[ApiServiceMetadata(new Scope([]))] class Main extends AbstractService { /** * Method returns current server time in the format YYYY-MM-DDThh:mm:ss±hh:mm. * * @link https://training.bitrix24.com/rest_help/general/server_time.php - * @return \Bitrix24\SDK\Services\Main\Result\ServerTimeResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'server.time', + 'https://training.bitrix24.com/rest_help/general/server_time.php', + 'Method returns current server time in the format YYYY-MM-DDThh:mm:ss±hh:mm.' + )] public function getServerTime(): ServerTimeResult { return new ServerTimeResult($this->core->call('server.time')); @@ -38,10 +50,14 @@ public function getServerTime(): ServerTimeResult * Allows to return basic Information about the current user without any scopes, in contrast to user.current. * * @link https://training.bitrix24.com/rest_help/general/profile.php - * @return \Bitrix24\SDK\Services\Main\Result\UserProfileResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'profile', + 'https://training.bitrix24.com/rest_help/general/profile.php', + 'Allows to return basic Information about the current user without any scopes, in contrast to user.current.' + )] public function getCurrentUserProfile(): UserProfileResult { return new UserProfileResult($this->core->call('profile')); @@ -50,13 +66,16 @@ public function getCurrentUserProfile(): UserProfileResult /** * Returns access permission names. * - * @param array $accessList * - * @return \Bitrix24\SDK\Core\Response\Response - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/access_name.php */ + #[ApiEndpointMetadata( + 'access.name', + 'https://training.bitrix24.com/rest_help/general/access_name.php', + 'Returns access permission names.' + )] public function getAccessName(array $accessList): Response { return $this->core->call('access.name', [ @@ -67,13 +86,16 @@ public function getAccessName(array $accessList): Response /** * Checks if the current user has at least one permission of those specified by the ACCESS parameter. * - * @param array $accessToCheck * - * @return \Bitrix24\SDK\Core\Response\Response - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/user_access.php */ + #[ApiEndpointMetadata( + 'user.access', + 'https://training.bitrix24.com/rest_help/general/user_access.php', + 'Checks if the current user has at least one permission of those specified by the ACCESS parameter.' + )] public function checkUserAccess(array $accessToCheck): Response { return $this->core->call('user.access', [ @@ -84,13 +106,16 @@ public function checkUserAccess(array $accessToCheck): Response /** * Method returns 2 parameters - isExisting and isAvailable * - * @param string $methodName * - * @return \Bitrix24\SDK\Services\Main\Result\MethodAffordabilityResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/method_get.php */ + #[ApiEndpointMetadata( + 'method.get', + 'https://training.bitrix24.com/rest_help/general/method_get.php', + 'Method returns 2 parameters - isExisting and isAvailable' + )] public function getMethodAffordability(string $methodName): MethodAffordabilityResult { return new MethodAffordabilityResult( @@ -103,11 +128,15 @@ public function getMethodAffordability(string $methodName): MethodAffordabilityR /** * It will return permissions available to the current application. * - * @return Response * @throws BaseException * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/scope.php */ + #[ApiEndpointMetadata( + 'scope', + 'https://training.bitrix24.com/rest_help/general/scope.php', + 'Method returns 2 parameters - isExisting and isAvailable' + )] public function getCurrentScope(): Response { return $this->core->call('scope'); @@ -116,11 +145,15 @@ public function getCurrentScope(): Response /** * Method will return a list of all possible permissions. * - * @return Response * @throws BaseException * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/scope.php */ + #[ApiEndpointMetadata( + 'scope', + 'https://training.bitrix24.com/rest_help/general/scope.php', + 'Method will return a list of all possible permissions.' + )] public function getAvailableScope(): Response { return $this->core->call('scope', ['full' => true]); @@ -129,12 +162,16 @@ public function getAvailableScope(): Response /** * Returns the methods available to the current application * - * @return Response * @throws BaseException * @throws TransportException * @deprecated use method.get * @link https://training.bitrix24.com/rest_help/general/methods.php */ + #[ApiEndpointMetadata( + 'methods', + 'https://training.bitrix24.com/rest_help/general/methods.php', + 'Returns the methods available to the current application' + )] public function getAvailableMethods(): Response { return $this->core->call('methods', []); @@ -143,12 +180,16 @@ public function getAvailableMethods(): Response /** * Returns the methods available * - * @return Response * @throws BaseException * @throws TransportException * @deprecated use method.get * @link https://training.bitrix24.com/rest_help/general/methods.php */ + #[ApiEndpointMetadata( + 'methods', + 'https://training.bitrix24.com/rest_help/general/methods.php', + 'Returns the methods available to the current application' + )] public function getAllMethods(): Response { return $this->core->call('methods', ['full' => true]); @@ -157,14 +198,17 @@ public function getAllMethods(): Response /** * Returns the methods available to the current application * - * @param string $scope * - * @return Response * @throws BaseException * @throws TransportException * @deprecated use method.get * @link https://training.bitrix24.com/rest_help/general/methods.php */ + #[ApiEndpointMetadata( + 'methods', + 'https://training.bitrix24.com/rest_help/general/methods.php', + 'Returns the methods available to the current application' + )] public function getMethodsByScope(string $scope): Response { return $this->core->call('methods', ['scope' => $scope]); @@ -173,11 +217,15 @@ public function getMethodsByScope(string $scope): Response /** * Displays application information. The method supports secure calling convention. * - * @return ApplicationInfoResult * @throws BaseException * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/app_info.php */ + #[ApiEndpointMetadata( + 'app.info', + 'https://training.bitrix24.com/rest_help/general/app_info.php', + 'Displays application information. The method supports secure calling convention.' + )] public function getApplicationInfo(): ApplicationInfoResult { return new ApplicationInfoResult($this->core->call('app.info')); @@ -186,11 +234,15 @@ public function getApplicationInfo(): ApplicationInfoResult /** * Checks if a current user has permissions to manage application parameters. * - * @return IsUserAdminResult * @throws BaseException * @throws TransportException * @link https://training.bitrix24.com/rest_help/general/user_admin.php */ + #[ApiEndpointMetadata( + 'user.admin', + 'https://training.bitrix24.com/rest_help/general/user_admin.php', + 'Checks if a current user has permissions to manage application parameters.' + )] public function isCurrentUserHasAdminRights(): IsUserAdminResult { return new IsUserAdminResult($this->core->call('user.admin')); diff --git a/src/Services/Placement/PlacementServiceBuilder.php b/src/Services/Placement/PlacementServiceBuilder.php index 22b838be..cfefa8f9 100644 --- a/src/Services/Placement/PlacementServiceBuilder.php +++ b/src/Services/Placement/PlacementServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement; @@ -10,9 +19,6 @@ class PlacementServiceBuilder extends AbstractServiceBuilder { - /** - * @return Placement - */ public function placement(): Placement { if (!isset($this->serviceCache[__METHOD__])) { @@ -22,9 +28,6 @@ public function placement(): Placement return $this->serviceCache[__METHOD__]; } - /** - * @return \Bitrix24\SDK\Services\Placement\Service\UserFieldType - */ public function userfieldtype(): UserFieldType { if (!isset($this->serviceCache[__METHOD__])) { diff --git a/src/Services/Placement/Result/DeleteUserTypeResult.php b/src/Services/Placement/Result/DeleteUserTypeResult.php index 66cfb1ce..67d01d05 100644 --- a/src/Services/Placement/Result/DeleteUserTypeResult.php +++ b/src/Services/Placement/Result/DeleteUserTypeResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; @@ -10,7 +19,6 @@ class DeleteUserTypeResult extends AbstractResult { /** - * @return bool * @throws BaseException */ public function isSuccess(): bool diff --git a/src/Services/Placement/Result/PlacementBindResult.php b/src/Services/Placement/Result/PlacementBindResult.php index 4dfa0ddd..4cf00d6a 100644 --- a/src/Services/Placement/Result/PlacementBindResult.php +++ b/src/Services/Placement/Result/PlacementBindResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; @@ -10,7 +19,6 @@ class PlacementBindResult extends AbstractResult { /** - * @return bool * @throws BaseException */ public function isSuccess(): bool diff --git a/src/Services/Placement/Result/PlacementLocationCodesResult.php b/src/Services/Placement/Result/PlacementLocationCodesResult.php index 0804042b..9490c7c7 100644 --- a/src/Services/Placement/Result/PlacementLocationCodesResult.php +++ b/src/Services/Placement/Result/PlacementLocationCodesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; @@ -9,7 +18,6 @@ class PlacementLocationCodesResult extends AbstractResult { /** - * @return array * @throws \Bitrix24\SDK\Core\Exceptions\BaseException */ public function getLocationCodes(): array diff --git a/src/Services/Placement/Result/PlacementLocationItemResult.php b/src/Services/Placement/Result/PlacementLocationItemResult.php index 4b3b829b..5f0415c5 100644 --- a/src/Services/Placement/Result/PlacementLocationItemResult.php +++ b/src/Services/Placement/Result/PlacementLocationItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; diff --git a/src/Services/Placement/Result/PlacementUnbindResult.php b/src/Services/Placement/Result/PlacementUnbindResult.php index 51dd7e51..41e14e02 100644 --- a/src/Services/Placement/Result/PlacementUnbindResult.php +++ b/src/Services/Placement/Result/PlacementUnbindResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; @@ -10,7 +19,6 @@ class PlacementUnbindResult extends AbstractResult { /** - * @return int * @throws BaseException */ public function getDeletedPlacementHandlersCount(): int diff --git a/src/Services/Placement/Result/PlacementsLocationInformationResult.php b/src/Services/Placement/Result/PlacementsLocationInformationResult.php index 328f3ae4..f817566e 100644 --- a/src/Services/Placement/Result/PlacementsLocationInformationResult.php +++ b/src/Services/Placement/Result/PlacementsLocationInformationResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; diff --git a/src/Services/Placement/Result/RegisterUserTypeResult.php b/src/Services/Placement/Result/RegisterUserTypeResult.php index 2a0c6baf..a72e7e60 100644 --- a/src/Services/Placement/Result/RegisterUserTypeResult.php +++ b/src/Services/Placement/Result/RegisterUserTypeResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; @@ -10,7 +19,6 @@ class RegisterUserTypeResult extends AbstractResult { /** - * @return bool * @throws BaseException */ public function isSuccess(): bool diff --git a/src/Services/Placement/Result/UserFieldTypeItemResult.php b/src/Services/Placement/Result/UserFieldTypeItemResult.php index 4ed69497..a0e80a6f 100644 --- a/src/Services/Placement/Result/UserFieldTypeItemResult.php +++ b/src/Services/Placement/Result/UserFieldTypeItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; diff --git a/src/Services/Placement/Result/UserFieldTypesResult.php b/src/Services/Placement/Result/UserFieldTypesResult.php index 5496a458..75e677cc 100644 --- a/src/Services/Placement/Result/UserFieldTypesResult.php +++ b/src/Services/Placement/Result/UserFieldTypesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Result; diff --git a/src/Services/Placement/Service/Placement.php b/src/Services/Placement/Service/Placement.php index f27fd63f..ec302ecf 100644 --- a/src/Services/Placement/Service/Placement.php +++ b/src/Services/Placement/Service/Placement.php @@ -1,29 +1,44 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Placement\Result\PlacementBindResult; use Bitrix24\SDK\Services\Placement\Result\PlacementLocationCodesResult; use Bitrix24\SDK\Services\Placement\Result\PlacementsLocationInformationResult; use Bitrix24\SDK\Services\Placement\Result\PlacementUnbindResult; - +#[ApiServiceMetadata(new Scope(['placement']))] class Placement extends AbstractService { /** * Installs the embedding location handler * - * @param string $placementCode - * @param string $handlerUrl - * @param array $lang * - * @return \Bitrix24\SDK\Services\Placement\Result\PlacementBindResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/metods/placement_bind.php */ + #[ApiEndpointMetadata( + 'placement.bind', + 'https://training.bitrix24.com/rest_help/application_embedding/metods/placement_bind.php', + 'Installs the embedding location handler' + )] public function bind(string $placementCode, string $handlerUrl, array $lang): PlacementBindResult { return new PlacementBindResult( @@ -41,14 +56,15 @@ public function bind(string $placementCode, string $handlerUrl, array $lang): Pl /** * Deletes the registered embedding location handler. Shall be executed with the available account administrative privileges. * - * @param string $placementCode - * @param string|null $handlerUrl - * - * @return \Bitrix24\SDK\Services\Placement\Result\PlacementUnbindResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/metods/placement_unbind.php */ + #[ApiEndpointMetadata( + 'placement.unbind', + 'https://training.bitrix24.com/rest_help/application_embedding/metods/placement_unbind.php', + 'Deletes the registered embedding location handler. Shall be executed with the available account administrative privileges.' + )] public function unbind(string $placementCode, ?string $handlerUrl = null): PlacementUnbindResult { return new PlacementUnbindResult( @@ -65,13 +81,15 @@ public function unbind(string $placementCode, ?string $handlerUrl = null): Place /** * This method is used to retrieve the list of embedding locations, available to the application. * - * @param string|null $applicationScopeCode - * - * @return PlacementLocationCodesResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/metods/placement_list.php */ + #[ApiEndpointMetadata( + 'placement.list', + 'https://training.bitrix24.com/rest_help/application_embedding/metods/placement_list.php', + 'This method is used to retrieve the list of embedding locations, available to the application.' + )] public function list(?string $applicationScopeCode = null): PlacementLocationCodesResult { return new PlacementLocationCodesResult( @@ -84,11 +102,15 @@ public function list(?string $applicationScopeCode = null): PlacementLocationCod /** * This method is used to retrieve the list of registered handlers for embedding locations. * - * @return PlacementsLocationInformationResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/metods/placement_get.php */ + #[ApiEndpointMetadata( + 'placement.get', + 'https://training.bitrix24.com/rest_help/application_embedding/metods/placement_get.php', + 'This method is used to retrieve the list of registered handlers for embedding locations.' + )] public function get(): PlacementsLocationInformationResult { return new PlacementsLocationInformationResult($this->core->call('placement.get')); diff --git a/src/Services/Placement/Service/PlacementLocationCode.php b/src/Services/Placement/Service/PlacementLocationCode.php index 6602e5bf..9217e71d 100644 --- a/src/Services/Placement/Service/PlacementLocationCode.php +++ b/src/Services/Placement/Service/PlacementLocationCode.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Service; @@ -10,83 +19,190 @@ class PlacementLocationCode { // CRM scope - public const CRM_LEAD_LIST_MENU = 'CRM_LEAD_LIST_MENU'; // List menu for Leads - public const CRM_LEAD_DETAIL_TAB = 'CRM_LEAD_DETAIL_TAB'; // Upper menu item in the Lead details tab - public const CRM_LEAD_DETAIL_ACTIVITY = 'CRM_LEAD_DETAIL_ACTIVITY'; // Lead activity menu item - public const CRM_DEAL_LIST_MENU = 'CRM_DEAL_LIST_MENU'; //Deals list menu - public const CRM_DEAL_DETAIL_TAB = 'CRM_DEAL_DETAIL_TAB'; // Upper menu item in the Deals details - public const CRM_DEAL_DETAIL_ACTIVITY = 'CRM_DEAL_DETAIL_ACTIVITY'; // Deal activity menu item - public const CRM_CONTACT_LIST_MENU = 'CRM_CONTACT_LIST_MENU'; // Contact list menu - public const CRM_CONTACT_DETAIL_TAB = 'CRM_CONTACT_DETAIL_TAB'; // Upper menu item in the Contact details - public const CRM_CONTACT_DETAIL_ACTIVITY = 'CRM_CONTACT_DETAIL_ACTIVITY'; // Contact activity menu item - public const CRM_COMPANY_LIST_MENU = 'CRM_COMPANY_LIST_MENU'; // Company list menu - public const CRM_COMPANY_DETAIL_TAB = 'CRM_COMPANY_DETAIL_TAB'; // Upper menu item in the Company details - public const CRM_COMPANY_DETAIL_ACTIVITY = 'CRM_COMPANY_DETAIL_ACTIVITY'; // Company activity menu item - public const CRM_INVOICE_LIST_MENU = 'CRM_INVOICE_LIST_MENU'; // Invoices list menu - public const CRM_QUOTE_LIST_MENU = 'CRM_QUOTE_LIST_MENU'; // Quotes list context menu - public const CRM_ACTIVITY_LIST_MENU = 'CRM_ACTIVITY_LIST_MENU'; // Activities list context menu - public const CRM_ANALYTICS_MENU = 'CRM_ANALYTICS_MENU'; // CRM Analytics menu + public const CRM_LEAD_LIST_MENU = 'CRM_LEAD_LIST_MENU'; + + // List menu for Leads + public const CRM_LEAD_DETAIL_TAB = 'CRM_LEAD_DETAIL_TAB'; + + // Upper menu item in the Lead details tab + public const CRM_LEAD_DETAIL_ACTIVITY = 'CRM_LEAD_DETAIL_ACTIVITY'; + + // Lead activity menu item + public const CRM_DEAL_LIST_MENU = 'CRM_DEAL_LIST_MENU'; + + //Deals list menu + public const CRM_DEAL_DETAIL_TAB = 'CRM_DEAL_DETAIL_TAB'; + + // Upper menu item in the Deals details + public const CRM_DEAL_DETAIL_ACTIVITY = 'CRM_DEAL_DETAIL_ACTIVITY'; + + // Deal activity menu item + public const CRM_CONTACT_LIST_MENU = 'CRM_CONTACT_LIST_MENU'; + + // Contact list menu + public const CRM_CONTACT_DETAIL_TAB = 'CRM_CONTACT_DETAIL_TAB'; + + // Upper menu item in the Contact details + public const CRM_CONTACT_DETAIL_ACTIVITY = 'CRM_CONTACT_DETAIL_ACTIVITY'; + + // Contact activity menu item + public const CRM_COMPANY_LIST_MENU = 'CRM_COMPANY_LIST_MENU'; + + // Company list menu + public const CRM_COMPANY_DETAIL_TAB = 'CRM_COMPANY_DETAIL_TAB'; + + // Upper menu item in the Company details + public const CRM_COMPANY_DETAIL_ACTIVITY = 'CRM_COMPANY_DETAIL_ACTIVITY'; + + // Company activity menu item + public const CRM_INVOICE_LIST_MENU = 'CRM_INVOICE_LIST_MENU'; + + // Invoices list menu + public const CRM_QUOTE_LIST_MENU = 'CRM_QUOTE_LIST_MENU'; + + // Quotes list context menu + public const CRM_ACTIVITY_LIST_MENU = 'CRM_ACTIVITY_LIST_MENU'; + + // Activities list context menu + public const CRM_ANALYTICS_MENU = 'CRM_ANALYTICS_MENU'; + + // CRM Analytics menu public const CRM_FUNNELS_TOOLBAR = 'CRM_FUNNELS_TOOLBAR'; + public const CRM_ANALYTICS_TOOLBAR = 'CRM_ANALYTICS_TOOLBAR'; - public const CRM_DEAL_LIST_TOOLBAR = 'CRM_DEAL_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu - public const CRM_LEAD_LIST_TOOLBAR = 'CRM_LEAD_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu - public const CRM_CONTACT_LIST_TOOLBAR = 'CRM_CONTACT_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu - public const CRM_COMPANY_LIST_TOOLBAR = 'CRM_COMPANY_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu - public const CRM_INVOICE_LIST_TOOLBAR = 'CRM_INVOICE_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu - public const CRM_QUOTE_LIST_TOOLBAR = 'CRM_QUOTE_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu - public const CRM_DEAL_DETAIL_TOOLBAR = 'CRM_DEAL_DETAIL_TOOLBAR'; // Button at the upper section of CRM details. - public const CRM_LEAD_DETAIL_TOOLBAR = 'CRM_LEAD_DETAIL_TOOLBAR'; // Button at the upper section of CRM details. - public const CRM_CONTACT_DETAIL_TOOLBAR = 'CRM_CONTACT_DETAIL_TOOLBAR'; // Button at the upper section of CRM details. - public const CRM_COMPANY_DETAIL_TOOLBAR = 'CRM_COMPANY_DETAIL_TOOLBAR'; // Button at the upper section of CRM details. - public const CRM_INVOICE_DETAIL_TOOLBAR = 'CRM_INVOICE_DETAIL_TOOLBAR'; // Button at the upper section of CRM details. - public const CRM_QUOTE_DETAIL_TOOLBAR = 'CRM_QUOTE_DETAIL_TOOLBAR'; // Button at the upper section of CRM details. - public const CRM_DEAL_ACTIVITY_TIMELINE_MENU = 'CRM_DEAL_ACTIVITY_TIMELINE_MENU'; // Button in the object context menu - public const CRM_LEAD_ACTIVITY_TIMELINE_MENU = 'CRM_LEAD_ACTIVITY_TIMELINE_MENU'; // Button in the object context menu - public const CRM_DEAL_DOCUMENTGENERATOR_BUTTON = 'CRM_DEAL_DOCUMENTGENERATOR_BUTTON'; // Button in documents. - public const CRM_LEAD_DOCUMENTGENERATOR_BUTTON = 'CRM_LEAD_DOCUMENTGENERATOR_BUTTON'; // Button in documents. - public const CRM_DEAL_ROBOT_DESIGNER_TOOLBAR = 'CRM_DEAL_ROBOT_DESIGNER_TOOLBAR'; // Option in cogwheel dropdown menu with automation rules + + public const CRM_DEAL_LIST_TOOLBAR = 'CRM_DEAL_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu + public const CRM_LEAD_LIST_TOOLBAR = 'CRM_LEAD_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu + public const CRM_CONTACT_LIST_TOOLBAR = 'CRM_CONTACT_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu + public const CRM_COMPANY_LIST_TOOLBAR = 'CRM_COMPANY_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu + public const CRM_INVOICE_LIST_TOOLBAR = 'CRM_INVOICE_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu + public const CRM_QUOTE_LIST_TOOLBAR = 'CRM_QUOTE_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu + public const CRM_DEAL_DETAIL_TOOLBAR = 'CRM_DEAL_DETAIL_TOOLBAR'; + + // Button at the upper section of CRM details. + public const CRM_LEAD_DETAIL_TOOLBAR = 'CRM_LEAD_DETAIL_TOOLBAR'; + + // Button at the upper section of CRM details. + public const CRM_CONTACT_DETAIL_TOOLBAR = 'CRM_CONTACT_DETAIL_TOOLBAR'; + + // Button at the upper section of CRM details. + public const CRM_COMPANY_DETAIL_TOOLBAR = 'CRM_COMPANY_DETAIL_TOOLBAR'; + + // Button at the upper section of CRM details. + public const CRM_INVOICE_DETAIL_TOOLBAR = 'CRM_INVOICE_DETAIL_TOOLBAR'; + + // Button at the upper section of CRM details. + public const CRM_QUOTE_DETAIL_TOOLBAR = 'CRM_QUOTE_DETAIL_TOOLBAR'; + + // Button at the upper section of CRM details. + public const CRM_DEAL_ACTIVITY_TIMELINE_MENU = 'CRM_DEAL_ACTIVITY_TIMELINE_MENU'; + + // Button in the object context menu + public const CRM_LEAD_ACTIVITY_TIMELINE_MENU = 'CRM_LEAD_ACTIVITY_TIMELINE_MENU'; + + // Button in the object context menu + public const CRM_DEAL_DOCUMENTGENERATOR_BUTTON = 'CRM_DEAL_DOCUMENTGENERATOR_BUTTON'; + + // Button in documents. + public const CRM_LEAD_DOCUMENTGENERATOR_BUTTON = 'CRM_LEAD_DOCUMENTGENERATOR_BUTTON'; + + // Button in documents. + public const CRM_DEAL_ROBOT_DESIGNER_TOOLBAR = 'CRM_DEAL_ROBOT_DESIGNER_TOOLBAR'; + + // Option in cogwheel dropdown menu with automation rules public const CRM_LEAD_ROBOT_DESIGNER_TOOLBAR = 'CRM_LEAD_ROBOT_DESIGNER_TOOLBAR'; // Option in cogwheel dropdown menu with automation rules - public const TASK_USER_LIST_TOOLBAR = 'TASK_USER_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu. You must pass user ID in placement_options. - public const TASK_GROUP_LIST_TOOLBAR = 'TASK_GROUP_LIST_TOOLBAR'; // Option in Automation Rules dropdown menu. You must pass workgroup ID in placement_options. - public const TASK_ROBOT_DESIGNER_TOOLBAR = 'TASK_ROBOT_DESIGNER_TOOLBAR'; // Option in cogwheel dropdown menu with automation rule. - public const SONET_GROUP_ROBOT_DESIGNER_TOOLBAR = 'SONET_GROUP_ROBOT_DESIGNER_TOOLBAR'; // Option in Automation Rules dropdown menu in workgroup. You must pass current workgroup ID in placement_options. - public const SONET_GROUP_TOOLBAR = 'SONET_GROUP_TOOLBAR'; // Option in Automation Rules dropdown menu inside workgroup. You must pass current workgroup ID in placement_options идентификатор текущей группы. - public const USER_PROFILE_MENU = 'USER_PROFILE_MENU'; // Option with dropdown selection in the upper Bitrix24 account main menu. You must pass current user ID in placement_options. - public const USER_PROFILE_TOOLBAR = 'USER_PROFILE_TOOLBAR'; // Option in dropdown menu inside user profile. You must pass current user ID in placement_options. + public const TASK_USER_LIST_TOOLBAR = 'TASK_USER_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu. You must pass user ID in placement_options. + public const TASK_GROUP_LIST_TOOLBAR = 'TASK_GROUP_LIST_TOOLBAR'; + + // Option in Automation Rules dropdown menu. You must pass workgroup ID in placement_options. + public const TASK_ROBOT_DESIGNER_TOOLBAR = 'TASK_ROBOT_DESIGNER_TOOLBAR'; + + // Option in cogwheel dropdown menu with automation rule. + public const SONET_GROUP_ROBOT_DESIGNER_TOOLBAR = 'SONET_GROUP_ROBOT_DESIGNER_TOOLBAR'; + + // Option in Automation Rules dropdown menu in workgroup. You must pass current workgroup ID in placement_options. + public const SONET_GROUP_TOOLBAR = 'SONET_GROUP_TOOLBAR'; + + // Option in Automation Rules dropdown menu inside workgroup. You must pass current workgroup ID in placement_options идентификатор текущей группы. + public const USER_PROFILE_MENU = 'USER_PROFILE_MENU'; + + // Option with dropdown selection in the upper Bitrix24 account main menu. You must pass current user ID in placement_options. + public const USER_PROFILE_TOOLBAR = 'USER_PROFILE_TOOLBAR'; + + // Option in dropdown menu inside user profile. You must pass current user ID in placement_options. public const CRM_SMART_INVOICE_LIST_TOOLBAR = 'CRM_SMART_INVOICE_LIST_TOOLBAR'; + public const CRM_SMART_INVOICE_DETAIL_TOOLBAR = 'CRM_SMART_INVOICE_DETAIL_TOOLBAR'; + public const CRM_SMART_INVOICE_ACTIVITY_TIMELINE_MENU = 'CRM_SMART_INVOICE_ACTIVITY_TIMELINE_MENU'; + public const CRM_SMART_INVOICE_FUNNELS_TOOLBAR = 'CRM_SMART_INVOICE_FUNNELS_TOOLBAR'; + public const CRM_SMART_INVOICE_ROBOT_DESIGNER_TOOLBAR = 'CRM_SMART_INVOICE_ROBOT_DESIGNER_TOOLBAR'; + public const CRM_SMART_INVOICE_DETAIL_TAB = 'CRM_SMART_INVOICE_DETAIL_TAB'; + public const CRM_SMART_INVOICE_LIST_MENU = 'CRM_SMART_INVOICE_LIST_MENU'; + public const CRM_SMART_INVOICE_DETAIL_ACTIVITY = 'CRM_SMART_INVOICE_DETAIL_ACTIVITY'; + public const CRM_CONTACT_DOCUMENTGENERATOR_BUTTON = 'CRM_CONTACT_DOCUMENTGENERATOR_BUTTON'; + public const CRM_COMPANY_DOCUMENTGENERATOR_BUTTON = 'CRM_COMPANY_DOCUMENTGENERATOR_BUTTON'; + public const CRM_INVOICE_DOCUMENTGENERATOR_BUTTON = 'CRM_INVOICE_DOCUMENTGENERATOR_BUTTON'; + public const CRM_QUOTE_DOCUMENTGENERATOR_BUTTON = 'CRM_QUOTE_DOCUMENTGENERATOR_BUTTON'; + public const CRM_SMART_INVOICE_DOCUMENTGENERATOR_BUTTON = 'CRM_SMART_INVOICE_DOCUMENTGENERATOR_BUTTON'; + public const CRM_REQUISITE_EDIT_FORM = 'CRM_REQUISITE_EDIT_FORM'; + public const MAIN_1C_PAGE = '1C_PAGE'; + public const CRM_DETAIL_SEARCH = 'CRM_DETAIL_SEARCH'; // ExternalLine scope - public const CALL_CARD = 'CALL_CARD'; // Call ID screen + public const CALL_CARD = 'CALL_CARD'; + + // Call ID screen public const TELEPHONY_ANALYTICS_MENU = 'TELEPHONY_ANALYTICS_MENU'; // Landing Scope - public const LANDING_SETTINGS = 'LANDING_SETTINGS'; // Settings menu (for Landing Page / Site) + public const LANDING_SETTINGS = 'LANDING_SETTINGS'; + + // Settings menu (for Landing Page / Site) public const LANDING_BLOCK = 'LANDING_BLOCK'; // Edit option for any block. // Workgroups scope public const SONET_GROUP_DETAIL_TAB = 'SONET_GROUP_DETAIL_TAB'; // Workgroup detail tab. // scope task - public const TASK_LIST_CONTEXT_MENU = 'TASK_LIST_CONTEXT_MENU'; // Task list context menu. - public const TASK_VIEW_TAB = 'TASK_VIEW_TAB'; // New tab when viewing task - public const TASK_VIEW_SIDEBAR = 'TASK_VIEW_SIDEBAR'; // New side bar when viewing task + public const TASK_LIST_CONTEXT_MENU = 'TASK_LIST_CONTEXT_MENU'; + + // Task list context menu. + public const TASK_VIEW_TAB = 'TASK_VIEW_TAB'; + + // New tab when viewing task + public const TASK_VIEW_SIDEBAR = 'TASK_VIEW_SIDEBAR'; + + // New side bar when viewing task public const TASK_VIEW_TOP_PANEL = 'TASK_VIEW_TOP_PANEL'; // Top panel when viewing task // Calendar scope @@ -115,31 +231,19 @@ class PlacementLocationCode // this URL receives a message with text and error code and the embedding itself is deleted. public const PAGE_BACKGROUND_WORKER = 'PAGE_BACKGROUND_WORKER'; - /** - * @param int $entityId - * - * @return string - */ + public function getForCrmDynamicListMenu(int $entityId): string { return sprintf('CRM_DYNAMIC_%s_LIST_MENU', $entityId); } - /** - * @param int $entityId - * - * @return string - */ + public function getForCrmDynamicDetailTab(int $entityId): string { return sprintf('CRM_DYNAMIC_%s_DETAIL_TAB', $entityId); } - /** - * @param int $entityId - * - * @return string - */ + public function getForCrmDynamicDetailActivity(int $entityId): string { return sprintf('CRM_DYNAMIC_%s_DETAIL_ACTIVITY', $entityId); diff --git a/src/Services/Placement/Service/UserFieldType.php b/src/Services/Placement/Service/UserFieldType.php index c37c8c2f..75d706a4 100644 --- a/src/Services/Placement/Service/UserFieldType.php +++ b/src/Services/Placement/Service/UserFieldType.php @@ -1,14 +1,28 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Placement\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Placement\Result\DeleteUserTypeResult; use Bitrix24\SDK\Services\Placement\Result\RegisterUserTypeResult; use Bitrix24\SDK\Services\Placement\Result\UserFieldTypesResult; - +#[ApiServiceMetadata(new Scope(['placement']))] class UserFieldType extends AbstractService { /** @@ -19,11 +33,15 @@ class UserFieldType extends AbstractService * @param string $title Type text name. Will be displayed in the admin interface of user field settings. * @param string $description Type text description. Will be displayed in the admin interface of user field settings. * - * @return \Bitrix24\SDK\Services\Placement\Result\RegisterUserTypeResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_add.php */ + #[ApiEndpointMetadata( + 'userfieldtype.add', + 'https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_add.php', + 'Registration of new type of user fields. This method returns true or an error with description.' + )] public function add(string $userTypeId, string $handlerUrl, string $title, string $description): RegisterUserTypeResult { return new RegisterUserTypeResult( @@ -42,11 +60,15 @@ public function add(string $userTypeId, string $handlerUrl, string $title, strin /** * Retrieves list of user field types, registrered by the application. List method. Results in the list of field types with page-by-page navigation. * - * @return UserFieldTypesResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_list.php */ + #[ApiEndpointMetadata( + 'userfieldtype.list', + 'https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_list.php', + 'Retrieves list of user field types, registrered by the application. List method. Results in the list of field types with page-by-page navigation.' + )] public function list(): UserFieldTypesResult { return new UserFieldTypesResult( @@ -62,11 +84,15 @@ public function list(): UserFieldTypesResult * @param string $title Type text name. Will be displayed in the admin interface of user field settings. * @param string $description Type text description. Will be displayed in the admin interface of user field settings. * - * @return \Bitrix24\SDK\Services\Placement\Result\RegisterUserTypeResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_update.php */ + #[ApiEndpointMetadata( + 'userfieldtype.update', + 'https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_update.php', + 'Modifies settings of user field types, registered by the application. This method returns true or an error with description.' + )] public function update(string $userTypeId, string $handlerUrl, string $title, string $description): RegisterUserTypeResult { return new RegisterUserTypeResult( @@ -87,11 +113,15 @@ public function update(string $userTypeId, string $handlerUrl, string $title, st * * @param string $userTypeId Inline code of the type. Required parameter. a-z0-9 * - * @return \Bitrix24\SDK\Services\Placement\Result\DeleteUserTypeResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException * @link https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_delete.php */ + #[ApiEndpointMetadata( + 'userfieldtype.delete', + 'https://training.bitrix24.com/rest_help/application_embedding/user_field/userfieldtype_delete.php', + 'Deletes user field type, registered by the application. This method returns true or an error with description.' + )] public function delete(string $userTypeId): DeleteUserTypeResult { return new DeleteUserTypeResult( diff --git a/src/Services/ServiceBuilder.php b/src/Services/ServiceBuilder.php index 8afda04e..8d646598 100644 --- a/src/Services/ServiceBuilder.php +++ b/src/Services/ServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services; diff --git a/src/Services/ServiceBuilderFactory.php b/src/Services/ServiceBuilderFactory.php index 3a19848c..dc44bac5 100644 --- a/src/Services/ServiceBuilderFactory.php +++ b/src/Services/ServiceBuilderFactory.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services; diff --git a/src/Services/Telephony/Call/Result/TranscriptAttachItemResult.php b/src/Services/Telephony/Call/Result/TranscriptAttachItemResult.php index ef5945ba..3b60c3aa 100644 --- a/src/Services/Telephony/Call/Result/TranscriptAttachItemResult.php +++ b/src/Services/Telephony/Call/Result/TranscriptAttachItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Call\Result; diff --git a/src/Services/Telephony/Call/Result/TranscriptAttachedResult.php b/src/Services/Telephony/Call/Result/TranscriptAttachedResult.php index 0bdf3ae0..4738bce6 100644 --- a/src/Services/Telephony/Call/Result/TranscriptAttachedResult.php +++ b/src/Services/Telephony/Call/Result/TranscriptAttachedResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Call\Result; diff --git a/src/Services/Telephony/Call/Service/Batch.php b/src/Services/Telephony/Call/Service/Batch.php index 970df4af..19b02264 100644 --- a/src/Services/Telephony/Call/Service/Batch.php +++ b/src/Services/Telephony/Call/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Call\Service; diff --git a/src/Services/Telephony/Call/Service/Call.php b/src/Services/Telephony/Call/Service/Call.php index 4ffa221e..206f4308 100644 --- a/src/Services/Telephony/Call/Service/Call.php +++ b/src/Services/Telephony/Call/Service/Call.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Call\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; @@ -13,7 +25,7 @@ use Bitrix24\SDK\Services\Telephony\Call\Service\Batch; use Money\Money; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class Call extends AbstractService { public function __construct( @@ -34,6 +46,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_call_attachtranscription.php */ + #[ApiEndpointMetadata( + 'telephony.call.attachTranscription', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_call_attachtranscription.php', + 'The method adds a call transcript.' + )] public function attachTranscription( string $callId, Money $money, diff --git a/src/Services/Telephony/Common/CallFailedCode.php b/src/Services/Telephony/Common/CallFailedCode.php index 328578a9..1d61285f 100644 --- a/src/Services/Telephony/Common/CallFailedCode.php +++ b/src/Services/Telephony/Common/CallFailedCode.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/CallType.php b/src/Services/Telephony/Common/CallType.php index 1ff4fe89..74c7e0fb 100644 --- a/src/Services/Telephony/Common/CallType.php +++ b/src/Services/Telephony/Common/CallType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/CrmEntity.php b/src/Services/Telephony/Common/CrmEntity.php index d8db3879..537522bc 100644 --- a/src/Services/Telephony/Common/CrmEntity.php +++ b/src/Services/Telephony/Common/CrmEntity.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/CrmEntityType.php b/src/Services/Telephony/Common/CrmEntityType.php index 529b06b6..4a34b6ff 100644 --- a/src/Services/Telephony/Common/CrmEntityType.php +++ b/src/Services/Telephony/Common/CrmEntityType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/PbxType.php b/src/Services/Telephony/Common/PbxType.php index e6e07e81..b3233003 100644 --- a/src/Services/Telephony/Common/PbxType.php +++ b/src/Services/Telephony/Common/PbxType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/SipRegistrationStatus.php b/src/Services/Telephony/Common/SipRegistrationStatus.php index 234475da..f4d10555 100644 --- a/src/Services/Telephony/Common/SipRegistrationStatus.php +++ b/src/Services/Telephony/Common/SipRegistrationStatus.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/TelephonyCallStatusCode.php b/src/Services/Telephony/Common/TelephonyCallStatusCode.php index d07bb2de..59aeb600 100644 --- a/src/Services/Telephony/Common/TelephonyCallStatusCode.php +++ b/src/Services/Telephony/Common/TelephonyCallStatusCode.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/TranscriptMessage.php b/src/Services/Telephony/Common/TranscriptMessage.php index 80ce22be..ca71ac97 100644 --- a/src/Services/Telephony/Common/TranscriptMessage.php +++ b/src/Services/Telephony/Common/TranscriptMessage.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Common/TranscriptMessageSide.php b/src/Services/Telephony/Common/TranscriptMessageSide.php index 9acd7a1a..529fffd8 100644 --- a/src/Services/Telephony/Common/TranscriptMessageSide.php +++ b/src/Services/Telephony/Common/TranscriptMessageSide.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Common; diff --git a/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStart.php b/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStart.php index 41ec1624..57e23965 100644 --- a/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStart.php +++ b/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStart.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnExternalCallBackStart; diff --git a/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStartEventPayload.php b/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStartEventPayload.php index c78653ee..4b36c9ed 100644 --- a/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStartEventPayload.php +++ b/src/Services/Telephony/Events/OnExternalCallBackStart/OnExternalCallBackStartEventPayload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnExternalCallBackStart; diff --git a/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStart.php b/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStart.php index d9ec396d..f6a450d6 100644 --- a/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStart.php +++ b/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStart.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnExternalCallStart; diff --git a/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStartEventPayload.php b/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStartEventPayload.php index 7a57d2af..5e747e4c 100644 --- a/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStartEventPayload.php +++ b/src/Services/Telephony/Events/OnExternalCallStart/OnExternalCallStartEventPayload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnExternalCallStart; diff --git a/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEnd.php b/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEnd.php index d277a1c9..0c8cc335 100644 --- a/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEnd.php +++ b/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEnd.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallEnd; diff --git a/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEndEventPayload.php b/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEndEventPayload.php index 6e8cd2fc..32f7dbd9 100644 --- a/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEndEventPayload.php +++ b/src/Services/Telephony/Events/OnVoximplantCallEnd/OnVoximplantCallEndEventPayload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallEnd; diff --git a/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInit.php b/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInit.php index f21a93fb..cc29ce27 100644 --- a/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInit.php +++ b/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInit.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallInit; diff --git a/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInitEventPayload.php b/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInitEventPayload.php index 057a66dc..f9aad78c 100644 --- a/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInitEventPayload.php +++ b/src/Services/Telephony/Events/OnVoximplantCallInit/OnVoximplantCallInitEventPayload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallInit; diff --git a/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStart.php b/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStart.php index 186aeecf..a78c3586 100644 --- a/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStart.php +++ b/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStart.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallStart; diff --git a/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStartEventPayload.php b/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStartEventPayload.php index e7b6ff44..c67036b4 100644 --- a/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStartEventPayload.php +++ b/src/Services/Telephony/Events/OnVoximplantCallStart/OnVoximplantCallStartEventPayload.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Events\OnVoximplantCallStart; diff --git a/src/Services/Telephony/Events/TelephonyEventsFabric.php b/src/Services/Telephony/Events/TelephonyEventsFabric.php index 6bfe978d..e19f2f44 100644 --- a/src/Services/Telephony/Events/TelephonyEventsFabric.php +++ b/src/Services/Telephony/Events/TelephonyEventsFabric.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedItemResult.php b/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedItemResult.php index 8abf0d14..9c516464 100644 --- a/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedItemResult.php +++ b/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedResult.php b/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedResult.php index 42d5cd02..ea448047 100644 --- a/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedResult.php +++ b/src/Services/Telephony/ExternalCall/Result/CallRecordFileUploadedResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlItemResult.php b/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlItemResult.php index ea4c35c3..1c6524de 100644 --- a/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlItemResult.php +++ b/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlResult.php b/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlResult.php index 7849b8a3..566385c6 100644 --- a/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlResult.php +++ b/src/Services/Telephony/ExternalCall/Result/CallRecordUploadUrlResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedItemResult.php b/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedItemResult.php index 72f4189a..64e0d5cf 100644 --- a/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedItemResult.php +++ b/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedResult.php b/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedResult.php index fcd8aa1c..b6baae82 100644 --- a/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedResult.php +++ b/src/Services/Telephony/ExternalCall/Result/ExternalCallFinishedResult.php @@ -1,5 +1,15 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredItemResult.php b/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredItemResult.php index 65deebb8..1bfb63c0 100644 --- a/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredItemResult.php +++ b/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredResult.php b/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredResult.php index b43696f1..72d84f7f 100644 --- a/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredResult.php +++ b/src/Services/Telephony/ExternalCall/Result/ExternalCallRegisteredResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesItemResult.php b/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesItemResult.php index 68401e49..ad65555d 100644 --- a/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesItemResult.php +++ b/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesResult.php b/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesResult.php index db2f1df5..8034e77e 100644 --- a/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesResult.php +++ b/src/Services/Telephony/ExternalCall/Result/SearchCrmEntitiesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Result/UserDigestItemResult.php b/src/Services/Telephony/ExternalCall/Result/UserDigestItemResult.php index 62585ca6..d74ff7b5 100644 --- a/src/Services/Telephony/ExternalCall/Result/UserDigestItemResult.php +++ b/src/Services/Telephony/ExternalCall/Result/UserDigestItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Result; diff --git a/src/Services/Telephony/ExternalCall/Service/Batch.php b/src/Services/Telephony/ExternalCall/Service/Batch.php index 111e4c9c..3e9a4956 100644 --- a/src/Services/Telephony/ExternalCall/Service/Batch.php +++ b/src/Services/Telephony/ExternalCall/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Service; diff --git a/src/Services/Telephony/ExternalCall/Service/ExternalCall.php b/src/Services/Telephony/ExternalCall/Service/ExternalCall.php index 64dedbfe..b7ca7d6d 100644 --- a/src/Services/Telephony/ExternalCall/Service/ExternalCall.php +++ b/src/Services/Telephony/ExternalCall/Service/ExternalCall.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalCall\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\FileNotFoundException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; @@ -24,6 +36,7 @@ use Money\Money; use Psr\Log\LoggerInterface; +#[ApiServiceMetadata(new Scope(['telephony']))] class ExternalCall extends AbstractService { public function __construct( @@ -47,6 +60,11 @@ public function __construct( * @throws FileNotFoundException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_attachRecord.php */ + #[ApiEndpointMetadata( + 'telephony.externalCall.attachRecord', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_attachRecord.php', + 'Get url for upload call record' + )] public function getCallRecordUploadUrl( string $callId, string $callRecordFileName, @@ -70,6 +88,11 @@ public function getCallRecordUploadUrl( * @throws FileNotFoundException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_attachRecord.php */ + #[ApiEndpointMetadata( + 'telephony.externalCall.attachRecord', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_attachRecord.php', + 'This method connects a record to a finished call and to the call Activity.' + )] public function attachCallRecordInBase64( string $callId, string $callRecordFileName, @@ -125,6 +148,11 @@ public function attachCallRecordInBase64( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_register.php */ + #[ApiEndpointMetadata( + 'telephony.externalcall.register', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_register.php', + 'Method registers a call in Bitrix24. For this purpose, it searches an object that corresponds to the number in CRM.' + )] public function register( string $userInnerPhoneNumber, int $b24UserId, @@ -184,6 +212,11 @@ public function register( * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'telephony.externalCall.searchCrmEntities', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalCall_searchCrmEntities.php', + 'This method allows to retrieve information about a client from CRM by a telephone number via single request.' + )] public function searchCrmEntities(string $phoneNumber): SearchCrmEntitiesResult { return new SearchCrmEntitiesResult($this->core->call('telephony.externalCall.searchCrmEntities', @@ -203,6 +236,11 @@ public function searchCrmEntities(string $phoneNumber): SearchCrmEntitiesResult * @throws TransportException * @see https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_finish.php */ + #[ApiEndpointMetadata( + 'telephony.externalcall.finish', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_finish.php', + 'This method allows to retrieve information about a client from CRM by a telephone number via single request.' + )] public function finishForUserPhoneInner( string $callId, string $userInnerPhoneNumber, @@ -239,6 +277,11 @@ public function finishForUserPhoneInner( * @throws TransportException * @see https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_finish.php */ + #[ApiEndpointMetadata( + 'telephony.externalcall.finish', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_finish.php', + 'This method allows to retrieve information about a client from CRM by a telephone number via single request.' + )] public function finishForUserId( string $callId, int $b24UserId, @@ -273,6 +316,11 @@ public function finishForUserId( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_show.php */ + #[ApiEndpointMetadata( + 'telephony.externalcall.show', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_show.php', + 'The method displays a call ID screen to the user.' + )] public function show(string $callId, array $b24UserId): UserInterfaceDialogCallResult { return new UserInterfaceDialogCallResult($this->core->call('telephony.externalcall.show', @@ -291,6 +339,11 @@ public function show(string $callId, array $b24UserId): UserInterfaceDialogCallR * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_hide.php */ + #[ApiEndpointMetadata( + 'telephony.externalcall.hide', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalcall_hide.php', + ' This method hides call information window.' + )] public function hide(string $callId, array $b24UserId): UserInterfaceDialogCallResult { return new UserInterfaceDialogCallResult($this->core->call('telephony.externalcall.hide', diff --git a/src/Services/Telephony/ExternalLine/Result/ExternalLineAddItemResult.php b/src/Services/Telephony/ExternalLine/Result/ExternalLineAddItemResult.php index 87cbbf75..34cfe9d8 100644 --- a/src/Services/Telephony/ExternalLine/Result/ExternalLineAddItemResult.php +++ b/src/Services/Telephony/ExternalLine/Result/ExternalLineAddItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalLine\Result; diff --git a/src/Services/Telephony/ExternalLine/Result/ExternalLineAddedResult.php b/src/Services/Telephony/ExternalLine/Result/ExternalLineAddedResult.php index f9fbf926..08755af2 100644 --- a/src/Services/Telephony/ExternalLine/Result/ExternalLineAddedResult.php +++ b/src/Services/Telephony/ExternalLine/Result/ExternalLineAddedResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalLine\Result; diff --git a/src/Services/Telephony/ExternalLine/Result/ExternalLineItemResult.php b/src/Services/Telephony/ExternalLine/Result/ExternalLineItemResult.php index ae13aa3d..24f3e585 100644 --- a/src/Services/Telephony/ExternalLine/Result/ExternalLineItemResult.php +++ b/src/Services/Telephony/ExternalLine/Result/ExternalLineItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalLine\Result; diff --git a/src/Services/Telephony/ExternalLine/Result/ExternalLinesResult.php b/src/Services/Telephony/ExternalLine/Result/ExternalLinesResult.php index 97599289..24620127 100644 --- a/src/Services/Telephony/ExternalLine/Result/ExternalLinesResult.php +++ b/src/Services/Telephony/ExternalLine/Result/ExternalLinesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalLine\Result; diff --git a/src/Services/Telephony/ExternalLine/Service/Batch.php b/src/Services/Telephony/ExternalLine/Service/Batch.php index 2bf29666..7f747eed 100644 --- a/src/Services/Telephony/ExternalLine/Service/Batch.php +++ b/src/Services/Telephony/ExternalLine/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalLine\Service; diff --git a/src/Services/Telephony/ExternalLine/Service/ExternalLine.php b/src/Services/Telephony/ExternalLine/Service/ExternalLine.php index 969aaa92..1156b3e9 100644 --- a/src/Services/Telephony/ExternalLine/Service/ExternalLine.php +++ b/src/Services/Telephony/ExternalLine/Service/ExternalLine.php @@ -1,19 +1,30 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\ExternalLine\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\EmptyResult; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Telephony\ExternalLine\Result\ExternalLineAddedResult; use Bitrix24\SDK\Services\Telephony\ExternalLine\Result\ExternalLinesResult; -use Bitrix24\SDK\Services\Telephony\ExternalLine\Service\Batch; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class ExternalLine extends AbstractService { public function __construct( @@ -36,6 +47,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_add.php */ + #[ApiEndpointMetadata( + 'telephony.externalLine.add', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_add.php', + 'Method adds an external line' + )] public function add(string $lineNumber, bool $isAutoCreateCrmEntities = true, ?string $lineName = null): ExternalLineAddedResult { return new ExternalLineAddedResult($this->core->call('telephony.externalLine.add', [ @@ -52,6 +68,11 @@ public function add(string $lineNumber, bool $isAutoCreateCrmEntities = true, ?s * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_delete.php */ + #[ApiEndpointMetadata( + 'telephony.externalLine.delete', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_delete.php', + 'Method for deleting an external line.' + )] public function delete(string $lineNumber): EmptyResult { return new EmptyResult($this->core->call('telephony.externalLine.delete', [ @@ -66,6 +87,11 @@ public function delete(string $lineNumber): EmptyResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_get.php */ + #[ApiEndpointMetadata( + 'telephony.externalLine.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/telephony/telephony_externalLine_delete.php', + 'Method allows to retrieve the list of external lines of an application.' + )] public function get(): ExternalLinesResult { return new ExternalLinesResult($this->core->call('telephony.externalLine.get')); diff --git a/src/Services/Telephony/TelephonyServiceBuilder.php b/src/Services/Telephony/TelephonyServiceBuilder.php index c5b79457..6d872b31 100644 --- a/src/Services/Telephony/TelephonyServiceBuilder.php +++ b/src/Services/Telephony/TelephonyServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony; diff --git a/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallItemResult.php b/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallItemResult.php index 6ca811c2..44105010 100644 --- a/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallItemResult.php +++ b/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Result; diff --git a/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallResult.php b/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallResult.php index 2dd9a86e..f84fe59e 100644 --- a/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallResult.php +++ b/src/Services/Telephony/Voximplant/InfoCall/Result/VoximplantInfoCallResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Result; diff --git a/src/Services/Telephony/Voximplant/InfoCall/Service/Batch.php b/src/Services/Telephony/Voximplant/InfoCall/Service/Batch.php index 54f1bf39..40f1dec5 100644 --- a/src/Services/Telephony/Voximplant/InfoCall/Service/Batch.php +++ b/src/Services/Telephony/Voximplant/InfoCall/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Service; diff --git a/src/Services/Telephony/Voximplant/InfoCall/Service/InfoCall.php b/src/Services/Telephony/Voximplant/InfoCall/Service/InfoCall.php index 47cc133b..74a0e9a4 100644 --- a/src/Services/Telephony/Voximplant/InfoCall/Service/InfoCall.php +++ b/src/Services/Telephony/Voximplant/InfoCall/Service/InfoCall.php @@ -1,17 +1,29 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Telephony\Voximplant\InfoCall\Result\VoximplantInfoCallResult; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class InfoCall extends AbstractService { public function __construct( @@ -36,6 +48,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_infocall_startwithtext.php */ + #[ApiEndpointMetadata( + 'voximplant.infocall.startwithtext', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_infocall_startwithtext.php', + 'method performs the call to the specified number with automatic voiceover of specified text' + )] public function startWithText(string $lineId, string $toNumber, string $text, ?string $voiceCode = null): VoximplantInfoCallResult { return new VoximplantInfoCallResult($this->core->call('voximplant.infocall.startwithtext', [ @@ -46,6 +63,11 @@ public function startWithText(string $lineId, string $toNumber, string $text, ?s ])); } + #[ApiEndpointMetadata( + 'voximplant.infocall.startwithsound', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_infocall_startwithsound.php', + 'Makes a call to the specified number with playback of .mp3 format file by URL.' + )] public function startWithSound(string $lineId, string $toNumber, string $recordUrl): VoximplantInfoCallResult { return new VoximplantInfoCallResult($this->core->call('voximplant.infocall.startwithsound', [ diff --git a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdItemResult.php b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdItemResult.php index ddbdffec..1f7b6172 100644 --- a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdItemResult.php +++ b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result; diff --git a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdResult.php b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdResult.php index deccd1db..517e334c 100644 --- a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdResult.php +++ b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineIdResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result; diff --git a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineItemResult.php b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineItemResult.php index 616591df..acd04a4d 100644 --- a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineItemResult.php +++ b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLineItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result; diff --git a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLinesResult.php b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLinesResult.php index b2fcc19c..3069b32e 100644 --- a/src/Services/Telephony/Voximplant/Line/Result/VoximplantLinesResult.php +++ b/src/Services/Telephony/Voximplant/Line/Result/VoximplantLinesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/Telephony/Voximplant/Line/Service/Batch.php b/src/Services/Telephony/Voximplant/Line/Service/Batch.php index 44e54e41..ddc7759b 100644 --- a/src/Services/Telephony/Voximplant/Line/Service/Batch.php +++ b/src/Services/Telephony/Voximplant/Line/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Line\Service; diff --git a/src/Services/Telephony/Voximplant/Line/Service/Line.php b/src/Services/Telephony/Voximplant/Line/Service/Line.php index 472dd8df..e4e9ee20 100644 --- a/src/Services/Telephony/Voximplant/Line/Service/Line.php +++ b/src/Services/Telephony/Voximplant/Line/Service/Line.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Line\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult; @@ -12,7 +24,7 @@ use Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result\VoximplantLineIdResult; use Bitrix24\SDK\Services\Telephony\Voximplant\Line\Result\VoximplantLinesResult; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class Line extends AbstractService { public function __construct( @@ -30,6 +42,11 @@ public function __construct( * This method is available to the user with granted access permissions for Manage numbers - Edit - Any. * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_sip_set.php */ + #[ApiEndpointMetadata( + 'voximplant.line.outgoing.sip.set', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_sip_set.php', + 'Sets the selected SIP line as an outgoing line by default.' + )] public function outgoingSipSet(int $sipLineId): UserInterfaceDialogCallResult { return new UserInterfaceDialogCallResult($this->core->call('voximplant.line.outgoing.sip.set', [ @@ -42,6 +59,11 @@ public function outgoingSipSet(int $sipLineId): UserInterfaceDialogCallResult * * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_get.php */ + #[ApiEndpointMetadata( + 'voximplant.line.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_get.php', + 'Returns list of all of the available outgoing lines.' + )] public function get(): VoximplantLinesResult { return new VoximplantLinesResult($this->core->call('voximplant.line.get')); @@ -54,6 +76,11 @@ public function get(): VoximplantLinesResult * * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_get.php */ + #[ApiEndpointMetadata( + 'voximplant.line.outgoing.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_get.php', + 'Returns the currently selected line as an outgoing line by default.' + )] public function outgoingGet(): VoximplantLineIdResult { return new VoximplantLineIdResult($this->core->call('voximplant.line.outgoing.get')); @@ -68,6 +95,11 @@ public function outgoingGet(): VoximplantLineIdResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'voximplant.line.outgoing.set', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_line_outgoing_set.php', + 'Sets the selected line as an outgoing line by default.' + )] public function outgoingSet(string $lineId): UserInterfaceDialogCallResult { return new UserInterfaceDialogCallResult($this->core->call('voximplant.line.outgoing.set', [ diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusItemResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusItemResult.php index 9d13191e..3a8c330a 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusItemResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result; diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusResult.php index e6a521c3..1df8ce4f 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipConnectorStatusResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result; diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipLineAddedResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipLineAddedResult.php index 2701cb83..3df894d0 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipLineAddedResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipLineAddedResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result; diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipLineItemResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipLineItemResult.php index 117e3e41..3ee86ada 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipLineItemResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipLineItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result; diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusItemResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusItemResult.php index 79f21f9f..3480d135 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusItemResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result; diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusResult.php index 3fd1dab0..94078b3d 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipLineStatusResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result; diff --git a/src/Services/Telephony/Voximplant/Sip/Result/SipLinesResult.php b/src/Services/Telephony/Voximplant/Sip/Result/SipLinesResult.php index 4ff7bfce..1abba0d0 100644 --- a/src/Services/Telephony/Voximplant/Sip/Result/SipLinesResult.php +++ b/src/Services/Telephony/Voximplant/Sip/Result/SipLinesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/Telephony/Voximplant/Sip/Service/Batch.php b/src/Services/Telephony/Voximplant/Sip/Service/Batch.php index 2a458e34..860cb617 100644 --- a/src/Services/Telephony/Voximplant/Sip/Service/Batch.php +++ b/src/Services/Telephony/Voximplant/Sip/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service; diff --git a/src/Services/Telephony/Voximplant/Sip/Service/Sip.php b/src/Services/Telephony/Voximplant/Sip/Service/Sip.php index 09c91902..600bb347 100644 --- a/src/Services/Telephony/Voximplant/Sip/Service/Sip.php +++ b/src/Services/Telephony/Voximplant/Sip/Service/Sip.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; @@ -17,7 +29,7 @@ use Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLinesResult; use Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLineStatusResult; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class Sip extends AbstractService { public function __construct( @@ -37,6 +49,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_connector_status.php */ + #[ApiEndpointMetadata( + 'voximplant.sip.connector.status', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_connector_status.php', + 'Returns the current status of the SIP Connector.' + )] public function getConnectorStatus(): SipConnectorStatusResult { return new SipConnectorStatusResult($this->core->call('voximplant.sip.connector.status')); @@ -49,6 +66,11 @@ public function getConnectorStatus(): SipConnectorStatusResult * * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_add.php */ + #[ApiEndpointMetadata( + 'voximplant.sip.add', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_add.php', + 'Сreates a new SIP line linked to the application. Once created, this line becomes an outbound line by default.' + )] public function add( PbxType $pbxType, string $title, @@ -75,6 +97,11 @@ public function add( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_delete.php */ + #[ApiEndpointMetadata( + 'voximplant.sip.delete', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_delete.php', + 'Deletes the current SIP line (created by the application).' + )] public function delete(int $sipConfigId): DeletedItemResult { return new DeletedItemResult($this->core->call('voximplant.sip.delete', [ @@ -90,6 +117,11 @@ public function delete(int $sipConfigId): DeletedItemResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_get.php */ + #[ApiEndpointMetadata( + 'voximplant.sip.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_get.php', + 'Returns the list of all SIP lines created by the application. It is a list method.' + )] public function get(): SipLinesResult { return new SipLinesResult($this->core->call('voximplant.sip.get')); @@ -105,6 +137,11 @@ public function get(): SipLinesResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'voximplant.sip.status', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_status.php', + 'Returns the current status of the SIP registration (for cloud hosted PBX only).' + )] public function status(int $sipRegistrationId): SipLineStatusResult { return new SipLineStatusResult($this->core->call('voximplant.sip.status', [ @@ -120,6 +157,11 @@ public function status(int $sipRegistrationId): SipLineStatusResult * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_update.php * @throws InvalidArgumentException */ + #[ApiEndpointMetadata( + 'voximplant.sip.update', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_sip_update.php', + 'Updates the existing SIP line (created by the application).' + )] public function update(int $sipConfigId, PbxType $pbxType, ?string $title = null, diff --git a/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoiceItemResult.php b/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoiceItemResult.php index 1e249e33..acd636d3 100644 --- a/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoiceItemResult.php +++ b/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoiceItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\TTS\Voices\Result; diff --git a/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoicesResult.php b/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoicesResult.php index fb0b4a5c..b0c7beed 100644 --- a/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoicesResult.php +++ b/src/Services/Telephony/Voximplant/TTS/Voices/Result/VoximplantVoicesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/Telephony/Voximplant/TTS/Voices/Service/Batch.php b/src/Services/Telephony/Voximplant/TTS/Voices/Service/Batch.php index cc6cea9a..b08b5f89 100644 --- a/src/Services/Telephony/Voximplant/TTS/Voices/Service/Batch.php +++ b/src/Services/Telephony/Voximplant/TTS/Voices/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\TTS\Voices\Service; diff --git a/src/Services/Telephony/Voximplant/TTS/Voices/Service/Voices.php b/src/Services/Telephony/Voximplant/TTS/Voices/Service/Voices.php index a322299f..6428f39a 100644 --- a/src/Services/Telephony/Voximplant/TTS/Voices/Service/Voices.php +++ b/src/Services/Telephony/Voximplant/TTS/Voices/Service/Voices.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\TTS\Voices\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; @@ -12,6 +24,7 @@ use Bitrix24\SDK\Services\Telephony\Voximplant\TTS\Voices\Result\VoximplantVoicesResult; use Psr\Log\LoggerInterface; +#[ApiServiceMetadata(new Scope(['telephony']))] class Voices extends AbstractService { public function __construct( @@ -31,6 +44,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_tts_voices.get.php */ + #[ApiEndpointMetadata( + 'voximplant.tts.voices.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_tts_voices.get.php', + 'Returns an array of available voices for generation of speech in the format of voice ID => voice name.' + )] public function get(): VoximplantVoicesResult { return new VoximplantVoicesResult($this->core->call('voximplant.tts.voices.get')); diff --git a/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesItemResult.php b/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesItemResult.php index 67eab9fa..54e75210 100644 --- a/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesItemResult.php +++ b/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Url\Result; diff --git a/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesResult.php b/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesResult.php index cb1eea78..48ba7581 100644 --- a/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesResult.php +++ b/src/Services/Telephony/Voximplant/Url/Result/VoximplantPagesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Url\Result; diff --git a/src/Services/Telephony/Voximplant/Url/Service/Batch.php b/src/Services/Telephony/Voximplant/Url/Service/Batch.php index 1f5e6b7b..362fcd67 100644 --- a/src/Services/Telephony/Voximplant/Url/Service/Batch.php +++ b/src/Services/Telephony/Voximplant/Url/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Url\Service; diff --git a/src/Services/Telephony/Voximplant/Url/Service/Url.php b/src/Services/Telephony/Voximplant/Url/Service/Url.php index 1a5e8c06..0e43112a 100644 --- a/src/Services/Telephony/Voximplant/Url/Service/Url.php +++ b/src/Services/Telephony/Voximplant/Url/Service/Url.php @@ -1,16 +1,28 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\Url\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Telephony\Voximplant\Url\Result\VoximplantPagesResult; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class Url extends AbstractService { public function __construct( @@ -30,6 +42,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_url_get.php */ + #[ApiEndpointMetadata( + 'voximplant.url.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_url_get.php', + 'Returns a set of links for browsing telephony scope pages.' + )] public function get(): VoximplantPagesResult { return new VoximplantPagesResult($this->core->call('voximplant.url.get')); diff --git a/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsItemResult.php b/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsItemResult.php index fa7007a0..e55eece5 100644 --- a/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsItemResult.php +++ b/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\User\Result; diff --git a/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsResult.php b/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsResult.php index f5eeaa8e..e992d305 100644 --- a/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsResult.php +++ b/src/Services/Telephony/Voximplant/User/Result/VoximplantUserSettingsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\User\Result; diff --git a/src/Services/Telephony/Voximplant/User/Service/Batch.php b/src/Services/Telephony/Voximplant/User/Service/Batch.php index aab41d26..90593a2c 100644 --- a/src/Services/Telephony/Voximplant/User/Service/Batch.php +++ b/src/Services/Telephony/Voximplant/User/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\User\Service; diff --git a/src/Services/Telephony/Voximplant/User/Service/User.php b/src/Services/Telephony/Voximplant/User/Service/User.php index d77bdd1c..cc59ccd8 100644 --- a/src/Services/Telephony/Voximplant/User/Service/User.php +++ b/src/Services/Telephony/Voximplant/User/Service/User.php @@ -1,28 +1,29 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant\User\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; -use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; -use Bitrix24\SDK\Core\Result\DeletedItemResult; -use Bitrix24\SDK\Core\Result\EmptyResult; -use Bitrix24\SDK\Core\Result\UpdatedItemResult; use Bitrix24\SDK\Core\Result\UserInterfaceDialogCallResult; use Bitrix24\SDK\Services\AbstractService; -use Bitrix24\SDK\Services\Telephony\Common\PbxType; -use Bitrix24\SDK\Services\Telephony\ExternalLine\Result\ExternalLineAddedResult; -use Bitrix24\SDK\Services\Telephony\ExternalLine\Result\ExternalLinesResult; -use Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLineAddedResult; -use Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLinesResult; -use Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLineStatusItemResult; -use Bitrix24\SDK\Services\Telephony\Voximplant\Sip\Result\SipLineStatusResult; use Bitrix24\SDK\Services\Telephony\Voximplant\User\Result\VoximplantUserSettingsResult; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['telephony']))] class User extends AbstractService { public function __construct( @@ -43,6 +44,11 @@ public function __construct( * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_deactivatePhone.php */ + #[ApiEndpointMetadata( + 'voximplant.user.deactivatePhone', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_deactivatePhone.php', + 'This method disables an indicator of SIP-phone availability. Method checks the availability of the access permissions to modify users.' + )] public function deactivatePhone(int $userId): UserInterfaceDialogCallResult { return new UserInterfaceDialogCallResult($this->core->call('voximplant.user.deactivatePhone', [ @@ -59,6 +65,11 @@ public function deactivatePhone(int $userId): UserInterfaceDialogCallResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_activatePhone.php */ + #[ApiEndpointMetadata( + 'voximplant.user.activatePhone', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_activatePhone.php', + 'This method raises the event of SIP-phone availability for an employee. Method checks the availability of the access permissions to modify users.' + )] public function activatePhone(int $userId): UserInterfaceDialogCallResult { return new UserInterfaceDialogCallResult($this->core->call('voximplant.user.activatePhone', [ @@ -76,6 +87,11 @@ public function activatePhone(int $userId): UserInterfaceDialogCallResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_get.php */ + #[ApiEndpointMetadata( + 'voximplant.user.get', + 'https://training.bitrix24.com/rest_help/scope_telephony/voximplant/voximplant_user_get.php', + 'This method returns user settings.' + )] public function get(array $userIds): VoximplantUserSettingsResult { return new VoximplantUserSettingsResult($this->core->call('voximplant.user.get', diff --git a/src/Services/Telephony/Voximplant/VoximplantServiceBuilder.php b/src/Services/Telephony/Voximplant/VoximplantServiceBuilder.php index 99215854..1bb65ad9 100644 --- a/src/Services/Telephony/Voximplant/VoximplantServiceBuilder.php +++ b/src/Services/Telephony/Voximplant/VoximplantServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Telephony\Voximplant; diff --git a/src/Services/User/Result/UserItemResult.php b/src/Services/User/Result/UserItemResult.php index de8b597e..bd4061c9 100644 --- a/src/Services/User/Result/UserItemResult.php +++ b/src/Services/User/Result/UserItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\User\Result; diff --git a/src/Services/User/Result/UserResult.php b/src/Services/User/Result/UserResult.php index 01e0ee4b..928a6697 100644 --- a/src/Services/User/Result/UserResult.php +++ b/src/Services/User/Result/UserResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/User/Result/UsersResult.php b/src/Services/User/Result/UsersResult.php index a4fff780..94881973 100644 --- a/src/Services/User/Result/UsersResult.php +++ b/src/Services/User/Result/UsersResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/User/Service/User.php b/src/Services/User/Service/User.php index 1590a7db..13c55978 100644 --- a/src/Services/User/Service/User.php +++ b/src/Services/User/Service/User.php @@ -1,9 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\User\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; @@ -14,6 +26,7 @@ use Bitrix24\SDK\Services\User\Result\UserResult; use Bitrix24\SDK\Services\User\Result\UsersResult; +#[ApiServiceMetadata(new Scope(['user']))] class User extends AbstractService { /** @@ -22,6 +35,11 @@ class User extends AbstractService * @throws TransportException * @link https://training.bitrix24.com/rest_help/users/user_fields.php */ + #[ApiEndpointMetadata( + 'user.fields', + 'https://training.bitrix24.com/rest_help/users/user_fields.php', + 'Get user entity fields' + )] public function fields(): FieldsResult { return new FieldsResult($this->core->call('user.fields')); @@ -33,6 +51,11 @@ public function fields(): FieldsResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/users/user_current.php */ + #[ApiEndpointMetadata( + 'user.current', + 'https://training.bitrix24.com/rest_help/users/user_current.php', + 'Get current user' + )] public function current(): UserResult { return new UserResult($this->core->call('user.current')); @@ -46,6 +69,11 @@ public function current(): UserResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/users/user_add.php */ + #[ApiEndpointMetadata( + 'user.add', + 'https://training.bitrix24.com/rest_help/users/user_add.php', + 'Invites a user. Available only for users with invitation permissions, usually an administrator. Sends a standard account invitation to the user on success.' + )] public function add(array $fields, string $messageText = ''): AddedItemResult { if (!array_key_exists('EXTRANET', $fields)) { @@ -68,6 +96,11 @@ public function add(array $fields, string $messageText = ''): AddedItemResult * @throws BaseException * @throws TransportException */ + #[ApiEndpointMetadata( + 'user.get', + 'https://training.bitrix24.com/rest_help/users/user_get.php', + 'Get user by id' + )] public function get(array $order, array $filter, bool $isAdminMode = false): UsersResult { if ($order === []) { @@ -88,6 +121,11 @@ public function get(array $order, array $filter, bool $isAdminMode = false): Use * @throws TransportException * @link https://training.bitrix24.com/rest_help/users/user_update.php */ + #[ApiEndpointMetadata( + 'user.update', + 'https://training.bitrix24.com/rest_help/users/user_get.php', + 'Updates user information. Available only for users with invitation permissions.' + )] public function update(int $userId, array $fields): UpdatedItemResult { return new UpdatedItemResult($this->core->call('user.update', array_merge( @@ -105,6 +143,11 @@ public function update(int $userId, array $fields): UpdatedItemResult * @throws TransportException * @link https://training.bitrix24.com/rest_help/users/user_search.php */ + #[ApiEndpointMetadata( + 'user.search', + 'https://training.bitrix24.com/rest_help/users/user_search.php', + 'This method is used to retrieve list of users with expedited personal data search.' + )] public function search(array $filterFields): UsersResult { return new UsersResult($this->core->call('user.search', $filterFields)); diff --git a/src/Services/User/UserServiceBuilder.php b/src/Services/User/UserServiceBuilder.php index 7b69235d..aee42ca8 100644 --- a/src/Services/User/UserServiceBuilder.php +++ b/src/Services/User/UserServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\User; diff --git a/src/Services/UserConsent/Result/UserConsentAgreementItemResult.php b/src/Services/UserConsent/Result/UserConsentAgreementItemResult.php index 90147522..cc802d3c 100644 --- a/src/Services/UserConsent/Result/UserConsentAgreementItemResult.php +++ b/src/Services/UserConsent/Result/UserConsentAgreementItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\UserConsent\Result; diff --git a/src/Services/UserConsent/Result/UserConsentAgreementResult.php b/src/Services/UserConsent/Result/UserConsentAgreementResult.php index 9738998c..2763d672 100644 --- a/src/Services/UserConsent/Result/UserConsentAgreementResult.php +++ b/src/Services/UserConsent/Result/UserConsentAgreementResult.php @@ -1,17 +1,26 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\UserConsent\Result; +use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AbstractResult; class UserConsentAgreementResult extends AbstractResult { /** - * @return \Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @throws BaseException */ public function agreement(): UserConsentAgreementItemResult { diff --git a/src/Services/UserConsent/Result/UserConsentAgreementTextItemResult.php b/src/Services/UserConsent/Result/UserConsentAgreementTextItemResult.php index 099efd59..7778443b 100644 --- a/src/Services/UserConsent/Result/UserConsentAgreementTextItemResult.php +++ b/src/Services/UserConsent/Result/UserConsentAgreementTextItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\UserConsent\Result; diff --git a/src/Services/UserConsent/Result/UserConsentAgreementTextResult.php b/src/Services/UserConsent/Result/UserConsentAgreementTextResult.php index 591c16d5..647b8e21 100644 --- a/src/Services/UserConsent/Result/UserConsentAgreementTextResult.php +++ b/src/Services/UserConsent/Result/UserConsentAgreementTextResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); @@ -10,7 +19,6 @@ class UserConsentAgreementTextResult extends AbstractResult { /** - * @return \Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementTextItemResult * @throws \Bitrix24\SDK\Core\Exceptions\BaseException */ public function text(): UserConsentAgreementTextItemResult diff --git a/src/Services/UserConsent/Result/UserConsentAgreementsResult.php b/src/Services/UserConsent/Result/UserConsentAgreementsResult.php index 0992ef0d..be4ce952 100644 --- a/src/Services/UserConsent/Result/UserConsentAgreementsResult.php +++ b/src/Services/UserConsent/Result/UserConsentAgreementsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); diff --git a/src/Services/UserConsent/Service/UserConsent.php b/src/Services/UserConsent/Service/UserConsent.php index 05fc9896..95eac67d 100644 --- a/src/Services/UserConsent/Service/UserConsent.php +++ b/src/Services/UserConsent/Service/UserConsent.php @@ -1,12 +1,26 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\UserConsent\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Core\Result\AddedItemResult; use Bitrix24\SDK\Services\AbstractService; - +#[ApiServiceMetadata(new Scope(['userconsent']))] class UserConsent extends AbstractService { /** @@ -14,12 +28,15 @@ class UserConsent extends AbstractService * * @see https://training.bitrix24.com/rest_help/userconsent/userconsent_consent_add.php * - * @param array $consentFields * - * @return AddedItemResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'userconsent.consent.add', + 'https://training.bitrix24.com/rest_help/userconsent/userconsent_consent_add.php', + 'Add the received user agreement consent' + )] public function add(array $consentFields): AddedItemResult { return new AddedItemResult($this->core->call('userconsent.consent.add', $consentFields)); diff --git a/src/Services/UserConsent/Service/UserConsentAgreement.php b/src/Services/UserConsent/Service/UserConsentAgreement.php index d5418d19..b4c97b81 100644 --- a/src/Services/UserConsent/Service/UserConsentAgreement.php +++ b/src/Services/UserConsent/Service/UserConsentAgreement.php @@ -1,38 +1,62 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\UserConsent\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; +use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementsResult; use Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementTextResult; - +#[ApiServiceMetadata(new Scope(['userconsent']))] class UserConsentAgreement extends AbstractService { /** * Get user consent agreement list * - * @return \Bitrix24\SDK\Services\UserConsent\Result\UserConsentAgreementsResult - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[ApiEndpointMetadata( + 'userconsent.agreement.list', + 'https://training.bitrix24.com/rest_help/userconsent/userconsent_consent_add.php', + 'Add the received user agreement consent' + )] public function list(): UserConsentAgreementsResult { return new UserConsentAgreementsResult($this->core->call('userconsent.agreement.list')); } /** - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException - * @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException + * @throws TransportException + * @throws InvalidArgumentException + * @throws BaseException */ + #[ApiEndpointMetadata( + 'userconsent.agreement.text', + 'https://training.bitrix24.com/rest_help/userconsent/userconsent_agreement_text.php', + 'This method gets the agreement text' + )] public function text(int $agreementId, array $replace): UserConsentAgreementTextResult { if (!array_key_exists('button_caption', $replace)) { throw new InvalidArgumentException('field «button_caption» not found in argument replace '); } + if (!array_key_exists('fields', $replace)) { throw new InvalidArgumentException('field «fields» not found in argument replace'); } diff --git a/src/Services/UserConsent/UserConsentServiceBuilder.php b/src/Services/UserConsent/UserConsentServiceBuilder.php index 509966d0..fa6cb423 100644 --- a/src/Services/UserConsent/UserConsentServiceBuilder.php +++ b/src/Services/UserConsent/UserConsentServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\UserConsent; @@ -12,8 +21,6 @@ class UserConsentServiceBuilder extends AbstractServiceBuilder { /** * get user consent agreement service - * - * @return UserConsentAgreement */ public function UserConsentAgreement(): UserConsentAgreement { @@ -26,8 +33,6 @@ public function UserConsentAgreement(): UserConsentAgreement /** * get user consent service - * - * @return UserConsent */ public function UserConsent(): UserConsent { diff --git a/src/Services/Workflows/Activity/Result/AddedActivityResult.php b/src/Services/Workflows/Activity/Result/AddedActivityResult.php index 676c1217..0c786929 100644 --- a/src/Services/Workflows/Activity/Result/AddedActivityResult.php +++ b/src/Services/Workflows/Activity/Result/AddedActivityResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Activity\Result; diff --git a/src/Services/Workflows/Activity/Result/AddedMessageToLogResult.php b/src/Services/Workflows/Activity/Result/AddedMessageToLogResult.php index ca90c650..fc5e0201 100644 --- a/src/Services/Workflows/Activity/Result/AddedMessageToLogResult.php +++ b/src/Services/Workflows/Activity/Result/AddedMessageToLogResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Activity\Result; diff --git a/src/Services/Workflows/Activity/Result/UpdateActivityResult.php b/src/Services/Workflows/Activity/Result/UpdateActivityResult.php index 99926003..e370949e 100644 --- a/src/Services/Workflows/Activity/Result/UpdateActivityResult.php +++ b/src/Services/Workflows/Activity/Result/UpdateActivityResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Activity\Result; diff --git a/src/Services/Workflows/Activity/Result/WorkflowActivitiesResult.php b/src/Services/Workflows/Activity/Result/WorkflowActivitiesResult.php index 1b140482..aef541fd 100644 --- a/src/Services/Workflows/Activity/Result/WorkflowActivitiesResult.php +++ b/src/Services/Workflows/Activity/Result/WorkflowActivitiesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Activity\Result; diff --git a/src/Services/Workflows/Activity/Service/Activity.php b/src/Services/Workflows/Activity/Service/Activity.php index 6de4f601..b6f94f75 100644 --- a/src/Services/Workflows/Activity/Service/Activity.php +++ b/src/Services/Workflows/Activity/Service/Activity.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Activity\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; @@ -16,7 +28,7 @@ use Bitrix24\SDK\Services\Workflows\Activity\Result\UpdateActivityResult; use Bitrix24\SDK\Services\Workflows\Common\WorkflowDocumentType; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['bizproc']))] class Activity extends AbstractService { public function __construct( @@ -35,6 +47,11 @@ public function __construct( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_list.php */ + #[ApiEndpointMetadata( + 'bizproc.activity.log', + 'https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_list.php', + 'This method records data in the workflow log.' + )] public function log(string $eventToken, string $message): Workflows\Activity\Result\AddedMessageToLogResult { return new Workflows\Activity\Result\AddedMessageToLogResult($this->core->call('bizproc.activity.log', [ @@ -50,6 +67,11 @@ public function log(string $eventToken, string $message): Workflows\Activity\Res * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_list.php */ + #[ApiEndpointMetadata( + 'bizproc.activity.list', + 'https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_list.php', + 'This method returns list of activities, installed by the application.' + )] public function list(): Workflows\Activity\Result\WorkflowActivitiesResult { return new Workflows\Activity\Result\WorkflowActivitiesResult($this->core->call('bizproc.activity.list')); @@ -75,6 +97,11 @@ public function list(): Workflows\Activity\Result\WorkflowActivitiesResult * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_add.php */ + #[ApiEndpointMetadata( + 'bizproc.activity.add', + 'https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_add.php', + 'Adds new activity to a workflow.' + )] public function add( string $code, string $handlerUrl, @@ -112,6 +139,11 @@ public function add( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_delete.php */ + #[ApiEndpointMetadata( + 'bizproc.activity.delete', + 'https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_delete.php', + 'This method deletes an activity.' + )] public function delete(string $activityCode): DeletedItemResult { return new DeletedItemResult( @@ -140,6 +172,11 @@ public function delete(string $activityCode): DeletedItemResult * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_update.php */ + #[ApiEndpointMetadata( + 'bizproc.activity.update', + 'https://training.bitrix24.com/rest_help/workflows/app_activities/bizproc_activity_update.php', + 'This method allows to update activity fields. Method parameters are similar to bizproc.activity.add.' + )] public function update( string $code, ?string $handlerUrl, diff --git a/src/Services/Workflows/Activity/Service/Batch.php b/src/Services/Workflows/Activity/Service/Batch.php index 07d3fdb7..aa6ee33a 100644 --- a/src/Services/Workflows/Activity/Service/Batch.php +++ b/src/Services/Workflows/Activity/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Activity\Service; diff --git a/src/Services/Workflows/Common/Auth.php b/src/Services/Workflows/Common/Auth.php index be50a388..8988357f 100644 --- a/src/Services/Workflows/Common/Auth.php +++ b/src/Services/Workflows/Common/Auth.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/DocumentType.php b/src/Services/Workflows/Common/DocumentType.php index cffde998..3bca1e40 100644 --- a/src/Services/Workflows/Common/DocumentType.php +++ b/src/Services/Workflows/Common/DocumentType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowAutoExecutionType.php b/src/Services/Workflows/Common/WorkflowAutoExecutionType.php index d8684bce..1eae76bb 100644 --- a/src/Services/Workflows/Common/WorkflowAutoExecutionType.php +++ b/src/Services/Workflows/Common/WorkflowAutoExecutionType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowDocumentId.php b/src/Services/Workflows/Common/WorkflowDocumentId.php index 01c67772..63fdafbd 100644 --- a/src/Services/Workflows/Common/WorkflowDocumentId.php +++ b/src/Services/Workflows/Common/WorkflowDocumentId.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowDocumentType.php b/src/Services/Workflows/Common/WorkflowDocumentType.php index 759621b6..e1bbe0ca 100644 --- a/src/Services/Workflows/Common/WorkflowDocumentType.php +++ b/src/Services/Workflows/Common/WorkflowDocumentType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowPropertyType.php b/src/Services/Workflows/Common/WorkflowPropertyType.php index 4ff90cf9..6ec69804 100644 --- a/src/Services/Workflows/Common/WorkflowPropertyType.php +++ b/src/Services/Workflows/Common/WorkflowPropertyType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowTaskActivityType.php b/src/Services/Workflows/Common/WorkflowTaskActivityType.php index e7fba294..76945f80 100644 --- a/src/Services/Workflows/Common/WorkflowTaskActivityType.php +++ b/src/Services/Workflows/Common/WorkflowTaskActivityType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowTaskCompleteStatusType.php b/src/Services/Workflows/Common/WorkflowTaskCompleteStatusType.php index d03867b8..52d5622b 100644 --- a/src/Services/Workflows/Common/WorkflowTaskCompleteStatusType.php +++ b/src/Services/Workflows/Common/WorkflowTaskCompleteStatusType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowTaskStatusType.php b/src/Services/Workflows/Common/WorkflowTaskStatusType.php index 78872afc..9389ddca 100644 --- a/src/Services/Workflows/Common/WorkflowTaskStatusType.php +++ b/src/Services/Workflows/Common/WorkflowTaskStatusType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Common/WorkflowTaskUserStatusType.php b/src/Services/Workflows/Common/WorkflowTaskUserStatusType.php index 51910fde..d0fc40df 100644 --- a/src/Services/Workflows/Common/WorkflowTaskUserStatusType.php +++ b/src/Services/Workflows/Common/WorkflowTaskUserStatusType.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Common; diff --git a/src/Services/Workflows/Event/Result/EventSendResult.php b/src/Services/Workflows/Event/Result/EventSendResult.php index c5acfee5..32b87ee7 100644 --- a/src/Services/Workflows/Event/Result/EventSendResult.php +++ b/src/Services/Workflows/Event/Result/EventSendResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Event\Result; diff --git a/src/Services/Workflows/Event/Service/Batch.php b/src/Services/Workflows/Event/Service/Batch.php index feaba616..9252244d 100644 --- a/src/Services/Workflows/Event/Service/Batch.php +++ b/src/Services/Workflows/Event/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Event\Service; diff --git a/src/Services/Workflows/Event/Service/Event.php b/src/Services/Workflows/Event/Service/Event.php index a36958b3..7cbe4eba 100644 --- a/src/Services/Workflows/Event/Service/Event.php +++ b/src/Services/Workflows/Event/Service/Event.php @@ -1,16 +1,28 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Event\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Workflows; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['bizproc']))] class Event extends AbstractService { public function __construct( @@ -30,6 +42,11 @@ public function __construct( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/workflows_events/bizproc_event_send.php */ + #[ApiEndpointMetadata( + 'bizproc.event.send', + 'https://training.bitrix24.com/rest_help/workflows/workflows_events/bizproc_event_send.php', + 'returns output parameters to an activity. Parameters are specified in the activity description.' + )] public function send( string $eventToken, array $returnValues, diff --git a/src/Services/Workflows/Exceptions/ActivityOrRobotAlreadyInstalledException.php b/src/Services/Workflows/Exceptions/ActivityOrRobotAlreadyInstalledException.php index bb3ee0e6..c6574be2 100644 --- a/src/Services/Workflows/Exceptions/ActivityOrRobotAlreadyInstalledException.php +++ b/src/Services/Workflows/Exceptions/ActivityOrRobotAlreadyInstalledException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + namespace Bitrix24\SDK\Services\Workflows\Exceptions; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; diff --git a/src/Services/Workflows/Exceptions/ActivityOrRobotValidationFailureException.php b/src/Services/Workflows/Exceptions/ActivityOrRobotValidationFailureException.php index 8dd148f7..2dd24998 100644 --- a/src/Services/Workflows/Exceptions/ActivityOrRobotValidationFailureException.php +++ b/src/Services/Workflows/Exceptions/ActivityOrRobotValidationFailureException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + namespace Bitrix24\SDK\Services\Workflows\Exceptions; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; diff --git a/src/Services/Workflows/Exceptions/WorkflowTaskAlreadyCompletedException.php b/src/Services/Workflows/Exceptions/WorkflowTaskAlreadyCompletedException.php index 83a611ad..af26237f 100644 --- a/src/Services/Workflows/Exceptions/WorkflowTaskAlreadyCompletedException.php +++ b/src/Services/Workflows/Exceptions/WorkflowTaskAlreadyCompletedException.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + namespace Bitrix24\SDK\Services\Workflows\Exceptions; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; diff --git a/src/Services/Workflows/Robot/Request/IncomingRobotRequest.php b/src/Services/Workflows/Robot/Request/IncomingRobotRequest.php index 679ad196..859d9a64 100644 --- a/src/Services/Workflows/Robot/Request/IncomingRobotRequest.php +++ b/src/Services/Workflows/Robot/Request/IncomingRobotRequest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Robot\Request; diff --git a/src/Services/Workflows/Robot/Result/AddedRobotResult.php b/src/Services/Workflows/Robot/Result/AddedRobotResult.php index 93c1bb18..5888cb64 100644 --- a/src/Services/Workflows/Robot/Result/AddedRobotResult.php +++ b/src/Services/Workflows/Robot/Result/AddedRobotResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Robot\Result; diff --git a/src/Services/Workflows/Robot/Result/UpdateRobotResult.php b/src/Services/Workflows/Robot/Result/UpdateRobotResult.php index fe2d2c3b..5e7615d9 100644 --- a/src/Services/Workflows/Robot/Result/UpdateRobotResult.php +++ b/src/Services/Workflows/Robot/Result/UpdateRobotResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Robot\Result; diff --git a/src/Services/Workflows/Robot/Result/WorkflowRobotsResult.php b/src/Services/Workflows/Robot/Result/WorkflowRobotsResult.php index 95f2523a..c2145357 100644 --- a/src/Services/Workflows/Robot/Result/WorkflowRobotsResult.php +++ b/src/Services/Workflows/Robot/Result/WorkflowRobotsResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Robot\Result; diff --git a/src/Services/Workflows/Robot/Service/Robot.php b/src/Services/Workflows/Robot/Service/Robot.php index c77e7dd8..be7c4f20 100644 --- a/src/Services/Workflows/Robot/Service/Robot.php +++ b/src/Services/Workflows/Robot/Service/Robot.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Robot\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; @@ -16,7 +28,7 @@ use Bitrix24\SDK\Services\Workflows\Template\Service\Batch; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['bizproc']))] class Robot extends AbstractService { public function __construct( @@ -37,6 +49,11 @@ public function __construct( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_add.php */ + #[ApiEndpointMetadata( + 'bizproc.robot.add', + 'https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_add.php', + 'Registers new automation rule.' + )] public function add( string $code, string $handlerUrl, @@ -67,6 +84,11 @@ public function add( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_list.php */ + #[ApiEndpointMetadata( + 'bizproc.robot.list', + 'https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_list.php', + 'This method returns list of automation rules, registered by the application.' + )] public function list(): Workflows\Robot\Result\WorkflowRobotsResult { return new Workflows\Robot\Result\WorkflowRobotsResult($this->core->call('bizproc.robot.list')); @@ -80,6 +102,11 @@ public function list(): Workflows\Robot\Result\WorkflowRobotsResult * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_delete.php */ + #[ApiEndpointMetadata( + 'bizproc.robot.delete', + 'https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_delete.php', + 'This method deletes registered automation rule.' + )] public function delete(string $robotCode): DeletedItemResult { return new DeletedItemResult( @@ -98,6 +125,11 @@ public function delete(string $robotCode): DeletedItemResult * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_update.php */ + #[ApiEndpointMetadata( + 'bizproc.robot.update', + 'https://training.bitrix24.com/rest_help/workflows/app_automation_rules/bizproc_robot_update.php', + 'updates fields of automation rules' + )] public function update( string $code, ?string $handlerUrl = null, diff --git a/src/Services/Workflows/Task/Result/WorkflowTaskCompleteResult.php b/src/Services/Workflows/Task/Result/WorkflowTaskCompleteResult.php index e4d5d170..278b63cf 100644 --- a/src/Services/Workflows/Task/Result/WorkflowTaskCompleteResult.php +++ b/src/Services/Workflows/Task/Result/WorkflowTaskCompleteResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Task\Result; diff --git a/src/Services/Workflows/Task/Result/WorkflowTaskItemResult.php b/src/Services/Workflows/Task/Result/WorkflowTaskItemResult.php index b3588db0..10ba5eca 100644 --- a/src/Services/Workflows/Task/Result/WorkflowTaskItemResult.php +++ b/src/Services/Workflows/Task/Result/WorkflowTaskItemResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Task\Result; @@ -11,7 +20,6 @@ use Bitrix24\SDK\Services\Workflows\Common\WorkflowTaskStatusType; use Bitrix24\SDK\Services\Workflows\Common\WorkflowTaskUserStatusType; use Carbon\CarbonImmutable; -use DateTimeImmutable; /** * @property-read int $ID task ID diff --git a/src/Services/Workflows/Task/Result/WorkflowTasksResult.php b/src/Services/Workflows/Task/Result/WorkflowTasksResult.php index f1fd9113..e4be2947 100644 --- a/src/Services/Workflows/Task/Result/WorkflowTasksResult.php +++ b/src/Services/Workflows/Task/Result/WorkflowTasksResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Task\Result; diff --git a/src/Services/Workflows/Task/Service/Batch.php b/src/Services/Workflows/Task/Service/Batch.php index ab408b62..8a3b0d25 100644 --- a/src/Services/Workflows/Task/Service/Batch.php +++ b/src/Services/Workflows/Task/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Task\Service; diff --git a/src/Services/Workflows/Task/Service/Task.php b/src/Services/Workflows/Task/Service/Task.php index 7d209803..ccbb226e 100644 --- a/src/Services/Workflows/Task/Service/Task.php +++ b/src/Services/Workflows/Task/Service/Task.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Task\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; @@ -17,7 +29,7 @@ use Carbon\CarbonImmutable; use Psr\Log\LoggerInterface; use Bitrix24\SDK\Services\Workflows\Task\Result\WorkflowTasksResult; - +#[ApiServiceMetadata(new Scope(['bizproc']))] class Task extends AbstractService { public function __construct( @@ -43,6 +55,11 @@ public function __construct( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/workflows_tasks/bizproc_task_complete.php */ + #[ApiEndpointMetadata( + 'bizproc.task.complete', + 'https://training.bitrix24.com/rest_help/workflows/workflows_tasks/bizproc_task_complete.php', + 'Complete workflow task' + )] public function complete(int $taskId, WorkflowTaskCompleteStatusType $status, string $comment, ?array $taskFields = null): WorkflowTaskCompleteResult { return new WorkflowTaskCompleteResult($this->core->call('bizproc.task.complete', [ @@ -108,6 +125,11 @@ public function complete(int $taskId, WorkflowTaskCompleteStatusType $status, st * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/workflows_tasks/bizproc_task_list.php */ + #[ApiEndpointMetadata( + 'bizproc.task.list', + 'https://training.bitrix24.com/rest_help/workflows/workflows_tasks/bizproc_task_list.php', + 'List of workflow tasks' + )] public function list( array $order = ['ID' => 'DESC'], array $filter = [], diff --git a/src/Services/Workflows/Template/Result/WorkflowTemplateItemResult.php b/src/Services/Workflows/Template/Result/WorkflowTemplateItemResult.php index 13a95c00..2c3f3629 100644 --- a/src/Services/Workflows/Template/Result/WorkflowTemplateItemResult.php +++ b/src/Services/Workflows/Template/Result/WorkflowTemplateItemResult.php @@ -1,12 +1,21 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Template\Result; use Bitrix24\SDK\Core\Result\AbstractItem; use Bitrix24\SDK\Services\Workflows\Common\WorkflowAutoExecutionType; -use DateTimeImmutable; +use Carbon\CarbonImmutable; /** * @property-read int $ID @@ -19,7 +28,7 @@ * @property-read ?array $PARAMETERS * @property-read ?array $VARIABLES * @property-read ?array $CONSTANTS - * @property-read ?DateTimeImmutable $MODIFIED + * @property-read ?CarbonImmutable $MODIFIED * @property-read ?bool $IS_MODIFIED * @property-read ?int $USER_ID * @property-read ?string $SYSTEM_CODE @@ -39,7 +48,7 @@ public function __get($offset) return null; case 'MODIFIED': if ($this->data[$offset] !== '') { - return DateTimeImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); + return CarbonImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); } return null; case 'IS_MODIFIED': diff --git a/src/Services/Workflows/Template/Result/WorkflowTemplatesResult.php b/src/Services/Workflows/Template/Result/WorkflowTemplatesResult.php index 062ad2d0..2680c618 100644 --- a/src/Services/Workflows/Template/Result/WorkflowTemplatesResult.php +++ b/src/Services/Workflows/Template/Result/WorkflowTemplatesResult.php @@ -1,14 +1,20 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Template\Result; use Bitrix24\SDK\Core\Exceptions\BaseException; -use Bitrix24\SDK\Core\Result\AbstractItem; use Bitrix24\SDK\Core\Result\AbstractResult; -use Bitrix24\SDK\Services\CRM\Deal\Result\DealItemResult; -use DateTimeInterface; class WorkflowTemplatesResult extends AbstractResult { diff --git a/src/Services/Workflows/Template/Service/Batch.php b/src/Services/Workflows/Template/Service/Batch.php index af3aee34..830b3e46 100644 --- a/src/Services/Workflows/Template/Service/Batch.php +++ b/src/Services/Workflows/Template/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Template\Service; diff --git a/src/Services/Workflows/Template/Service/Template.php b/src/Services/Workflows/Template/Service/Template.php index 2d62f485..c12b9820 100644 --- a/src/Services/Workflows/Template/Service/Template.php +++ b/src/Services/Workflows/Template/Service/Template.php @@ -1,10 +1,22 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Template\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; @@ -16,7 +28,7 @@ use Bitrix24\SDK\Services\Workflows; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['bizproc']))] class Template extends AbstractService { public function __construct( @@ -37,6 +49,11 @@ public function __construct( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_add.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.template.add', + 'https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_add.php', + 'Add a workflow template, requires administrator access permissions' + )] public function add( Workflows\Common\WorkflowDocumentType $workflowDocumentType, string $name, @@ -67,6 +84,11 @@ public function add( * @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException * @see https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_update.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.template.update', + 'https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_update.php', + 'Update workflow template' + )] public function update( int $templateId, ?Workflows\Common\WorkflowDocumentType $workflowDocumentType, @@ -115,6 +137,11 @@ public function update( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_delete.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.template.delete', + 'https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_delete.php', + 'The method deletes workflow template. Requires the administrator access permissions.' + )] public function delete(int $templateId): DeletedItemResult { return new DeletedItemResult($this->core->call('bizproc.workflow.template.delete', [ @@ -129,6 +156,11 @@ public function delete(int $templateId): DeletedItemResult * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_list.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.template.list', + 'https://training.bitrix24.com/rest_help/workflows/wirkflow_template/bizproc_workflow_template_list.php', + 'The method bizproc.workflow.template.list returns list of workflow templates, specified for a site. ' + )] public function list( array $select = ['ID', 'MODULE_ID', 'ENTITY', 'DOCUMENT_TYPE', 'AUTO_EXECUTE', 'NAME', 'NAME', 'TEMPLATE', 'PARAMETERS', 'VARIABLES', 'CONSTANTS', 'MODIFIED', 'IS_MODIFIED', 'USER_ID', 'SYSTEM_CODE'], array $filter = []): Workflows\Template\Result\WorkflowTemplatesResult diff --git a/src/Services/Workflows/Workflow/Request/IncomingWorkflowRequest.php b/src/Services/Workflows/Workflow/Request/IncomingWorkflowRequest.php index bfde824f..06e20671 100644 --- a/src/Services/Workflows/Workflow/Request/IncomingWorkflowRequest.php +++ b/src/Services/Workflows/Workflow/Request/IncomingWorkflowRequest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Request; diff --git a/src/Services/Workflows/Workflow/Result/WorkflowInstanceItemResult.php b/src/Services/Workflows/Workflow/Result/WorkflowInstanceItemResult.php index d5df6c77..942db4a9 100644 --- a/src/Services/Workflows/Workflow/Result/WorkflowInstanceItemResult.php +++ b/src/Services/Workflows/Workflow/Result/WorkflowInstanceItemResult.php @@ -1,19 +1,27 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Result; use Bitrix24\SDK\Core\Result\AbstractItem; use Bitrix24\SDK\Services\Workflows\Common\WorkflowAutoExecutionType; -use DateTimeImmutable; -use DateTimeInterface; +use Carbon\CarbonImmutable; /** * @property-read string $ID workflow ID - * @property-read DateTimeImmutable $MODIFIED - * @property-read ?DateTimeImmutable $OWNED_UNTIL time for blocking of a workflow. Process is considered as unresponsive, if the difference of blocking time with the current time is more than 5 minutes; - * @property-read ?DateTimeImmutable $STARTED workflow launch date; + * @property-read CarbonImmutable $MODIFIED + * @property-read ?CarbonImmutable $OWNED_UNTIL time for blocking of a workflow. Process is considered as unresponsive, if the difference of blocking time with the current time is more than 5 minutes; + * @property-read ?CarbonImmutable $STARTED workflow launch date; * @property-read ?string $MODULE_ID module ID (as per document); * @property-read ?string $ENTITY entity ID (as per document); * @property-read ?int $DOCUMENT_ID document ID; @@ -37,7 +45,7 @@ public function __get($offset) case 'MODIFIED': case 'STARTED': if ($this->data[$offset] !== '') { - return DateTimeImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); + return CarbonImmutable::createFromFormat(DATE_ATOM, $this->data[$offset]); } return null; } diff --git a/src/Services/Workflows/Workflow/Result/WorkflowInstanceStartResult.php b/src/Services/Workflows/Workflow/Result/WorkflowInstanceStartResult.php index 2677bc9a..99c146f0 100644 --- a/src/Services/Workflows/Workflow/Result/WorkflowInstanceStartResult.php +++ b/src/Services/Workflows/Workflow/Result/WorkflowInstanceStartResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Result; diff --git a/src/Services/Workflows/Workflow/Result/WorkflowInstancesResult.php b/src/Services/Workflows/Workflow/Result/WorkflowInstancesResult.php index 97be077c..45d8c647 100644 --- a/src/Services/Workflows/Workflow/Result/WorkflowInstancesResult.php +++ b/src/Services/Workflows/Workflow/Result/WorkflowInstancesResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Result; diff --git a/src/Services/Workflows/Workflow/Result/WorkflowKillResult.php b/src/Services/Workflows/Workflow/Result/WorkflowKillResult.php index 4173ee57..1f71e8f5 100644 --- a/src/Services/Workflows/Workflow/Result/WorkflowKillResult.php +++ b/src/Services/Workflows/Workflow/Result/WorkflowKillResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Result; diff --git a/src/Services/Workflows/Workflow/Result/WorkflowTerminationResult.php b/src/Services/Workflows/Workflow/Result/WorkflowTerminationResult.php index a9ad8f88..65405c41 100644 --- a/src/Services/Workflows/Workflow/Result/WorkflowTerminationResult.php +++ b/src/Services/Workflows/Workflow/Result/WorkflowTerminationResult.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Result; diff --git a/src/Services/Workflows/Workflow/Service/Batch.php b/src/Services/Workflows/Workflow/Service/Batch.php index 653cd4f7..d8c3df6d 100644 --- a/src/Services/Workflows/Workflow/Service/Batch.php +++ b/src/Services/Workflows/Workflow/Service/Batch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Service; diff --git a/src/Services/Workflows/Workflow/Service/Workflow.php b/src/Services/Workflows/Workflow/Service/Workflow.php index 78e38c06..55071fc4 100644 --- a/src/Services/Workflows/Workflow/Service/Workflow.php +++ b/src/Services/Workflows/Workflow/Service/Workflow.php @@ -1,17 +1,29 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows\Workflow\Service; +use Bitrix24\SDK\Attributes\ApiEndpointMetadata; +use Bitrix24\SDK\Attributes\ApiServiceMetadata; use Bitrix24\SDK\Core\Contracts\CoreInterface; +use Bitrix24\SDK\Core\Credentials\Scope; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\AbstractService; use Bitrix24\SDK\Services\Workflows; use Psr\Log\LoggerInterface; - +#[ApiServiceMetadata(new Scope(['bizproc']))] class Workflow extends AbstractService { public function __construct( @@ -32,6 +44,11 @@ public function __construct( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_kill.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.kill', + 'https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_kill.php', + 'Deletes a launched workflow' + )] public function kill(string $workflowId): Workflows\Workflow\Result\WorkflowKillResult { return new Workflows\Workflow\Result\WorkflowKillResult($this->core->call('bizproc.workflow.kill', [ @@ -45,6 +62,11 @@ public function kill(string $workflowId): Workflows\Workflow\Result\WorkflowKill * @return Workflows\Workflow\Result\WorkflowTerminationResult * @see https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_terminate.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.terminate', + 'https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_terminate.php', + 'Stops an active workflow.' + )] public function terminate(string $workflowId, string $message): Workflows\Workflow\Result\WorkflowTerminationResult { return new Workflows\Workflow\Result\WorkflowTerminationResult($this->core->call('bizproc.workflow.terminate', [ @@ -62,6 +84,11 @@ public function terminate(string $workflowId, string $message): Workflows\Workfl * @see https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_start.php * */ + #[ApiEndpointMetadata( + 'bizproc.workflow.start', + 'https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_start.php', + 'Launches a workflow' + )] public function start( Workflows\Common\DocumentType $workflowDocumentType, int $bizProcTemplateId, @@ -124,6 +151,11 @@ public function start( * @throws TransportException * @see https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_instances.php */ + #[ApiEndpointMetadata( + 'bizproc.workflow.instances', + 'https://training.bitrix24.com/rest_help/workflows/workflow/bizproc_workflow_instances.php', + 'returns list of launched workflows' + )] public function instances( array $select = ['ID', 'MODIFIED', 'OWNED_UNTIL', 'MODULE_ID', 'ENTITY', 'DOCUMENT_ID', 'STARTED', 'STARTED_BY', 'TEMPLATE_ID'], array $order = ['STARTED' => 'DESC'], diff --git a/src/Services/Workflows/WorkflowsServiceBuilder.php b/src/Services/Workflows/WorkflowsServiceBuilder.php index cb9d84a5..e7475a5e 100644 --- a/src/Services/Workflows/WorkflowsServiceBuilder.php +++ b/src/Services/Workflows/WorkflowsServiceBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Services\Workflows; diff --git a/tests/.env b/tests/.env index 6fc806a2..dc897384 100644 --- a/tests/.env +++ b/tests/.env @@ -20,4 +20,6 @@ BITRIX24_WEBHOOK= # monolog log level INTEGRATION_TEST_LOG_LEVEL=200 # integration tests assets -INTEGRATION_TEST_OPEN_LINE_CODE=40863c519996e505b5cde98749c97413 \ No newline at end of file +INTEGRATION_TEST_OPEN_LINE_CODE=40863c519996e505b5cde98749c97413 + +DOCUMENTATION_DEFAULT_TARGET_BRANCH= \ No newline at end of file diff --git a/tests/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceTest.php b/tests/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceTest.php index 2ee76d58..ab38daf9 100644 --- a/tests/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceTest.php +++ b/tests/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\ApplicationInstallations\Entity; diff --git a/tests/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterfaceTest.php b/tests/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterfaceTest.php index 614fa20c..f7024979 100644 --- a/tests/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterfaceTest.php +++ b/tests/Application/Contracts/ApplicationInstallations/Repository/ApplicationInstallationRepositoryInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\ApplicationInstallations\Repository; diff --git a/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php b/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php index 21d89660..c5c24274 100644 --- a/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\Bitrix24Accounts\Entity; diff --git a/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php b/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php index 61a93bc3..e3fb3818 100644 --- a/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Accounts/Repository/Bitrix24AccountRepositoryInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\Bitrix24Accounts\Repository; diff --git a/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php b/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php index 9083b80b..140f9eb9 100644 --- a/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\Bitrix24Partners\Entity; diff --git a/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php b/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php index 5136247d..58f3b93e 100644 --- a/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php +++ b/tests/Application/Contracts/Bitrix24Partners/Repository/Bitrix24PartnerRepositoryInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\Bitrix24Partners\Repository; diff --git a/tests/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceTest.php b/tests/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceTest.php index 4e28300d..dab78765 100644 --- a/tests/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceTest.php +++ b/tests/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\ContactPersons\Entity; diff --git a/tests/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterfaceTest.php b/tests/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterfaceTest.php index f255af7f..66ec443a 100644 --- a/tests/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterfaceTest.php +++ b/tests/Application/Contracts/ContactPersons/Repository/ContactPersonRepositoryInterfaceTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Application\Contracts\ContactPersons\Repository; diff --git a/tests/ApplicationBridge/ApplicationCredentialsProvider.php b/tests/ApplicationBridge/ApplicationCredentialsProvider.php index 00713385..0524e7fe 100644 --- a/tests/ApplicationBridge/ApplicationCredentialsProvider.php +++ b/tests/ApplicationBridge/ApplicationCredentialsProvider.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\ApplicationBridge; diff --git a/tests/ApplicationBridge/AuthTokenFileStorage.php b/tests/ApplicationBridge/AuthTokenFileStorage.php index 1af6a99e..787324de 100644 --- a/tests/ApplicationBridge/AuthTokenFileStorage.php +++ b/tests/ApplicationBridge/AuthTokenFileStorage.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\ApplicationBridge; diff --git a/tests/ApplicationBridge/AuthTokenRepositoryInterface.php b/tests/ApplicationBridge/AuthTokenRepositoryInterface.php index 8302e31b..fa1389d9 100644 --- a/tests/ApplicationBridge/AuthTokenRepositoryInterface.php +++ b/tests/ApplicationBridge/AuthTokenRepositoryInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\ApplicationBridge; diff --git a/tests/ApplicationBridge/index.php b/tests/ApplicationBridge/index.php index 90947415..69093196 100644 --- a/tests/ApplicationBridge/index.php +++ b/tests/ApplicationBridge/index.php @@ -1,6 +1,15 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + use Bitrix24\SDK\Core\Credentials\AuthToken; use Bitrix24\SDK\Core\Credentials\ApplicationProfile; use Bitrix24\SDK\Services\ServiceBuilderFactory; diff --git a/tests/ApplicationBridge/install.php b/tests/ApplicationBridge/install.php index eae01705..5ca9c29f 100644 --- a/tests/ApplicationBridge/install.php +++ b/tests/ApplicationBridge/install.php @@ -1,4 +1,12 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ ?> \ No newline at end of file diff --git a/tests/Builders/DemoDataGenerator.php b/tests/Builders/DemoDataGenerator.php index 4f23d5f0..b95a5763 100644 --- a/tests/Builders/DemoDataGenerator.php +++ b/tests/Builders/DemoDataGenerator.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ namespace Bitrix24\SDK\Tests\Builders; @@ -9,6 +19,9 @@ use libphonenumber\NumberParseException; use libphonenumber\PhoneNumber; use libphonenumber\PhoneNumberUtil; +use Money\Currency; +use Money\Money; +use Random\RandomException; class DemoDataGenerator { @@ -49,4 +62,17 @@ public static function getUserAgentIp(): Multi { return Multi::factory(Faker\Factory::create()->ipv4()); } + + public static function getCurrency(): Currency + { + return new Currency('USD'); + } + + /** + * @throws RandomException + */ + public static function getMoneyAmount(): Money + { + return new Money(random_int(1000, 1000000), self::getCurrency()); + } } \ No newline at end of file diff --git a/tests/Builders/Services/CRM/PhoneCollectionBuilder.php b/tests/Builders/Services/CRM/PhoneCollectionBuilder.php index 2dbe6819..71e4addd 100644 --- a/tests/Builders/Services/CRM/PhoneCollectionBuilder.php +++ b/tests/Builders/Services/CRM/PhoneCollectionBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Builders\Services\CRM; diff --git a/tests/Builders/Services/CRM/PhoneNumberBuilder.php b/tests/Builders/Services/CRM/PhoneNumberBuilder.php index bcb14a96..62d3eedc 100644 --- a/tests/Builders/Services/CRM/PhoneNumberBuilder.php +++ b/tests/Builders/Services/CRM/PhoneNumberBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Builders\Services\CRM; @@ -26,6 +35,6 @@ public function withLength(int $length): self */ public function build(): string { - return '+7' . substr((string)time(), 2, $this->length) . substr((string)random_int(1000, PHP_INT_MAX), 0, 3); + return '+1' . substr((string)time(), 2, $this->length) . substr((string)random_int(1000, PHP_INT_MAX), 0, 3); } } \ No newline at end of file diff --git a/tests/CustomAssertions/CustomBitrix24Assertions.php b/tests/CustomAssertions/CustomBitrix24Assertions.php new file mode 100644 index 00000000..5f12030d --- /dev/null +++ b/tests/CustomAssertions/CustomBitrix24Assertions.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +namespace Bitrix24\SDK\Tests\CustomAssertions; + +use Bitrix24\SDK\Services\CRM\Contact\Result\ContactItemResult; +use Typhoon\Reflection\TyphoonReflector; + +trait CustomBitrix24Assertions +{ + /** + * @param array $fieldCodesFromApi + * @param class-string $resultItemClassName + * @return void + */ + protected function assertBitrix24AllResultItemFieldsAnnotated(array $fieldCodesFromApi, string $resultItemClassName): void + { + sort($fieldCodesFromApi); + + // parse keys from phpdoc annotation + $props = TyphoonReflector::build()->reflectClass($resultItemClassName)->properties(); + $propsFromAnnotations = []; + foreach ($props as $meta) { + if ($meta->isAnnotated() && !$meta->isNative()) { + $propsFromAnnotations[] = $meta->id->name; + } + } + sort($propsFromAnnotations); + + $this->assertEquals($fieldCodesFromApi, $propsFromAnnotations, + sprintf('in phpdocs annotations for class %s we not found fields from actual api response: %s', + $resultItemClassName, + implode(', ', array_values(array_diff($fieldCodesFromApi, $propsFromAnnotations))) + )); + } +} \ No newline at end of file diff --git a/tests/Integration/Core/BatchGetTraversableTest.php b/tests/Integration/Core/BatchGetTraversableTest.php index f21bdbf9..70f8fa20 100644 --- a/tests/Integration/Core/BatchGetTraversableTest.php +++ b/tests/Integration/Core/BatchGetTraversableTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Core; diff --git a/tests/Integration/Core/BatchTest.php b/tests/Integration/Core/BatchTest.php index 1aaf427e..42c66ba0 100644 --- a/tests/Integration/Core/BatchTest.php +++ b/tests/Integration/Core/BatchTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Core; @@ -7,6 +16,7 @@ use Bitrix24\SDK\Core\Batch; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; use Bitrix24\SDK\Services\ServiceBuilder; +use Bitrix24\SDK\Tests\Builders\DemoDataGenerator; use Bitrix24\SDK\Tests\Integration\Fabric; use PHPUnit\Framework\TestCase; use Symfony\Component\Stopwatch\Stopwatch; @@ -46,7 +56,7 @@ public function testGetTraversableListWithMoreThanMaxBatchPageCountWithoutLimit( 'TITLE' => sprintf('deal-%s', $i), 'IS_MANUAL_OPPORTUNITY' => 'Y', 'OPPORTUNITY' => sprintf('%s.00', random_int(100, 40000)), - 'CURRENCY_ID' => 'RUB', + 'CURRENCY_ID' => DemoDataGenerator::getCurrency()->getCode(), 'CONTACT_ID' => $contactId, ]; } @@ -136,7 +146,7 @@ public function testGetTraversableListWithLessThanPageSizeWithLimit(): void 'TITLE' => sprintf('deal-%s', $i), 'IS_MANUAL_OPPORTUNITY' => 'Y', 'OPPORTUNITY' => sprintf('%s.00', random_int(100, 40000)), - 'CURRENCY_ID' => 'RUB', + 'CURRENCY_ID' => DemoDataGenerator::getCurrency()->getCode(), 'CONTACT_ID' => $contactId, ]; } @@ -213,7 +223,7 @@ public function testGetTraversableListWithLessThanPageSizeWithoutLimit(): void 'TITLE' => sprintf('deal-%s', $i), 'IS_MANUAL_OPPORTUNITY' => 'Y', 'OPPORTUNITY' => sprintf('%s.00', random_int(100, 40000)), - 'CURRENCY_ID' => 'RUB', + 'CURRENCY_ID' => DemoDataGenerator::getCurrency()->getCode(), 'CONTACT_ID' => $contactId, ]; } diff --git a/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrderTest.php b/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrderTest.php index 3c37725d..503c7b87 100644 --- a/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrderTest.php +++ b/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Core\BulkItemsReader\ReadStrategies; @@ -7,6 +16,7 @@ use Bitrix24\SDK\Core\BulkItemsReader\ReadStrategies\FilterWithBatchWithoutCountOrder; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; use Bitrix24\SDK\Services\ServiceBuilder; +use Bitrix24\SDK\Tests\Builders\DemoDataGenerator; use Bitrix24\SDK\Tests\Integration\Fabric; use PHPUnit\Framework\TestCase; use Symfony\Component\Stopwatch\Stopwatch; @@ -96,7 +106,7 @@ public function setUp(): void 'TITLE' => sprintf('deal-%s', $i), 'IS_MANUAL_OPPORTUNITY' => 'Y', 'OPPORTUNITY' => sprintf('%s.00', random_int(100, 40000)), - 'CURRENCY_ID' => 'RUB', + 'CURRENCY_ID' => DemoDataGenerator::getCurrency()->getCode(), 'CONTACT_ID' => $this->contactId, ]; } diff --git a/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrderTest.php b/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrderTest.php index 9d6b7002..7717e607 100644 --- a/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrderTest.php +++ b/tests/Integration/Core/BulkItemsReader/ReadStrategies/FilterWithoutBatchWithoutCountOrderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Core\BulkItemsReader\ReadStrategies; @@ -8,6 +17,7 @@ use Bitrix24\SDK\Core\BulkItemsReader\ReadStrategies\FilterWithoutBatchWithoutCountOrder; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; use Bitrix24\SDK\Services\ServiceBuilder; +use Bitrix24\SDK\Tests\Builders\DemoDataGenerator; use Bitrix24\SDK\Tests\Integration\Fabric; use PHPUnit\Framework\TestCase; use Symfony\Component\Stopwatch\Stopwatch; @@ -93,7 +103,7 @@ public function setUp(): void // add contact $this->contactId = $this->serviceBuilder->getCRMScope()->contact()->add( [ - 'NAME' => sprintf('first_%s', time()), + 'NAME' => sprintf('first_%s', time()), 'SECOND' => sprintf('second_%s', time()), ] )->getId(); @@ -105,11 +115,11 @@ public function setUp(): void // add deals to bitrix24 for ($i = 0; $i < self::DEMO_DATA_ARRAY_SIZE_MORE_THAN_ONE_BATCH_PAGE_SIZE; $i++) { $rawDeals[] = [ - 'TITLE' => sprintf('deal-%s', $i), + 'TITLE' => sprintf('deal-%s', $i), 'IS_MANUAL_OPPORTUNITY' => 'Y', - 'OPPORTUNITY' => sprintf('%s.00', random_int(100, 40000)), - 'CURRENCY_ID' => 'RUB', - 'CONTACT_ID' => $this->contactId, + 'OPPORTUNITY' => sprintf('%s.00', random_int(100, 40000)), + 'CURRENCY_ID' => DemoDataGenerator::getCurrency()->getCode(), + 'CONTACT_ID' => $this->contactId, ]; } foreach ($this->serviceBuilder->getCRMScope()->deal()->batch->add($rawDeals) as $addDealResult) { diff --git a/tests/Integration/Core/CoreTest.php b/tests/Integration/Core/CoreTest.php index 1c541897..e972f3bc 100644 --- a/tests/Integration/Core/CoreTest.php +++ b/tests/Integration/Core/CoreTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Core; diff --git a/tests/Integration/Fabric.php b/tests/Integration/Fabric.php index f8b635f7..238e4b9b 100644 --- a/tests/Integration/Fabric.php +++ b/tests/Integration/Fabric.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration; diff --git a/tests/Integration/Services/CRM/Activity/ReadModel/EmailFetcherTest.php b/tests/Integration/Services/CRM/Activity/ReadModel/EmailFetcherTest.php index c8bf7ed9..b9855548 100644 --- a/tests/Integration/Services/CRM/Activity/ReadModel/EmailFetcherTest.php +++ b/tests/Integration/Services/CRM/Activity/ReadModel/EmailFetcherTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Activity\ReadModel; diff --git a/tests/Integration/Services/CRM/Activity/ReadModel/OpenLineFetcherTest.php b/tests/Integration/Services/CRM/Activity/ReadModel/OpenLineFetcherTest.php index 10628ad5..c4ad949f 100644 --- a/tests/Integration/Services/CRM/Activity/ReadModel/OpenLineFetcherTest.php +++ b/tests/Integration/Services/CRM/Activity/ReadModel/OpenLineFetcherTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Activity\ReadModel; diff --git a/tests/Integration/Services/CRM/Activity/ReadModel/VoximplantFetcherTest.php b/tests/Integration/Services/CRM/Activity/ReadModel/VoximplantFetcherTest.php index 6ad0af15..273739f3 100644 --- a/tests/Integration/Services/CRM/Activity/ReadModel/VoximplantFetcherTest.php +++ b/tests/Integration/Services/CRM/Activity/ReadModel/VoximplantFetcherTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Activity\ReadModel; diff --git a/tests/Integration/Services/CRM/Activity/ReadModel/WebFormFetcherTest.php b/tests/Integration/Services/CRM/Activity/ReadModel/WebFormFetcherTest.php index f3a9b942..92bc50e7 100644 --- a/tests/Integration/Services/CRM/Activity/ReadModel/WebFormFetcherTest.php +++ b/tests/Integration/Services/CRM/Activity/ReadModel/WebFormFetcherTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Activity\ReadModel; diff --git a/tests/Integration/Services/CRM/Activity/Service/ActivityTest.php b/tests/Integration/Services/CRM/Activity/Service/ActivityTest.php index f0b0acfc..758717ed 100644 --- a/tests/Integration/Services/CRM/Activity/Service/ActivityTest.php +++ b/tests/Integration/Services/CRM/Activity/Service/ActivityTest.php @@ -1,15 +1,31 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Activity\Service; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Services\CRM\Activity\ActivityContentType; +use Bitrix24\SDK\Services\CRM\Activity\ActivityDirectionType; +use Bitrix24\SDK\Services\CRM\Activity\Result\ActivityItemResult; use Bitrix24\SDK\Services\CRM\Activity\Service\Activity; +use Bitrix24\SDK\Services\CRM\Activity\ActivityType; use Bitrix24\SDK\Services\CRM\Contact\Service\Contact; +use Bitrix24\SDK\Services\CRM\Deal\Result\DealProductRowItemResult; +use Bitrix24\SDK\Tests\Builders\DemoDataGenerator; use Bitrix24\SDK\Tests\Integration\Fabric; use PHPUnit\Framework\TestCase; +use Typhoon\Reflection\TyphoonReflector; class ActivityTest extends TestCase { @@ -29,19 +45,19 @@ public function testAdd(): void $this->contactId[] = $contactId; $this->activityId[] = $this->activityService->add( [ - 'OWNER_ID' => $contactId, - 'OWNER_TYPE_ID' => 3, - 'TYPE_ID' => 2, - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'OWNER_ID' => $contactId, + 'OWNER_TYPE_ID' => 3, + 'TYPE_ID' => ActivityType::call->value, + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', - 'SUBJECT' => 'test activity', - 'DESCRIPTION' => 'test activity description', + 'SUBJECT' => 'test activity', + 'DESCRIPTION' => 'test activity description', 'DESCRIPTION_TYPE' => '1', - 'DIRECTION' => '2', - 'COMMUNICATIONS' => [ + 'DIRECTION' => '2', + 'COMMUNICATIONS' => [ 0 => [ - 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'TYPE' => 'PHONE', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ] @@ -61,19 +77,19 @@ public function testDelete(): void $this->contactId[] = $contactId; $activityId = $this->activityService->add( [ - 'OWNER_ID' => $contactId, - 'OWNER_TYPE_ID' => 3, - 'TYPE_ID' => 2, - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'OWNER_ID' => $contactId, + 'OWNER_TYPE_ID' => 3, + 'TYPE_ID' => ActivityType::call->value, + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', - 'SUBJECT' => 'test activity', - 'DESCRIPTION' => 'test activity description', + 'SUBJECT' => 'test activity', + 'DESCRIPTION' => 'test activity description', 'DESCRIPTION_TYPE' => '1', - 'DIRECTION' => '2', - 'COMMUNICATIONS' => [ + 'DIRECTION' => '2', + 'COMMUNICATIONS' => [ 0 => [ - 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'TYPE' => 'PHONE', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ] @@ -102,19 +118,19 @@ public function testGet(): void $this->contactId[] = $contactId; $newActivity = [ - 'OWNER_ID' => $contactId, - 'OWNER_TYPE_ID' => 3, - 'TYPE_ID' => 2, - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'OWNER_ID' => $contactId, + 'OWNER_TYPE_ID' => 3, + 'TYPE_ID' => ActivityType::call->value, + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', - 'SUBJECT' => 'test activity', - 'DESCRIPTION' => 'test activity description', + 'SUBJECT' => 'test activity', + 'DESCRIPTION' => 'test activity description', 'DESCRIPTION_TYPE' => '1', - 'DIRECTION' => '2', - 'COMMUNICATIONS' => [ + 'DIRECTION' => '2', + 'COMMUNICATIONS' => [ 0 => [ - 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'TYPE' => 'PHONE', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; @@ -140,19 +156,19 @@ public function testList(): void $newActivity = []; for ($i = 1; $i < 10; $i++) { $newActivity[$i] = [ - 'OWNER_ID' => $contactId, - 'OWNER_TYPE_ID' => 3, - 'TYPE_ID' => 2, - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'OWNER_ID' => $contactId, + 'OWNER_TYPE_ID' => 3, + 'TYPE_ID' => ActivityType::call->value, + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', - 'SUBJECT' => sprintf('test activity - %s', $i), - 'DESCRIPTION' => 'test activity description', + 'SUBJECT' => sprintf('test activity - %s', $i), + 'DESCRIPTION' => 'test activity description', 'DESCRIPTION_TYPE' => '1', - 'DIRECTION' => '2', - 'COMMUNICATIONS' => [ + 'DIRECTION' => '2', + 'COMMUNICATIONS' => [ 0 => [ - 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'TYPE' => 'PHONE', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; @@ -181,19 +197,19 @@ public function testUpdate(): void $this->contactId[] = $contactId; $newActivity = [ - 'OWNER_ID' => $contactId, - 'OWNER_TYPE_ID' => 3, - 'TYPE_ID' => 2, - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'OWNER_ID' => $contactId, + 'OWNER_TYPE_ID' => 3, + 'TYPE_ID' => ActivityType::call->value, + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', - 'SUBJECT' => 'test activity', - 'DESCRIPTION' => 'test activity description', + 'SUBJECT' => 'test activity', + 'DESCRIPTION' => 'test activity description', 'DESCRIPTION_TYPE' => '1', - 'DIRECTION' => '2', - 'COMMUNICATIONS' => [ + 'DIRECTION' => '2', + 'COMMUNICATIONS' => [ 0 => [ - 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'TYPE' => 'PHONE', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; @@ -220,19 +236,19 @@ public function testCountByFilter(): void $newActivity = []; for ($i = 1; $i < 10; $i++) { $newActivity[$i] = [ - 'OWNER_ID' => $contactId, - 'OWNER_TYPE_ID' => 3, - 'TYPE_ID' => 2, - 'PROVIDER_ID' => 'VOXIMPLANT_CALL', + 'OWNER_ID' => $contactId, + 'OWNER_TYPE_ID' => 3, + 'TYPE_ID' => ActivityType::call->value, + 'PROVIDER_ID' => 'VOXIMPLANT_CALL', 'PROVIDER_TYPE_ID' => 'CALL', - 'SUBJECT' => sprintf('test activity - %s', $i), - 'DESCRIPTION' => 'test activity description', + 'SUBJECT' => sprintf('test activity - %s', $i), + 'DESCRIPTION' => 'test activity description', 'DESCRIPTION_TYPE' => '1', - 'DIRECTION' => '2', - 'COMMUNICATIONS' => [ + 'DIRECTION' => '2', + 'COMMUNICATIONS' => [ 0 => [ - 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'TYPE' => 'PHONE', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; diff --git a/tests/Integration/Services/CRM/Activity/Service/BatchTest.php b/tests/Integration/Services/CRM/Activity/Service/BatchTest.php index f848cb7e..f2d32bd1 100644 --- a/tests/Integration/Services/CRM/Activity/Service/BatchTest.php +++ b/tests/Integration/Services/CRM/Activity/Service/BatchTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Activity\Service; @@ -8,6 +17,7 @@ use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\CRM\Activity\Service\Activity; use Bitrix24\SDK\Services\CRM\Contact\Service\Contact; +use Bitrix24\SDK\Tests\Builders\DemoDataGenerator; use Bitrix24\SDK\Tests\Integration\Fabric; use PHPUnit\Framework\TestCase; @@ -43,7 +53,7 @@ public function testBatchAdd(): void 'COMMUNICATIONS' => [ 0 => [ 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; @@ -89,7 +99,7 @@ public function testBatchDelete(): void 'COMMUNICATIONS' => [ 0 => [ 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; @@ -146,7 +156,7 @@ public function testBatchList(): void 'COMMUNICATIONS' => [ 0 => [ 'TYPE' => 'PHONE', - 'VALUE' => '+79780194444', + 'VALUE' => DemoDataGenerator::getMobilePhone()->getNationalNumber(), ], ], ]; diff --git a/tests/Integration/Services/CRM/Contact/Service/ContactBatchTest.php b/tests/Integration/Services/CRM/Contact/Service/ContactBatchTest.php index fafd8cb5..af252f53 100644 --- a/tests/Integration/Services/CRM/Contact/Service/ContactBatchTest.php +++ b/tests/Integration/Services/CRM/Contact/Service/ContactBatchTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Contact\Service; diff --git a/tests/Integration/Services/CRM/Contact/Service/ContactTest.php b/tests/Integration/Services/CRM/Contact/Service/ContactTest.php index 058555a1..425fe881 100644 --- a/tests/Integration/Services/CRM/Contact/Service/ContactTest.php +++ b/tests/Integration/Services/CRM/Contact/Service/ContactTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Contact\Service; @@ -10,7 +19,9 @@ use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\InstantMessengerValueType; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\PhoneValueType; use Bitrix24\SDK\Services\CRM\Common\Result\SystemFields\Types\WebsiteValueType; +use Bitrix24\SDK\Services\CRM\Contact\Result\ContactItemResult; use Bitrix24\SDK\Services\CRM\Contact\Service\Contact; +use Bitrix24\SDK\Tests\CustomAssertions\CustomBitrix24Assertions; use Bitrix24\SDK\Tests\Integration\Fabric; use PHPUnit\Framework\TestCase; use Bitrix24\SDK\Core; @@ -23,8 +34,10 @@ */ class ContactTest extends TestCase { - protected Contact $contactService; - protected Faker\Generator $faker; + use CustomBitrix24Assertions; + + private Contact $contactService; + private Faker\Generator $faker; /** * @throws BaseException @@ -56,6 +69,12 @@ public function testFields(): void self::assertIsArray($this->contactService->fields()->getFieldsDescription()); } + public function testAllSystemFieldsAnnotated(): void + { + $propListFromApi = (new Core\Fields\FieldsFilter())->filterSystemFields(array_keys($this->contactService->fields()->getFieldsDescription())); + $this->assertBitrix24AllResultItemFieldsAnnotated($propListFromApi, ContactItemResult::class); + } + /** * @throws BaseException * @throws TransportException @@ -203,7 +222,7 @@ public function testGetWebsite(): void 'WEB' => [ [ 'VALUE' => $url, - 'VALUE_TYPE' => WebsiteValueType::work, + 'VALUE_TYPE' => WebsiteValueType::work->name, ] ], ])->getId())->contact()->WEB[0]->VALUE); diff --git a/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldTest.php b/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldTest.php index 314ba302..13204f6c 100644 --- a/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldTest.php +++ b/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Contact\Service; diff --git a/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldUseCaseTest.php b/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldUseCaseTest.php index 0e0cfb53..e61f7ae3 100644 --- a/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldUseCaseTest.php +++ b/tests/Integration/Services/CRM/Contact/Service/ContactUserfieldUseCaseTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Contact\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/BatchTest.php b/tests/Integration/Services/CRM/Deal/Service/BatchTest.php index 08c19dbd..83aba611 100644 --- a/tests/Integration/Services/CRM/Deal/Service/BatchTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/BatchTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/DealCategoryStageTest.php b/tests/Integration/Services/CRM/Deal/Service/DealCategoryStageTest.php index 1d2066d3..cbe5aa81 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealCategoryStageTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealCategoryStageTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/DealCategoryTest.php b/tests/Integration/Services/CRM/Deal/Service/DealCategoryTest.php index 0507a601..1e5aea71 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealCategoryTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealCategoryTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/DealContactTest.php b/tests/Integration/Services/CRM/Deal/Service/DealContactTest.php index 8666e0ee..3c6da9a7 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealContactTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealContactTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/DealProductRowsTest.php b/tests/Integration/Services/CRM/Deal/Service/DealProductRowsTest.php index 2c286da0..a5b73daa 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealProductRowsTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealProductRowsTest.php @@ -1,29 +1,70 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; +use Money\Currencies\ISOCurrencies; +use Money\Currency; +use Money\Formatter\DecimalMoneyFormatter; +use Money\Money; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Services\CRM\Common\Result\DiscountType; +use Bitrix24\SDK\Services\CRM\Deal\Result\DealProductRowItemResult; use Bitrix24\SDK\Services\CRM\Deal\Service\Deal; use Bitrix24\SDK\Services\CRM\Deal\Service\DealProductRows; +use Bitrix24\SDK\Tests\Builders\DemoDataGenerator; use Bitrix24\SDK\Tests\Integration\Fabric; -use Money\Currencies\ISOCurrencies; -use Money\Currency; -use Money\Formatter\DecimalMoneyFormatter; -use Money\Money; +use MoneyPHP\Percentage\Percentage; use PHPUnit\Framework\TestCase; +use Typhoon\Reflection\TyphoonReflector; -/** - * Class DealsTest - * - * @package Bitrix24\SDK\Tests\Integration\Services\CRM\Deals\Service - */ class DealProductRowsTest extends TestCase { - protected Deal $dealService; - protected DealProductRows $dealProductRowsService; + private Deal $dealService; + private DealProductRows $dealProductRowsService; + private DecimalMoneyFormatter $decimalMoneyFormatter; + private TyphoonReflector $typhoonReflector; + + public function testAllSystemPropertiesAnnotated(): void + { + $dealId = $this->dealService->add(['TITLE' => 'test deal'])->getId(); + $this->dealProductRowsService->set( + $dealId, + [ + [ + 'PRODUCT_NAME' => sprintf('product name %s', time()), + 'PRICE' => $this->decimalMoneyFormatter->format(new Money(100000, DemoDataGenerator::getCurrency())), + ], + ] + ); + // get response from server with actual keys + $propListFromApi = array_keys($this->dealProductRowsService->get($dealId)->getCoreResponse()->getResponseData()->getResult()['result']['rows'][0]); + // parse keys from phpdoc annotation + $props = $this->typhoonReflector->reflectClass(DealProductRowItemResult::class)->properties(); + $propsFromAnnotations = []; + foreach ($props as $meta) { + if ($meta->isAnnotated() && !$meta->isNative()) { + $propsFromAnnotations[] = $meta->id->name; + } + } + + $this->assertEquals($propListFromApi, $propsFromAnnotations, + sprintf('in phpdocs annotations for class %s cant find fields from actual api response: %s', + DealProductRowItemResult::class, + implode(', ', array_values(array_diff($propListFromApi, $propsFromAnnotations))) + )); + } /** * @throws BaseException @@ -32,67 +73,65 @@ class DealProductRowsTest extends TestCase */ public function testSet(): void { - - $callCosts = new Money(1050, new Currency('USD')); - $currencies = new ISOCurrencies(); - - $moneyFormatter = new DecimalMoneyFormatter($currencies); - $newDealId = $this->dealService->add(['TITLE' => 'test deal'])->getId(); - $this::assertCount(5, $this->dealProductRowsService->get($newDealId)->getProductRows()); + $dealId = $this->dealService->add(['TITLE' => sprintf('test deal %s', time())])->getId(); + $deal = $this->dealService->get($dealId)->deal(); + $price = new Money(100000, $deal->CURRENCY_ID); + $discount = new Money(50012, $deal->CURRENCY_ID); $this::assertTrue( $this->dealProductRowsService->set( - $newDealId, + $dealId, [ [ - 'PRODUCT_NAME' => 'wine', - 'PRICE' => $moneyFormatter->format($callCosts), + 'PRODUCT_NAME' => sprintf('product name %s', time()), + 'PRICE' => $this->decimalMoneyFormatter->format($price), + 'DISCOUNT_TYPE_ID' => 1, + 'DISCOUNT_SUM' => $this->decimalMoneyFormatter->format($discount) ], ] )->isSuccess() ); - $this::assertCount(1, $this->dealProductRowsService->get($newDealId)->getProductRows()); - - + $productRows = $this->dealProductRowsService->get($dealId); + $this->assertCount(1, $productRows->getProductRows()); + $productRow = $productRows->getProductRows()[0]; + $this->assertEquals($price, $productRow->PRICE); + $this->assertEquals(DiscountType::monetary, $productRow->DISCOUNT_TYPE_ID); + $this->assertEquals($discount, $productRow->DISCOUNT_SUM); + $discount = $discount->multiply(100)->divide($this->decimalMoneyFormatter->format($price->add($discount))); + $calculatedPercentage = new Percentage((string)((int)$discount->getAmount() / 100)); + $this->assertEquals($calculatedPercentage, $productRow->DISCOUNT_RATE); } - /** - * @throws BaseException - * @throws TransportException - */ public function testGet(): void { - $callCosts = new Money(1050, new Currency('USD')); - $currencies = new ISOCurrencies(); - - $moneyFormatter = new DecimalMoneyFormatter($currencies); - $newDealId = $this->dealService->add(['TITLE' => 'test deal', 'CURRENCY_ID' => $callCosts->getCurrency()->getCode()])->getId(); + $dealId = $this->dealService->add(['TITLE' => sprintf('test deal %s', time())])->getId(); + $deal = $this->dealService->get($dealId)->deal(); + $price = new Money(100000, $deal->CURRENCY_ID); + $discount = new Money(0, $deal->CURRENCY_ID); $this::assertTrue( $this->dealProductRowsService->set( - $newDealId, + $dealId, [ [ - 'PRODUCT_NAME' => 'wine', - 'PRICE' => $moneyFormatter->format($callCosts), + 'PRODUCT_NAME' => sprintf('product name %s', time()), + 'PRICE' => $this->decimalMoneyFormatter->format($price), ], ] )->isSuccess() ); - $currency = $callCosts->getCurrency(); - - $resultWithoutAvailableCurrency = $this->dealProductRowsService->get($newDealId); - $resultWithAvailableCurrency = $this->dealProductRowsService->get($newDealId, $currency); - foreach ($resultWithoutAvailableCurrency->getProductRows() as $productRow) { - $this::assertEquals($callCosts, $productRow->PRICE); - } - foreach ($resultWithAvailableCurrency->getProductRows() as $productRow) { - $this::assertEquals($callCosts, $productRow->PRICE); - } + $productRows = $this->dealProductRowsService->get($dealId); + $this->assertCount(1, $productRows->getProductRows()); + $productRow = $productRows->getProductRows()[0]; + $this->assertEquals($price, $productRow->PRICE); + $this->assertEquals(DiscountType::percentage, $productRow->DISCOUNT_TYPE_ID); + $this->assertEquals($discount, $productRow->DISCOUNT_SUM); + $this->assertEquals(Percentage::zero(), $productRow->DISCOUNT_RATE); } public function setUp(): void { $this->dealService = Fabric::getServiceBuilder()->getCRMScope()->deal(); $this->dealProductRowsService = Fabric::getServiceBuilder()->getCRMScope()->dealProductRows(); - $this->core = Fabric::getCore(); + $this->decimalMoneyFormatter = new DecimalMoneyFormatter(new ISOCurrencies()); + $this->typhoonReflector = TyphoonReflector::build(); } } \ No newline at end of file diff --git a/tests/Integration/Services/CRM/Deal/Service/DealTest.php b/tests/Integration/Services/CRM/Deal/Service/DealTest.php index 527e32a8..09fe64a8 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/DealUserfieldTest.php b/tests/Integration/Services/CRM/Deal/Service/DealUserfieldTest.php index 3055e8bc..ff46e856 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealUserfieldTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealUserfieldTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Deal/Service/DealUserfieldUseCaseTest.php b/tests/Integration/Services/CRM/Deal/Service/DealUserfieldUseCaseTest.php index 88f9d1a1..4e90aa58 100644 --- a/tests/Integration/Services/CRM/Deal/Service/DealUserfieldUseCaseTest.php +++ b/tests/Integration/Services/CRM/Deal/Service/DealUserfieldUseCaseTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Deal\Service; diff --git a/tests/Integration/Services/CRM/Duplicates/Service/DuplicateTest.php b/tests/Integration/Services/CRM/Duplicates/Service/DuplicateTest.php index d2efa86f..18282c1f 100644 --- a/tests/Integration/Services/CRM/Duplicates/Service/DuplicateTest.php +++ b/tests/Integration/Services/CRM/Duplicates/Service/DuplicateTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Duplicates\Service; diff --git a/tests/Integration/Services/CRM/Lead/Service/BatchTest.php b/tests/Integration/Services/CRM/Lead/Service/BatchTest.php index 8792fab2..23bfd35c 100644 --- a/tests/Integration/Services/CRM/Lead/Service/BatchTest.php +++ b/tests/Integration/Services/CRM/Lead/Service/BatchTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Lead\Service; diff --git a/tests/Integration/Services/CRM/Lead/Service/LeadTest.php b/tests/Integration/Services/CRM/Lead/Service/LeadTest.php index 9891e483..83ba1381 100644 --- a/tests/Integration/Services/CRM/Lead/Service/LeadTest.php +++ b/tests/Integration/Services/CRM/Lead/Service/LeadTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Lead\Service; diff --git a/tests/Integration/Services/CRM/Products/Service/ProductsTest.php b/tests/Integration/Services/CRM/Products/Service/ProductsTest.php index 0e9223ba..be7cd637 100644 --- a/tests/Integration/Services/CRM/Products/Service/ProductsTest.php +++ b/tests/Integration/Services/CRM/Products/Service/ProductsTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Products\Service; diff --git a/tests/Integration/Services/CRM/Userfield/Service/UserfieldTest.php b/tests/Integration/Services/CRM/Userfield/Service/UserfieldTest.php index f1397ca5..b6391a3a 100644 --- a/tests/Integration/Services/CRM/Userfield/Service/UserfieldTest.php +++ b/tests/Integration/Services/CRM/Userfield/Service/UserfieldTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\CRM\Userfield\Service; diff --git a/tests/Integration/Services/Catalog/Catalog/Service/CatalogTest.php b/tests/Integration/Services/Catalog/Catalog/Service/CatalogTest.php index dc106b5b..47e03abb 100644 --- a/tests/Integration/Services/Catalog/Catalog/Service/CatalogTest.php +++ b/tests/Integration/Services/Catalog/Catalog/Service/CatalogTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Catalog\Catalog\Service; @@ -8,54 +17,47 @@ use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog; use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; +#[CoversClass(Catalog::class)] class CatalogTest extends TestCase { protected Catalog $service; /** - * Test the Fields method. - * - * @return void * @throws BaseException if there is a base exception occurred * @throws TransportException if there is a transport exception occurred - * @covers \Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog::fields - * @testdox Test Catalog::fields method */ + #[TestDox('Test Catalog::fields method')] public function testFields(): void { $this->assertIsArray($this->service->fields()->getFieldsDescription()); } /** - * Test the List method. - * - * @return void * @throws BaseException if there is a base exception occurred * @throws TransportException if there is a transport exception occurred - * @covers \Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog::list */ + #[TestDox('Test Catalog::list method')] public function testList(): void { $this->assertGreaterThan(1, $this->service->list([], [], [], 1)->getCatalogs()[0]->id); } /** - * Retrieves a catalog using the `get` method and asserts that the retrieved catalog's ID matches the original catalog's ID. - * - * @return void * @throws BaseException if there is a general exception. * @throws TransportException if there is an exception during transport. - * @covers \Bitrix24\SDK\Services\Catalog\Catalog\Service\Catalog::get */ + #[TestDox('Test Catalog::get method')] public function testGet(): void { $catalog = $this->service->list([], [], [], 1)->getCatalogs()[0]; $this->assertEquals($catalog->id, $this->service->get($catalog->id)->catalog()->id); } - public function setUp(): void + protected function setUp(): void { $this->service = Fabric::getServiceBuilder()->getCatalogScope()->catalog(); } diff --git a/tests/Integration/Services/Catalog/Product/Service/ProductTest.php b/tests/Integration/Services/Catalog/Product/Service/ProductTest.php index 5628390e..3e514c0f 100644 --- a/tests/Integration/Services/Catalog/Product/Service/ProductTest.php +++ b/tests/Integration/Services/Catalog/Product/Service/ProductTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Catalog\Product\Service; @@ -10,23 +19,22 @@ use Bitrix24\SDK\Services\Catalog\Common\ProductType; use Bitrix24\SDK\Services\Catalog\Product\Service\Product; use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\TestDox; +#[CoversClass(Product::class)] class ProductTest extends TestCase { protected Product $productService; + protected Catalog $catalogService; /** - * Tests the fieldsByFilter method. - * - * @return void - * * @throws BaseException * @throws TransportException - * @covers \Bitrix24\SDK\Services\Catalog\Product\Service\Product::fieldsByFilter - * @testdox test Product::fieldsByFilter */ + #[TestDox('test Product::fieldsByFilter')] public function testFieldsByFilter(): void { $iblockId = $this->catalogService->list([], [], [], 1)->getCatalogs()[0]->iblockId; @@ -37,13 +45,10 @@ public function testFieldsByFilter(): void } /** - * Adds a new product to the system and asserts that the product was added successfully. - * - * @return void * @throws BaseException If there is a base exception thrown during the product addition process. * @throws TransportException If there is a transport exception thrown during the product addition process. - * @covers Product::add() */ + #[TestDox('test Product::add')] public function testAdd(): void { $iblockId = $this->catalogService->list([], [], [], 1)->getCatalogs()[0]->iblockId; @@ -52,19 +57,16 @@ public function testAdd(): void 'name' => sprintf('test product name %s', time()), '' ]; - $result = $this->productService->add($fields); - $this->assertEquals($fields['name'], $result->product()->name); - $this->productService->delete($result->product()->id); + $productResult = $this->productService->add($fields); + $this->assertEquals($fields['name'], $productResult->product()->name); + $this->productService->delete($productResult->product()->id); } /** - * Retrieves a product from the system and asserts that the correct product was retrieved. - * - * @return void * @throws BaseException If there is a base exception thrown during the product retrieval process. * @throws TransportException If there is a transport exception thrown during the product retrieval process. - * @covers Product::get() */ + #[TestDox('test Product::get')] public function testGet(): void { $iblockId = $this->catalogService->list([], [], [], 1)->getCatalogs()[0]->iblockId; @@ -72,21 +74,19 @@ public function testGet(): void 'iblockId' => $iblockId, 'name' => sprintf('test product name %s', time()), ]; - $result = $this->productService->add($fields); - $productGet = $this->productService->get($result->product()->id); - $this->assertEquals($result->product()->id, $productGet->product()->id); + $productResult = $this->productService->add($fields); + $productGet = $this->productService->get($productResult->product()->id); + $this->assertEquals($productResult->product()->id, $productGet->product()->id); $this->productService->delete($productGet->product()->id); } /** * Deletes a product from the system and asserts that the product was deleted successfully. * - * @return void * @throws BaseException If there is a base exception thrown during the product deletion process. * @throws TransportException If there is a transport exception thrown during the product deletion process. - * @covers Product::delete() - * @testdox test Product::delete */ + #[TestDox('test Product::delete')] public function testDelete(): void { $iblockId = $this->catalogService->list([], [], [], 1)->getCatalogs()[0]->iblockId; @@ -94,12 +94,12 @@ public function testDelete(): void 'iblockId' => $iblockId, 'name' => sprintf('test product name %s', time()), ]; - $result = $this->productService->add($fields); - $productGet = $this->productService->get($result->product()->id); - $this->assertEquals($result->product()->id, $productGet->product()->id); + $productResult = $this->productService->add($fields); + $productGet = $this->productService->get($productResult->product()->id); + $this->assertEquals($productResult->product()->id, $productGet->product()->id); $this->productService->delete($productGet->product()->id); - $filteredProducts = $this->productService->list( + $productsResult = $this->productService->list( [ 'id', 'iblockId' @@ -113,17 +113,16 @@ public function testDelete(): void ], 1 ); - $this->assertCount(0, $filteredProducts->getProducts()); + $this->assertCount(0, $productsResult->getProducts()); } /** * Retrieves a list of products that match the specified filter criteria and asserts that the expected number of products is returned. * - * @return void * @throws BaseException If there is a base exception thrown during the process of listing products. * @throws TransportException If there is a transport exception thrown during the process of listing products. - * @covers Product::list() */ + #[TestDox('test Product::list')] public function testList():void { $iblockId = $this->catalogService->list([], [], [], 1)->getCatalogs()[0]->iblockId; @@ -131,10 +130,10 @@ public function testList():void 'iblockId' => $iblockId, 'name' => sprintf('test product name %s', time()), ]; - $result = $this->productService->add($fields); - $productGet = $this->productService->get($result->product()->id); - $this->assertEquals($result->product()->id, $productGet->product()->id); - $filteredProducts = $this->productService->list( + $productResult = $this->productService->add($fields); + $productGet = $this->productService->get($productResult->product()->id); + $this->assertEquals($productResult->product()->id, $productGet->product()->id); + $productsResult = $this->productService->list( [ 'id', 'iblockId' @@ -148,10 +147,10 @@ public function testList():void ], 1 ); - $this->assertCount(1, $filteredProducts->getProducts()); + $this->assertCount(1, $productsResult->getProducts()); } - public function setUp(): void + protected function setUp(): void { $this->productService = Fabric::getServiceBuilder()->getCatalogScope()->product(); $this->catalogService = Fabric::getServiceBuilder()->getCatalogScope()->catalog(); diff --git a/tests/Integration/Services/IM/Service/NotifyTest.php b/tests/Integration/Services/IM/Service/NotifyTest.php new file mode 100644 index 00000000..a90b42e3 --- /dev/null +++ b/tests/Integration/Services/IM/Service/NotifyTest.php @@ -0,0 +1,169 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Tests\Integration\Services\IM\Notify\Service; + +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Services\IM\Notify\Service\Notify; +use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; +use PHPUnit\Framework\TestCase; + +#[CoversClass(Notify::class)] +class NotifyTest extends TestCase +{ + private Notify $imNotifyService; + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test send notification from system')] + public function testFromSystem(): void + { + $addedItemResult = $this->imNotifyService->fromSystem( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message at %s', time()) + ); + $this->assertGreaterThan(0, $addedItemResult->getId()); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test send notification from personal')] + public function testFromPersonal(): void + { + $addedItemResult = $this->imNotifyService->fromPersonal( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message at %s', time()) + ); + $this->assertGreaterThan(0, $addedItemResult->getId()); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test delete notification')] + public function testDelete(): void + { + $addedItemResult = $this->imNotifyService->fromSystem( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message for delete at %s', time()) + ); + $this->assertGreaterThan(0, $addedItemResult->getId()); + $this->assertTrue($this->imNotifyService->delete($addedItemResult->getId())->isSuccess()); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test mark as read notification')] + public function testMarkAsRead(): void + { + $addedItemResult = $this->imNotifyService->fromSystem( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message for mark as read at %s', time()) + ); + $this->assertGreaterThan(0, $addedItemResult->getId()); + $this->assertTrue($this->imNotifyService->markAsRead($addedItemResult->getId())->isSuccess()); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test mark messages as read')] + public function testMarkMessagesAsRead(): void + { + $messageIds = []; + for ($i = 0; $i < 5; $i++) { + $messageIds[] = $this->imNotifyService->fromSystem( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message for mark as read at %s', time()) + )->getId(); + } + + $this->assertTrue($this->imNotifyService->markMessagesAsRead($messageIds)->isSuccess()); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test mark messages as unread')] + public function testMarkMessagesAsUnread(): void + { + $messageIds = []; + for ($i = 0; $i < 5; $i++) { + $messageIds[] = $this->imNotifyService->fromSystem( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message for mark as read at %s', time()) + )->getId(); + } + + $this->assertTrue($this->imNotifyService->markMessagesAsRead($messageIds)->isSuccess()); + $this->assertTrue($this->imNotifyService->markMessagesAsUnread($messageIds)->isSuccess()); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test mark messages as answered')] + public function testAnswer(): void + { + $addedItemResult = $this->imNotifyService->fromPersonal( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message at %s', time()) + ); + $this->assertGreaterThan(0, $addedItemResult->getId()); + + $this->imNotifyService->answer($addedItemResult->getId(), 'reply text'); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test Interaction with notification buttons')] + public function testConfirm(): void + { + $addedItemResult = $this->imNotifyService->fromPersonal( + (int)$this->imNotifyService->core->call('PROFILE')->getResponseData()->getResult()['ID'], + sprintf('Test message at %s', time()) + ); + $this->assertGreaterThan(0, $addedItemResult->getId()); + + $this->imNotifyService->confirm($addedItemResult->getId(), true); + } + + protected function setUp(): void + { + $this->imNotifyService = Fabric::getServiceBuilder()->getIMScope()->notify(); + } +} \ No newline at end of file diff --git a/tests/Integration/Services/IMOpenLines/Service/NetworkTest.php b/tests/Integration/Services/IMOpenLines/Service/NetworkTest.php index 80948a9e..9f3b564e 100644 --- a/tests/Integration/Services/IMOpenLines/Service/NetworkTest.php +++ b/tests/Integration/Services/IMOpenLines/Service/NetworkTest.php @@ -1,49 +1,59 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\IMOpenLines\Service; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\IMOpenLines\Service\Network; use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; +#[CoversClass(Network::class)] class NetworkTest extends TestCase { private Network $networkService; /** - * @covers \Bitrix24\SDK\Services\IMOpenLines\Service\Network::join - * @testdox test get agreements list - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[TestDox('test get agreements list')] public function testJoin(): void { - $res = $this->networkService->join(Fabric::getOpenLineCode()); - $this->assertGreaterThanOrEqual(1, $res->getId()); + $joinOpenLineResult = $this->networkService->join(Fabric::getOpenLineCode()); + $this->assertGreaterThanOrEqual(1, $joinOpenLineResult->getId()); } /** - * @covers \Bitrix24\SDK\Services\IMOpenLines\Service\Network::join - * @testdox test get agreements list - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[TestDox('test get agreements list')] public function testMessageAdd(): void { - $res = $this->networkService->messageAdd( + $addedMessageItemResult = $this->networkService->messageAdd( Fabric::getOpenLineCode(), (int)$this->networkService->core->call('PROFILE')->getResponseData()->getResult()['ID'], sprintf('Test message at %s', time()) ); - $this->assertTrue($res->isSuccess()); + $this->assertTrue($addedMessageItemResult->isSuccess()); } - public function setUp(): void + protected function setUp(): void { $this->networkService = Fabric::getServiceBuilder()->getIMOpenLinesScope()->Network(); } diff --git a/tests/Integration/Services/Main/Service/MainTest.php b/tests/Integration/Services/Main/Service/MainTest.php index d4bd3adc..09100776 100644 --- a/tests/Integration/Services/Main/Service/MainTest.php +++ b/tests/Integration/Services/Main/Service/MainTest.php @@ -1,23 +1,36 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Main\Service; use Bitrix24\SDK\Core\Credentials\Scope; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException; use Bitrix24\SDK\Services\Main\Service\Main; use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; +#[CoversClass(Main::class)] class MainTest extends TestCase { private Main $mainService; /** - * @covers \Bitrix24\SDK\Services\Main\Service\Main::getServerTime - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function testGetServerTime(): void { @@ -26,22 +39,18 @@ public function testGetServerTime(): void } /** - * @covers \Bitrix24\SDK\Services\Main\Service\Main::getCurrentUserProfile - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function testGetCurrentUserProfile(): void { - $profile = $this->mainService->getCurrentUserProfile()->getUserProfile(); - $this->assertTrue($profile->ADMIN); + $userProfileItemResult = $this->mainService->getCurrentUserProfile()->getUserProfile(); + $this->assertTrue($userProfileItemResult->ADMIN); } /** - * @covers \Bitrix24\SDK\Services\Main\Service\Main::isCurrentUserHasAdminRights - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function testIsUserIsAdmin(): void { @@ -49,10 +58,8 @@ public function testIsUserIsAdmin(): void } /** - * @covers \Bitrix24\SDK\Services\Main\Service\Main::getMethodAffordability - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function testMethodGetInformationForNonExistsMethod(): void { @@ -61,10 +68,8 @@ public function testMethodGetInformationForNonExistsMethod(): void } /** - * @covers \Bitrix24\SDK\Services\Main\Service\Main::getApplicationInfo - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ public function testApplicationInfo(): void { @@ -72,10 +77,9 @@ public function testApplicationInfo(): void } /** - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException - * @throws \Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException + * @throws BaseException + * @throws TransportException + * @throws UnknownScopeCodeException */ public function testGetAvailableScope(): void { @@ -84,10 +88,9 @@ public function testGetAvailableScope(): void } /** - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException - * @throws \Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException + * @throws BaseException + * @throws TransportException + * @throws UnknownScopeCodeException */ public function testGetCurrentScope(): void { @@ -98,18 +101,16 @@ public function testGetCurrentScope(): void } /** - * @covers \Bitrix24\SDK\Services\Main\Service\Main::getAvailableMethods - * @testdox test methods list - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[TestDox('test methods list')] public function testGetAvailableMethods(): void { $this->assertIsArray($this->mainService->getAvailableMethods()->getResponseData()->getResult()); } - public function setUp(): void + protected function setUp(): void { $this->mainService = Fabric::getServiceBuilder()->getMainScope()->main(); } diff --git a/tests/Integration/Services/Placement/Service/PlacementTest.php b/tests/Integration/Services/Placement/Service/PlacementTest.php new file mode 100644 index 00000000..69714442 --- /dev/null +++ b/tests/Integration/Services/Placement/Service/PlacementTest.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace Bitrix24\SDK\Tests\Integration\Services\Placement\Service; + +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; +use Bitrix24\SDK\Services\IM\Notify\Service\Notify; +use Bitrix24\SDK\Services\IMOpenLines\Service\Network; +use Bitrix24\SDK\Services\Placement\Result\PlacementLocationItemResult; +use Bitrix24\SDK\Services\Placement\Service\Placement; +use Bitrix24\SDK\Services\Placement\Service\PlacementLocationCode; +use Bitrix24\SDK\Services\Telephony\Call\Service\Call; +use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Test; +use PHPUnit\Framework\Attributes\TestDox; +use PHPUnit\Framework\TestCase; + +#[CoversClass(Placement::class)] +class PlacementTest extends TestCase +{ + private Placement $placementService; + + #[Test] + #[TestDox('Test method bind')] + public function testBind(): void + { + /** + * @var PlacementLocationItemResult[] $placements + */ + $placements = $this->placementService->get()->getPlacementsLocationInformation(); + foreach ($placements as $placement) { + $this->assertGreaterThanOrEqual(0, $this->placementService->unbind($placement->placement)->getDeletedPlacementHandlersCount()); + } + + $placementBindResult = $this->placementService->bind( + PlacementLocationCode::CRM_CONTACT_DETAIL_TAB, + 'https://bitrix24test.com', [ + 'en' => [ + 'TITLE' => 'test app' + ] + ]); + $this->assertTrue($placementBindResult->isSuccess()); + $placement = $this->placementService->get()->getPlacementsLocationInformation()[0]; + $this->assertEquals(PlacementLocationCode::CRM_CONTACT_DETAIL_TAB, $placement->placement); + $this->placementService->unbind(PlacementLocationCode::CRM_CONTACT_DETAIL_TAB)->getDeletedPlacementHandlersCount(); + } + + #[Test] + #[TestDox('Test method unbind')] + public function testUnbind(): void + { + /** + * @var PlacementLocationItemResult[] $placements + */ + $placements = $this->placementService->get()->getPlacementsLocationInformation(); + foreach ($placements as $placement) { + $this->assertGreaterThanOrEqual(0, $this->placementService->unbind($placement->placement)->getDeletedPlacementHandlersCount()); + } + + $placementBindResult = $this->placementService->bind( + PlacementLocationCode::CRM_CONTACT_DETAIL_TAB, + 'https://bitrix24test.com', [ + 'en' => [ + 'TITLE' => 'test app' + ] + ]); + $this->assertTrue($placementBindResult->isSuccess()); + $placement = $this->placementService->get()->getPlacementsLocationInformation()[0]; + $this->assertEquals(PlacementLocationCode::CRM_CONTACT_DETAIL_TAB, $placement->placement); + + $this->placementService->unbind(PlacementLocationCode::CRM_CONTACT_DETAIL_TAB)->getDeletedPlacementHandlersCount(); + + } + + #[Test] + #[TestDox('Test method get')] + public function testGet(): void + { + $placementsLocationInformationResult = $this->placementService->get(); + $this->assertGreaterThanOrEqual(0, count($placementsLocationInformationResult->getPlacementsLocationInformation())); + } + + /** + * @throws BaseException + * @throws TransportException + */ + #[Test] + #[TestDox('Test method list')] + public function testList(): void + { + $placementLocationCodesResult = $this->placementService->list(); + $this->assertGreaterThanOrEqual(0, count($placementLocationCodesResult->getLocationCodes())); + } + + protected function setUp(): void + { + $this->placementService = Fabric::getServiceBuilder(true)->getPlacementScope()->placement(); + } +} \ No newline at end of file diff --git a/tests/Integration/Services/Telephony/Call/Service/CallTest.php b/tests/Integration/Services/Telephony/Call/Service/CallTest.php index 51ebcac9..e1383fca 100644 --- a/tests/Integration/Services/Telephony/Call/Service/CallTest.php +++ b/tests/Integration/Services/Telephony/Call/Service/CallTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Call\Service; diff --git a/tests/Integration/Services/Telephony/ExternalCall/Service/ExternalCallTest.php b/tests/Integration/Services/Telephony/ExternalCall/Service/ExternalCallTest.php index a25f0cf7..6968f76e 100644 --- a/tests/Integration/Services/Telephony/ExternalCall/Service/ExternalCallTest.php +++ b/tests/Integration/Services/Telephony/ExternalCall/Service/ExternalCallTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\ExternalCall\Service; diff --git a/tests/Integration/Services/Telephony/ExternalLine/Service/ExternalLineTest.php b/tests/Integration/Services/Telephony/ExternalLine/Service/ExternalLineTest.php index 113c2171..e89edda0 100644 --- a/tests/Integration/Services/Telephony/ExternalLine/Service/ExternalLineTest.php +++ b/tests/Integration/Services/Telephony/ExternalLine/Service/ExternalLineTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\ExternalLine\Service; diff --git a/tests/Integration/Services/Telephony/Voximplant/InfoCall/Service/InfoCallTest.php b/tests/Integration/Services/Telephony/Voximplant/InfoCall/Service/InfoCallTest.php index 0785e5ff..dd08922e 100644 --- a/tests/Integration/Services/Telephony/Voximplant/InfoCall/Service/InfoCallTest.php +++ b/tests/Integration/Services/Telephony/Voximplant/InfoCall/Service/InfoCallTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Voximplant\InfoCall\Service; diff --git a/tests/Integration/Services/Telephony/Voximplant/Line/Service/LineTest.php b/tests/Integration/Services/Telephony/Voximplant/Line/Service/LineTest.php index 0fec82a9..d038867a 100644 --- a/tests/Integration/Services/Telephony/Voximplant/Line/Service/LineTest.php +++ b/tests/Integration/Services/Telephony/Voximplant/Line/Service/LineTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Voximplant\Line\Service; diff --git a/tests/Integration/Services/Telephony/Voximplant/Sip/SipTest.php b/tests/Integration/Services/Telephony/Voximplant/Sip/SipTest.php index 2d55c0e1..ed790441 100644 --- a/tests/Integration/Services/Telephony/Voximplant/Sip/SipTest.php +++ b/tests/Integration/Services/Telephony/Voximplant/Sip/SipTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Voximplant\Sip; diff --git a/tests/Integration/Services/Telephony/Voximplant/TTS/Voices/Service/VoicesTest.php b/tests/Integration/Services/Telephony/Voximplant/TTS/Voices/Service/VoicesTest.php index 3d0c1649..1d7a47de 100644 --- a/tests/Integration/Services/Telephony/Voximplant/TTS/Voices/Service/VoicesTest.php +++ b/tests/Integration/Services/Telephony/Voximplant/TTS/Voices/Service/VoicesTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Voximplant\TTS\Voices\Service; diff --git a/tests/Integration/Services/Telephony/Voximplant/Url/Service/UrlTest.php b/tests/Integration/Services/Telephony/Voximplant/Url/Service/UrlTest.php index 8f6eedb9..70271de7 100644 --- a/tests/Integration/Services/Telephony/Voximplant/Url/Service/UrlTest.php +++ b/tests/Integration/Services/Telephony/Voximplant/Url/Service/UrlTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Voximplant\Url\Service; diff --git a/tests/Integration/Services/Telephony/Voximplant/User/UserTest.php b/tests/Integration/Services/Telephony/Voximplant/User/UserTest.php index 0b1f9540..2245f5cb 100644 --- a/tests/Integration/Services/Telephony/Voximplant/User/UserTest.php +++ b/tests/Integration/Services/Telephony/Voximplant/User/UserTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\Telephony\Voximplant\User; diff --git a/tests/Integration/Services/User/Service/UserTest.php b/tests/Integration/Services/User/Service/UserTest.php index 8e9931fe..ea98df75 100644 --- a/tests/Integration/Services/User/Service/UserTest.php +++ b/tests/Integration/Services/User/Service/UserTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\User\Service; diff --git a/tests/Integration/Services/UserConsent/Service/UserConsentAgreementTest.php b/tests/Integration/Services/UserConsent/Service/UserConsentAgreementTest.php index 3f694869..bb4c93dd 100644 --- a/tests/Integration/Services/UserConsent/Service/UserConsentAgreementTest.php +++ b/tests/Integration/Services/UserConsent/Service/UserConsentAgreementTest.php @@ -1,11 +1,23 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\UserConsent\Service; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\UserConsent\Service\UserConsentAgreement; use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; class UserConsentAgreementTest extends TestCase @@ -13,45 +25,42 @@ class UserConsentAgreementTest extends TestCase private UserConsentAgreement $userConsentAgreementService; /** - * @covers UserConsentAgreement::list - * @testdox test get agreements list - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[TestDox('test get agreements list')] public function testList(): void { $this->assertIsArray($this->userConsentAgreementService->list()->getAgreements()); } /** - * @covers UserConsentAgreement::text - * @testdox test get agreements list - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[TestDox('test get agreements list')] public function testText(): void { // get agreement id $agreements = $this->userConsentAgreementService->list()->getAgreements(); // empty agreement list - if (count($agreements) === 0) { + if ($agreements === []) { $this->assertTrue(true); return; } + $agreementId = $agreements[0]->ID; - $agreementText = $this->userConsentAgreementService->text($agreementId, [ + $userConsentAgreementTextItemResult = $this->userConsentAgreementService->text($agreementId, [ 'button_caption' => 'Button call to action title', 'fields' => 'fields collection: email, phone', ])->text(); - $this->assertNotNull($agreementText->TEXT); - $this->assertNotNull($agreementText->LABEL); + $this->assertNotNull($userConsentAgreementTextItemResult->TEXT); + $this->assertNotNull($userConsentAgreementTextItemResult->LABEL); } - public function setUp(): void + protected function setUp(): void { $this->userConsentAgreementService = Fabric::getServiceBuilder()->getUserConsentScope()->UserConsentAgreement(); } diff --git a/tests/Integration/Services/UserConsent/Service/UserConsentTest.php b/tests/Integration/Services/UserConsent/Service/UserConsentTest.php index 7759a6a2..e52cf207 100644 --- a/tests/Integration/Services/UserConsent/Service/UserConsentTest.php +++ b/tests/Integration/Services/UserConsent/Service/UserConsentTest.php @@ -1,39 +1,50 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Services\UserConsent\Service; +use Bitrix24\SDK\Core\Exceptions\BaseException; +use Bitrix24\SDK\Core\Exceptions\TransportException; use Bitrix24\SDK\Services\UserConsent\Service\UserConsent; use Bitrix24\SDK\Services\UserConsent\Service\UserConsentAgreement; use Bitrix24\SDK\Tests\Integration\Fabric; +use PHPUnit\Framework\Attributes\TestDox; use PHPUnit\Framework\TestCase; class UserConsentTest extends TestCase { private UserConsent $userConsentService; + private UserConsentAgreement $userConsentAgreementService; /** - * @covers UserConsent::add - * @testdox test get agreements list - * @return void - * @throws \Bitrix24\SDK\Core\Exceptions\BaseException - * @throws \Bitrix24\SDK\Core\Exceptions\TransportException + * @throws BaseException + * @throws TransportException */ + #[TestDox('test get agreements list')] public function testAdd(): void { // get agreement id $agreements = $this->userConsentAgreementService->list()->getAgreements(); // empty agreement list - if (count($agreements) === 0) { + if ($agreements === []) { $this->assertTrue(true); return; } $agreementId = $agreements[0]->ID; - $res = $this->userConsentService->add( + $addedItemResult = $this->userConsentService->add( [ 'agreement_id' => $agreementId, 'ip' => '127.0.0.1', @@ -41,10 +52,10 @@ public function testAdd(): void 'originator_id' => 'test@gmail.com', ] ); - $this->assertIsInt($res->getId()); + $this->assertIsInt($addedItemResult->getId()); } - public function setUp(): void + protected function setUp(): void { $this->userConsentService = Fabric::getServiceBuilder()->getUserConsentScope()->UserConsent(); $this->userConsentAgreementService = Fabric::getServiceBuilder()->getUserConsentScope()->UserConsentAgreement(); diff --git a/tests/Temp/OperatingTimingTest.php b/tests/Temp/OperatingTimingTest.php index 50ffbb87..35f48267 100644 --- a/tests/Temp/OperatingTimingTest.php +++ b/tests/Temp/OperatingTimingTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Integration\Core; @@ -27,12 +36,12 @@ class OperatingTimingTest extends TestCase */ public function testOperatingTiming(): void { - // С версии модуля Rest 22.0.0 в облачной версии Битрикс24 во всех ответах rest запросов в массиве time с - // дополнительной информацией о времени выполнения запроса добавлен дополнительный ключ operating, который - // говорит о времени выполнения запроса к методу конкретным приложением. Данные о времени выполнения запросов к - // методу суммируются. При превышении времени выполнения запросов сверх 480 секунд в рамках прошедших 10 минут - // данный метод блокируется для приложения. При этом все остальные методы продолжают работать. - // Ключ operating_reset_at возвращает timestamp в которое будет высвобождена часть лимита на данный метод. + // Since the Rest module version 22.0.0 in the cloud version of Bitrix24 in all rest request responses in the time array with + // with additional information about the request execution time, an additional operating key has been added, which + // talks about the execution time of a request to a method by a specific application. Query execution time data + // the method is summed up. If the query execution time exceeds 480 seconds within the past 10 minutes + // this method is blocked for the application. However, all other methods continue to work. + // The operating_reset_at key returns the timestamp at which part of the limit for this method will be released. //example: //911 |operating 74.438894271851 |cur_time 2023-04-15 16:56:46 |op_reset_at 1681567606 → 2023-04-15 14:06:46 @@ -46,9 +55,9 @@ public function testOperatingTiming(): void // $contactsToUpdate = $this->getContactsUpdateCommand(15000); // // -// //todo считать количество контактов для обновления и считать количество контактов которые обновили, если не совпало, то падаем с ошибкой -// -// // обновляем контакты в батч-режиме +// //todo count the number of contacts to update and count the number of contacts that were updated, if it doesn’t match, then we crash with an error + + // $cnt = 0; // foreach ($this->contactService->batch->update($contactsToUpdate) as $b24ContactId => $contactUpdateResult) { // $cnt++; @@ -71,11 +80,9 @@ public function testOperatingTiming(): void // sprintf('updated contacts count %s not equal to expected %s cmd items', $cnt, count($contactsToUpdate)) // ); - // шаг 1 - выброс корректного исключения, что мол упали из за блокировки метода - // проблемы: - можно потерять часть данных при обновлении, т.к. мы не знаем, какие контакты в клиентском коде обновились, а какие нет или знаем? - -// todo уточнение, по возможности возвращать в исключении остаток данных, которые не успели обновиться - + // step 1 - throwing a correct exception, saying that the method failed because the method was blocked + // problems: - you can lose some data when updating, because We don’t know which contacts in the client code have been updated and which ones haven’t, or do we know? + // todo clarification, if possible, return in an exception the remainder of the data that has not yet been updated //[2023-04-15T14:17:57.881428+00:00] integration-test.INFO: getResponseData.responseBody {"responseBody": //{"result": //{ @@ -110,10 +117,9 @@ public function testOperatingTiming(): void //[2023-04-15T14:37:47.371279+00:00] integration-test.DEBUG: handleApiLevelErrors.start [] {"file":"/Users/mesilov/work/msk03-dev/loyalty/bitrix24-php-sdk/src/Core/Response/Response.php","line":152,"class":"Bitrix24\\SDK\\Core\\Response\\Response","function":"handleApiLevelErrors","memory_usage":"36 MB"} - // шаг 2 - сделать отдельные стратегии с логикой для батча и придумать, как может быть - // - 2.1 ожидание разблокировки метода без завершения работы батча, т.е. скрипт будет висеть 10 минут, потом попробует продолжить работу, такое можно делать толкьо осознавая последсвия - // - 2.2 выброс события \ вызов обработчика за N секунд до блокировки метода, т.е делегируем логику обработки в клиентский код - + // step 2 - make separate strategies with logic for the batch and figure out how it could be + // - 2.1 waiting for the method to be unlocked without completing the batch, i.e. the script will hang for 10 minutes, then try to continue working, this can only be done if you are aware of the consequences + // - 2.2 event release \ handler call N seconds before the method is blocked, i.e. we delegate the processing logic to the client code } diff --git a/tests/Unit/Application/ApplicationStatusTest.php b/tests/Unit/Application/ApplicationStatusTest.php index 857f7f00..b83a60e9 100644 --- a/tests/Unit/Application/ApplicationStatusTest.php +++ b/tests/Unit/Application/ApplicationStatusTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application; diff --git a/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceReferenceImplementationTest.php b/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceReferenceImplementationTest.php index e7f8a3d4..044ae6ee 100644 --- a/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceReferenceImplementationTest.php +++ b/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationInterfaceReferenceImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ApplicationInstallations\Entity; diff --git a/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationReferenceEntityImplementation.php b/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationReferenceEntityImplementation.php index 3bb4165e..9245e287 100644 --- a/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationReferenceEntityImplementation.php +++ b/tests/Unit/Application/Contracts/ApplicationInstallations/Entity/ApplicationInstallationReferenceEntityImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ApplicationInstallations\Entity; diff --git a/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementation.php b/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementation.php index c8308294..112fa944 100644 --- a/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementation.php +++ b/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ApplicationInstallations\Repository; diff --git a/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementationTest.php b/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementationTest.php index be5849a3..45a8bd8d 100644 --- a/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementationTest.php +++ b/tests/Unit/Application/Contracts/ApplicationInstallations/Repository/InMemoryApplicationInstallationRepositoryImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ApplicationInstallations\Repository; diff --git a/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceReferenceImplementationTest.php b/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceReferenceImplementationTest.php index d2135df7..a6fa96be 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceReferenceImplementationTest.php +++ b/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountInterfaceReferenceImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Accounts\Entity; diff --git a/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountReferenceEntityImplementation.php b/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountReferenceEntityImplementation.php index 84afef59..e441c11d 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountReferenceEntityImplementation.php +++ b/tests/Unit/Application/Contracts/Bitrix24Accounts/Entity/Bitrix24AccountReferenceEntityImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Accounts\Entity; diff --git a/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementation.php b/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementation.php index eb790fa0..b8a3ab66 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementation.php +++ b/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Accounts\Repository; diff --git a/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementationTest.php b/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementationTest.php index 42ae95b9..689a6a54 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementationTest.php +++ b/tests/Unit/Application/Contracts/Bitrix24Accounts/Repository/InMemoryBitrix24AccountRepositoryImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Accounts\Repository; diff --git a/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceReferenceImplementationTest.php b/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceReferenceImplementationTest.php index 03fc12f0..ff52fb38 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceReferenceImplementationTest.php +++ b/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerInterfaceReferenceImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Partners\Entity; diff --git a/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerReferenceEntityImplementation.php b/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerReferenceEntityImplementation.php index 7bc6e4fe..4684f69d 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerReferenceEntityImplementation.php +++ b/tests/Unit/Application/Contracts/Bitrix24Partners/Entity/Bitrix24PartnerReferenceEntityImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Partners\Entity; diff --git a/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementation.php b/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementation.php index bd5133c2..ca6fc91f 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementation.php +++ b/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Partners\Repository; diff --git a/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementationTest.php b/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementationTest.php index a3d822ea..29536918 100644 --- a/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementationTest.php +++ b/tests/Unit/Application/Contracts/Bitrix24Partners/Repository/InMemoryBitrix24PartnerRepositoryImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\Bitrix24Partners\Repository; diff --git a/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceReferenceImplementationTest.php b/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceReferenceImplementationTest.php index 3f3f70d0..58032148 100644 --- a/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceReferenceImplementationTest.php +++ b/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonInterfaceReferenceImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ContactPersons\Entity; diff --git a/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonReferenceEntityImplementation.php b/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonReferenceEntityImplementation.php index 411efed6..2a72c5ac 100644 --- a/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonReferenceEntityImplementation.php +++ b/tests/Unit/Application/Contracts/ContactPersons/Entity/ContactPersonReferenceEntityImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ContactPersons\Entity; diff --git a/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementation.php b/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementation.php index 7da6f27e..6d710b7a 100644 --- a/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementation.php +++ b/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementation.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ContactPersons\Repository; diff --git a/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementationTest.php b/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementationTest.php index f0bd3836..3c4ed448 100644 --- a/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementationTest.php +++ b/tests/Unit/Application/Contracts/ContactPersons/Repository/InMemoryContactPersonRepositoryImplementationTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Application\Contracts\ContactPersons\Repository; diff --git a/tests/Unit/Core/ApiLevelErrorHandlerTest.php b/tests/Unit/Core/ApiLevelErrorHandlerTest.php index b49b8ba4..63c5b20e 100644 --- a/tests/Unit/Core/ApiLevelErrorHandlerTest.php +++ b/tests/Unit/Core/ApiLevelErrorHandlerTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core; diff --git a/tests/Unit/Core/CoreBuilderTest.php b/tests/Unit/Core/CoreBuilderTest.php index 19ba5b02..c7926e5e 100644 --- a/tests/Unit/Core/CoreBuilderTest.php +++ b/tests/Unit/Core/CoreBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core; diff --git a/tests/Unit/Core/Credentials/ApplicationProfileTest.php b/tests/Unit/Core/Credentials/ApplicationProfileTest.php index 637c3588..823ef7fa 100644 --- a/tests/Unit/Core/Credentials/ApplicationProfileTest.php +++ b/tests/Unit/Core/Credentials/ApplicationProfileTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core\Credentials; diff --git a/tests/Unit/Core/Credentials/CredentialsTest.php b/tests/Unit/Core/Credentials/CredentialsTest.php index c81a7de0..5085fa59 100644 --- a/tests/Unit/Core/Credentials/CredentialsTest.php +++ b/tests/Unit/Core/Credentials/CredentialsTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core\Credentials; diff --git a/tests/Unit/Core/Credentials/ScopeTest.php b/tests/Unit/Core/Credentials/ScopeTest.php index ab789cea..96cbdb9a 100644 --- a/tests/Unit/Core/Credentials/ScopeTest.php +++ b/tests/Unit/Core/Credentials/ScopeTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core\Credentials; diff --git a/tests/Unit/Core/Credentials/WebhookUrlTest.php b/tests/Unit/Core/Credentials/WebhookUrlTest.php index 318abec6..0342277c 100644 --- a/tests/Unit/Core/Credentials/WebhookUrlTest.php +++ b/tests/Unit/Core/Credentials/WebhookUrlTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core\Credentials; diff --git a/tests/Unit/Core/Response/DTO/TimeTest.php b/tests/Unit/Core/Response/DTO/TimeTest.php index 34a4585b..fee29aef 100644 --- a/tests/Unit/Core/Response/DTO/TimeTest.php +++ b/tests/Unit/Core/Response/DTO/TimeTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core\Response\DTO; @@ -23,14 +32,14 @@ public function testInitFromResponseData(array $result): void { $time = Time::initFromResponse($result); - $this->assertEquals($result['start'], $time->getStart()); - $this->assertEquals($result['finish'], $time->getFinish()); - $this->assertEquals($result['duration'], $time->getDuration()); - $this->assertEquals($result['processing'], $time->getProcessing()); - $this->assertEquals($result['operating'], $time->getOperating()); - $this->assertEquals($result['operating_reset_at'], $time->getOperatingResetAt()); - $this->assertEquals($result['date_start'], $time->getDateStart()->format(\DATE_ATOM)); - $this->assertEquals($result['date_finish'], $time->getDateFinish()->format(\DATE_ATOM)); + $this->assertEquals($result['start'], $time->start); + $this->assertEquals($result['finish'], $time->finish); + $this->assertEquals($result['duration'], $time->duration); + $this->assertEquals($result['processing'], $time->processing); + $this->assertEquals($result['operating'], $time->operating); + $this->assertEquals($result['operating_reset_at'], $time->operatingResetAt); + $this->assertEquals($result['date_start'], $time->dateStart->format(\DATE_ATOM)); + $this->assertEquals($result['date_finish'], $time->dateFinish->format(\DATE_ATOM)); } public static function timingsDataProvider(): Generator diff --git a/tests/Unit/Core/Result/AbstractItemTest.php b/tests/Unit/Core/Result/AbstractItemTest.php index 6d9608de..6468cb85 100644 --- a/tests/Unit/Core/Result/AbstractItemTest.php +++ b/tests/Unit/Core/Result/AbstractItemTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Core\Result; diff --git a/tests/Unit/Infrastructure/HttpClient/RequestId/DefaultRequestIdGeneratorTest.php b/tests/Unit/Infrastructure/HttpClient/RequestId/DefaultRequestIdGeneratorTest.php index 8da0bb9d..6946ec71 100644 --- a/tests/Unit/Infrastructure/HttpClient/RequestId/DefaultRequestIdGeneratorTest.php +++ b/tests/Unit/Infrastructure/HttpClient/RequestId/DefaultRequestIdGeneratorTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Infrastructure\HttpClient\RequestId; diff --git a/tests/Unit/Services/CRM/CRMServiceBuilderTest.php b/tests/Unit/Services/CRM/CRMServiceBuilderTest.php index 91a29bca..e7819d61 100644 --- a/tests/Unit/Services/CRM/CRMServiceBuilderTest.php +++ b/tests/Unit/Services/CRM/CRMServiceBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Services\CRM; diff --git a/tests/Unit/Services/IM/IMServiceBuilderTest.php b/tests/Unit/Services/IM/IMServiceBuilderTest.php index 27b5bc8a..7124e058 100644 --- a/tests/Unit/Services/IM/IMServiceBuilderTest.php +++ b/tests/Unit/Services/IM/IMServiceBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Services\IM; @@ -9,22 +18,18 @@ use Bitrix24\SDK\Tests\Unit\Stubs\NullBatch; use Bitrix24\SDK\Tests\Unit\Stubs\NullBulkItemsReader; use Bitrix24\SDK\Tests\Unit\Stubs\NullCore; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; -/** - * Class IMServiceBuilderTest - * - * @package Bitrix24\SDK\Tests\Unit\Services\IM - */ -#[\PHPUnit\Framework\Attributes\CoversClass(\Bitrix24\SDK\Services\IM\IMServiceBuilder::class)] +#[CoversClass(IMServiceBuilder::class)] class IMServiceBuilderTest extends TestCase { private IMServiceBuilder $serviceBuilder; public function testGetIMService(): void { - $this->serviceBuilder->IM(); + $this->serviceBuilder->notify(); $this::assertTrue(true); } diff --git a/tests/Unit/Services/Main/MainServiceBuilderTest.php b/tests/Unit/Services/Main/MainServiceBuilderTest.php index 255207b5..eb6487e4 100644 --- a/tests/Unit/Services/Main/MainServiceBuilderTest.php +++ b/tests/Unit/Services/Main/MainServiceBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Services\Main; diff --git a/tests/Unit/Services/ServiceBuilderTest.php b/tests/Unit/Services/ServiceBuilderTest.php index f50cfb00..698e1ec4 100644 --- a/tests/Unit/Services/ServiceBuilderTest.php +++ b/tests/Unit/Services/ServiceBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Services; diff --git a/tests/Unit/Stubs/NullBatch.php b/tests/Unit/Stubs/NullBatch.php index fc6b0a7c..8b28d0c8 100644 --- a/tests/Unit/Stubs/NullBatch.php +++ b/tests/Unit/Stubs/NullBatch.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Stubs; @@ -9,7 +18,7 @@ use Bitrix24\SDK\Core\Response\DTO\Pagination; use Bitrix24\SDK\Core\Response\DTO\ResponseData; use Bitrix24\SDK\Core\Response\DTO\Time; -use DateTimeImmutable; +use Carbon\CarbonImmutable; use Generator; class NullBatch implements BatchOperationsInterface @@ -41,7 +50,7 @@ public function getTraversableListWithCount( */ public function addEntityItems(string $apiMethod, array $entityItems): Generator { - yield new ResponseData([],new Time(0,0,0,0,0, new DateTimeImmutable(),new DateTimeImmutable(),0,),new Pagination()); + yield new ResponseData([],new Time(0,0,0,0,0, new CarbonImmutable(),new CarbonImmutable(),0,),new Pagination()); } /** @@ -49,7 +58,7 @@ public function addEntityItems(string $apiMethod, array $entityItems): Generator */ public function deleteEntityItems(string $apiMethod, array $entityItemId): Generator { - yield new ResponseData([],new Time(0,0,0,0,0, new DateTimeImmutable(),new DateTimeImmutable(),0,),new Pagination()); + yield new ResponseData([],new Time(0,0,0,0,0, new CarbonImmutable(),new CarbonImmutable(),0,),new Pagination()); } /** @@ -57,6 +66,6 @@ public function deleteEntityItems(string $apiMethod, array $entityItemId): Gener */ public function updateEntityItems(string $apiMethod, array $entityItems): Generator { - yield new ResponseData([],new Time(0,0,0,0,0, new DateTimeImmutable(),new DateTimeImmutable(),0,),new Pagination()); + yield new ResponseData([],new Time(0,0,0,0,0, new CarbonImmutable(),new CarbonImmutable(),0,),new Pagination()); } } \ No newline at end of file diff --git a/tests/Unit/Stubs/NullBulkItemsReader.php b/tests/Unit/Stubs/NullBulkItemsReader.php index 9f2b8500..5548be03 100644 --- a/tests/Unit/Stubs/NullBulkItemsReader.php +++ b/tests/Unit/Stubs/NullBulkItemsReader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Stubs; diff --git a/tests/Unit/Stubs/NullCore.php b/tests/Unit/Stubs/NullCore.php index eadfa259..2e359926 100644 --- a/tests/Unit/Stubs/NullCore.php +++ b/tests/Unit/Stubs/NullCore.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tests\Unit\Stubs; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index ba8c63ba..aad20729 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); use Symfony\Component\Console\Input\ArgvInput; diff --git a/tools/Commands/CopyPropertyValues.php b/tools/Commands/CopyPropertyValues.php index d4cd9d8c..4c2bfd1c 100644 --- a/tools/Commands/CopyPropertyValues.php +++ b/tools/Commands/CopyPropertyValues.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tools\Commands; diff --git a/tools/Commands/GenerateContactsCommand.php b/tools/Commands/GenerateContactsCommand.php index 26880314..0c77721c 100644 --- a/tools/Commands/GenerateContactsCommand.php +++ b/tools/Commands/GenerateContactsCommand.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tools\Commands; @@ -157,7 +166,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); } $timeEnd = microtime(true); - $io->writeln(GenerateContactsCommand . phpsprintf('batch query duration: %s seconds', round($timeEnd - $timeStart, 2)) . PHP_EOL . PHP_EOL); + $io->writeln(sprintf('batch query duration: %s seconds', round($timeEnd - $timeStart, 2)) . PHP_EOL . PHP_EOL); $io->success('contacts added'); } catch (BaseException $exception) { $io = new SymfonyStyle($input, $output); diff --git a/tools/Commands/PerformanceBenchmarks/ListCommand.php b/tools/Commands/PerformanceBenchmarks/ListCommand.php index 88ed9fc0..7a2a70d2 100644 --- a/tools/Commands/PerformanceBenchmarks/ListCommand.php +++ b/tools/Commands/PerformanceBenchmarks/ListCommand.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tools\Commands\PerformanceBenchmarks; @@ -426,10 +435,10 @@ protected function simpleList(array $order, array $filter, array $select): array ); return [ - 'order_count' => $default->getResponseData()->getTime()->getDuration(), - 'order_without_count' => $orderAndNoCount->getResponseData()->getTime()->getDuration(), - 'without_order_count' => $noOrderAndCount->getResponseData()->getTime()->getDuration(), - 'without_order_without_count' => $noOrderAndNoCount->getResponseData()->getTime()->getDuration(), + 'order_count' => $default->getResponseData()->getTime()->duration, + 'order_without_count' => $orderAndNoCount->getResponseData()->getTime()->duration, + 'without_order_count' => $noOrderAndCount->getResponseData()->getTime()->duration, + 'without_order_without_count' => $noOrderAndNoCount->getResponseData()->getTime()->duration, ]; } } \ No newline at end of file diff --git a/tools/Commands/ShowFieldsDescriptionCommand.php b/tools/Commands/ShowFieldsDescriptionCommand.php index c24d8733..d13cee95 100644 --- a/tools/Commands/ShowFieldsDescriptionCommand.php +++ b/tools/Commands/ShowFieldsDescriptionCommand.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the MIT-LICENSE.txt + * file that was distributed with this source code. + */ + declare(strict_types=1); namespace Bitrix24\SDK\Tools\Commands;