├── LICENSE ├── README.md ├── composer.json └── src ├── .gitkeep ├── Client.php ├── ClientOptions.php ├── Constant ├── ColorConstant.php └── NotionErrorCodeConstant.php ├── Endpoint ├── AbstractEndpoint.php ├── BlocksChildrenEndpoint.php ├── BlocksEndpoint.php ├── DatabasesEndpoint.php ├── PagesEndpoint.php ├── PagesPropertiesEndpoint.php ├── SearchEndpoint.php └── UsersEndpoint.php ├── Exception ├── AbstractNotionException.php ├── ApiResponseException.php ├── HttpResponseException.php ├── InvalidFileException.php ├── InvalidMentionException.php ├── InvalidPaginationResponseException.php ├── InvalidParentException.php ├── InvalidPropertyConfigurationException.php ├── InvalidPropertyException.php ├── InvalidPropertyItemException.php ├── InvalidPropertyObjectException.php ├── InvalidPropertyValueException.php ├── InvalidResourceException.php ├── InvalidResourceTypeException.php ├── InvalidRichTextException.php ├── RequestTimeoutException.php ├── UnsupportedFileTypeException.php ├── UnsupportedFormulaTypeException.php ├── UnsupportedMentionTypeException.php ├── UnsupportedPaginationResponseTypeException.php ├── UnsupportedParentTypeException.php ├── UnsupportedPropertyConfigurationException.php ├── UnsupportedPropertyItemException.php ├── UnsupportedPropertyObjectException.php ├── UnsupportedPropertyTypeException.php ├── UnsupportedPropertyValueException.php ├── UnsupportedRichTextTypeException.php └── UnsupportedUserTypeException.php ├── HttpClient ├── HttpClientFactory.php └── HttpClientFactoryInterface.php ├── RequestParameters.php ├── Resource ├── AbstractJsonSerializable.php ├── AbstractResource.php ├── Annotations.php ├── Block │ ├── AbstractBlock.php │ ├── AbstractHeadingBlock.php │ ├── AudioBlock.php │ ├── BookmarkBlock.php │ ├── BreadcrumbBlock.php │ ├── BulletedListItemBlock.php │ ├── CalloutBlock.php │ ├── ChildDatabaseBlock.php │ ├── ChildPageBlock.php │ ├── CodeBlock.php │ ├── ColumnBlock.php │ ├── ColumnListBlock.php │ ├── DividerBlock.php │ ├── EmbedBlock.php │ ├── EquationBlock.php │ ├── FileBlock.php │ ├── Heading1Block.php │ ├── Heading2Block.php │ ├── Heading3Block.php │ ├── ImageBlock.php │ ├── LinkPreviewBlock.php │ ├── LinkToPageBlock.php │ ├── NumberedListItemBlock.php │ ├── ParagraphBlock.php │ ├── PdfBlock.php │ ├── QuoteBlock.php │ ├── SyncedBlockBlock.php │ ├── TableBlock.php │ ├── TableOfContentsBlock.php │ ├── TableRowBlock.php │ ├── TemplateBlock.php │ ├── ToDoBlock.php │ ├── ToggleBlock.php │ ├── UnsupportedBlock.php │ └── VideoBlock.php ├── Database.php ├── Database │ ├── DatabaseRequest.php │ ├── PropertyConfiguration │ │ ├── CheckboxPropertyConfiguration.php │ │ ├── CreatedByPropertyConfiguration.php │ │ ├── CreatedTimePropertyConfiguration.php │ │ ├── DatePropertyConfiguration.php │ │ ├── EmailPropertyConfiguration.php │ │ ├── FilesPropertyConfiguration.php │ │ ├── FormulaPropertyConfiguration.php │ │ ├── LastEditedByPropertyConfiguration.php │ │ ├── LastEditedTimePropertyConfiguration.php │ │ ├── NumberPropertyConfiguration.php │ │ ├── PeoplePropertyConfiguration.php │ │ ├── PhoneNumberPropertyConfiguration.php │ │ ├── RelationPropertyConfiguration.php │ │ ├── RichTextPropertyConfiguration.php │ │ ├── RollupPropertyConfiguration.php │ │ ├── SelectPropertyConfiguration.php │ │ ├── StatusPropertyConfiguration.php │ │ ├── TitlePropertyConfiguration.php │ │ └── UrlPropertyConfiguration.php │ └── PropertyObject │ │ ├── AbstractPropertyObject.php │ │ ├── CheckboxPropertyObject.php │ │ ├── CreatedByPropertyObject.php │ │ ├── CreatedTimePropertyObject.php │ │ ├── DatePropertyObject.php │ │ ├── EmailPropertyObject.php │ │ ├── FilesPropertyObject.php │ │ ├── FormulaPropertyObject.php │ │ ├── LastEditedByPropertyObject.php │ │ ├── LastEditedTimePropertyObject.php │ │ ├── MultiSelectPropertyObject.php │ │ ├── NumberPropertyObject.php │ │ ├── PeoplePropertyObject.php │ │ ├── PhoneNumberPropertyObject.php │ │ ├── RelationPropertyObject.php │ │ ├── RichTextPropertyObject.php │ │ ├── RollupPropertyObject.php │ │ ├── SelectPropertyObject.php │ │ ├── StatusPropertyObject.php │ │ ├── TitlePropertyObject.php │ │ └── UrlPropertyObject.php ├── File │ ├── AbstractFile.php │ ├── CustomEmoji.php │ ├── Emoji.php │ ├── External.php │ └── File.php ├── Link.php ├── Page.php ├── Page │ ├── Parent │ │ ├── AbstractParentProperty.php │ │ ├── DatabaseIdParent.php │ │ ├── PageIdParent.php │ │ └── WorkspaceParent.php │ ├── PropertyItem │ │ ├── AbstractPropertyItem.php │ │ ├── PeoplePropertyItem.php │ │ ├── RelationPropertyItem.php │ │ ├── RichTextPropertyItem.php │ │ └── TitlePropertyItem.php │ └── PropertyValue │ │ ├── AbstractPropertyValue.php │ │ ├── CheckboxPropertyValue.php │ │ ├── CreatedByPropertyValue.php │ │ ├── CreatedTimePropertyValue.php │ │ ├── DatePropertyValue.php │ │ ├── EmailPropertyValue.php │ │ ├── FilesPropertyValue.php │ │ ├── FormulaPropertyValue.php │ │ ├── LastEditedByPropertyValue.php │ │ ├── LastEditedTimePropertyValue.php │ │ ├── MultiSelectPropertyValue.php │ │ ├── NumberPropertyValue.php │ │ ├── PeoplePropertyValue.php │ │ ├── PhoneNumberPropertyValue.php │ │ ├── RelationPropertyValue.php │ │ ├── RichTextPropertyValue.php │ │ ├── RollupPropertyValue.php │ │ ├── SelectPropertyValue.php │ │ ├── StatusPropertyValue.php │ │ ├── TitlePropertyValue.php │ │ ├── UniqueIdPropertyValue.php │ │ ├── UrlPropertyValue.php │ │ └── VerificationPropertyValue.php ├── Pagination │ ├── AbstractPaginationResults.php │ ├── BlockResults.php │ ├── DatabaseResults.php │ ├── PageOrDatabaseResults.php │ ├── PageResults.php │ ├── PaginationRequest.php │ ├── PropertyItemResults.php │ └── UserResults.php ├── Property │ ├── AbstractParagraphProperty.php │ ├── AbstractProperty.php │ ├── BookmarkProperty.php │ ├── BotProperty.php │ ├── BreadcrumbProperty.php │ ├── BulletedListItemProperty.php │ ├── CalloutProperty.php │ ├── ChildDatabaseProperty.php │ ├── ChildPageProperty.php │ ├── CodeProperty.php │ ├── CustomEmojiProperty.php │ ├── DateProperty.php │ ├── DividerProperty.php │ ├── EmbedProperty.php │ ├── EquationProperty.php │ ├── ExternalProperty.php │ ├── FileProperty.php │ ├── HeadingProperty.php │ ├── LinkMentionProperty.php │ ├── LinkPreviewProperty.php │ ├── LinkToPageProperty.php │ ├── NumberedListItemProperty.php │ ├── OwnerProperty.php │ ├── ParagraphProperty.php │ ├── PartialDatabaseProperty.php │ ├── PartialPageProperty.php │ ├── PersonProperty.php │ ├── QuoteProperty.php │ ├── RelationProperty.php │ ├── SelectProperty.php │ ├── StatusGroupProperty.php │ ├── SyncedBlockProperty.php │ ├── SyncedFromProperty.php │ ├── TableOfContentsProperty.php │ ├── TableProperty.php │ ├── TableRowProperty.php │ ├── TemplateProperty.php │ ├── TextProperty.php │ ├── ToDoProperty.php │ ├── ToggleProperty.php │ └── Value │ │ ├── AbstractValueProperty.php │ │ ├── ArrayValueProperty.php │ │ ├── BooleanValueProperty.php │ │ ├── DateValueProperty.php │ │ ├── NumberValueProperty.php │ │ └── StringValueProperty.php ├── ResourceInterface.php ├── RichText │ ├── AbstractMention.php │ ├── AbstractRichText.php │ ├── Equation.php │ ├── Mention.php │ ├── Mention │ │ ├── CustomEmojiMention.php │ │ ├── DatabaseMention.php │ │ ├── DateMention.php │ │ ├── LinkMentionMention.php │ │ ├── LinkPreviewMention.php │ │ ├── PageMention.php │ │ └── UserMention.php │ ├── MentionInterface.php │ └── Text.php ├── Search │ └── SearchRequest.php ├── User │ ├── AbstractUser.php │ ├── BotUser.php │ ├── PartialUser.php │ └── PersonUser.php └── UserInterface.php └── Util ├── ArrayHelper.php ├── StringHelper.php └── UrlHelper.php /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 brd6 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brd6/notion-sdk-php/71be0cf8273c1f208c7910a43335b123c3b95641/src/.gitkeep -------------------------------------------------------------------------------- /src/ClientOptions.php: -------------------------------------------------------------------------------- 1 | auth; 26 | } 27 | 28 | public function setAuth(string $auth): self 29 | { 30 | $this->auth = $auth; 31 | 32 | return $this; 33 | } 34 | 35 | public function hasAuth(): bool 36 | { 37 | return strlen($this->auth) > 0; 38 | } 39 | 40 | public function getBaseUrl(): string 41 | { 42 | return $this->baseUrl; 43 | } 44 | 45 | public function setBaseUrl(string $baseUrl): self 46 | { 47 | $this->baseUrl = $baseUrl; 48 | 49 | return $this; 50 | } 51 | 52 | public function getNotionVersion(): string 53 | { 54 | return $this->notionVersion; 55 | } 56 | 57 | public function setNotionVersion(string $notionVersion): self 58 | { 59 | $this->notionVersion = $notionVersion; 60 | 61 | return $this; 62 | } 63 | 64 | public function getTimeout(): int 65 | { 66 | return $this->timeout; 67 | } 68 | 69 | public function setTimeout(int $timeout): self 70 | { 71 | $this->timeout = $timeout; 72 | 73 | return $this; 74 | } 75 | 76 | public function getHttpClient(): ?HttpClientInterface 77 | { 78 | return $this->httpClient; 79 | } 80 | 81 | public function setHttpClient(HttpClientInterface $httpClient): self 82 | { 83 | $this->httpClient = $httpClient; 84 | 85 | return $this; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Constant/ColorConstant.php: -------------------------------------------------------------------------------- 1 | client = $client; 16 | } 17 | 18 | protected function getClient(): Client 19 | { 20 | return $this->client; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Endpoint/SearchEndpoint.php: -------------------------------------------------------------------------------- 1 | toArray() : [], 39 | $paginationRequest ? $paginationRequest->toArray() : [], 40 | ); 41 | 42 | $requestParameters = (new RequestParameters()) 43 | ->setPath('search') 44 | ->setBody($body) 45 | ->setMethod('POST'); 46 | 47 | $rawData = $this->getClient()->request($requestParameters); 48 | 49 | return AbstractPaginationResults::fromRawData($rawData); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Exception/AbstractNotionException.php: -------------------------------------------------------------------------------- 1 | messageCode = (string) $rawData['code']; 17 | $this->status = (int) $rawData['status']; 18 | 19 | $message = strlen($message) > 0 ? $message : (string) $rawData['message']; 20 | 21 | parent::__construct($statusCode, $headers, $rawData, $message); 22 | } 23 | 24 | public function getMessageCode(): string 25 | { 26 | return $this->messageCode; 27 | } 28 | 29 | public function getStatus(): int 30 | { 31 | return $this->status; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Exception/HttpResponseException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $statusCode); 21 | 22 | parent::__construct($message); 23 | 24 | $this->rawData = $rawData; 25 | $this->headers = $headers; 26 | } 27 | 28 | public function getMessageCode(): string 29 | { 30 | return NotionErrorCodeConstant::RESPONSE_ERROR; 31 | } 32 | 33 | public function getRawData(): array 34 | { 35 | return $this->rawData; 36 | } 37 | 38 | public function getHeaders(): array 39 | { 40 | return $this->headers; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Exception/InvalidFileException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $baseType); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidPropertyItemException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/InvalidRichTextException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedFormulaTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedMentionTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedPaginationResponseTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedParentTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedPropertyConfigurationException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedPropertyItemException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedPropertyObjectException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedPropertyTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type, $baseType); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedPropertyValueException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedRichTextTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Exception/UnsupportedUserTypeException.php: -------------------------------------------------------------------------------- 1 | 0 ? $message : sprintf(self::MESSAGE, $type); 17 | 18 | parent::__construct($message); 19 | } 20 | 21 | public function getMessageCode(): string 22 | { 23 | return ''; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/HttpClient/HttpClientFactoryInterface.php: -------------------------------------------------------------------------------- 1 | path; 17 | } 18 | 19 | public function setPath(string $path): self 20 | { 21 | $this->path = $path; 22 | 23 | return $this; 24 | } 25 | 26 | public function getMethod(): string 27 | { 28 | return $this->method; 29 | } 30 | 31 | public function setMethod(string $method): self 32 | { 33 | $this->method = $method; 34 | 35 | return $this; 36 | } 37 | 38 | public function getQuery(): array 39 | { 40 | return $this->query; 41 | } 42 | 43 | /** 44 | * @param array $query 45 | * 46 | * @return RequestParameters 47 | */ 48 | public function setQuery(array $query): self 49 | { 50 | $this->query = $query; 51 | 52 | return $this; 53 | } 54 | 55 | public function getBody(): array 56 | { 57 | return $this->body; 58 | } 59 | 60 | /** 61 | * @param array $body 62 | * 63 | * @return RequestParameters 64 | */ 65 | public function setBody(array $body): self 66 | { 67 | $this->body = $body; 68 | 69 | return $this; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Resource/AbstractResource.php: -------------------------------------------------------------------------------- 1 | setRawData($rawData); 31 | 32 | if (!isset($rawData['object'])) { 33 | throw new InvalidResourceException(); 34 | } 35 | 36 | if ($resource->rawData['object'] !== $resource->getResourceType()) { 37 | throw new InvalidResourceTypeException((string) $resource->rawData['object']); 38 | } 39 | 40 | $resource->initialize(); 41 | 42 | return $resource; 43 | } 44 | 45 | abstract protected function initialize(): void; 46 | 47 | abstract public static function getResourceType(): string; 48 | 49 | public function getRawData(): array 50 | { 51 | return $this->rawData; 52 | } 53 | 54 | protected function setRawData(array $rawData): self 55 | { 56 | $this->rawData = $rawData; 57 | 58 | $this->object = (string) ($this->getRawData()['object'] ?? ''); 59 | $this->id = (string) ($this->getRawData()['id'] ?? ''); 60 | 61 | return $this; 62 | } 63 | 64 | public function getObject(): string 65 | { 66 | return $this->object; 67 | } 68 | 69 | public function setObject(string $object): self 70 | { 71 | $this->object = $object; 72 | 73 | return $this; 74 | } 75 | 76 | public function setId(string $id): self 77 | { 78 | $this->id = $id; 79 | 80 | return $this; 81 | } 82 | 83 | public function getId(): string 84 | { 85 | return $this->id; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Resource/Block/AbstractHeadingBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 27 | 28 | $typeFormatted = StringHelper::snakeCaseToCamelCase($this->getType()); 29 | $methodName = "set$typeFormatted"; 30 | 31 | $this->$methodName(HeadingProperty::fromRawData($data)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resource/Block/AudioBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->audio = AbstractFile::fromRawData($data); 23 | } 24 | 25 | public function getAudio(): ?AbstractFile 26 | { 27 | return $this->audio; 28 | } 29 | 30 | public function setAudio(?AbstractFile $audio): self 31 | { 32 | $this->audio = $audio; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/BookmarkBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->bookmark = BookmarkProperty::fromRawData($data); 23 | } 24 | 25 | public function getBookmark(): ?BookmarkProperty 26 | { 27 | return $this->bookmark; 28 | } 29 | 30 | public function setBookmark(?BookmarkProperty $bookmark): self 31 | { 32 | $this->bookmark = $bookmark; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/BreadcrumbBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->breadcrumb = BreadcrumbProperty::fromRawData($data); 17 | } 18 | 19 | public function getBreadcrumb(): ?BreadcrumbProperty 20 | { 21 | return $this->breadcrumb; 22 | } 23 | 24 | public function setBreadcrumb(?BreadcrumbProperty $breadcrumb): self 25 | { 26 | $this->breadcrumb = $breadcrumb; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Block/BulletedListItemBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | /** @var BulletedListItemProperty $property */ 30 | $property = BulletedListItemProperty::fromRawData($data); 31 | 32 | $this->bulletedListItem = $property; 33 | } 34 | 35 | public function getBulletedListItem(): ?BulletedListItemProperty 36 | { 37 | return $this->bulletedListItem; 38 | } 39 | 40 | public function setBulletedListItem(?BulletedListItemProperty $bulletedListItem): self 41 | { 42 | $this->bulletedListItem = $bulletedListItem; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Block/CalloutBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 32 | $this->callout = CalloutProperty::fromRawData($data); 33 | } 34 | 35 | public function getCallout(): ?CalloutProperty 36 | { 37 | return $this->callout; 38 | } 39 | 40 | public function setCallout(?CalloutProperty $callout): self 41 | { 42 | $this->callout = $callout; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Block/ChildDatabaseBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->childDatabase = ChildDatabaseProperty::fromRawData($data); 17 | } 18 | 19 | public function getChildDatabase(): ?ChildDatabaseProperty 20 | { 21 | return $this->childDatabase; 22 | } 23 | 24 | /** 25 | * @param ChildDatabaseProperty $childDatabase 26 | * 27 | * @return ChildDatabaseBlock 28 | */ 29 | public function setChildDatabase(ChildDatabaseProperty $childDatabase): self 30 | { 31 | $this->childDatabase = $childDatabase; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Block/ChildPageBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->childPage = ChildPageProperty::fromRawData($data); 17 | } 18 | 19 | public function getChildPage(): ?ChildPageProperty 20 | { 21 | return $this->childPage; 22 | } 23 | 24 | /** 25 | * @param ChildPageProperty $childPage 26 | * 27 | * @return ChildPageBlock 28 | */ 29 | public function setChildPage(ChildPageProperty $childPage): self 30 | { 31 | $this->childPage = $childPage; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Block/CodeBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->code = CodeProperty::fromRawData($data); 23 | } 24 | 25 | public function getCode(): ?CodeProperty 26 | { 27 | return $this->code; 28 | } 29 | 30 | public function setCode(?CodeProperty $code): self 31 | { 32 | $this->code = $code; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/ColumnBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | $this->children = isset($data['children']) ? array_map( 30 | fn (array $childRawData) => AbstractBlock::fromRawData($childRawData), 31 | (array) $data['children'], 32 | ) : []; 33 | } 34 | 35 | /** 36 | * @return array|AbstractBlock[] 37 | */ 38 | public function getChildren(): array 39 | { 40 | return $this->children; 41 | } 42 | 43 | /** 44 | * @param array|AbstractBlock[] $children 45 | */ 46 | public function setChildren(array $children): self 47 | { 48 | $this->children = $children; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Resource/Block/ColumnListBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | $this->children = isset($data['children']) ? array_map( 30 | fn (array $childRawData) => AbstractBlock::fromRawData($childRawData), 31 | (array) $data['children'], 32 | ) : []; 33 | } 34 | 35 | public function getChildren(): array 36 | { 37 | return $this->children; 38 | } 39 | 40 | public function setChildren(array $children): self 41 | { 42 | $this->children = $children; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Block/DividerBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->divider = DividerProperty::fromRawData($data); 17 | } 18 | 19 | public function getDivider(): ?DividerProperty 20 | { 21 | return $this->divider; 22 | } 23 | 24 | public function setDivider(?DividerProperty $divider): self 25 | { 26 | $this->divider = $divider; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Block/EmbedBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->embed = EmbedProperty::fromRawData($data); 17 | } 18 | 19 | public function getEmbed(): ?EmbedProperty 20 | { 21 | return $this->embed; 22 | } 23 | 24 | public function setEmbed(?EmbedProperty $embed): self 25 | { 26 | $this->embed = $embed; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Block/EquationBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->equation = EquationProperty::fromRawData($data); 17 | } 18 | 19 | public function getEquation(): ?EquationProperty 20 | { 21 | return $this->equation; 22 | } 23 | 24 | public function setEquation(?EquationProperty $equation): EquationBlock 25 | { 26 | $this->equation = $equation; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Block/FileBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 33 | $this->file = AbstractFile::fromRawData($data); 34 | $this->caption = isset($data['caption']) ? array_map( 35 | fn (array $richTextRawData) => AbstractRichText::fromRawData($richTextRawData), 36 | (array) $data['caption'], 37 | ) : []; 38 | } 39 | 40 | public function getFile(): ?AbstractFile 41 | { 42 | return $this->file; 43 | } 44 | 45 | public function setFile(?AbstractFile $file): self 46 | { 47 | $this->file = $file; 48 | 49 | return $this; 50 | } 51 | 52 | /** 53 | * @return array|AbstractRichText[] 54 | */ 55 | public function getCaption(): array 56 | { 57 | return $this->caption; 58 | } 59 | 60 | /** 61 | * @param array|AbstractRichText[] $caption 62 | */ 63 | public function setCaption(array $caption): self 64 | { 65 | $this->caption = $caption; 66 | 67 | return $this; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Resource/Block/Heading1Block.php: -------------------------------------------------------------------------------- 1 | heading1; 16 | } 17 | 18 | public function setHeading1(?HeadingProperty $heading): self 19 | { 20 | $this->heading1 = $heading; 21 | 22 | return $this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Resource/Block/Heading2Block.php: -------------------------------------------------------------------------------- 1 | heading2; 16 | } 17 | 18 | public function setHeading2(?HeadingProperty $heading): self 19 | { 20 | $this->heading2 = $heading; 21 | 22 | return $this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Resource/Block/Heading3Block.php: -------------------------------------------------------------------------------- 1 | heading3; 16 | } 17 | 18 | public function setHeading3(?HeadingProperty $heading): self 19 | { 20 | $this->heading3 = $heading; 21 | 22 | return $this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Resource/Block/ImageBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->image = AbstractFile::fromRawData($data); 23 | } 24 | 25 | public function getImage(): ?AbstractFile 26 | { 27 | return $this->image; 28 | } 29 | 30 | public function setImage(?AbstractFile $image): self 31 | { 32 | $this->image = $image; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/LinkPreviewBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->linkPreview = LinkPreviewProperty::fromRawData($data); 17 | } 18 | 19 | public function getLinkPreview(): ?LinkPreviewProperty 20 | { 21 | return $this->linkPreview; 22 | } 23 | 24 | public function setLinkPreview(?LinkPreviewProperty $linkPreview): self 25 | { 26 | $this->linkPreview = $linkPreview; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Block/LinkToPageBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | 17 | $this->linkToPage = LinkToPageProperty::fromRawData($data); 18 | } 19 | 20 | public function getLinkToPage(): ?LinkToPageProperty 21 | { 22 | return $this->linkToPage; 23 | } 24 | 25 | public function setLinkToPage(?LinkToPageProperty $linkToPage): self 26 | { 27 | $this->linkToPage = $linkToPage; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Block/NumberedListItemBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | /** @var NumberedListItemProperty $property */ 30 | $property = NumberedListItemProperty::fromRawData($data); 31 | 32 | $this->numberedListItem = $property; 33 | } 34 | 35 | public function getNumberedListItem(): ?NumberedListItemProperty 36 | { 37 | return $this->numberedListItem; 38 | } 39 | 40 | public function setNumberedListItem(?NumberedListItemProperty $numberedListItem): self 41 | { 42 | $this->numberedListItem = $numberedListItem; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Block/ParagraphBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | /** @var ParagraphProperty $property */ 30 | $property = ParagraphProperty::fromRawData($data); 31 | 32 | $this->paragraph = $property; 33 | } 34 | 35 | public function getParagraph(): ?ParagraphProperty 36 | { 37 | return $this->paragraph; 38 | } 39 | 40 | /** 41 | * @param ParagraphProperty|null $paragraph 42 | * 43 | * @return ParagraphBlock 44 | */ 45 | public function setParagraph(?ParagraphProperty $paragraph): self 46 | { 47 | $this->paragraph = $paragraph; 48 | 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Resource/Block/PdfBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->pdf = AbstractFile::fromRawData($data); 23 | } 24 | 25 | public function getPdf(): ?AbstractFile 26 | { 27 | return $this->pdf; 28 | } 29 | 30 | public function setPdf(?AbstractFile $pdf): self 31 | { 32 | $this->pdf = $pdf; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/QuoteBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | /** @var QuoteProperty $property */ 30 | $property = QuoteProperty::fromRawData($data); 31 | 32 | $this->quote = $property; 33 | } 34 | 35 | public function getQuote(): ?QuoteProperty 36 | { 37 | return $this->quote; 38 | } 39 | 40 | /** 41 | * @param QuoteProperty|null $quote 42 | * 43 | * @return QuoteBlock 44 | */ 45 | public function setQuote(?QuoteProperty $quote): self 46 | { 47 | $this->quote = $quote; 48 | 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Resource/Block/SyncedBlockBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | 17 | $this->syncedBlock = SyncedBlockProperty::fromRawData($data); 18 | } 19 | 20 | public function getSyncedBlock(): ?SyncedBlockProperty 21 | { 22 | return $this->syncedBlock; 23 | } 24 | 25 | public function setSyncedBlock(?SyncedBlockProperty $syncedBlock): self 26 | { 27 | $this->syncedBlock = $syncedBlock; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Block/TableBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 24 | $this->table = TableProperty::fromRawData($data); 25 | } 26 | 27 | public function getTable(): ?TableProperty 28 | { 29 | return $this->table; 30 | } 31 | 32 | public function setTable(?TableProperty $table): self 33 | { 34 | $this->table = $table; 35 | 36 | return $this; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Resource/Block/TableOfContentsBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->tableOfContents = TableOfContentsProperty::fromRawData($data); 23 | } 24 | 25 | public function getTableOfContents(): ?TableOfContentsProperty 26 | { 27 | return $this->tableOfContents; 28 | } 29 | 30 | public function setTableOfContents(?TableOfContentsProperty $tableOfContents): self 31 | { 32 | $this->tableOfContents = $tableOfContents; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/TableRowBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->tableRow = TableRowProperty::fromRawData($data); 23 | } 24 | 25 | public function getTableRow(): ?TableRowProperty 26 | { 27 | return $this->tableRow; 28 | } 29 | 30 | public function setTableRow(?TableRowProperty $tableRow): self 31 | { 32 | $this->tableRow = $tableRow; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Block/TemplateBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | /** @var TemplateProperty $property */ 30 | $property = TemplateProperty::fromRawData($data); 31 | 32 | $this->template = $property; 33 | } 34 | 35 | public function getTemplate(): ?TemplateProperty 36 | { 37 | return $this->template; 38 | } 39 | 40 | public function setTemplate(?TemplateProperty $template): self 41 | { 42 | $this->template = $template; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Block/ToDoBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 26 | $this->toDo = ToDoProperty::fromRawData($data); 27 | } 28 | 29 | public function getToDo(): ?ToDoProperty 30 | { 31 | return $this->toDo; 32 | } 33 | 34 | public function setToDo(?ToDoProperty $toDo): self 35 | { 36 | $this->toDo = $toDo; 37 | 38 | return $this; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Resource/Block/ToggleBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 28 | 29 | /** @var ToggleProperty $property */ 30 | $property = ToggleProperty::fromRawData($data); 31 | 32 | $this->toggle = $property; 33 | } 34 | 35 | public function getToggle(): ?ToggleProperty 36 | { 37 | return $this->toggle; 38 | } 39 | 40 | public function setToggle(?ToggleProperty $toggle): self 41 | { 42 | $this->toggle = $toggle; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Block/UnsupportedBlock.php: -------------------------------------------------------------------------------- 1 | type = (string) $this->getRawData()['type']; 12 | } 13 | 14 | protected function initializeBlockProperty(): void 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Resource/Block/VideoBlock.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->video = AbstractFile::fromRawData($data); 23 | } 24 | 25 | public function getVideo(): ?AbstractFile 26 | { 27 | return $this->video; 28 | } 29 | 30 | public function setVideo(?AbstractFile $video): self 31 | { 32 | $this->video = $video; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/DatabaseRequest.php: -------------------------------------------------------------------------------- 1 | filter; 17 | } 18 | 19 | public function setFilter(array $filter): self 20 | { 21 | $this->filter = $filter; 22 | 23 | return $this; 24 | } 25 | 26 | public function getSorts(): array 27 | { 28 | return $this->sorts; 29 | } 30 | 31 | public function setSorts(array $sorts): self 32 | { 33 | $this->sorts = $sorts; 34 | 35 | return $this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyConfiguration/CheckboxPropertyConfiguration.php: -------------------------------------------------------------------------------- 1 | expression = (string) $rawData['expression']; 18 | 19 | return $property; 20 | } 21 | 22 | public function getExpression(): string 23 | { 24 | return $this->expression; 25 | } 26 | 27 | public function setExpression(string $expression): self 28 | { 29 | $this->expression = $expression; 30 | 31 | return $this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyConfiguration/LastEditedByPropertyConfiguration.php: -------------------------------------------------------------------------------- 1 | format = (string) $rawData['format']; 18 | 19 | return $property; 20 | } 21 | 22 | public function getFormat(): string 23 | { 24 | return $this->format; 25 | } 26 | 27 | public function setFormat(string $format): self 28 | { 29 | $this->format = $format; 30 | 31 | return $this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyConfiguration/PeoplePropertyConfiguration.php: -------------------------------------------------------------------------------- 1 | databaseId = (string) $rawData['database_id']; 20 | $property->syncedPropertyName = isset($rawData['synced_property_name']) ? 21 | (string) $rawData['synced_property_name'] : 22 | null; 23 | $property->syncedPropertyId = isset($rawData['synced_property_id']) ? 24 | (string) $rawData['synced_property_id'] : 25 | null; 26 | 27 | return $property; 28 | } 29 | 30 | public function getDatabaseId(): string 31 | { 32 | return $this->databaseId; 33 | } 34 | 35 | public function setDatabaseId(string $databaseId): self 36 | { 37 | $this->databaseId = $databaseId; 38 | 39 | return $this; 40 | } 41 | 42 | public function getSyncedPropertyName(): ?string 43 | { 44 | return $this->syncedPropertyName; 45 | } 46 | 47 | public function setSyncedPropertyName(?string $syncedPropertyName): self 48 | { 49 | $this->syncedPropertyName = $syncedPropertyName; 50 | 51 | return $this; 52 | } 53 | 54 | public function getSyncedPropertyId(): ?string 55 | { 56 | return $this->syncedPropertyId; 57 | } 58 | 59 | public function setSyncedPropertyId(?string $syncedPropertyId): self 60 | { 61 | $this->syncedPropertyId = $syncedPropertyId; 62 | 63 | return $this; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyConfiguration/RichTextPropertyConfiguration.php: -------------------------------------------------------------------------------- 1 | options = array_map(fn (array $selectData) => SelectProperty::fromRawData($selectData), $data); 25 | 26 | return $property; 27 | } 28 | 29 | /** 30 | * @return array|SelectProperty[] 31 | */ 32 | public function getOptions(): array 33 | { 34 | return $this->options; 35 | } 36 | 37 | /** 38 | * @param array|SelectProperty[] $options 39 | */ 40 | public function setOptions(array $options): self 41 | { 42 | $this->options = $options; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyConfiguration/StatusPropertyConfiguration.php: -------------------------------------------------------------------------------- 1 | options = array_map(fn (array $selectData) => SelectProperty::fromRawData($selectData), $data); 31 | 32 | return $property; 33 | } 34 | 35 | /** 36 | * @return array|SelectProperty[] 37 | */ 38 | public function getOptions(): array 39 | { 40 | return $this->options; 41 | } 42 | 43 | /** 44 | * @param array|SelectProperty[] $options 45 | */ 46 | public function setOptions(array $options): self 47 | { 48 | $this->options = $options; 49 | 50 | return $this; 51 | } 52 | 53 | public function getGroups(): array 54 | { 55 | return $this->groups; 56 | } 57 | 58 | public function setGroups(array $groups): self 59 | { 60 | $this->groups = $groups; 61 | 62 | return $this; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyConfiguration/TitlePropertyConfiguration.php: -------------------------------------------------------------------------------- 1 | checkbox = new CheckboxPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->checkbox = isset($this->getRawData()['checkbox']) ? 21 | CheckboxPropertyConfiguration::fromRawData((array) $this->getRawData()['checkbox']) : 22 | null; 23 | } 24 | 25 | public function getCheckbox(): ?CheckboxPropertyConfiguration 26 | { 27 | return $this->checkbox; 28 | } 29 | 30 | public function setCheckbox(?CheckboxPropertyConfiguration $checkbox): self 31 | { 32 | $this->checkbox = $checkbox; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/CreatedByPropertyObject.php: -------------------------------------------------------------------------------- 1 | createdBy = new CreatedByPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->createdBy = isset($this->getRawData()['created_by']) ? 21 | CreatedByPropertyConfiguration::fromRawData((array) $this->getRawData()['created_by']) : 22 | null; 23 | } 24 | 25 | public function getCreatedBy(): ?CreatedByPropertyConfiguration 26 | { 27 | return $this->createdBy; 28 | } 29 | 30 | public function setCreatedBy(?CreatedByPropertyConfiguration $createdBy): self 31 | { 32 | $this->createdBy = $createdBy; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/CreatedTimePropertyObject.php: -------------------------------------------------------------------------------- 1 | createdTime = new CreatedTimePropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->createdTime = isset($this->getRawData()['created_time']) ? 21 | CreatedTimePropertyConfiguration::fromRawData((array) $this->getRawData()['created_time']) : 22 | null; 23 | } 24 | 25 | public function getCreatedTime(): ?CreatedTimePropertyConfiguration 26 | { 27 | return $this->createdTime; 28 | } 29 | 30 | public function setCreatedTime(?CreatedTimePropertyConfiguration $createdTime): self 31 | { 32 | $this->createdTime = $createdTime; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/DatePropertyObject.php: -------------------------------------------------------------------------------- 1 | date = new DatePropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->date = isset($this->getRawData()['date']) ? 21 | DatePropertyConfiguration::fromRawData((array) $this->getRawData()['date']) : 22 | null; 23 | } 24 | 25 | public function getDate(): ?DatePropertyConfiguration 26 | { 27 | return $this->date; 28 | } 29 | 30 | public function setDate(?DatePropertyConfiguration $date): self 31 | { 32 | $this->date = $date; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/EmailPropertyObject.php: -------------------------------------------------------------------------------- 1 | email = new EmailPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->email = isset($this->getRawData()['email']) ? 21 | EmailPropertyConfiguration::fromRawData((array) $this->getRawData()['email']) : 22 | null; 23 | } 24 | 25 | public function getEmail(): ?EmailPropertyConfiguration 26 | { 27 | return $this->email; 28 | } 29 | 30 | public function setEmail(?EmailPropertyConfiguration $email): self 31 | { 32 | $this->email = $email; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/FilesPropertyObject.php: -------------------------------------------------------------------------------- 1 | files = new FilesPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->files = isset($this->getRawData()['files']) ? 21 | FilesPropertyConfiguration::fromRawData((array) $this->getRawData()['files']) : 22 | null; 23 | } 24 | 25 | public function getFiles(): ?FilesPropertyConfiguration 26 | { 27 | return $this->files; 28 | } 29 | 30 | public function setFiles(?FilesPropertyConfiguration $files): self 31 | { 32 | $this->files = $files; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/FormulaPropertyObject.php: -------------------------------------------------------------------------------- 1 | expression = new FormulaPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->expression = FormulaPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getExpression(): ?FormulaPropertyConfiguration 25 | { 26 | return $this->expression; 27 | } 28 | 29 | public function setExpression(FormulaPropertyConfiguration $expression): self 30 | { 31 | $this->expression = $expression; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/LastEditedByPropertyObject.php: -------------------------------------------------------------------------------- 1 | lastEditedBy = new LastEditedByPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->lastEditedBy = isset($this->getRawData()['last_edited_by']) ? 21 | LastEditedByPropertyConfiguration::fromRawData((array) $this->getRawData()['last_edited_by']) : 22 | null; 23 | } 24 | 25 | public function getLastEditedBy(): ?LastEditedByPropertyConfiguration 26 | { 27 | return $this->lastEditedBy; 28 | } 29 | 30 | public function setLastEditedBy(?LastEditedByPropertyConfiguration $lastEditedBy): self 31 | { 32 | $this->lastEditedBy = $lastEditedBy; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/LastEditedTimePropertyObject.php: -------------------------------------------------------------------------------- 1 | lastEditedTime = new LastEditedTimePropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->lastEditedTime = isset($this->getRawData()['last_edited_time']) ? 21 | LastEditedTimePropertyConfiguration::fromRawData((array) $this->getRawData()['last_edited_time']) : 22 | null; 23 | } 24 | 25 | public function getLastEditedTime(): ?LastEditedTimePropertyConfiguration 26 | { 27 | return $this->lastEditedTime; 28 | } 29 | 30 | public function setLastEditedTime(?LastEditedTimePropertyConfiguration $lastEditedTime): self 31 | { 32 | $this->lastEditedTime = $lastEditedTime; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/MultiSelectPropertyObject.php: -------------------------------------------------------------------------------- 1 | multiSelect = new SelectPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->multiSelect = SelectPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getMultiSelect(): ?SelectPropertyConfiguration 25 | { 26 | return $this->multiSelect; 27 | } 28 | 29 | public function setMultiSelect(?SelectPropertyConfiguration $multiSelect): self 30 | { 31 | $this->multiSelect = $multiSelect; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/NumberPropertyObject.php: -------------------------------------------------------------------------------- 1 | number = new NumberPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->number = NumberPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getNumber(): ?NumberPropertyConfiguration 25 | { 26 | return $this->number; 27 | } 28 | 29 | public function setNumber(NumberPropertyConfiguration $number): self 30 | { 31 | $this->number = $number; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/PeoplePropertyObject.php: -------------------------------------------------------------------------------- 1 | people = new PeoplePropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->people = isset($this->getRawData()['people']) ? 21 | PeoplePropertyConfiguration::fromRawData((array) $this->getRawData()['people']) : 22 | null; 23 | } 24 | 25 | public function getPeople(): ?PeoplePropertyConfiguration 26 | { 27 | return $this->people; 28 | } 29 | 30 | public function setPeople(?PeoplePropertyConfiguration $people): self 31 | { 32 | $this->people = $people; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/PhoneNumberPropertyObject.php: -------------------------------------------------------------------------------- 1 | phoneNumber = new PhoneNumberPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->phoneNumber = isset($this->getRawData()['phone_number']) ? 21 | PhoneNumberPropertyConfiguration::fromRawData((array) $this->getRawData()['phone_number']) : 22 | null; 23 | } 24 | 25 | public function getPhoneNumber(): ?PhoneNumberPropertyConfiguration 26 | { 27 | return $this->phoneNumber; 28 | } 29 | 30 | public function setPhoneNumber(?PhoneNumberPropertyConfiguration $phoneNumber): self 31 | { 32 | $this->phoneNumber = $phoneNumber; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/RelationPropertyObject.php: -------------------------------------------------------------------------------- 1 | relation = new RelationPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->relation = RelationPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getRelation(): ?RelationPropertyConfiguration 25 | { 26 | return $this->relation; 27 | } 28 | 29 | public function setRelation(RelationPropertyConfiguration $relation): self 30 | { 31 | $this->relation = $relation; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/RichTextPropertyObject.php: -------------------------------------------------------------------------------- 1 | richText = new RichTextPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->richText = isset($this->getRawData()['rich_text']) ? 21 | RichTextPropertyConfiguration::fromRawData((array) $this->getRawData()['rich_text']) : 22 | null; 23 | } 24 | 25 | public function getRichText(): ?RichTextPropertyConfiguration 26 | { 27 | return $this->richText; 28 | } 29 | 30 | public function setRichText(?RichTextPropertyConfiguration $richText): self 31 | { 32 | $this->richText = $richText; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/RollupPropertyObject.php: -------------------------------------------------------------------------------- 1 | rollup = new RollupPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->rollup = RollupPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getRollup(): ?RollupPropertyConfiguration 25 | { 26 | return $this->rollup; 27 | } 28 | 29 | public function setRollup(RollupPropertyConfiguration $rollup): self 30 | { 31 | $this->rollup = $rollup; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/SelectPropertyObject.php: -------------------------------------------------------------------------------- 1 | select = new SelectPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->select = SelectPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getSelect(): ?SelectPropertyConfiguration 25 | { 26 | return $this->select; 27 | } 28 | 29 | public function setSelect(?SelectPropertyConfiguration $select): self 30 | { 31 | $this->select = $select; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/StatusPropertyObject.php: -------------------------------------------------------------------------------- 1 | status = new StatusPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $data = (array) $this->getRawData()[$this->getType()]; 21 | $this->status = StatusPropertyConfiguration::fromRawData($data); 22 | } 23 | 24 | public function getStatus(): ?StatusPropertyConfiguration 25 | { 26 | return $this->status; 27 | } 28 | 29 | public function setStatus(?StatusPropertyConfiguration $status): self 30 | { 31 | $this->status = $status; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/TitlePropertyObject.php: -------------------------------------------------------------------------------- 1 | title = new TitlePropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->title = isset($this->getRawData()['title']) ? 21 | TitlePropertyConfiguration::fromRawData((array) $this->getRawData()['title']) : 22 | null; 23 | } 24 | 25 | public function getTitle(): ?TitlePropertyConfiguration 26 | { 27 | return $this->title; 28 | } 29 | 30 | public function setTitle(?TitlePropertyConfiguration $title): self 31 | { 32 | $this->title = $title; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Database/PropertyObject/UrlPropertyObject.php: -------------------------------------------------------------------------------- 1 | url = new UrlPropertyConfiguration(); 16 | } 17 | 18 | protected function initialize(): void 19 | { 20 | $this->url = isset($this->getRawData()['url']) ? 21 | UrlPropertyConfiguration::fromRawData((array) $this->getRawData()['url']) : 22 | null; 23 | } 24 | 25 | public function getUrl(): ?UrlPropertyConfiguration 26 | { 27 | return $this->url; 28 | } 29 | 30 | public function setUrl(?UrlPropertyConfiguration $url): self 31 | { 32 | $this->url = $url; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/File/CustomEmoji.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 23 | $this->customEmoji = CustomEmojiProperty::fromRawData($data); 24 | } 25 | 26 | public function getCustomEmoji(): ?CustomEmojiProperty 27 | { 28 | return $this->customEmoji; 29 | } 30 | 31 | public function setCustomEmoji(CustomEmojiProperty $customEmoji): self 32 | { 33 | $this->customEmoji = $customEmoji; 34 | 35 | return $this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Resource/File/Emoji.php: -------------------------------------------------------------------------------- 1 | emoji = (string) $this->getRawData()[$this->getType()]; 21 | } 22 | 23 | public function getEmoji(): string 24 | { 25 | return $this->emoji; 26 | } 27 | 28 | public function setEmoji(string $emoji): self 29 | { 30 | $this->emoji = $emoji; 31 | 32 | return $this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Resource/File/External.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 23 | $this->external = ExternalProperty::fromRawData($data); 24 | } 25 | 26 | public function getExternal(): ?ExternalProperty 27 | { 28 | return $this->external; 29 | } 30 | 31 | public function setExternal(ExternalProperty $external): self 32 | { 33 | $this->external = $external; 34 | 35 | return $this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Resource/File/File.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 23 | $this->file = FileProperty::fromRawData($data); 24 | } 25 | 26 | public function getFile(): ?FileProperty 27 | { 28 | return $this->file; 29 | } 30 | 31 | public function setFile(FileProperty $file): self 32 | { 33 | $this->file = $file; 34 | 35 | return $this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Resource/Link.php: -------------------------------------------------------------------------------- 1 | type = (string) ($rawData['type'] ?? ''); 16 | $link->url = (string) $rawData['url']; 17 | 18 | return $link; 19 | } 20 | 21 | public function getType(): string 22 | { 23 | return $this->type; 24 | } 25 | 26 | /** 27 | * @param string $type 28 | * 29 | * @return Link 30 | */ 31 | public function setType(string $type): self 32 | { 33 | $this->type = $type; 34 | 35 | return $this; 36 | } 37 | 38 | public function getUrl(): string 39 | { 40 | return $this->url; 41 | } 42 | 43 | /** 44 | * @param string $url 45 | * 46 | * @return Link 47 | */ 48 | public function setUrl(string $url): self 49 | { 50 | $this->url = $url; 51 | 52 | return $this; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Resource/Page/Parent/AbstractParentProperty.php: -------------------------------------------------------------------------------- 1 | setRawData($rawData) 40 | ->initialize(); 41 | 42 | return $property; 43 | } 44 | 45 | protected function setRawData(array $rawData): self 46 | { 47 | $this->rawData = $rawData; 48 | 49 | $this->type = (string) ($this->rawData['type'] ?? ''); 50 | 51 | return $this; 52 | } 53 | 54 | /** 55 | * @throws UnsupportedParentTypeException 56 | */ 57 | protected static function getMapClassFromType(string $type): string 58 | { 59 | $typeFormatted = StringHelper::snakeCaseToCamelCase($type); 60 | $class = "Brd6\\NotionSdkPhp\\Resource\\Page\\Parent\\{$typeFormatted}Parent"; 61 | 62 | if (!class_exists($class)) { 63 | throw new UnsupportedParentTypeException($type); 64 | } 65 | 66 | return $class; 67 | } 68 | 69 | abstract protected function initialize(): void; 70 | 71 | public function getRawData(): array 72 | { 73 | return $this->rawData; 74 | } 75 | 76 | public function getType(): string 77 | { 78 | return $this->type; 79 | } 80 | 81 | public function setType(string $type): self 82 | { 83 | $this->type = $type; 84 | 85 | return $this; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Resource/Page/Parent/DatabaseIdParent.php: -------------------------------------------------------------------------------- 1 | databaseId = (string) $this->getRawData()['database_id']; 14 | } 15 | 16 | public function getDatabaseId(): string 17 | { 18 | return $this->databaseId; 19 | } 20 | 21 | public function setDatabaseId(string $databaseId): self 22 | { 23 | $this->databaseId = $databaseId; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/Parent/PageIdParent.php: -------------------------------------------------------------------------------- 1 | pageId = (string) $this->getRawData()['page_id']; 14 | } 15 | 16 | public function getPageId(): string 17 | { 18 | return $this->pageId; 19 | } 20 | 21 | public function setPageId(string $pageId): self 22 | { 23 | $this->pageId = $pageId; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/Parent/WorkspaceParent.php: -------------------------------------------------------------------------------- 1 | workspace = (bool) $this->getRawData()['workspace']; 14 | } 15 | 16 | public function isWorkspace(): bool 17 | { 18 | return $this->workspace; 19 | } 20 | 21 | public function setWorkspace(bool $workspace): self 22 | { 23 | $this->workspace = $workspace; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyItem/PeoplePropertyItem.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->people = AbstractUser::fromRawData($data); 17 | } 18 | 19 | public function getPeople(): ?AbstractUser 20 | { 21 | return $this->people; 22 | } 23 | 24 | public function setPeople(AbstractUser $people): self 25 | { 26 | $this->people = $people; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyItem/RelationPropertyItem.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->relation = RelationProperty::fromRawData($data); 17 | } 18 | 19 | public function getRelation(): ?RelationProperty 20 | { 21 | return $this->relation; 22 | } 23 | 24 | public function setRelation(RelationProperty $relation): self 25 | { 26 | $this->relation = $relation; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyItem/RichTextPropertyItem.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->richText = AbstractRichText::fromRawData($data); 17 | } 18 | 19 | public function getRichText(): ?AbstractRichText 20 | { 21 | return $this->richText; 22 | } 23 | 24 | public function setRichText(AbstractRichText $richText): self 25 | { 26 | $this->richText = $richText; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyItem/TitlePropertyItem.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | 17 | $this->title = AbstractRichText::fromRawData($data); 18 | } 19 | 20 | public function getTitle(): ?AbstractRichText 21 | { 22 | return $this->title; 23 | } 24 | 25 | public function setTitle(AbstractRichText $title): self 26 | { 27 | $this->title = $title; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/CheckboxPropertyValue.php: -------------------------------------------------------------------------------- 1 | checkbox = (bool) $this->getRawData()[$this->getType()]; 14 | } 15 | 16 | public function getCheckbox(): bool 17 | { 18 | return $this->checkbox; 19 | } 20 | 21 | public function setCheckbox(bool $checkbox): self 22 | { 23 | $this->checkbox = $checkbox; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/CreatedByPropertyValue.php: -------------------------------------------------------------------------------- 1 | createdBy = AbstractUser::fromRawData((array) $this->getRawData()[$this->getType()]); 20 | } 21 | 22 | public function getCreatedBy(): ?AbstractUser 23 | { 24 | return $this->createdBy; 25 | } 26 | 27 | public function setCreatedBy(?AbstractUser $createdBy): self 28 | { 29 | $this->createdBy = $createdBy; 30 | 31 | return $this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/CreatedTimePropertyValue.php: -------------------------------------------------------------------------------- 1 | createdTime = new DateTimeImmutable((string) $this->getRawData()[$this->getType()]); 16 | } 17 | 18 | public function getCreatedTime(): ?DateTimeImmutable 19 | { 20 | return $this->createdTime; 21 | } 22 | 23 | public function setCreatedTime(?DateTimeImmutable $createdTime): self 24 | { 25 | $this->createdTime = $createdTime; 26 | 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/DatePropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->date = DateProperty::fromRawData($data); 17 | } 18 | 19 | public function getDate(): ?DateProperty 20 | { 21 | return $this->date; 22 | } 23 | 24 | public function setDate(?DateProperty $date): self 25 | { 26 | $this->date = $date; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/EmailPropertyValue.php: -------------------------------------------------------------------------------- 1 | email = (string) ($this->getRawData()[$this->getType()] ?? ''); 14 | } 15 | 16 | public function getEmail(): string 17 | { 18 | return $this->email; 19 | } 20 | 21 | public function setEmail(string $email): self 22 | { 23 | $this->email = $email; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/FilesPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 27 | 28 | $this->files = array_map( 29 | fn (array $filesRawData) => AbstractFile::fromRawData($filesRawData), 30 | $data, 31 | ); 32 | } 33 | 34 | /** 35 | * @return array|AbstractFile[] 36 | */ 37 | public function getFiles(): array 38 | { 39 | return $this->files; 40 | } 41 | 42 | /** 43 | * @param array|AbstractFile[] $files 44 | */ 45 | public function setFiles(array $files): self 46 | { 47 | $this->files = $files; 48 | 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/FormulaPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->formula = AbstractValueProperty::fromRawData($data); 23 | } 24 | 25 | public function getFormula(): ?AbstractValueProperty 26 | { 27 | return $this->formula; 28 | } 29 | 30 | public function setFormula(?AbstractValueProperty $formula): self 31 | { 32 | $this->formula = $formula; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/LastEditedByPropertyValue.php: -------------------------------------------------------------------------------- 1 | lastEditedBy = AbstractUser::fromRawData((array) $this->getRawData()[$this->getType()]); 20 | } 21 | 22 | public function getLastEditedBy(): ?AbstractUser 23 | { 24 | return $this->lastEditedBy; 25 | } 26 | 27 | public function setLastEditedBy(?AbstractUser $lastEditedBy): self 28 | { 29 | $this->lastEditedBy = $lastEditedBy; 30 | 31 | return $this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/LastEditedTimePropertyValue.php: -------------------------------------------------------------------------------- 1 | lastEditedTime = new DateTimeImmutable((string) $this->getRawData()[$this->getType()]); 16 | } 17 | 18 | public function getLastEditedTime(): ?DateTimeImmutable 19 | { 20 | return $this->lastEditedTime; 21 | } 22 | 23 | public function setLastEditedTime(?DateTimeImmutable $lastEditedTime): self 24 | { 25 | $this->lastEditedTime = $lastEditedTime; 26 | 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/MultiSelectPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 21 | $this->multiSelect = array_map(fn (array $selectData) => SelectProperty::fromRawData($selectData), $data); 22 | } 23 | 24 | /** 25 | * @return array|SelectProperty[] 26 | */ 27 | public function getMultiSelect(): array 28 | { 29 | return $this->multiSelect; 30 | } 31 | 32 | public function setMultiSelect(array $multiSelect): self 33 | { 34 | $this->multiSelect = $multiSelect; 35 | 36 | return $this; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/NumberPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData(); 14 | $this->number = isset($data['number']) ? (float) $data['number'] : null; 15 | } 16 | 17 | public function getNumber(): ?float 18 | { 19 | return $this->number; 20 | } 21 | 22 | public function setNumber(float $number): self 23 | { 24 | $this->number = $number; 25 | 26 | return $this; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/PeoplePropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 25 | 26 | $this->people = array_map( 27 | fn (array $peopleRawData) => AbstractUser::fromRawData($peopleRawData), 28 | $data, 29 | ); 30 | } 31 | 32 | /** 33 | * @return array|AbstractUser[] 34 | */ 35 | public function getPeople(): array 36 | { 37 | return $this->people; 38 | } 39 | 40 | /** 41 | * @param array|AbstractUser[] $people 42 | */ 43 | public function setPeople(array $people): self 44 | { 45 | $this->people = $people; 46 | 47 | return $this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/PhoneNumberPropertyValue.php: -------------------------------------------------------------------------------- 1 | phoneNumber = (string) ($this->getRawData()[$this->getType()] ?? ''); 14 | } 15 | 16 | public function getPhoneNumber(): string 17 | { 18 | return $this->phoneNumber; 19 | } 20 | 21 | public function setPhoneNumber(string $phoneNumber): self 22 | { 23 | $this->phoneNumber = $phoneNumber; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/RelationPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 21 | 22 | $this->relation = array_map( 23 | fn (array $relationRawData) => RelationProperty::fromRawData($relationRawData), 24 | $data, 25 | ); 26 | } 27 | 28 | /** 29 | * @return array|RelationProperty[] 30 | */ 31 | public function getRelation(): array 32 | { 33 | return $this->relation; 34 | } 35 | 36 | /** 37 | * @param array|RelationProperty[] $relation 38 | */ 39 | public function setRelation(array $relation): self 40 | { 41 | $this->relation = $relation; 42 | 43 | return $this; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/RichTextPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 27 | 28 | $this->richText = array_map( 29 | fn (array $richTextRawData) => AbstractRichText::fromRawData($richTextRawData), 30 | $data, 31 | ); 32 | } 33 | 34 | /** 35 | * @return array|AbstractRichText[] 36 | */ 37 | public function getRichText(): array 38 | { 39 | return $this->richText; 40 | } 41 | 42 | /** 43 | * @param array|AbstractRichText[] $richText 44 | */ 45 | public function setRichText(array $richText): self 46 | { 47 | $this->richText = $richText; 48 | 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/RollupPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 22 | $this->rollup = AbstractValueProperty::fromRawData($data); 23 | } 24 | 25 | public function getRollup(): ?AbstractValueProperty 26 | { 27 | return $this->rollup; 28 | } 29 | 30 | public function setRollup(?AbstractValueProperty $rollup): self 31 | { 32 | $this->rollup = $rollup; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/SelectPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->select = SelectProperty::fromRawData($data); 17 | } 18 | 19 | public function getSelect(): ?SelectProperty 20 | { 21 | return $this->select; 22 | } 23 | 24 | public function setSelect(?SelectProperty $select): self 25 | { 26 | $this->select = $select; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/StatusPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 16 | $this->status = SelectProperty::fromRawData($data); 17 | } 18 | 19 | public function getStatus(): ?SelectProperty 20 | { 21 | return $this->status; 22 | } 23 | 24 | public function setStatus(?SelectProperty $status): self 25 | { 26 | $this->status = $status; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/TitlePropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 27 | 28 | $this->title = array_map( 29 | fn (array $richTextRawData) => AbstractRichText::fromRawData($richTextRawData), 30 | $data, 31 | ); 32 | } 33 | 34 | /** 35 | * @return array|AbstractRichText[] 36 | */ 37 | public function getTitle(): array 38 | { 39 | return $this->title; 40 | } 41 | 42 | /** 43 | * @param array|AbstractRichText[] $title 44 | */ 45 | public function setTitle(array $title): self 46 | { 47 | $this->title = $title; 48 | 49 | return $this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/UniqueIdPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 15 | $this->number = (int) $data['number']; 16 | $this->prefix = isset($data['prefix']) ? (string) $data['prefix'] : null; 17 | } 18 | 19 | public function getNumber(): ?int 20 | { 21 | return $this->number; 22 | } 23 | 24 | public function setNumber(?int $number): self 25 | { 26 | $this->number = $number; 27 | 28 | return $this; 29 | } 30 | 31 | public function getPrefix(): ?string 32 | { 33 | return $this->prefix; 34 | } 35 | 36 | public function setPrefix(?string $prefix): self 37 | { 38 | $this->prefix = $prefix; 39 | 40 | return $this; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/UrlPropertyValue.php: -------------------------------------------------------------------------------- 1 | url = (string) ($this->getRawData()[$this->getType()] ?? ''); 14 | } 15 | 16 | public function getUrl(): string 17 | { 18 | return $this->url; 19 | } 20 | 21 | public function setUrl(string $url): self 22 | { 23 | $this->url = $url; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Page/PropertyValue/VerificationPropertyValue.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 19 | $this->state = (string) $data['state']; 20 | 21 | if (isset($data['verified_by']) && $data['verified_by'] !== null) { 22 | $this->verifiedBy = AbstractUser::fromRawData((array) $data['verified_by']); 23 | } 24 | 25 | if (isset($data['date']) && $data['date'] !== null) { 26 | $this->date = DateProperty::fromRawData((array) $data['date']); 27 | } 28 | } 29 | 30 | public function getState(): string 31 | { 32 | return $this->state; 33 | } 34 | 35 | public function setState(string $state): self 36 | { 37 | $this->state = $state; 38 | 39 | return $this; 40 | } 41 | 42 | public function getVerifiedBy(): ?AbstractUser 43 | { 44 | return $this->verifiedBy; 45 | } 46 | 47 | public function setVerifiedBy(?AbstractUser $verifiedBy): self 48 | { 49 | $this->verifiedBy = $verifiedBy; 50 | 51 | return $this; 52 | } 53 | 54 | public function getDate(): ?DateProperty 55 | { 56 | return $this->date; 57 | } 58 | 59 | public function setDate(?DateProperty $date): self 60 | { 61 | $this->date = $date; 62 | 63 | return $this; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Resource/Pagination/BlockResults.php: -------------------------------------------------------------------------------- 1 | results = isset($this->getRawData()['results']) ? array_map( 24 | fn (array $resultRawData) => AbstractBlock::fromRawData($resultRawData), 25 | (array) $this->getRawData()['results'], 26 | ) : []; 27 | } 28 | 29 | /** 30 | * @return AbstractBlock[]|array 31 | */ 32 | public function getResults(): array 33 | { 34 | return $this->results; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Pagination/DatabaseResults.php: -------------------------------------------------------------------------------- 1 | results = isset($this->getRawData()['results']) ? array_map( 22 | fn (array $resultRawData) => Database::fromRawData($resultRawData), 23 | (array) $this->getRawData()['results'], 24 | ) : []; 25 | } 26 | 27 | /** 28 | * @return Database[]|array 29 | */ 30 | public function getResults(): array 31 | { 32 | return $this->results; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Resource/Pagination/PageOrDatabaseResults.php: -------------------------------------------------------------------------------- 1 | results = isset($this->getRawData()['results']) ? array_map( 23 | fn (array $resultRawData) => $resultRawData['object'] === Database::RESOURCE_TYPE 24 | ? Database::fromRawData($resultRawData) 25 | : Page::fromRawData($resultRawData), 26 | (array) $this->getRawData()['results'], 27 | ) : []; 28 | } 29 | 30 | /** 31 | * @return Page[]|Database[]|array 32 | */ 33 | public function getResults(): array 34 | { 35 | return $this->results; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Resource/Pagination/PageResults.php: -------------------------------------------------------------------------------- 1 | results = isset($this->getRawData()['results']) ? array_map( 22 | fn (array $resultRawData) => Page::fromRawData($resultRawData), 23 | (array) $this->getRawData()['results'], 24 | ) : []; 25 | } 26 | 27 | /** 28 | * @return Page[]|array 29 | */ 30 | public function getResults(): array 31 | { 32 | return $this->results; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Resource/Pagination/PaginationRequest.php: -------------------------------------------------------------------------------- 1 | startCursor; 19 | } 20 | 21 | /** 22 | * @param string|null $startCursor 23 | * 24 | * @return PaginationRequest 25 | */ 26 | public function setStartCursor(?string $startCursor): self 27 | { 28 | $this->startCursor = $startCursor; 29 | 30 | return $this; 31 | } 32 | 33 | public function getPageSize(): int 34 | { 35 | return $this->pageSize; 36 | } 37 | 38 | /** 39 | * @param int $pageSize 40 | * 41 | * @return PaginationRequest 42 | */ 43 | public function setPageSize(int $pageSize): self 44 | { 45 | $this->pageSize = $pageSize; 46 | 47 | return $this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Resource/Pagination/PropertyItemResults.php: -------------------------------------------------------------------------------- 1 | results = isset($this->getRawData()['results']) ? array_map( 16 | fn (array $resultRawData) => AbstractPropertyItem::fromRawData($resultRawData), 17 | (array) $this->getRawData()['results'], 18 | ) : []; 19 | } 20 | 21 | /** 22 | * @return AbstractPropertyItem[]|array 23 | */ 24 | public function getResults(): array 25 | { 26 | return $this->results; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Resource/Pagination/UserResults.php: -------------------------------------------------------------------------------- 1 | results = isset($this->getRawData()['results']) ? array_map( 20 | fn (array $resultRawData) => AbstractUser::fromRawData($resultRawData), 21 | (array) $this->getRawData()['results'], 22 | ) : []; 23 | } 24 | 25 | /** 26 | * @return AbstractUser[]|array 27 | */ 28 | public function getResults(): array 29 | { 30 | return $this->results; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Resource/Property/AbstractProperty.php: -------------------------------------------------------------------------------- 1 | caption = isset($rawData['caption']) ? array_map( 31 | fn (array $richTextRawData) => AbstractRichText::fromRawData($richTextRawData), 32 | (array) $rawData['caption'], 33 | ) : []; 34 | $property->url = (string) $rawData['url']; 35 | 36 | return $property; 37 | } 38 | 39 | /** 40 | * @return array|AbstractRichText[] 41 | */ 42 | public function getCaption(): array 43 | { 44 | return $this->caption; 45 | } 46 | 47 | /** 48 | * @param array|AbstractRichText[] $caption 49 | */ 50 | public function setCaption(array $caption): self 51 | { 52 | $this->caption = $caption; 53 | 54 | return $this; 55 | } 56 | 57 | public function getUrl(): string 58 | { 59 | return $this->url; 60 | } 61 | 62 | public function setUrl(string $url): self 63 | { 64 | $this->url = $url; 65 | 66 | return $this; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Resource/Property/BotProperty.php: -------------------------------------------------------------------------------- 1 | owner = OwnerProperty::fromRawData((array) $rawData['owner']); 21 | 22 | return $property; 23 | } 24 | 25 | public function getOwner(): ?OwnerProperty 26 | { 27 | return $this->owner; 28 | } 29 | 30 | public function setOwner(OwnerProperty $owner): self 31 | { 32 | $this->owner = $owner; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/Property/BreadcrumbProperty.php: -------------------------------------------------------------------------------- 1 | icon = isset($rawData['icon']) ? 39 | AbstractFile::fromRawData((array) $rawData['icon']) : 40 | null; 41 | 42 | return $property; 43 | } 44 | 45 | public function getIcon(): ?AbstractFile 46 | { 47 | return $this->icon; 48 | } 49 | 50 | public function setIcon(?AbstractFile $icon): self 51 | { 52 | $this->icon = $icon; 53 | 54 | return $this; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Resource/Property/ChildDatabaseProperty.php: -------------------------------------------------------------------------------- 1 | title = (string) $rawData['title']; 15 | 16 | return $property; 17 | } 18 | 19 | public function getTitle(): string 20 | { 21 | return $this->title; 22 | } 23 | 24 | public function setTitle(string $title): self 25 | { 26 | $this->title = $title; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Property/ChildPageProperty.php: -------------------------------------------------------------------------------- 1 | title = (string) $rawData['title']; 15 | 16 | return $property; 17 | } 18 | 19 | public function getTitle(): string 20 | { 21 | return $this->title; 22 | } 23 | 24 | public function setTitle(string $title): self 25 | { 26 | $this->title = $title; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Property/CustomEmojiProperty.php: -------------------------------------------------------------------------------- 1 | id = (string) $rawData['id']; 18 | $property->name = (string) $rawData['name']; 19 | $property->url = (string) $rawData['url']; 20 | 21 | return $property; 22 | } 23 | 24 | public function getId(): string 25 | { 26 | return $this->id; 27 | } 28 | 29 | public function setId(string $id): self 30 | { 31 | $this->id = $id; 32 | 33 | return $this; 34 | } 35 | 36 | public function getName(): string 37 | { 38 | return $this->name; 39 | } 40 | 41 | public function setName(string $name): self 42 | { 43 | $this->name = $name; 44 | 45 | return $this; 46 | } 47 | 48 | public function getUrl(): string 49 | { 50 | return $this->url; 51 | } 52 | 53 | public function setUrl(string $url): self 54 | { 55 | $this->url = $url; 56 | 57 | return $this; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Resource/Property/DateProperty.php: -------------------------------------------------------------------------------- 1 | start = isset($rawData['start']) ? 20 | new DateTimeImmutable((string) $rawData['start']) : 21 | null; 22 | $property->end = isset($rawData['end']) ? 23 | new DateTimeImmutable((string) $rawData['end']) : 24 | null; 25 | $property->timeZone = isset($rawData['time_zone']) ? (string) $rawData['time_zone'] : null; 26 | 27 | return $property; 28 | } 29 | 30 | public function getStart(): ?DateTimeImmutable 31 | { 32 | return $this->start; 33 | } 34 | 35 | public function setStart(?DateTimeImmutable $start): self 36 | { 37 | $this->start = $start; 38 | 39 | return $this; 40 | } 41 | 42 | public function getEnd(): ?DateTimeImmutable 43 | { 44 | return $this->end; 45 | } 46 | 47 | public function setEnd(?DateTimeImmutable $end): self 48 | { 49 | $this->end = $end; 50 | 51 | return $this; 52 | } 53 | 54 | public function getTimeZone(): ?string 55 | { 56 | return $this->timeZone; 57 | } 58 | 59 | public function setTimeZone(?string $timeZone): self 60 | { 61 | $this->timeZone = $timeZone; 62 | 63 | return $this; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Resource/Property/DividerProperty.php: -------------------------------------------------------------------------------- 1 | url = (string) $rawData['url']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getUrl(): string 21 | { 22 | return $this->url; 23 | } 24 | 25 | public function setUrl(string $url): self 26 | { 27 | $this->url = $url; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/EquationProperty.php: -------------------------------------------------------------------------------- 1 | expression = (string) $rawData['expression']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getExpression(): string 21 | { 22 | return $this->expression; 23 | } 24 | 25 | public function setExpression(string $expression): self 26 | { 27 | $this->expression = $expression; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/ExternalProperty.php: -------------------------------------------------------------------------------- 1 | url = (string) $rawData['url']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getUrl(): string 21 | { 22 | return $this->url; 23 | } 24 | 25 | public function setUrl(string $url): self 26 | { 27 | $this->url = $url; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/FileProperty.php: -------------------------------------------------------------------------------- 1 | url = (string) $rawData['url']; 19 | $property->expiryTime = new DateTimeImmutable((string) $rawData['expiry_time']); 20 | 21 | return $property; 22 | } 23 | 24 | public function getUrl(): string 25 | { 26 | return $this->url; 27 | } 28 | 29 | public function setUrl(string $url): self 30 | { 31 | $this->url = $url; 32 | 33 | return $this; 34 | } 35 | 36 | public function getExpiryTime(): ?DateTimeImmutable 37 | { 38 | return $this->expiryTime; 39 | } 40 | 41 | public function setExpiryTime(?DateTimeImmutable $expiryTime): self 42 | { 43 | $this->expiryTime = $expiryTime; 44 | 45 | return $this; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Resource/Property/HeadingProperty.php: -------------------------------------------------------------------------------- 1 | href = (string) $rawData['href']; 17 | $property->title = (string) $rawData['title']; 18 | 19 | return $property; 20 | } 21 | 22 | public function getHref(): string 23 | { 24 | return $this->href; 25 | } 26 | 27 | public function setHref(string $href): self 28 | { 29 | $this->href = $href; 30 | 31 | return $this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Resource/Property/LinkPreviewProperty.php: -------------------------------------------------------------------------------- 1 | url = (string) $rawData['url']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getUrl(): string 21 | { 22 | return $this->url; 23 | } 24 | 25 | public function setUrl(string $url): self 26 | { 27 | $this->url = $url; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/LinkToPageProperty.php: -------------------------------------------------------------------------------- 1 | type = (string) $rawData['type']; 19 | $property->pageId = isset($rawData['page_id']) ? (string) $rawData['page_id'] : null; 20 | $property->databaseId = isset($rawData['database_id']) ? (string) $rawData['database_id'] : null; 21 | 22 | return $property; 23 | } 24 | 25 | public function getType(): string 26 | { 27 | return $this->type; 28 | } 29 | 30 | public function setType(string $type): self 31 | { 32 | $this->type = $type; 33 | 34 | return $this; 35 | } 36 | 37 | public function getPageId(): ?string 38 | { 39 | return $this->pageId; 40 | } 41 | 42 | public function setPageId(?string $pageId): self 43 | { 44 | $this->pageId = $pageId; 45 | 46 | return $this; 47 | } 48 | 49 | public function getDatabaseId(): ?string 50 | { 51 | return $this->databaseId; 52 | } 53 | 54 | public function setDatabaseId(?string $databaseId): self 55 | { 56 | $this->databaseId = $databaseId; 57 | 58 | return $this; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Resource/Property/NumberedListItemProperty.php: -------------------------------------------------------------------------------- 1 | type = (string) $rawData['type']; 27 | $property->workspace = array_key_exists('workspace', $rawData) ? 28 | (bool) $rawData['workspace'] : 29 | null; 30 | $property->user = isset($rawData['user']) ? 31 | AbstractUser::fromRawData((array) $rawData['user']) : 32 | null; 33 | 34 | return $property; 35 | } 36 | 37 | public function getType(): string 38 | { 39 | return $this->type; 40 | } 41 | 42 | public function setType(string $type): self 43 | { 44 | $this->type = $type; 45 | 46 | return $this; 47 | } 48 | 49 | public function getWorkspace(): ?bool 50 | { 51 | return $this->workspace; 52 | } 53 | 54 | public function setWorkspace(?bool $workspace): self 55 | { 56 | $this->workspace = $workspace; 57 | 58 | return $this; 59 | } 60 | 61 | public function getUser(): ?UserInterface 62 | { 63 | return $this->user; 64 | } 65 | 66 | public function setUser(?UserInterface $user): self 67 | { 68 | $this->user = $user; 69 | 70 | return $this; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Resource/Property/ParagraphProperty.php: -------------------------------------------------------------------------------- 1 | id = (string) $rawData['id']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getId(): string 21 | { 22 | return $this->id; 23 | } 24 | 25 | public function setId(string $id): self 26 | { 27 | $this->id = $id; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/PartialPageProperty.php: -------------------------------------------------------------------------------- 1 | id = (string) $rawData['id']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getId(): string 21 | { 22 | return $this->id; 23 | } 24 | 25 | public function setId(string $id): self 26 | { 27 | $this->id = $id; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/PersonProperty.php: -------------------------------------------------------------------------------- 1 | email = isset($rawData['email']) ? (string) $rawData['email'] : ''; 16 | 17 | return $property; 18 | } 19 | 20 | public function getEmail(): string 21 | { 22 | return $this->email; 23 | } 24 | 25 | public function setEmail(string $email): self 26 | { 27 | $this->email = $email; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/QuoteProperty.php: -------------------------------------------------------------------------------- 1 | id = (string) $rawData['id']; 15 | 16 | return $property; 17 | } 18 | 19 | public function getId(): string 20 | { 21 | return $this->id; 22 | } 23 | 24 | public function setId(string $id): self 25 | { 26 | $this->id = $id; 27 | 28 | return $this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Resource/Property/SelectProperty.php: -------------------------------------------------------------------------------- 1 | id = isset($rawData['id']) ? (string) $rawData['id'] : ''; 17 | $property->name = isset($rawData['name']) ? (string) $rawData['name'] : ''; 18 | $property->color = isset($rawData['color']) ? (string) $rawData['color'] : ''; 19 | 20 | return $property; 21 | } 22 | 23 | public function getId(): string 24 | { 25 | return $this->id; 26 | } 27 | 28 | public function setId(string $id): self 29 | { 30 | $this->id = $id; 31 | 32 | return $this; 33 | } 34 | 35 | public function getName(): string 36 | { 37 | return $this->name; 38 | } 39 | 40 | public function setName(string $name): self 41 | { 42 | $this->name = $name; 43 | 44 | return $this; 45 | } 46 | 47 | public function getColor(): string 48 | { 49 | return $this->color; 50 | } 51 | 52 | public function setColor(string $color): self 53 | { 54 | $this->color = $color; 55 | 56 | return $this; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Resource/Property/StatusGroupProperty.php: -------------------------------------------------------------------------------- 1 | id = isset($rawData['id']) ? (string) $rawData['id'] : ''; 18 | $property->name = isset($rawData['name']) ? (string) $rawData['name'] : ''; 19 | $property->color = isset($rawData['color']) ? (string) $rawData['color'] : ''; 20 | $property->optionIds = isset($rawData['option_ids']) ? (array) $rawData['option_ids'] : []; 21 | 22 | return $property; 23 | } 24 | 25 | public function getId(): string 26 | { 27 | return $this->id; 28 | } 29 | 30 | public function setId(string $id): self 31 | { 32 | $this->id = $id; 33 | 34 | return $this; 35 | } 36 | 37 | public function getName(): string 38 | { 39 | return $this->name; 40 | } 41 | 42 | public function setName(string $name): self 43 | { 44 | $this->name = $name; 45 | 46 | return $this; 47 | } 48 | 49 | public function getColor(): string 50 | { 51 | return $this->color; 52 | } 53 | 54 | public function setColor(string $color): self 55 | { 56 | $this->color = $color; 57 | 58 | return $this; 59 | } 60 | 61 | public function getOptionIds(): array 62 | { 63 | return $this->optionIds; 64 | } 65 | 66 | public function setOptionIds(array $optionIds): self 67 | { 68 | $this->optionIds = $optionIds; 69 | 70 | return $this; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Resource/Property/SyncedBlockProperty.php: -------------------------------------------------------------------------------- 1 | children = isset($rawData['children']) ? array_map( 33 | fn (array $childRawData) => AbstractBlock::fromRawData($childRawData), 34 | (array) $rawData['children'], 35 | ) : []; 36 | 37 | $property->syncedFrom = isset($rawData['synced_from']) ? 38 | SyncedFromProperty::fromRawData((array) $rawData['synced_from']) : 39 | null; 40 | 41 | return $property; 42 | } 43 | 44 | public function getSyncedFrom(): ?SyncedFromProperty 45 | { 46 | return $this->syncedFrom; 47 | } 48 | 49 | public function setSyncedFrom(?SyncedFromProperty $syncedFrom): self 50 | { 51 | $this->syncedFrom = $syncedFrom; 52 | 53 | return $this; 54 | } 55 | 56 | /** 57 | * @return array|AbstractBlock[] 58 | */ 59 | public function getChildren(): array 60 | { 61 | return $this->children; 62 | } 63 | 64 | public function setChildren(array $children): self 65 | { 66 | $this->children = $children; 67 | 68 | return $this; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Resource/Property/SyncedFromProperty.php: -------------------------------------------------------------------------------- 1 | type = (string) $rawData['type']; 17 | $property->blockId = (string) $rawData['block_id']; 18 | 19 | return $property; 20 | } 21 | 22 | public function getType(): string 23 | { 24 | return $this->type; 25 | } 26 | 27 | public function setType(string $type): SyncedFromProperty 28 | { 29 | $this->type = $type; 30 | 31 | return $this; 32 | } 33 | 34 | public function getBlockId(): string 35 | { 36 | return $this->blockId; 37 | } 38 | 39 | public function setBlockId(string $blockId): self 40 | { 41 | $this->blockId = $blockId; 42 | 43 | return $this; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Resource/Property/TableOfContentsProperty.php: -------------------------------------------------------------------------------- 1 | color = (string) $rawData['color']; 16 | 17 | return $property; 18 | } 19 | 20 | public function getColor(): string 21 | { 22 | return $this->color; 23 | } 24 | 25 | public function setColor(string $color): self 26 | { 27 | $this->color = $color; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/TableRowProperty.php: -------------------------------------------------------------------------------- 1 | > 18 | */ 19 | protected array $cells = []; 20 | 21 | /** 22 | * @param array $rawData 23 | * 24 | * @return TableRowProperty 25 | * 26 | * @throws InvalidRichTextException 27 | * @throws UnsupportedRichTextTypeException 28 | */ 29 | public static function fromRawData(array $rawData): self 30 | { 31 | $property = new self(); 32 | 33 | if (isset($rawData['cells'])) { 34 | /** @var array $cells */ 35 | $cells = $rawData['cells']; 36 | $property->cells = self::createCellsFromRawData($cells); 37 | } 38 | 39 | return $property; 40 | } 41 | 42 | /** 43 | * @param array $cellsRawData 44 | * 45 | * @return array> 46 | * 47 | * @throws InvalidRichTextException 48 | * @throws UnsupportedRichTextTypeException 49 | */ 50 | private static function createCellsFromRawData(array $cellsRawData): array 51 | { 52 | $cells = []; 53 | 54 | /** @var array $cellData */ 55 | foreach ($cellsRawData as $cellData) { 56 | $rawData = []; 57 | 58 | if (count($cellData) > 0) { 59 | /** @var array $rawData */ 60 | $rawData = array_map(static fn (array $data) => AbstractRichText::fromRawData($data), $cellData); 61 | } 62 | 63 | $cells[] = $rawData; 64 | } 65 | 66 | return $cells; 67 | } 68 | 69 | /** 70 | * @return array> 71 | */ 72 | public function getCells(): array 73 | { 74 | return $this->cells; 75 | } 76 | 77 | /** 78 | * @param array> $cells 79 | */ 80 | public function setCells(array $cells): self 81 | { 82 | $this->cells = $cells; 83 | 84 | return $this; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Resource/Property/TemplateProperty.php: -------------------------------------------------------------------------------- 1 | content = (string) $rawData['content']; 19 | $property->link = $rawData['link'] !== null ? Link::fromRawData((array) $rawData['link']) : null; 20 | 21 | return $property; 22 | } 23 | 24 | public function getContent(): string 25 | { 26 | return $this->content; 27 | } 28 | 29 | public function setContent(string $content): self 30 | { 31 | $this->content = $content; 32 | 33 | return $this; 34 | } 35 | 36 | public function getLink(): ?Link 37 | { 38 | return $this->link; 39 | } 40 | 41 | public function setLink(?Link $link): self 42 | { 43 | $this->link = $link; 44 | 45 | return $this; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Resource/Property/ToDoProperty.php: -------------------------------------------------------------------------------- 1 | checked = isset($rawData['checked']) ? (bool) $rawData['checked'] : null; 30 | 31 | return $property; 32 | } 33 | 34 | public function getChecked(): ?bool 35 | { 36 | return $this->checked; 37 | } 38 | 39 | public function setChecked(bool $checked): self 40 | { 41 | $this->checked = $checked; 42 | 43 | return $this; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Resource/Property/ToggleProperty.php: -------------------------------------------------------------------------------- 1 | array = array_map( 26 | fn (array $rawData) => AbstractValueProperty::fromRawData($rawData), 27 | (array) $this->getRawData()['array'], 28 | ); 29 | } 30 | 31 | /** 32 | * @return array|AbstractValueProperty[] 33 | */ 34 | public function getArray(): array 35 | { 36 | return $this->array; 37 | } 38 | 39 | /** 40 | * @param array|AbstractValueProperty[] $array 41 | */ 42 | public function setArray(array $array): self 43 | { 44 | $this->array = $array; 45 | 46 | return $this; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Resource/Property/Value/BooleanValueProperty.php: -------------------------------------------------------------------------------- 1 | boolean = (bool) $this->getRawData()['boolean']; 14 | } 15 | 16 | public function getBoolean(): bool 17 | { 18 | return $this->boolean; 19 | } 20 | 21 | public function setBoolean(bool $boolean): self 22 | { 23 | $this->boolean = $boolean; 24 | 25 | return $this; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Resource/Property/Value/DateValueProperty.php: -------------------------------------------------------------------------------- 1 | date = isset($this->getRawData()['date']) ? 16 | DateProperty::fromRawData((array) $this->getRawData()['date']) : 17 | null; 18 | } 19 | 20 | public function getDate(): ?DateProperty 21 | { 22 | return $this->date; 23 | } 24 | 25 | public function setDate(DateProperty $date): self 26 | { 27 | $this->date = $date; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/Property/Value/NumberValueProperty.php: -------------------------------------------------------------------------------- 1 | number = isset($this->getRawData()['number']) ? 14 | (float) $this->getRawData()['number'] : 15 | null; 16 | } 17 | 18 | public function getNumber(): ?float 19 | { 20 | return $this->number; 21 | } 22 | 23 | public function setNumber(float $number): self 24 | { 25 | $this->number = $number; 26 | 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Resource/Property/Value/StringValueProperty.php: -------------------------------------------------------------------------------- 1 | string = isset($this->getRawData()['string']) ? 14 | (string) $this->getRawData()['string'] : 15 | null; 16 | } 17 | 18 | public function getString(): ?string 19 | { 20 | return $this->string; 21 | } 22 | 23 | public function setString(string $string): self 24 | { 25 | $this->string = $string; 26 | 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Resource/ResourceInterface.php: -------------------------------------------------------------------------------- 1 | setRawData($rawData) 36 | ->initialize(); 37 | 38 | return $resource; 39 | } 40 | 41 | protected function setRawData(array $rawData): self 42 | { 43 | $this->rawData = $rawData; 44 | 45 | $this->type = (string) ($this->rawData['type'] ?? ''); 46 | 47 | return $this; 48 | } 49 | 50 | /** 51 | * @throws UnsupportedMentionTypeException 52 | */ 53 | protected static function getMapClassFromType(string $type): string 54 | { 55 | $typeFormatted = StringHelper::snakeCaseToCamelCase($type); 56 | $class = "Brd6\\NotionSdkPhp\\Resource\\RichText\\Mention\\{$typeFormatted}Mention"; 57 | 58 | if (!class_exists($class)) { 59 | throw new UnsupportedMentionTypeException($type); 60 | } 61 | 62 | return $class; 63 | } 64 | 65 | abstract protected function initialize(): void; 66 | 67 | public function getRawData(): array 68 | { 69 | return $this->rawData; 70 | } 71 | 72 | public function getType(): string 73 | { 74 | return $this->type; 75 | } 76 | 77 | public function setType(string $type): self 78 | { 79 | $this->type = $type; 80 | 81 | return $this; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Resource/RichText/Equation.php: -------------------------------------------------------------------------------- 1 | type = self::RICH_TEXT_TYPE; 17 | } 18 | 19 | protected function initialize(): void 20 | { 21 | $data = (array) $this->getRawData()[$this->getType()]; 22 | $this->equation = EquationProperty::fromRawData($data); 23 | } 24 | 25 | public function getEquation(): ?EquationProperty 26 | { 27 | return $this->equation; 28 | } 29 | 30 | public function setEquation(?EquationProperty $text): self 31 | { 32 | $this->equation = $text; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention.php: -------------------------------------------------------------------------------- 1 | type = self::RICH_TEXT_TYPE; 19 | } 20 | 21 | /** 22 | * @throws InvalidMentionException 23 | * @throws UnsupportedMentionTypeException 24 | */ 25 | protected function initialize(): void 26 | { 27 | $data = (array) $this->getRawData()[$this->getType()]; 28 | $this->mention = AbstractMention::fromRawData($data); 29 | } 30 | 31 | public function getType(): string 32 | { 33 | return $this->type; 34 | } 35 | 36 | public function setType(string $type): self 37 | { 38 | $this->type = $type; 39 | 40 | return $this; 41 | } 42 | 43 | public function getMention(): ?MentionInterface 44 | { 45 | return $this->mention; 46 | } 47 | 48 | public function setMention(MentionInterface $mention): self 49 | { 50 | $this->mention = $mention; 51 | 52 | return $this; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/CustomEmojiMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 17 | $this->customEmoji = CustomEmojiProperty::fromRawData($data); 18 | } 19 | 20 | public function getCustomEmoji(): ?CustomEmojiProperty 21 | { 22 | return $this->customEmoji; 23 | } 24 | 25 | public function setCustomEmoji(?CustomEmojiProperty $customEmoji): self 26 | { 27 | $this->customEmoji = $customEmoji; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/DatabaseMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 17 | $this->database = PartialDatabaseProperty::fromRawData($data); 18 | } 19 | 20 | public function getDatabase(): ?PartialDatabaseProperty 21 | { 22 | return $this->database; 23 | } 24 | 25 | public function setDatabase(?PartialDatabaseProperty $database): self 26 | { 27 | $this->database = $database; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/DateMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 17 | $this->date = DateProperty::fromRawData($data); 18 | } 19 | 20 | public function getDate(): ?DateProperty 21 | { 22 | return $this->date; 23 | } 24 | 25 | public function setDate(?DateProperty $date): self 26 | { 27 | $this->date = $date; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/LinkMentionMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 17 | $this->linkMention = LinkMentionProperty::fromRawData($data); 18 | } 19 | 20 | public function getLinkMention(): ?LinkMentionProperty 21 | { 22 | return $this->linkMention; 23 | } 24 | 25 | public function setLinkMention(?LinkMentionProperty $linkMention): self 26 | { 27 | $this->linkMention = $linkMention; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/LinkPreviewMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 17 | $this->linkPreview = LinkPreviewProperty::fromRawData($data); 18 | } 19 | 20 | public function getLinkPreview(): ?LinkPreviewProperty 21 | { 22 | return $this->linkPreview; 23 | } 24 | 25 | public function setLinkPreview(?LinkPreviewProperty $linkPreview): self 26 | { 27 | $this->linkPreview = $linkPreview; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/PageMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 17 | $this->page = PartialPageProperty::fromRawData($data); 18 | } 19 | 20 | public function getPage(): ?PartialPageProperty 21 | { 22 | return $this->page; 23 | } 24 | 25 | public function setPage(?PartialPageProperty $page): self 26 | { 27 | $this->page = $page; 28 | 29 | return $this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Resource/RichText/Mention/UserMention.php: -------------------------------------------------------------------------------- 1 | getRawData()[$this->getType()]; 18 | $this->user = AbstractUser::fromRawData($data); 19 | } 20 | 21 | public function getUser(): ?UserInterface 22 | { 23 | return $this->user; 24 | } 25 | 26 | public function setUser(?UserInterface $user): self 27 | { 28 | $this->user = $user; 29 | 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Resource/RichText/MentionInterface.php: -------------------------------------------------------------------------------- 1 | type = self::RICH_TEXT_TYPE; 18 | } 19 | 20 | public static function fromContent(string $content): self 21 | { 22 | $text = new self(); 23 | $text->annotations = new Annotations(); 24 | 25 | return $text->setText((new TextProperty())->setContent($content)); 26 | } 27 | 28 | protected function initialize(): void 29 | { 30 | $data = (array) $this->getRawData()[$this->getType()]; 31 | $this->text = TextProperty::fromRawData($data); 32 | } 33 | 34 | public function getText(): ?TextProperty 35 | { 36 | return $this->text; 37 | } 38 | 39 | public function setText(?TextProperty $text): self 40 | { 41 | $this->text = $text; 42 | 43 | return $this; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Resource/Search/SearchRequest.php: -------------------------------------------------------------------------------- 1 | filter; 18 | } 19 | 20 | public function setFilter(array $filter): self 21 | { 22 | $this->filter = $filter; 23 | 24 | return $this; 25 | } 26 | 27 | public function getSort(): array 28 | { 29 | return $this->sort; 30 | } 31 | 32 | public function setSort(array $sort): self 33 | { 34 | $this->sort = $sort; 35 | 36 | return $this; 37 | } 38 | 39 | public function getQuery(): ?string 40 | { 41 | return $this->query; 42 | } 43 | 44 | public function setQuery(?string $query): self 45 | { 46 | $this->query = $query; 47 | 48 | return $this; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Resource/User/BotUser.php: -------------------------------------------------------------------------------- 1 | bot = BotProperty::fromRawData((array) $this->getRawData()[(string) $this->getType()]); 18 | } 19 | 20 | public static function getResourceType(): string 21 | { 22 | return self::RESOURCE_TYPE; 23 | } 24 | 25 | public function getBot(): ?BotProperty 26 | { 27 | return $this->bot; 28 | } 29 | 30 | public function setBot(?BotProperty $bot): self 31 | { 32 | $this->bot = $bot; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/User/PartialUser.php: -------------------------------------------------------------------------------- 1 | person = PersonProperty::fromRawData((array) $this->getRawData()[(string) $this->getType()]); 18 | } 19 | 20 | public static function getResourceType(): string 21 | { 22 | return self::RESOURCE_TYPE; 23 | } 24 | 25 | public function getPerson(): ?PersonProperty 26 | { 27 | return $this->person; 28 | } 29 | 30 | public function setPerson(?PersonProperty $person): self 31 | { 32 | $this->person = $person; 33 | 34 | return $this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Resource/UserInterface.php: -------------------------------------------------------------------------------- 1 |