Skip to content
Open
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
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@

### Added

- Added service `Services\Biconnector\Dataset` with support methods,
see [biconnector.dataset.* methods](https://apidocs.bitrix24.com/api-reference/biconnector/dataset/index.html) ([#469](https://github.com/bitrix24/b24phpsdk/issues/469)):
- `add` adds a new dataset, with batch calls support
- `update` updates an existing dataset description, with batch calls support
- `get` gets information about the dataset by its identifier
- `list` gets the list of datasets, with batch calls support
- `delete` deletes a dataset, with batch calls support
- `fields` returns the fields description
- `updateFields` adds, updates visibility of, or deletes individual dataset columns (`biconnector.dataset.fields.update`)
- `count` counts datasets
- Added `dataset()` accessor to `BiconnectorServiceBuilder` ([#469](https://github.com/bitrix24/b24phpsdk/issues/469))
- Added service `Services\Biconnector\Source` with support methods,
see [biconnector.source.* methods](https://apidocs.bitrix24.com/api-reference/biconnector/source/index.html) ([#469](https://github.com/bitrix24/b24phpsdk/issues/469)):
- `add` adds a new data source, with batch calls support
- `update` updates an existing data source, with batch calls support
- `get` gets information about the data source by its identifier
- `list` gets the list of data sources, with batch calls support
- `delete` deletes a data source, with batch calls support
- `fields` returns the fields description
- `count` counts data sources
- Added `source()` accessor to `BiconnectorServiceBuilder` ([#469](https://github.com/bitrix24/b24phpsdk/issues/469))
- Added service `Services\Biconnector\Connector` with support methods,
see [biconnector.connector.* methods](https://github.com/bitrix24/b24phpsdk/issues/469):
- `add` adds a new connector, with batch calls support
- `update` updates an existing connector, with batch calls support
- `get` gets information about the connector by its identifier
- `list` gets the list of connectors, with batch calls support
- `delete` deletes a connector, with batch calls support
- `fields` returns the fields description
- `count` counts connectors

- Added support for events:
- `onCrmDocumentGeneratorDocumentAdd` — fires when a document is created,
see [event documentation](https://apidocs.bitrix24.com/api-reference/crm/document-generator/documents/events/on-crm-document-generator-document-add.html)
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,22 @@ integration_tests_crm_documentgenerator_document:
integration_tests_crm_documentgenerator_template:
docker compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_documentgenerator_template

.PHONY: test-integration-scope-biconnector
test-integration-scope-biconnector:
docker compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_scope_biconnector

.PHONY: test-integration-biconnector-connector
test-integration-biconnector-connector:
docker compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_biconnector_connector

.PHONY: test-integration-biconnector-source
test-integration-biconnector-source:
docker compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_biconnector_source

.PHONY: test-integration-biconnector-dataset
test-integration-biconnector-dataset:
docker compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_biconnector_dataset

# work dev environment
.PHONY: php-dev-server-up
php-dev-server-up:
Expand Down
15 changes: 15 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,21 @@
<testsuite name="integration_tests_scope_sonet_group">
<directory>./tests/Integration/Services/SonetGroup/</directory>
</testsuite>
<testsuite name="integration_tests_scope_biconnector">
<directory>./tests/Integration/Services/Biconnector/</directory>
</testsuite>
<testsuite name="integration_tests_biconnector_connector">
<directory>./tests/Integration/Services/Biconnector/Connector/Service/</directory>
<directory>./tests/Integration/Services/Biconnector/Connector/Result/</directory>
</testsuite>
<testsuite name="integration_tests_biconnector_source">
<directory>./tests/Integration/Services/Biconnector/Source/Service/</directory>
<directory>./tests/Integration/Services/Biconnector/Source/Result/</directory>
</testsuite>
<testsuite name="integration_tests_biconnector_dataset">
<directory>./tests/Integration/Services/Biconnector/Dataset/Service/</directory>
<directory>./tests/Integration/Services/Biconnector/Dataset/Result/</directory>
</testsuite>
</testsuites>
<source>
<include>
Expand Down
103 changes: 103 additions & 0 deletions src/Services/Biconnector/BiconnectorServiceBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Dmitriy Ignatenko <algonexys@gmail.com>
*
* For the full copyright 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\Biconnector;

use Bitrix24\SDK\Attributes\ApiServiceBuilderMetadata;
use Bitrix24\SDK\Core\Credentials\Scope;
use Bitrix24\SDK\Services\AbstractServiceBuilder;
use Bitrix24\SDK\Services\Biconnector\Connector\Batch as ConnectorBatch;
use Bitrix24\SDK\Services\Biconnector\Connector\Service\Batch;
use Bitrix24\SDK\Services\Biconnector\Connector\Service\Connector;
use Bitrix24\SDK\Services\Biconnector\Dataset\Batch as DatasetBatch;
use Bitrix24\SDK\Services\Biconnector\Dataset\Service\Batch as DatasetServiceBatch;
use Bitrix24\SDK\Services\Biconnector\Dataset\Service\Dataset;
use Bitrix24\SDK\Services\Biconnector\Source\Batch as SourceBatch;
use Bitrix24\SDK\Services\Biconnector\Source\Service\Batch as SourceServiceBatch;
use Bitrix24\SDK\Services\Biconnector\Source\Service\Source;

#[ApiServiceBuilderMetadata(new Scope(['biconnector']))]
class BiconnectorServiceBuilder extends AbstractServiceBuilder
{
/**
* Get the Connector service
*
* Uses a specialized ConnectorBatch to handle biconnector.connector.* REST API differences:
* - list uses 'page' parameter (page number) instead of standard 'start' (offset)
* - delete uses lowercase 'id' instead of 'ID'
*/
public function connector(): Connector
{
if (!isset($this->serviceCache[__METHOD__])) {
// Use specialized Batch for Connector to ensure correct REST parameter mapping
$connectorBatch = new ConnectorBatch(
$this->core,
$this->log
);
$this->serviceCache[__METHOD__] = new Connector(
new Batch($connectorBatch, $this->log),
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}

/**
* Get the Dataset service
*
* Uses a specialized DatasetBatch to handle biconnector.dataset.* REST API differences:
* - list uses 'page' parameter (page number) instead of standard 'start' (offset)
* - delete uses lowercase 'id' instead of 'ID'
*/
public function dataset(): Dataset
{
if (!isset($this->serviceCache[__METHOD__])) {
$datasetBatch = new DatasetBatch(
$this->core,
$this->log
);
$this->serviceCache[__METHOD__] = new Dataset(
new DatasetServiceBatch($datasetBatch, $this->log),
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}

/**
* Get the Source service
*
* Uses a specialized SourceBatch to handle biconnector.source.* REST API differences:
* - delete uses lowercase 'id' instead of 'ID'
*/
public function source(): Source
{
if (!isset($this->serviceCache[__METHOD__])) {
$sourceBatch = new SourceBatch(
$this->core,
$this->log
);
$this->serviceCache[__METHOD__] = new Source(
new SourceServiceBatch($sourceBatch, $this->log),
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}
}
Loading
Loading