Notion PowerShell Module
Notion - A class-based PowerShell module for interacting with Notion
⚠ Work in progress - not all features are implemented yet, if you are missing something, or experience any issues, please open an issue on GitHub.
Notion, is an online knowledge management tool in which you can structure your requirements yourself or be inspired by countless templates and formats. Unfortunately, there was no PowerShell module that offers the full power of the API.
In order to ensure the smoothest possible interaction with the API, the specifications were implemented with PowerShell classes. This means that classes are used in the background for all cmdlets. You can also create your own Notion objects directly using the classes provided.
Prerequisites
- PowerShell 7.0 or higher
Getting started
To get started either:
- Install from the PowerShell Gallery using PowerShellGet by running the following command:
# PowerShellGet 2.x
Install-Module -Name Notion -Repository PSGallery
# PowerShellGet 3.x
Install-PSResource -Name Notion
# Connect to Notion
$BearerToken = Read-Host -Prompt "Enter your Notion Bearer Token" -AsSecureString
Connect-Notion -BearerToken $BearerToken
Or download it via the Microsoft PowerShell Gallery
Documentation
Documentation is available in the Wiki.
Issues
Please open a github issue here.
Contributing
Contributing
Please check out common DSC Community contributing guidelines.
Running the Tests
If want to know how to run this module’s tests you can look at the Testing Guidelines
Branch Model
The branch model is based on the GitFlow model.
flowchart TD
B[Dev] --> |Release|A[main]
C[Features] --> |PreRelease|B
D[Hotfix] --> |Release|A
E[Bugfix] --> |PreRelease|B
GitVersion install
#eventually you need to install the nuget.org source
#dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
dotnet tool install --global GitVersion.Tool --version 5.12.0
Manual Build, Import & Connect
# Clone the repository
#when running the first time you also need to resolve the dependencies
./build.ps1 -Tasks build -ResolveDependency -UseModuleFast
$version = (dotnet-gitversion.exe /showvariable MajorMinorPatch)
$ModuleFile = ".\output\module\Notion\$version\Notion.psd1"
Import-Module $ModuleFile
# Import-Module Microsoft.PowerShell.PlatyPS -Force
# New-MarkdownCommandHelp -ModuleInfo (Get-Module Notion) -OutputFolder .\docs -WithModulePage -HelpVersion "$version" -Force
$BearerToken = Read-Host -Prompt "Enter your Notion Bearer Token" -AsSecureString
Connect-Notion -BearerToken $BearerToken
Wiki
Welcome to the PowerShell Notion Module Wiki
Here you will find all the information you need to use Notion.
Please leave comments, feature requests and bug reports for this module in the issues section of this repository.
Find the FAQs here: FAQs
Installation
# Install via PowerShellGet 2.x
Install-Module -Name Notion -Repository PSGallery
# Install via PowerShellGet 3.x
Install-PSResource Notion -Repository PSGallery
How to start with this module?
Before you start with connecting to your Notion teamspace, you need to create an integration, which is allowed to interact with your space.
Follow this link to get a detailed instructions how to create your Notion integration.
Usage
# Import the module
Import-Module -Name Notion
# List all Cmdlets
Get-Command -Module Notion
# List Cmdlets for blocks
Get-Command -Module Notion -Noun NotionBlock
# Connect to Notion (with your integration/bearer token)
$BearerToken = Read-Host -Prompt "Enter your Bearer token" | ConvertTo-Securestring -AsPlainText
Connect-Notion -BearerToken $BearerToken
Idea behind a class based Notion module
There are several attempts to talk to the Notion API out there, but most of them didn’t take care of the correct syntax of the individual configuration of each block/page/database etc. So we decided to create classes for all available Notion objects presented by the API. (there are some objects which are not available right now - end of 2024 like e.g. template)
The charm of Notion classes are this simple use while creating objects.
[notion_block]::new() # creates an empty block object
[notion_page]::new() # creates a new page object
[notion_emoji]::new() # creates a new emoji object
However, there is also a New-Notion
New-NotionBookmarkBlock -URL "https://www.example.com" -Caption "Example Bookmark"
New-NotionCalloutBlock -RichText "This is a callout" -Icon "💡"
New-NotionBreadcrumbBlock #new breadcrumb block
If you receive items from the API, the Notion module will automatically convert it into Notion objects (based on the classes) so that the can be used.
Notion Objects
There are several type of Notion object for different purposes.
- Block
- Page
- Database
- Parent
- User
- Comment
- Unfurl attribute
- File
- Emoji
Find the classes Documentation here: Classes Documentation
General used verbs for those objects
Nesting of those objects

