Skip to content

Add IM\Search service for im.search.* methods #431

@mesilov

Description

@mesilov

Problem

The Bitrix24 REST API methods im.search.* (search chats/users/departments and manage last-search history) are not yet supported by the SDK.

Proposed solution

Add a new service src/Services/IM/Search/Service/Search.php that wraps the following REST methods, following patterns in other src/Services/<Scope>/ folders. Scope: im.

Methods to implement

  • im.search.chat.list — search chats accessible to the current user
  • im.search.user.list — search users by name, position, department
  • im.search.department.list — search departments by title
  • im.search.last.add — add a dialog to the last-search history (legacy)
  • im.search.last.get — get the last-search history (legacy)
  • im.search.last.delete — remove a dialog from the last-search history (legacy)

Legacy methods (im.search.last.*) work only in the previous chat UI version per the docs; include them for API completeness but mark as legacy in PHPDoc.

Acceptance criteria

  • Bitrix24\SDK\Services\IM\Search\Service\Search implements each method with correct parameter mapping and #[ApiEndpointMetadata] / #[ApiServiceMetadata(new Scope(['im']))] attributes
  • IMServiceBuilder::search() exposes the new service
  • SearchChatItemResult, SearchUserItemResult, SearchDepartmentItemResult with @property-read annotations cover all returned fields
  • Unit tests in tests/Unit/Services/IM/Search/Service/SearchTest.php pass (make test-unit)
  • Integration tests in tests/Integration/Services/IM/Search/Service/SearchTest.php pass
  • Dedicated annotation tests in tests/Integration/Services/IM/Search/Result/ pass for every *ItemResult (annotation completeness + type-cast checks)
  • make test-integration-im-search target added to Makefile and a suite added to phpunit.xml.dist
  • CHANGELOG.md entry under ## 3.2.0 – UNRELEASED### Added with link to this issue

Part of #422.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions