Skip to content

Add scope Booking wrappers#476

Draft
fatestr1ngs wants to merge 1 commit into
bitrix24:v3-devfrom
fatestr1ngs:feature/473-add-booking-scope-v3
Draft

Add scope Booking wrappers#476
fatestr1ngs wants to merge 1 commit into
bitrix24:v3-devfrom
fatestr1ngs:feature/473-add-booking-scope-v3

Conversation

@fatestr1ngs
Copy link
Copy Markdown

Q A
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #473
License MIT

This PR adds support for the Booking scope in the PHP SDK.

  • Added the Booking scope builder and typed services for booking, waitlist, resource, resource type, resource slots, client type, booking client, booking external data, waitlist client, and waitlist external data methods.
  • Added typed result DTOs for Booking entities and operation results.
  • Added integration coverage for CRUD flows and dedicated annotation validation tests for Booking result items.
  • Wired the new Booking tests into the PHPUnit testsuite and Makefile target.
  • Updated the Booking client type contract to match the live API response shape returned by the portal.

Example usage:

$builder = ServiceBuilderFactory::createServiceBuilderFromWebhook($webhookUrl);
$bookingScope = $builder->getBookingScope();

$resourceTypeId = $bookingScope->resourceType()->add([
    'code' => 'room',
    'name' => 'Room',
])->getId();

$resourceId = $bookingScope->resource()->add([
    'typeId' => $resourceTypeId,
    'name' => 'Room A',
])->getId();

$bookingId = $bookingScope->booking()->add([
    'name' => 'Consultation',
    'resourceIds' => [$resourceId],
    'datePeriod' => [
        'from' => ['timestamp' => time() + 3600, 'timezone' => 'Europe/Berlin'],
        'to' => ['timestamp' => time() + 5400, 'timezone' => 'Europe/Berlin'],
    ],
])->getId();

$booking = $bookingScope->booking()->get($bookingId);

Quality-gate checklist

  • make lint-cs-fixer
  • make lint-phpstan
  • make lint-rector
  • make test-unit
  • make test-integration-scope-booking
  • docker-compose run --rm php-cli vendor/bin/phpstan analyse tests/Integration/Services/Booking

Closes #473

@fatestr1ngs fatestr1ngs mentioned this pull request May 20, 2026
11 tasks
Copy link
Copy Markdown
Collaborator

@mesilov mesilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please

  1. update branch from v3-dev
  2. resolve comments

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Maksim Mesilov <mesilov.maxim@gmail.com>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add your full name and contacts

* @property-read array<string, mixed>|null $datePeriod
* @property-read array<int, int>|null $resourceIds
*/
class BookingItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 3.2.0 we added https://github.com/bitrix24/b24phpsdk/blob/v3/src/Core/Result/AbstractAnnotatedItem.php#L22C16-L22C37 with automatic type casting based on phpdocs annotations

please fix
class BookingItemResult extends AbstractItem

to
class BookingItemResult extends AbstractAnnotatedItem

* @property-read int|null $id
* @property-read array<string, string>|null $type
*/
class BookingClientItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @property-read string|null $moduleId
* @property-read string|null $value
*/
class BookingExternalDataItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @property-read string|null $code
* @property-read string|null $module
*/
class ClientTypeItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @property-read string|null $templateTypeFeedback
* @property-read string|null $templateTypeReminder
*/
class ResourceTypeItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @property-read int|null $id
* @property-read string|null $note
*/
class WaitlistItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @property-read int|null $id
* @property-read array<string, string>|null $type
*/
class WaitlistClientItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @property-read string|null $moduleId
* @property-read string|null $value
*/
class WaitlistExternalDataItemResult extends AbstractItem
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread CHANGELOG.md

### Added

- Added `Services\Booking\BookingServiceBuilder` with Booking scope wrappers and integration coverage for `booking.v1.clienttype.*`, `booking.v1.resourceType.*`, `booking.v1.resource.*`, `booking.v1.resource.slots.*`, `booking.v1.waitlist.*`, `booking.v1.waitlist.client.*`, `booking.v1.waitlist.externalData.*`, `booking.v1.booking.*`, `booking.v1.booking.client.*`, and `booking.v1.booking.externalData.*` methods.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to 3.3.0 planned release

@mesilov mesilov added this to the 3.3.0 milestone May 25, 2026
@mesilov mesilov linked an issue May 25, 2026 that may be closed by this pull request
9 tasks
@mesilov mesilov added the enhancement in SDK New feature or request in SDK label May 25, 2026
@fatestr1ngs fatestr1ngs force-pushed the feature/473-add-booking-scope-v3 branch from 23c325c to c497f17 Compare May 26, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement in SDK New feature or request in SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature in SDK]: Add Booking scope wrappers and integration tests

2 participants