General used verbs for objects
- Get (retrieves an object)
- New (creates an object without uploading it)
- Add (adds a new object to another already existing object e.g. a block to a page)
- Update (modifies an object)
- Remove (deletes an object)
Each of the objects have got individual CmdLets to deal with.
| Object: Block |
|---|
| Add-NotionBlockToPage |
| Get-NotionBlock |
| Get-NotionBlockChildren |
| Object: Database |
|---|
| Add-NotionPageToDatabase |
| Edit-NotionDatabase |
| Get-NotionDatabase |
| Move-NotionDatabaseToArchive |
| New-NotionDatabase |
| Remove-NotionDatabase |
| Restore-NotionDatabase |
| Object: DatabaseProperties |
|---|
| Add-NotionDatabaseProperty |
| New-NotionDatabaseProperty |
| Remove-NotionDatabaseProperty |
| Object: Page |
|---|
| Get-NotionPage |
| Get-NotionPageChildren |
| Move-NotionPageToArchive |
| New-NotionPage |
| Remove-NotionPage |
| Restore-NotionPage |
| Object: PageProperties |
|---|
| Get-NotionPageProperty |
| Update-NotionPageProperty |
| Object: User |
|---|
| Get-NotionUser |
Classes and Enums
An easy way to generate new blocks is to instantiate them from predefined classes via [classname]::new().
On the querying side the API returns a naked object with properties. The module automatically turns those answers into proper Notion objects (derived from classes)
The enumerations (enums) are predefined values which are valid for a certain properties. e.g. colors
Enums
[notion_rich_text_type][notion_blocktype][notion_database_property_type]#[relation_type][notion_database_property_format_type][notion_filetype][notion_page_property_type][notion_property_color][notion_formula_type][notion_rollup_type][notion_rollup_function_type][notion_page_verification_state][notion_parent_type][bot_owner_type][notion_color][notion_icon_type][rich_text_mention_type][template_mention_date]
Classes
[notion_annotation][notion_heading_1_block][notion_heading_2_block][notion_heading_3_block][notion_block][notion_bookmark_block][notion_bot_user][notion_breadcrumb_block][notion_bulleted_list_item_block][notion_callout_block][notion_checkbox_page_property][notion_child_database_block][notion_child_page_block][notion_code_block][notion_column_block][notion_column_list_block][notion_comment][notion_created_by_page_property][notion_created_time_page_property][notion_custom_emoji][notion_database][notion_databaseproperties][notion_date_page_property][notion_divider_block][notion_email_page_property][notion_embed_block][notion_emoji][notion_equation_block][notion_external_file][notion_file][notion_file_block][notion_files_page_property][notion_formula_page_property][notion_hosted_file][notion_image_block][notion_last_edited_by_page_property][notion_last_edited_time_page_property][notion_link_preview_block][notion_multi_select_item][notion_multi_select_page_property][notion_number_page_property][notion_numbered_list_item_block][notion_page][notion_icon][notion_page_parent][notion_pageproperties][notion_paragraph_block][notion_parent][notion_page_parent][notion_workspace_parent][notion_PDF_block][notion_people_page_property][notion_people_user][notion_phone_number_page_property][notion_quote_block][notion_relation_page_property][notion_rich_text_page_property][notion_rollup_page_property][notion_section_unfurl_attribute][notion_select_page_property][notion_status_page_property][notion_sub_type_child_unfurl_attribute][notion_sub_type_unfurl_attribute][notion_synced_block][notion_table_of_contents_block][notion_title_page_property][notion_to_do_block][notion_toggle_block][notion_unique_id_page_property][notion_url_page_property][notion_user][notion_verification_page_property][notion_video_block][rich_text][rich_text_equation][rich_text_equation_structure][rich_text_mention][rich_text_mention_base][rich_text_mention_database][rich_text_mention_database_structure][rich_text_mention_date][rich_text_mention_date_structure][rich_text_mention_link_preview][rich_text_mention_page][rich_text_mention_page_structure][rich_text_mention_template_mention][rich_text_mention_template_mention_structure_base][rich_text_mention_template_mention_template_mention_date_structure][rich_text_mention_template_mention_template_mention_user_structure][rich_text_mention_user][rich_text_text][rich_text_text_structure]
Change log
A full list of changes in each version can be found in the change log.
Changes
Changelog for Notion
The format is based on and uses the types of changes according to Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[0.13.0] - 2025-09-25
Added
-
tests/Unit/Public/Block/Bookmark/New-NotionBookmarkBlock.Tests.ps1
Introduced unit tests forNew-NotionBookmarkBlock, covering default and captioned bookmark creation. -
tests/Unit/Public/Block/Breadcrumb/New-NotionBreadcrumbBlock.Tests.ps1
Added unit tests validating default behavior of breadcrumb block creation. -
tests/Unit/Public/Block/BulletedListItem/New-NotionBulletedListItemBlock.Tests.ps1
Introduced tests to verify text content and color for bulleted list items. -
tests/Unit/Public/Block/ChildDatabase/New-NotionChildDatabaseBlock.Tests.ps1
Added validation for empty and titled child database block generation. -
tests/Unit/Public/Block/ChildDatabase/ChildPage/New-NotionChildPageBlock.Tests.ps1
Implemented tests for verifying empty and titled child page block creation. -
tests/Unit/Public/Block/Code/New-NotionCodeBlock.Tests.ps1
Introduced unit tests for code block creation with various combinations of text, caption, and language. -
tests/Unit/Public/Block/Column/New-NotionColumnBlock.Tests.ps1,
tests/Unit/Public/Block/ColumnList/New-NotionColumnListBlock.Tests.ps1
Added tests for verifying the default behavior of column and column list block generation. -
tests/Unit/Public/Block/Divider/New-NotionDividerBlock.Tests.ps1
Added validation for divider block construction. -
tests/Unit/Public/Block/Embed/New-NotionEmbedBlock.Tests.ps1
Added extensive test coverage for URL and caption handling in embed blocks. -
tests/Unit/Public/Block/Equation/New-NotionEquationBlock.Tests.ps1
Added unit tests verifying LaTeX expression parsing in equation blocks. -
tests/Unit/Public/Block/File/New-NotionFileBlock.Tests.ps1
Introduced tests for external, hosted, and file-object-based file block creation, including expiry handling. -
tests/Unit/Public/Block/Heading/New-NotionHeadingBlock.Tests.ps1
Renamed and relocated test under a structured directory. -
tests/Unit/Public/Block/Image/New-NotionImageBlock.Tests.ps1
Added support for image block testing fromnotion_fileobjects. -
tests/Unit/Public/Block/LinkPreview/New-NotionLinkPreviewBlock.Tests.ps1
Added test confirming thatlink_previewblocks cannot be manually created. -
tests/Unit/Public/Block/NumberedListItem/New-NotionNumberedListItemBlock.Tests.ps1
Added tests to verify rich text rendering in numbered list items. -
tests/Unit/Public/Block/Paragraph/New-NotionParagraphBlock.Tests.ps1
Implemented tests for default and colored paragraph content. -
tests/Unit/Public/Block/Pdf/New-NotionPdfBlock.Tests.ps1
Renamed and moved PDF block tests into structured folder. -
tests/Unit/Public/Block/Quote/New-NotionQuoteBlock.Tests.ps1
Added validation for quote blocks with content and color options. -
tests/Unit/Public/Block/Synced/New-NotionSyncedBlock.Tests.ps1
Added coverage for synced block creation. -
tests/Unit/Public/Block/Table/New-NotionTableBlock.Tests.ps1
Rewritten and expanded validation for table blocks, including headers, error handling, and hashtable inputs. -
tests/Unit/Public/Block/TableOfContents/New-NotionTableOfContentsBlock.Tests.ps1
Introduced default and color-specific table of contents creation tests. -
tests/Unit/Public/Block/TableRow/New-NotionTableRowBlock.Tests.ps1
Added tests verifying creation of table rows from flat cell content arrays. -
tests/Unit/Public/Block/ToDo/New-NotionToDoBlock.Tests.ps1
Extensive tests covering plain, checked, and color-variant to-do block creation. -
tests/Unit/Public/Block/Toggle/New-NotionToggleBlock.Tests.ps1
Implemented tests for toggle blocks including rich text and color validation. -
tests/Unit/Public/Block/Video/New-NotionVideoBlock.Tests.ps1
Renamed and organized video block tests into structured location. -
tests/Unit/Public/Block/New-NotionBlock.Tests.ps1
Added meta tests covering dynamic creation of multiple block types usingNew-NotionBlock. -
tests/Unit/Public/Block/_RichText/New-NotionRichText.Tests.ps1
Comprehensive unit tests for rich text construction across multiple parameter sets. -
tests/Unit/Public/Block/_RichText/New-NotionRichTextAnnotation.Tests.ps1
Added focused testing for annotation creation via object and flag-based inputs.
Changed
-
source/Classes/Block/RichText/01_Rich_Text.ps1
Minor formatting improvement to spacing inswitchblock for content type routing. -
source/Classes/Block/RichText/02_Rich_Text_Annotation.ps1
Improved readability, added verbose logging, and corrected default handling inConvertFromObject. -
source/Classes/Block/RichText/Type/01_Rich_text_text.ps1
Introduced verbose output and ensuredplain_textis assigned from the underlying text structure. -
source/Classes/Block/RichText/Type/03_Rich_text_equation.ps1
Implemented full support forConvertFromObjectlogic and commented out unusedToJson()method stub. -
source/Classes/03_File/03_external_file.ps1, source/Classes/Block/23.1_File_block.ps1
AddedWrite-Verbosediagnostic logging for constructor calls.
Fixed
-
source/Classes/Block/05_Bookmark.ps1
Refactoredbookmark_structureconstructor to unify input parsing and ensure consistent caption/url handling. -
source/Classes/Block/11_Code.ps1
Fixed incorrect assignment of caption text to rich text; reordered constructor logic for correctness. -
source/Classes/Block/30_Table_Of_Contents.ps1
Ensuredcolorproperty is always initialized to a valid default. -
source/Classes/Block/27.2_TableRow.ps1
Corrected debug output to reference actual dynamic cell count instead of fixed index. -
tests/Unit/Classes/Block/05_Bookmark.tests.ps1
Removed redundant assertion and corrected expected structure for caption verification. -
tests/Unit/Classes/Block/11_Code.tests.ps1
Corrected assertion expecting incorrect text in the caption field. -
tests/Unit/Classes/Block/30_Table_Of_Contents.tests.ps1
Updated type expectation to match new default structure initialization. -
tests/Unit/Classes/Database/DatabaseProperties/09_dp_formula.Tests.ps1
Adjusted tests to validate exception behavior when formula input is missing or malformed. -
All test files:
Applied-DisableNameCheckingto allImport-Module Pesterstatements to suppress Pester warnings and improve compatibility.
[0.12.0] - 2025-08-23
Added
-
.github/copilot-instructions.md- Introduced internal documentation to guide GitHub Copilot in understanding the Notion PowerShell module:
- Describes project structure, coding and testing conventions.
- Covers class hierarchy, type usage, PowerShell best practices, and module loading order.
- Includes inline code examples and module-specific conventions for cmdlets, parameters, and testing.
- Introduced internal documentation to guide GitHub Copilot in understanding the Notion PowerShell module:
-
source/Private/Remove-DefaultPropertyNames.ps1- Added utility function
Remove-DefaultPropertyNamesto filter out common .NET object property names, used during property conversion processes for cleaner hashtable parsing.
- Added utility function
source/Public/Database/Add-NotionDatabaseToParent.ps1- Introduced new cmdlet
Add-NotionDatabaseToParent, wrapping the database creation API call in a reusable function. - Accepts parameters for
parent_obj,title, andproperties, returning a strongly-typednotion_databaseobject. - Implements detailed parameter validation and integrates with
New-NotionDatabaseand object converters for simplified database creation logic.
- Introduced new cmdlet
source/Classes/02_Page/PageProperties/01_pp.ps1- Enhanced
ConvertFromObjectmethod innotion_pagepropertiesto handle both hashtables and custom objects, usingRemove-DefaultPropertyNamesfor cleaner property filtering.
- Enhanced
source/Classes/Database/DatabaseProperties/01_dp.ps1- Re-implemented
ConvertFromObjectmethod innotion_databasepropertiesto support input validation and dynamic property extraction, aligning with improvements innotion_pageproperties.
- Re-implemented
source/Public/zz1_Type_Accelerator.ps1- Complete Type Accelerator Reorganization: Added comprehensive type accelerators for all Database and Page Property classes, organized into clear sections:
- DatabaseProperties Section: Added all database property classes (
notion_*_database_property) and related classes (DatabasePropertiesBase, relation hierarchy,notion_status_group) - PageProperties Section: Added all page property classes (
notion_*_page_property) and related classes (PagePropertiesBase,notion_pageproperties) - Structure Cleanup: Removed internal
*_structureclasses to keep type accelerators focused on main classes - Proper Organization: Moved misplaced classes (
notion_unique_id,notion_verification) to appropriate sections - Alphabetical Ordering: All classes within sections are alphabetically sorted for better maintainability
- DatabaseProperties Section: Added all database property classes (
- Complete Type Accelerator Reorganization: Added comprehensive type accelerators for all Database and Page Property classes, organized into clear sections:
- Unit Tests
- Introduced
New-NotionDatabase.Tests.ps1with Pester tests to validate theNew-NotionDatabasefunction:- Ensures
-parent_objis mandatory. - Verifies creation with string titles and rich_text title objects.
- Supports pre-converted
notion_databaseproperties. - Confirms default values (archived, in_trash, is_inline) are unset.
- Ensures
- Added
notion_database.Class.Tests.ps1with Pester unit tests for the notion_database class, covering constructors, ConvertFromObject, default values, nested object conversions, and edge cases. - Comprehensive Database Properties Test Suite: Added complete Pester test coverage for all Database Property classes with extensive German inline comments:
- Database Property Tests: Added individual Pester unit tests for all simple database property types (e.g., checkbox, created_by, created_time, date, email, files, formula, last_edited_by, last_edited_time, people, phone_number, rich_text, title, url). Each test file includes:
- Constructor, property, and
ConvertFromObjecttests. - Inheritance validation from
DatabasePropertiesBase. - Edge case coverage including nulls, type checks, and validation errors.
- Consistent test structure and German inline documentation for clarity and maintainability.
- Constructor, property, and
- Complex Property Tests:
12_dp_multi_select.Tests.ps1(with options management and 100-item limit validation),13_dp_number.Tests.ps1(with format type support),16_dp_relation.Tests.ps1(with inheritance hierarchy for single/dual relations),18_dp_rollup.Tests.ps1(with fallback mechanisms),19_dp_select.Tests.ps1(with options management),20_dp_status.Tests.ps1(with groups and options),23_dp_unique_id.Tests.ps1(with prefix handling)- Each test file includes: Constructor Tests, Property Tests, ConvertFromObject Tests, Inheritance Tests from
DatabasePropertiesBase - Comprehensive edge case handling: null values, empty arrays, type validation, parameter limits, and error conditions
- All tests follow consistent structure with detailed German documentation for maintainability
- Each test file includes: Constructor Tests, Property Tests, ConvertFromObject Tests, Inheritance Tests from
- Database Property Tests: Added individual Pester unit tests for all simple database property types (e.g., checkbox, created_by, created_time, date, email, files, formula, last_edited_by, last_edited_time, people, phone_number, rich_text, title, url). Each test file includes:
- Introduced
Changed
-
source/Classes/Block/08_Callout.ps1- Refactored constructor of
callout_structureto accept rich text object(s) directly, replacing single string handling withrich_text::ConvertFromObjects, enhancing flexibility and correctness.
- Refactored constructor of
-
source/Classes/Database/01_database.ps1- Reordered parameters in constructors of
notion_databaseto placeparentbeforetitlefor consistent and intuitive usage. - Adjusted
ConvertFromObjectlogic to correctly transformtitleanddescriptionfields usingforeachwith clearer formatting.
- Reordered parameters in constructors of
-
source/Public/Database/New-NotionDatabase.ps1- Simplified rich text conversion for the
titleparameter usingrich_text::ConvertFromObjects. - Refactored function to directly return a new
notion_databaseobject instead of manually building a body and invoking the API call, reducing redundancy and centralizing object construction logic. - Updated documentation to clarify parameter usage.
- Simplified rich text conversion for the
-
source/Public/Database/Add-NotionPageToDatabase.ps1- Minor formatting and parameter declaration updates to align with standard PowerShell conventions.
-
source/Public/Invoke-NotionApiCall.ps1- Unified casing for
paramandprocesskeywords for consistency. - Updated format specifiers from
-Fto lowercase-f, aligning with PowerShell formatting best practices. - Cleaned up spacing and streamlined control flow for pagination logic in API call processing.
- Unified casing for
-
source/Classes/00_General/17_notion_rollup.ps1- Added
Createfactory method to instantiate rollup subclasses based on rollup type (array,date,number, etc.), improving usability and maintainability.
- Added
-
source/Classes/00_General/19_notion_select.ps1- Extended constructor overloads in
notion_selectto accept color and name parameters. - Improved object initialization with default color assignment.
- Extended constructor overloads in
-
source/Classes/00_General/20_notion_status.ps1- Added default constructor for
notion_status. - Enhanced overloaded constructors to default missing parameters and reduce errors during object construction.
- Added default constructor for
-
source/Classes/Database/DatabaseProperties/00_dp_base.ps1- Improved validation and error handling in
DatabasePropertiesBase::ConvertFromObject. - Expanded switch statement for more readable property type conversion.
- Ensures
nullinputs are properly caught with helpful errors.
- Improved validation and error handling in
-
source/Classes/Database/DatabaseProperties/01_dp.ps1- Improved logic in
notion_databaseproperties::ConvertFromObjectto handle hashtables, custom objects, and existing instances more flexibly. - Added internal validation to
Add()method to enforce proper typing and error reporting.
- Improved logic in
-
source/Classes/Database/DatabaseProperties/09_dp_formula.ps1- Improved structure conversion logic with validation for missing
expressionfield. - Added constructor-level documentation and default handling in
notion_formula_database_property.
- Improved structure conversion logic with validation for missing
-
source/Classes/Database/DatabaseProperties/12_dp_multi_select.ps1- Refactored
addmethod to include validation for color and item limits. - Enhanced constructor overloads to allow immediate option injection.
- Refactored
-
source/Classes/Database/DatabaseProperties/13_dp_number.ps1- Refined error checking for
notion_number_database_property_structure. - Streamlined constructor input parsing and enum conversion.
- Refined error checking for
-
source/Classes/Database/DatabaseProperties/16_dp_relation.ps1- Removed
database_idfrom structure constructors where no longer applicable. - Improved validation and error handling in all classes related to
notion_relation_database_property. - Fixed improper use of
-invalidDataparameter inWrite-Error.
- Removed
-
source/Classes/Database/DatabaseProperties/19_dp_select.ps1- Added overloads to
notion_select_database_property_structurefor adding options with or without colors and IDs. - Improved error handling and capped item count to 100.
- Clarified and improved structure population logic.
- Added overloads to
-
source/Classes/Database/DatabaseProperties/20_dp_status.ps1- Introduced constructors and
addmethods for programmatically buildingnotion_status_database_property_structure. - Added null-checks and error validation in
ConvertFromObjectto reduce conversion-time failures.
- Introduced constructors and
-
source/Classes/Database/DatabaseProperties/21_dp_title.ps1- Removed obsolete
TODOcomment. - Minor formatting cleanup.
- Removed obsolete
-
source/Classes/Database/DatabaseProperties/23_dp_unique_id.ps1- Improved null checking and early return in
ConvertFromObject. - Replaced all raw type checks with consistent, safe PowerShell exception handling.
- Reformatted parameter block and function declaration to align with PowerShell style standards.
- Improved null checking and early return in
Fixed
source/Classes/Database/01_database.ps1- Fixed constructor to ensure all kind of possible parameter types are handled correctly, including rich text objects for
title.
- Fixed constructor to ensure all kind of possible parameter types are handled correctly, including rich text objects for
source/Classes/Database/DatabaseProperties/16_dp_relation.ps1- Fixed Write Error parameters to use
-Category InvalidData, fixed the error message to include the actual type value, and removed the-invalidDataparameter which is not a valid parameter forWrite-Error.
- Fixed Write Error parameters to use
[0.11.0] - 2025-07-01
Added
-
source/Public/Block/Pdf/New-NotionPdfBlock.ps1- Implemented
New-NotionPdfBlockto generate a Notion PDF block from provided caption and URL.
- Implemented
-
source/Public/Block/Video/New-NotionVideoBlock.ps1- Implemented
New-NotionVideoBlockto create a Notion video block with specified input.
- Implemented
-
tests/Unit/Public/Block/New-NotionPdfBlock.Tests.ps1- Added unit tests for
New-NotionPdfBlock, validating block construction from caption and URL.
- Added unit tests for
-
tests/Unit/Public/Block/New-NotionVideoBlock.Tests.ps1- Added unit tests for
New-NotionVideoBlock, covering basic functionality and input validation.
- Added unit tests for
Fixed
/workspaces/Notion/source/Classes/Block/27.99_Table.ps1- Fixed
[Table_structure]::ConvertFromObject()
- Fixed
Removed
- Removed unimplemented placeholder versions of these functions from the
Cmdsfolder after relocating and implementing them.source/Public/Block/Cmds/Pdf/New-NotionPdfBlock.ps1source/Public/Block/Cmds/Video/New-NotionVideoBlock.ps1
[0.10.0] - 2025-06-27
Added
-
.devcontainer/setup.ps1- Added logic to ensure the
.dotnet/toolsdirectory is prepended to$env:PATHif not already present, improving the reliability of dotnet tool availability in devcontainers.
- Added logic to ensure the
-
GitVersion.yml- Updated the
hotfixbranch regex to also matchbugfixprefixes, enhancing support for multiple fix naming conventions.
- Updated the
-
source/Private/Invoke-TransposeTable.ps1- Introduced
Invoke-TransposeTable, a utility function that transposes a 2D array. Useful for converting row-major to column-major formats.
- Introduced
-
source/Public/Block/Image/New-NotionImageBlock.ps1- Implemented
New-NotionImageBlockto construct anotion_image_blockfrom a file input.
- Implemented
-
tests/Integration/Block/table.tests.ps1- Added integration tests verifying creation of table blocks with structured content.
-
tests/QA/ModulePrefix.Tests.ps1- Introduced QA test to enforce module function naming conventions using
Verb-PrefixFunctionNamepattern.
- Introduced QA test to enforce module function naming conventions using
-
tests/Unit/Classes/Block/27.99_Table.tests.ps1- Added comprehensive unit tests for
Table_structureandnotion_table_blockclasses, covering constructors, methods, and conversion behavior.
- Added comprehensive unit tests for
-
tests/Unit/Private/Invoke-TransposeTable.Tests.ps1- Introduced unit tests for
Invoke-TransposeTable, validating matrix transposition and error handling for invalid input.
- Introduced unit tests for
-
tests/Unit/Public/Block/New-NotionTableBlock.Tests.ps1- Added extensive unit tests for
New-NotionTableBlock, validating behavior across input types, flags, and edge cases.
- Added extensive unit tests for
Changed
-
source/Classes/Block/21_Image.ps1- Enhanced
notion_image_block.ConvertFromObjectto handle bothnotion_fileobjects and plain objects, improving robustness.
- Enhanced
-
source/Classes/Block/27.2_TableRow.ps1- Updated
TableRow_structure.ConvertFromObjectto short-circuit if input is already aTableRow_structureinstance, avoiding unnecessary processing.
- Updated
-
source/Classes/Block/27.99_Table.ps1- Modified
addRowandaddRowsto sethas_childrenflag when adding rows, ensuring block state consistency.
- Modified
-
source/Public/Block/_RichText/New-NotionRichText.ps1- Updated the
Annotationsparameter to inherit defaults from parent object when unspecified.
- Updated the
-
tests/Integration/Block/callout.tests.ps1- Adjusted emoji and color properties of callout blocks to align with expected test results.
-
tests/Unit/Classes/Page/PageProperties/pp_checkbox.Tests.ps1- Fixed path resolution logic to correct import of project resources.
-
tests/Unit/Classes/Parent/parent.Tests.ps1- Improved error handling for invalid parent types in
notion_parent.ConvertFromObject.
- Improved error handling for invalid parent types in
Fixed
-
source/Public/Block/Table/New-NotionTableBlock.ps1- Renamed function from
New-NotionTabletoNew-NotionTableBlockand significantly refactored its logic to support structured inputs (e.g., hashtables). - Corrected behavior for handling column and row headers.
- Added support for optional pivoting of data and validation of inputs.
- Renamed function from
-
source/Public/Block/TableRow/New-NotionTableRowBlock.ps1- Renamed function from
New-NotionTableRowtoNew-NotionTableRowBlockand updated references to match, ensuring correct module export and functionality.
- Renamed function from
[0.9.2] - 2025-06-24
- .github/workflows/generate-project-page.yml
- Only run when the changelog was updated
[0.9.1] - 2025-06-24
Fixed
- .github/workflows/update-changelog-on-release.yml
- Included Dependency installation
[0.9.0] - 2025-06-24
Added
- .github/workflows/update-changelog-on-release.yml
- Added a GitHub Actions workflow to automatically update the changelog upon release.
- github/workflows/publish.yml
- Added a exclusion for ChangeLog.md changes and commits by the bot user to prevent unnecessary workflow runs.
[0.8.0] - 2025-06-23
Added
- source/Classes/Block/RichText/01_Rich_Text.ps1
- Added Factory method
::Createto instantiatenotion_rich_textobjects from various input types. - Added prototype of
ConvertFromMarkdownmethod to convert Markdown text tonotion_rich_textobjects.
- Added Factory method
- source/Classes/Parent/00_parent.ps1
- Added Recommended Action for unknown parent types in the
ConvertFromObjectmethod.
- Added Recommended Action for unknown parent types in the
- source/Public/Block/Code/New-NotionCodeBlock.ps1
- Added Aliases for
text:code,content, for better flexibility in block creation.
- Added Aliases for
- source/Public/Block/_RichText/New-NotionRichText.ps1
- Included Possibility to pass a Markdown via
-MarkdownText
- Included Possibility to pass a Markdown via
- source/Public/Emoji/New-NotionEmoji.ps1
- Added new function to create
notion_emojiobjects from strings.
- Added new function to create
- tests/Integration/Block/callout.tests.ps1
- Added integration tests for
New-NotionCalloutBlockcmdlet, covering various scenarios and rich text handling.
- Added integration tests for
- New Unit Tests for several classes:
tests/Unit/Classes/Emoji/Custom_Emoji.Tests.ps1tests/Unit/Classes/Emoji/Emoji.Tests.ps1tests/Unit/Classes/Page/PageProperties/pp_checkbox.Tests.ps1tests/Unit/Classes/Parent/parent.Tests.ps1tests/Unit/Classes/User/user.Tests.ps1
- New Unit Tests for several functions:
tests/Unit/Public/Block/Callout/New-NotionCalloutBlock.Tests.ps1tests/Unit/Public/Emoji/New-NotionEmoji.Tests.ps1
Changed
- renamed
icon_typetonotion_icon_type
Fixed
- source/Classes/Block/05_Bookmark.ps1
- Corrected constructors to (remove call to base class constructor)
- source/Classes/Block/RichText/Type/01_Rich_text_text.ps1
- Fixed
ConvertFromObjectin main class and structure class to handle both string and object inputs correctly, ensuring robust rich text handling. - Also fix href handling in the constructor to ensure it is set correctly when provided.
- Fixed
- source/Classes/Emoji/02_Custom_Emoji.ps1
- hardcoded the
typeproperty tocustom_emojiin the constructor, as it is required by the Notion API.
- hardcoded the
- source/Public/Block/Callout/New-NotionCalloutBlock.ps1
- Switched to object array for
rich_textparameter to allow multiple rich text objects, improving flexibility in block creation.
- Switched to object array for
- source/Public/Block/_RichText/New-NotionRichText.ps1
- Fixed conversion of rich_text, by passing it as an object to
[rich_text]::ConvertFromObjects, ensuring consistent handling of rich text objects.
- Fixed conversion of rich_text, by passing it as an object to
- source/Public/Parent/New-NotionParent.ps1
- Switched to factory method
::Createto ensure the conversion logic is handled by the class itself, improving consistency and maintainability. Also initalize the id to an empty string if not provided, to ensure the object is always in a valid state and can be created without errors.
- Switched to factory method
Removed
- source/Classes/Block/RichText/Type/03_Rich_text_equation.ps1
- Duplicate constructor with one parameter removed, PowerShell does not support this syntax.
Deprecated
- source/Public/Block/LinkPreview/New-NotionLinkPreviewBlock.ps1
- Deprecated
New-NotionLinkPreviewBlockcmdlet, as the Notion API does not support creating link preview blocks directly. - Added a error message to inform users about the deprecation.
- Deprecated
[0.7.0] - 2025-06-19
Added
- .gitignore
- Added rules to exclude diff files (
*.diff,diff.*) from version control.
- Added rules to exclude diff files (
- source/Classes/Parent/00_parent.ps1
- Created Factory method
::newto instantiatenotion_parentobjects from various input types.
- Created Factory method
- source/Public/Parent/New-NotionParent.ps1
- New function to create
parentobjects (page_id,database_id,block_id,wordspace)
- New function to create
- source/Private/Remove-NullValuesFromObject.ps1
- Added docs
- source/Private/Test-NotionApiSettings.ps1
- New function to validate Notion API settings, ensuring
NotionApiKey,NotionApiUriandNotionApiVersionare set.
- New function to validate Notion API settings, ensuring
- source/Public/File/New-NotionFile.ps1
- New function to create
notion_fileobjects, supporting various file types and rich text captions.
- New function to create
- source/Public/Page/Get-NotionPage.ps1
- Added
-Rawparameter to return raw JSON data from the Notion API, allowing for more flexible data handling. - Added check of API Parameters to ensure
NotionApiKey,NotionApiUri, andNotionApiVersionare set before making API calls.
- Added
- tests/Unit/Classes/00_General/00_icon.tests.ps1
- Added unit tests for
notion_iconclass, covering various input types and conversion methods.
- Added unit tests for
Changed
-
.vscode/profile.ps1
- Simplified directory change logic to always set location to the Notion module path.
-
.vscode/settings.json
- Removed custom terminal profile definition for Linux (
Notion pwsh), likely to simplify or standardize terminal configurations.
- Removed custom terminal profile definition for Linux (
-
build.ps1
- Simplified
gitversionalias creation by unconditionally defining the alias todotnet-gitversion, removing conditional logic.
- Simplified
-
source/Classes/03_File/01_notion_file.ps1
- Refactored
ConvertFromObjectlogic to simplify type checking and error handling. - Removed unimplemented
file_uploadtype handling.
- Refactored
-
source/Classes/03_File/03_external_file.ps1
- Removed redundant constructor that accepted only a URL, consolidating object creation pathways.
-
source/Public/Block/_RichText/New-NotionRichText.ps1
- Use handling in [richt_text] instead of maintaining separate logic in the cmdlet.
-
source/Public/Page/Get-NotionPageChildren.ps1
- Added connectivity check
Fixed
- source/Classes/00_General/00_icon.ps1
- Fixed
ConvertFromObjectto handle both string and object inputs correctly, ensuring robust icon handling. - Created factory method (::new) to instantiate
notion_iconobjects from various input types.
- Fixed
- source/Classes/03_File/01_file.ps1
- Handle caption correctly in
ConvertFromObject, ensuring its only processed if present.
- Handle caption correctly in
- source/Classes/03_File/02_hosted_file.ps1
- Added Constructor with two parameters:
urlandexpiry_time, to support creation without caption and name. - Ensure the rich_text is converted correctly using
[rich_text]::ConvertFromObjectsfor consistent rich text handling.
- Added Constructor with two parameters:
- source/Classes/03_File/03_external_file.ps1
- Fixed
ConvertFromObjectto handle both string and object inputs correctly, ensuring robust external file handling. - Ensure rich_text is converted correctly using
[rich_text]::ConvertFromObjectsfor consistent rich text handling.
- Fixed
- source/Classes/Block/RichText/01_Rich_Text.ps1
- Fixed
ConvertFromObjectsto handle empty strings correctly (no conversion), and allow Object and
- Fixed
- source/Public/Page/New-NotionPage.ps1
- Fixed
IconandCoverproperty handling
- Fixed
-
source/Private/Remove-NullValuesFromObject.ps1
- Fixed handling of empty strings and arrays only containing empty strings, ensuring they are removed from the object.
- source/Public/Block/Paragraph/New-NotionParagraphBlock.ps1
- Fixed parameter handling, added example documentation
[0.6.0] - 2025-06-16
Added
-
Development Environment
.devcontainer/devcontainer.json: Added VS Code extensionsgithub.vscode-github-actionsandshd101wyy.markdown-preview-enhancedfor enhanced GitHub workflow and markdown preview..vscode/extensions.json: Added the same extensions to the recommended list.
-
Documentation and Site Generation
.github/templates/README.template.md: Introduced a new README template that dynamically includesREADME.md,CONTRIBUTING.md, the Wiki homepage, andCHANGELOG.md..github/workflows/generate-project-page.yml: Created GitHub Actions workflow to deploy a Jekyll-based project page from a feature branch usingpeaceiris/actions-gh-pages.GemFile: Added dependencies:jekyll,minima,csv,logger,base64.jekyll_config.yml: Defined Jekyll site configuration including theme and SEO plugin.
Changed
-
README and Assets
README.md: Replaced deprecated<center>tag with<p align="center">, and updated image path.TSNotion_mini.png: Moved toassets/TSNotion_mini.pngfor better organisation.
-
Development Environment Settings
.vscode/profile.ps1: Removed conditional directory check to always set working location to the Notion module path..vscode/settings.json: Removed Linux terminal profile configuration and associated settings.
-
Build Script Behavior
build.ps1: Simplified alias setup to always definegitversionfordotnet-gitversion.build.yaml: AddedCreate_ChangeLog_GitHub_PRtask topublishstage to write version number inCHANGELOG.mdfrom latest GitHub release tag.
-
Class Definitions
source/Classes/03_File/01_notion_file.ps1: Removed unsupported"file_upload"case fromCreateandConvertFromObject.source/Classes/03_File/03_external_file.ps1: Removed unused constructor fornotion_external_filethat only accepted a URL.
-
Block Type Handling
source/Classes/Block/04_Block.ps1: Removed early return if input was already anotion_block.
-
Paragraph Block Structure
source/Classes/Block/23_Paragraph.ps1: Removed constructors withcoloras second argument; simplified initialization.
-
PDF Block Structure
source/Classes/Block/24_PDF.ps1: Refactored to use a newPDF_structureclass, enabling rich text captions and stronger type safety.
-
Quote Block Structure
source/Classes/Block/25_Quote.ps1: Simplified constructors and improved parsing inConvertFromObjectusing rich text conversion.
-
Synced Block Structure
source/Classes/Block/26_Synced_Block.ps1: RemovedSynced_Block_Duplicate_structureclass; streamlined synced block logic.
-
Table Row Logic
source/Classes/Block/27.2_TableRow.ps1: Simplified cell-adding logic using directForEachwith cleaner checks.
-
Table of Contents Block
source/Classes/Block/30_Table_Of_Contents.ps1: Cleaned up constructor logic and enum parsing.
-
To-do Block Structure
source/Classes/Block/31_To_do.ps1: Switched toForEachfor rich text and clarified argument handling.
-
Toggle Block Structure
source/Classes/Block/32_Toggle.ps1: Rewrote constructors for better type clarity and streamlined text conversion.
[0.5.0] - 2025-06-15
Added
-
VSCode Configuration
.vscode/settings.json: Configuredterminal.integrated.bracketedPasteMode, disabled minimap, custom terminal profile, formatter preferences, and extension settings..vscode/profile.ps1: PowerShell profile to auto-import the module during VSCode sessions..vscode/vsicons-custom-icons/: Support for custom icons, includingfile_type_pester.svgandcopyFileToSystemPath.ps1.
-
Build and Wiki Scripts
.build/Copy-WikiContent.ps1: Script to copy wiki content from source to destination with flattened structure..build/New-WikiSidebarFromPs1.ps1: Generates_Sidebar.mdfrom PowerShell and Markdown files..build/README.md: Documentation for adding custom build tasks and workflows.build.yaml: Addedminibuildtask with steps forClean,Build_Module_ModuleBuilder, andBuild_NestedModules_ModuleBuilder.
-
Module Source Code
source/Classes/03_File/01_notion_file.ps1: StaticCreatemethod to instantiate child objects based on file type.source/Classes/Block/RichText/01_Rich_Text.ps1:ConvertFromObjectsmethod to convert arrays or single objects intorich_text[].- Various block classes (
Bookmark,Callout,ChildPage,Code,Image,Video, etc.): New or refactored constructors, support for flexible input,ConvertFromObject(s)methods, support forcaption, emoji, etc. source/Classes/Block/04_Block.ps1: Improved error messages for unsupported and unknown block types with GitHub issue link.source/Classes/Emoji/01_emoji.ps1:ConvertFromObjectmethod to handle strings and emoji objects.source/Public/Block/New-NotionBlock.ps1: Generic factory function to create Notion blocks.source/Public/Block/Cmds/*: Many new cmdlets likeNew-NotionBookmarkBlock,New-NotionCalloutBlock, etc.docs/Enums/: Markdown documentation for all enums used in the module.source/WikiSource/: Wiki source files including setup guide, FAQ, and integration images.
-
Tests
tests/Integration/Block/testpage.tests.ps1: Improved logic and error message validation.tests/Integration/PageProperties/testpage.tests.ps1: Validation for page property types.tests/Unit/Classes/Block/: Unit tests for many block classes.- Additional tests for new constructors, block types, and unsupported block error messages.
Changed
-
General Refactoring
- Refactored many constructors across block classes to support more flexible input and consistent use of
ConvertFromObjects. source/Classes/Emoji/01_emoji.ps1: Improved emoji conversion logic.source/Enum/*: Added missing enum values and documentation links.
- Refactored many constructors across block classes to support more flexible input and consistent use of
-
Configuration Files
.vscode/analyzersettings.psd1: Relaxed some analyzer rules (e.g., allowedWrite-Host)..github/ISSUE_TEMPLATE/: Updated templates to reflect support for cmdlets, classes, and enums.README.md: Added badges, logo, and improved getting started section.RequiredModules.psd1: Switched to Pester Version 6.build.ps1: Added tasksGenerate_Wiki_Sidebar_From_Ps1andCopy_Wiki_Content_Custom.
Fixed
-
Class Fixes
source/Enum/01_notion_color.ps1: Addeddefault_backgroundcolor.source/Classes/Block/32_Toggle.ps1: Fixed class name and constructor.source/Classes/Block/33_Video.ps1: Fixed constructors and file instantiation logic.source/Classes/Block/05_Bookmark.ps1: Fixed constructors andbookmark_structurelogic.source/Classes/Block/07_Bulleted_List_Item.ps1: Fixedrich_textconversion in constructors.source/Classes/Block/08_Callout.ps1: Fixed constructors and emoji handling.source/Classes/Emoji/01_emoji.ps1: FixedConvertFromObjectto handle strings and emoji objects.
-
Tests and Validation
- Improved error handling and validation in integration tests.
- Enhanced input validation to prevent runtime errors.
- Fixed
ConvertTo-Jsondepth handling for complete serialization. - Fixed enum handling and added missing values.
[0.3.0] - 2025-05-18
Fixed
- Fix Wiki Sidebar
- Fix Logo in ReadMe
[0.2.0] - 2025-05-18
Added
- Documentation to Classes: Comment, Emoji, File, General, Page, Parent, User
- Documentation to Classes: Block, Database, DatabaseProperties
- Documentation to Classes: add relation between classes, in dedicated docs folder
- Documentation to all PSCmdlets
- prepared automatic Wiki Generation
- Add-NotionPageToDatabase, Move-NotionPageToArchive: prepared
- Get-NotionPageProperty: prepared and partly tested
- Update-NotionPageProperty: prepared
- Add-NotionDatabaseProperty, Remove-NotionDatabaseProperty, Move-NotionPageToArchive: prepared
- Add-NotionBlockToPage: prepared
- Get-NotionPageChildren: implemented
- Remove-NotionBlock: function to remove / trash a block
- Update-NotionBlock: function to update a block
- New-NotionTable: function to create a new table
- New-NotionTableRow: function to create a new table row
Changed
- Module Manifest: Added Metadata
- Filenames: changed to match the cmdlet names
- ConvertTo-NotionObject: include property_item
- Disconnect-Notion: improve Confirm message
- Restore-NotionPage, Restore-NotionDatabase: add archived = $false, to ensure restore is possible from both trash and archive
- For changes in existing functionality.
- Remove-NotionPage: specify output type, fix code
- Get-NotionBlockChildren: refactored
Removed
- page, Get-NotionPage: remove children
- TableCell: was only a wrongly implemented wrapper for rich_text
Fixed
- Add-NotionHeaderToBlock: fix parameter types
- New-NotionHeader: switch to factory method of notion_heading_block
- block: fix ConvertFrom-Object
- Column List: fix ConvertFrom-Object
- Numbered List item: Fix constructors and color conversion to enum
- paragraph: added color in ConvertFrom-Object
- to_do: Fixed ConvertFrom-Object, added default constructor
- Heading: Adjusted implementation to match API Schema
- Remove-NullValuesFromObject: fix DateTime objects and remove empty arrays, include handling for nested arrays
- notion_table_block: implemented according to API Schema
- notion_table_row_block: implemented according to API Schema
- rich_text_text: handle primitive types correctly
Security
- API Variables: switch from global to script scope