diff --git a/src/Pages/Properties/Checkbox.php b/src/Pages/Properties/Checkbox.php index aa16df1f..1ef979fc 100644 --- a/src/Pages/Properties/Checkbox.php +++ b/src/Pages/Properties/Checkbox.php @@ -33,6 +33,13 @@ public static function createUnchecked(): self return new self($property, false); } + public static function createEmpty(string $id = null): self + { + $property = PropertyMetadata::create($id ?? "", PropertyType::Checkbox); + + return new self($property, false); + } + public static function fromArray(array $array): self { /** @psalm-var CheckboxJson $array */ diff --git a/src/Pages/Properties/Date.php b/src/Pages/Properties/Date.php index b66cfff2..99ecd933 100644 --- a/src/Pages/Properties/Date.php +++ b/src/Pages/Properties/Date.php @@ -39,9 +39,9 @@ public static function createRange(DateTimeImmutable $start, DateTimeImmutable $ return new self($property, CommonDate::createRange($start, $end)); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $metadata = PropertyMetadata::create("", PropertyType::Date); + $metadata = PropertyMetadata::create($id ?? "", PropertyType::Date); return new self($metadata, null); } diff --git a/src/Pages/Properties/Email.php b/src/Pages/Properties/Email.php index 1be81c36..fbb6af8c 100644 --- a/src/Pages/Properties/Email.php +++ b/src/Pages/Properties/Email.php @@ -26,9 +26,9 @@ public static function create(string $email): self return new self($property, $email); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $property = PropertyMetadata::create("", PropertyType::Email); + $property = PropertyMetadata::create($id ?? "", PropertyType::Email); return new self($property, null); } diff --git a/src/Pages/Properties/Files.php b/src/Pages/Properties/Files.php index 407fe430..3ec95d7f 100644 --- a/src/Pages/Properties/Files.php +++ b/src/Pages/Properties/Files.php @@ -39,6 +39,13 @@ public static function create(File ...$files): self return new self($property, $files); } + public static function createEmpty(string $id = null): self + { + $property = PropertyMetadata::create($id ?? "", PropertyType::Files); + + return new self($property, []); + } + public static function fromArray(array $array): self { /** @psalm-var FilesJson $array */ diff --git a/src/Pages/Properties/MultiSelect.php b/src/Pages/Properties/MultiSelect.php index 9606a445..1f1a8154 100644 --- a/src/Pages/Properties/MultiSelect.php +++ b/src/Pages/Properties/MultiSelect.php @@ -24,6 +24,13 @@ private function __construct( ) { } + public static function createEmpty(string $id = null): self + { + $property = PropertyMetadata::create($id ?? "", PropertyType::MultiSelect); + + return new self($property, []); + } + public static function fromIds(string ...$ids): self { $metadata = PropertyMetadata::create("", PropertyType::MultiSelect); diff --git a/src/Pages/Properties/Number.php b/src/Pages/Properties/Number.php index 21e9d4cc..2ae8fb31 100644 --- a/src/Pages/Properties/Number.php +++ b/src/Pages/Properties/Number.php @@ -26,9 +26,9 @@ public static function create(int|float $number): self return new self($property, $number); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $property = PropertyMetadata::create("", PropertyType::Number); + $property = PropertyMetadata::create($id ?? "", PropertyType::Number); return new self($property, null); } diff --git a/src/Pages/Properties/People.php b/src/Pages/Properties/People.php index eb4fb635..ea17d1a5 100644 --- a/src/Pages/Properties/People.php +++ b/src/Pages/Properties/People.php @@ -31,6 +31,13 @@ public static function create(User ...$users): self return new self($property, $users); } + public static function createEmpty(string $id = null): self + { + $property = PropertyMetadata::create($id ?? "", PropertyType::People); + + return new self($property, []); + } + public static function fromArray(array $array): self { /** @psalm-var PeopleJson $array */ diff --git a/src/Pages/Properties/PhoneNumber.php b/src/Pages/Properties/PhoneNumber.php index 9065f51a..2bc10294 100644 --- a/src/Pages/Properties/PhoneNumber.php +++ b/src/Pages/Properties/PhoneNumber.php @@ -26,9 +26,9 @@ public static function create(string $phone): self return new self($property, $phone); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $property = PropertyMetadata::create("", PropertyType::PhoneNumber); + $property = PropertyMetadata::create($id ?? "", PropertyType::PhoneNumber); return new self($property, null); } diff --git a/src/Pages/Properties/Relation.php b/src/Pages/Properties/Relation.php index 0d4e41e7..69af0e90 100644 --- a/src/Pages/Properties/Relation.php +++ b/src/Pages/Properties/Relation.php @@ -27,6 +27,13 @@ public static function create(string ...$pageIds): self return new self($property, $pageIds); } + public static function createEmpty(string $id = null): self + { + $property = PropertyMetadata::create($id ?? "", PropertyType::Relation); + + return new self($property, []); + } + public static function fromArray(array $array): self { /** @psalm-var RelationJson $array */ diff --git a/src/Pages/Properties/RichTextProperty.php b/src/Pages/Properties/RichTextProperty.php index b102f62c..212ca9b6 100644 --- a/src/Pages/Properties/RichTextProperty.php +++ b/src/Pages/Properties/RichTextProperty.php @@ -39,9 +39,9 @@ public static function fromString(string $text): self return new self($metadata, $texts); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $metadata = PropertyMetadata::create("", PropertyType::RichText); + $metadata = PropertyMetadata::create($id ?? "", PropertyType::RichText); return new self($metadata, []); } diff --git a/src/Pages/Properties/Select.php b/src/Pages/Properties/Select.php index 4a95e4b8..82ca9ac5 100644 --- a/src/Pages/Properties/Select.php +++ b/src/Pages/Properties/Select.php @@ -44,9 +44,9 @@ public static function fromOption(SelectOption $option): self return new self($metadata, $option); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $metadata = PropertyMetadata::create("", PropertyType::Select); + $metadata = PropertyMetadata::create($id ?? "", PropertyType::Select); return new self($metadata, null); } diff --git a/src/Pages/Properties/Status.php b/src/Pages/Properties/Status.php index cff115b2..e4a73b60 100644 --- a/src/Pages/Properties/Status.php +++ b/src/Pages/Properties/Status.php @@ -22,6 +22,13 @@ private function __construct( ) { } + public static function createEmpty(string $id = null): self + { + $property = PropertyMetadata::create($id ?? "", PropertyType::Status); + + return new self($property, null); + } + public static function fromId(string $id): self { $metadata = PropertyMetadata::create("", PropertyType::Status); diff --git a/src/Pages/Properties/Title.php b/src/Pages/Properties/Title.php index 32c7c840..84993686 100644 --- a/src/Pages/Properties/Title.php +++ b/src/Pages/Properties/Title.php @@ -26,6 +26,13 @@ private function __construct( ) { } + public static function createEmpty(): self + { + $property = PropertyMetadata::create("title", PropertyType::Title); + + return new self($property, []); + } + /** @psalm-mutation-free */ public static function fromText(RichText ...$title): self { diff --git a/src/Pages/Properties/Url.php b/src/Pages/Properties/Url.php index f0926407..c2c21e29 100644 --- a/src/Pages/Properties/Url.php +++ b/src/Pages/Properties/Url.php @@ -26,9 +26,9 @@ public static function create(string $url): self return new self($metadata, $url); } - public static function createEmpty(): self + public static function createEmpty(string $id = null): self { - $metadata = PropertyMetadata::create("", PropertyType::Url); + $metadata = PropertyMetadata::create($id ?? "", PropertyType::Url); return new self($metadata, null); }