Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
* improve DX - add [Rector](https://github.com/rectorphp/rector) for improve code quality and speed up releases cycle

### Changed
* ❗️ migrate from `ramsey/uuid` to `symfony/uid`
* ❗️ update scope `telephony`, scope fully rewritten
* `ExternalCall` – work with external call:
* `getCallRecordUploadUrl` – get url for upload call record file
Expand Down Expand Up @@ -115,7 +116,9 @@
* 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
* 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`


### Deleted
* remove class `Bitrix24\SDK\Application\Requests\Events\OnApplicationInstall\Auth`
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"ext-intl": "*",
"psr/log": "^2 || ^3",
"fig/http-message-util": "1.1.*",
"ramsey/uuid": "^3 ||^4",
"nesbot/carbon": "3.3.*",
"moneyphp/money": "^3 || ^4",
"symfony/http-client": "^6 || ^7",
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ protected function getTraversable(bool $isHaltOnError): Generator
[
'batchItemNumber' => $batchItem,
'batchApiCommand' => $traversableBatchResult->getApiCommand()->getApiMethod(),
'batchApiCommandUuid' => $traversableBatchResult->getApiCommand()->getUuid()->toString(),
'batchApiCommandId' => $traversableBatchResult->getApiCommand()->getId(),
]
);
// todo try to multiplex requests
Expand Down Expand Up @@ -831,7 +831,7 @@ private function convertToApiCommands(): array
{
$apiCommands = [];
foreach ($this->commands as $command) {
$apiCommands[$command->getName() ?? $command->getUuid()->toString()] = sprintf(
$apiCommands[$command->getId()] = sprintf(
'%s?%s',
$command->getApiMethod(),
http_build_query($command->getParameters())
Expand Down
37 changes: 10 additions & 27 deletions src/Core/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,18 @@

namespace Bitrix24\SDK\Core\Commands;

use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Uid\Uuid;

/**
* Class Command
*
* @package Bitrix24\SDK\Core\Commands
*/
class Command
{
private readonly string $name;

private readonly \Ramsey\Uuid\UuidInterface $uuid;

/**
* BatchCommand constructor.
*
*
* @throws \Exception
*/
public function __construct(private readonly string $apiMethod, private readonly array $parameters, ?string $name = null)
{
$this->uuid = Uuid::uuid4();
$this->name = $name ?? $this->uuid->toString();
}

public function getUuid(): UuidInterface
public function __construct(
private readonly string $apiMethod,
private readonly array $parameters,
private ?string $id = null)
{
return $this->uuid;
if ($id === null) {
$this->id = (Uuid::v7())->toRfc4122();
}
}

public function getApiMethod(): string
Expand All @@ -45,8 +28,8 @@ public function getParameters(): array
return $this->parameters;
}

public function getName(): ?string
public function getId(): string
{
return $this->name;
return $this->id;
}
}