Skip to content

Add Note service for note.* v3 support (#515)#524

Open
fatestr1ngs wants to merge 2 commits into
bitrix24:v3-devfrom
fatestr1ngs:feature/515-add-note-scope
Open

Add Note service for note.* v3 support (#515)#524
fatestr1ngs wants to merge 2 commits into
bitrix24:v3-devfrom
fatestr1ngs:feature/515-add-note-scope

Conversation

@fatestr1ngs

@fatestr1ngs fatestr1ngs commented Jul 2, 2026

Copy link
Copy Markdown
Contributor
Q A
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #515
License MIT

Adds the note.* v3 scope (Knowledge Base 2.0) — all 25 methods across three services:

  • Collection (note.collection.*, 8 methods): add, archive, delete, fieldGet, fieldList, get, list, update. list() uses cursor-based pagination via typed CollectionListPagination / CollectionListCursor value objects (modeled on the existing Main\Service\EventLogTailCursor idiom), since the server returns a ready-made nextCursor object.
  • Document (note.document.*, 13 methods): CRUD + archive, plus note.document.tree.* and note.document.search.* folded into the same service class.
  • File (note.file.*, 4 methods): upload (base64-encoded content) and retrieval.
$note = $serviceBuilder->getNoteScope();

$collection = $note->collection()->add('Product docs')->collection();
$document = $note->document()->add($collection->id, 'Getting started', markdown: '# Hello')->document();
$note->file()->add($document->id, 'diagram.png', base64_encode($binaryContent));

$cursor = null;
do {
    $page = $note->collection()->list(new CollectionListPagination(50, $cursor));
    // ...
    $cursor = $page->getNextCursor();
} while ($cursor !== null);

Note: while implementing, live verification against a real portal showed that every *.field.list response wraps its array in result.items (matching every other list endpoint), even though the OpenAPI schema describes result itself as a flat array. All five *FieldsResult classes were fixed and covered by integration tests that assert non-empty field lists.

Test plan

  • make lint-cs-fixer — passed
  • make lint-deptrac — passed (0 violations)
  • make test-unit — passed (1013/1013, no regressions)
  • make test-integration-note-collection — passed (11/11, live portal)
  • make test-integration-note-document — passed (21/21, live portal)
  • make test-integration-note-file — passed (6/6, live portal)
  • make lint-phpstan / make lint-rector — passed

Closes #515

Implements all 25 note.* methods (Knowledge Base 2.0): Collection,
Document (incl. tree and search), and File, with typed select
builders and cursor pagination for note.collection.list.
)

RenameVariableToMatchNewTypeRector flagged $pagination for not
matching its CollectionListPagination type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant