Skip to content

feat(data-sources): support listing data source templates#95

Merged
brd6 merged 2 commits into
mainfrom
feat/list-templates
Jul 14, 2026
Merged

feat(data-sources): support listing data source templates#95
brd6 merged 2 commits into
mainfrom
feat/list-templates

Conversation

@brd6

@brd6 brd6 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Description

Adds dataSources()->listTemplates(string $dataSourceId, ?string $name = null, ?PaginationRequest $paginationRequest = null) against GET /v1/data_sources/{id}/templates, mirroring the reference JavaScript SDK's dataSources.listTemplates:

  • The response is a custom envelope (templates, has_more, next_cursor — not the standard list shape), hydrated into a DataSourceTemplateResults of typed DataSourceTemplate items (id, name, isDefault()).
  • The optional $name query filters by template name; pagination uses the standard PaginationRequest.
  • Template ids pair with PageTemplate::templateId() from feat(pages): support page templates and erasing content #94 for applying a template to a page.

Motivation and context

The January 2026 API changelog added template listing; it completes the template flow — without it, consumers cannot discover which template ids exist to apply.

How has this been tested?

  • New tests asserting the request path, the name/pagination query, and hydration of the custom envelope into typed items including the default flag.
  • Verified live against the Notion API: listed a real data source's templates and hydrated its actual template ("New item", marked default).
  • Full suite green (215 tests), plus parallel-lint, phpcs, PHPStan, and Psalm.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.

brd6 added 2 commits July 14, 2026 22:21
GET /v1/data_sources/{id}/templates lists the templates available in a
data source. The response is a custom envelope — templates, has_more,
next_cursor — hydrated into typed DataSourceTemplate items; the ids
pair with PageTemplate::templateId() when creating or updating pages.
@brd6
brd6 merged commit a9216e1 into main Jul 14, 2026
21 checks passed
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