diff options
author | 2022-05-18 01:02:56 -0400 | |
---|---|---|
committer | 2022-05-17 22:02:56 -0700 | |
commit | 8160fea0ffa1f074538ec5fd73b317bc9d023d6e (patch) | |
tree | ecd9288aa409051e57695b638f416540eb77cbe5 /src/models/tests | |
parent | a0106b557ee1af347b7c422be3364dd6d0fac945 (diff) | |
download | notion-8160fea0ffa1f074538ec5fd73b317bc9d023d6e.tar.gz notion-8160fea0ffa1f074538ec5fd73b317bc9d023d6e.tar.zst notion-8160fea0ffa1f074538ec5fd73b317bc9d023d6e.zip |
Upgrade notion version (#39)
* Upgrade constant
* Fix lint
* Change module file tree
Changed around module file tree, but module structure hasn't changed. Converted models.rs to mod.rs under models folder
* Minor refactoring
* Add MentionObject for rich text mention types
* Add new fields to BlockCommon. Modify existing field model Text. Add heading 1 test
Add created_by and last_edited_by fields to BlockCommon. Change field text to rich_text for model Text to handle breaking change in API version 2022-02-22
* Differentiate between unsupported and unknown block types
* Change text field to rich_text in paragraph block
* Add callout block. Add file and emoji object
* Fix as_id for unsupported block
* Fix lint issues
* Move quote block to follow documentation order. Add color field to TextAndChildren struct
* Add color field to ToDoFields struct
* Formatting
* Add caption field to code block
Add caption field to code block. Create enum CodeLanguage for code block. Reorder code block to reflect documentation
* Add child database block
* Create embed block
* Refactor notion file object struct name
* Create image block
* Create video block
* Create file block
* Fix video block field
* Create pdf block
* Change text field to rich_text in TodoFields for Notion API version 2022-02-22
* Create bookmark block
* Create divider block
* Create table of contents block
* Create breadcrumb block
* Create column list and column block
* Create link preview block
* Create template block
* Formatting
* Create link to page block
* Fix ColumnListFields struct
* Create table and table row block
* Fix AsIdentifier trait impl for Block
* Create synced block
Diffstat (limited to 'src/models/tests')
-rw-r--r-- | src/models/tests/callout.json | 43 | ||||
-rw-r--r-- | src/models/tests/emoji_object.json | 4 | ||||
-rw-r--r-- | src/models/tests/external_file_object.json | 6 | ||||
-rw-r--r-- | src/models/tests/file_object.json | 7 | ||||
-rw-r--r-- | src/models/tests/heading_1.json | 175 | ||||
-rw-r--r-- | src/models/tests/rich_text_mention_date.json | 21 | ||||
-rw-r--r-- | src/models/tests/rich_text_mention_date_with_end.json | 21 | ||||
-rw-r--r-- | src/models/tests/rich_text_mention_date_with_end_and_time.json | 21 | ||||
-rw-r--r-- | src/models/tests/rich_text_mention_date_with_time.json | 21 | ||||
-rw-r--r-- | src/models/tests/rich_text_mention_user_person.json | 26 | ||||
-rw-r--r-- | src/models/tests/rich_text_text.json | 19 |
11 files changed, 364 insertions, 0 deletions
diff --git a/src/models/tests/callout.json b/src/models/tests/callout.json new file mode 100644 index 0000000..e4d884d --- /dev/null +++ b/src/models/tests/callout.json @@ -0,0 +1,43 @@ +{ + "object": "block", + "id": "00e8829a-a7b8-4075-884a-8f53be145d2f", + "created_time": "2022-05-13T20:08:00.000Z", + "last_edited_time": "2022-05-13T20:08:00.000Z", + "created_by": { + "object": "user", + "id": "e2507360-468c-4e0f-a928-7bbcbbb45353" + }, + "last_edited_by": { + "object": "user", + "id": "e2507360-468c-4e0f-a928-7bbcbbb45353" + }, + "has_children": true, + "archived": false, + "type": "callout", + "callout": { + "rich_text": [ + { + "type": "text", + "text": { + "content": "Test callout", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "Test callout", + "href": null + } + ], + "icon": { + "type": "emoji", + "emoji": "💡" + }, + "color": "green" + } +}
\ No newline at end of file diff --git a/src/models/tests/emoji_object.json b/src/models/tests/emoji_object.json new file mode 100644 index 0000000..1fb3b56 --- /dev/null +++ b/src/models/tests/emoji_object.json @@ -0,0 +1,4 @@ +{ + "type": "emoji", + "emoji": "💡" +}
\ No newline at end of file diff --git a/src/models/tests/external_file_object.json b/src/models/tests/external_file_object.json new file mode 100644 index 0000000..b5d4b85 --- /dev/null +++ b/src/models/tests/external_file_object.json @@ -0,0 +1,6 @@ +{ + "type": "external", + "external": { + "url": "https://nerdist.com/wp-content/uploads/2020/07/maxresdefault.jpg" + } +}
\ No newline at end of file diff --git a/src/models/tests/file_object.json b/src/models/tests/file_object.json new file mode 100644 index 0000000..650cf9b --- /dev/null +++ b/src/models/tests/file_object.json @@ -0,0 +1,7 @@ +{ + "type": "file", + "file": { + "url": "https://s3.us-west-2.amazonaws.com/secure.notion-static.com/2703e742-ace5-428c-a74d-1c587ceddc32/DiRT_Rally.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220513%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220513T201035Z&X-Amz-Expires=3600&X-Amz-Signature=714b49bde0b499fb8f3aae1a88a8cbd374f2b09c1d128e91cac49e85ce0e00fb&X-Amz-SignedHeaders=host&x-id=GetObject", + "expiry_time": "2022-05-13T21:10:35.817Z" + } +}
\ No newline at end of file diff --git a/src/models/tests/heading_1.json b/src/models/tests/heading_1.json new file mode 100644 index 0000000..ab2d7e1 --- /dev/null +++ b/src/models/tests/heading_1.json @@ -0,0 +1,175 @@ +{ + "object": "block", + "id": "9e891834-6a03-475c-a2b8-421e17f0f3aa", + "created_time": "2022-05-12T21:15:00.000Z", + "last_edited_time": "2022-05-12T22:10:00.000Z", + "created_by": { + "object": "user", + "id": "6419f912-5293-4ea8-b2c8-9c3ce44f90e3" + }, + "last_edited_by": { + "object": "user", + "id": "6419f912-5293-4ea8-b2c8-9c3ce44f90e3" + }, + "has_children": false, + "archived": false, + "type": "heading_1", + "heading_1": { + "rich_text": [ + { + "type": "text", + "text": { + "content": "This", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": true, + "color": "default" + }, + "plain_text": "This", + "href": null + }, + { + "type": "text", + "text": { + "content": " ", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": " ", + "href": null + }, + { + "type": "text", + "text": { + "content": "is", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": true, + "code": false, + "color": "default" + }, + "plain_text": "is", + "href": null + }, + { + "type": "text", + "text": { + "content": " ", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": " ", + "href": null + }, + { + "type": "text", + "text": { + "content": "a", + "link": null + }, + "annotations": { + "bold": false, + "italic": true, + "strikethrough": false, + "underline": true, + "code": false, + "color": "default" + }, + "plain_text": "a", + "href": null + }, + { + "type": "text", + "text": { + "content": " ", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": " ", + "href": null + }, + { + "type": "text", + "text": { + "content": "Heading", + "link": null + }, + "annotations": { + "bold": false, + "italic": true, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "Heading", + "href": null + }, + { + "type": "text", + "text": { + "content": " ", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": " ", + "href": null + }, + { + "type": "text", + "text": { + "content": "1", + "link": null + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": true, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "1", + "href": null + } + ], + "color": "default" + } +}
\ No newline at end of file diff --git a/src/models/tests/rich_text_mention_date.json b/src/models/tests/rich_text_mention_date.json new file mode 100644 index 0000000..687f6dc --- /dev/null +++ b/src/models/tests/rich_text_mention_date.json @@ -0,0 +1,21 @@ +{ + "type": "mention", + "mention": { + "type": "date", + "date": { + "start": "2022-04-16", + "end": null, + "time_zone": null + } + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "2022-04-16 → ", + "href": null +}
\ No newline at end of file diff --git a/src/models/tests/rich_text_mention_date_with_end.json b/src/models/tests/rich_text_mention_date_with_end.json new file mode 100644 index 0000000..b4953a0 --- /dev/null +++ b/src/models/tests/rich_text_mention_date_with_end.json @@ -0,0 +1,21 @@ +{ + "type": "mention", + "mention": { + "type": "date", + "date": { + "start": "2022-05-12", + "end": "2022-05-13", + "time_zone": null + } + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "2022-05-12 → 2022-05-13", + "href": null +}
\ No newline at end of file diff --git a/src/models/tests/rich_text_mention_date_with_end_and_time.json b/src/models/tests/rich_text_mention_date_with_end_and_time.json new file mode 100644 index 0000000..2070207 --- /dev/null +++ b/src/models/tests/rich_text_mention_date_with_end_and_time.json @@ -0,0 +1,21 @@ +{ + "type": "mention", + "mention": { + "type": "date", + "date": { + "start": "2022-04-16T12:00:00.000-04:00", + "end": "2022-04-16T12:00:00.000-04:00", + "time_zone": null + } + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "2022-04-16T12:00:00.000-04:00 → 2022-04-16T12:00:00.000-04:00", + "href": null +}
\ No newline at end of file diff --git a/src/models/tests/rich_text_mention_date_with_time.json b/src/models/tests/rich_text_mention_date_with_time.json new file mode 100644 index 0000000..127d9bd --- /dev/null +++ b/src/models/tests/rich_text_mention_date_with_time.json @@ -0,0 +1,21 @@ +{ + "type": "mention", + "mention": { + "type": "date", + "date": { + "start": "2022-05-14T09:00:00.000-04:00", + "end": null, + "time_zone": null + } + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "2022-05-14T09:00:00.000-04:00 → ", + "href": null +}
\ No newline at end of file diff --git a/src/models/tests/rich_text_mention_user_person.json b/src/models/tests/rich_text_mention_user_person.json new file mode 100644 index 0000000..8851266 --- /dev/null +++ b/src/models/tests/rich_text_mention_user_person.json @@ -0,0 +1,26 @@ +{ + "type": "mention", + "mention": { + "type": "user", + "user": { + "object": "user", + "id": "1118608e-35e8-4fa3-aef7-a4ced85ce8e0", + "name": "John Doe", + "avatar_url": "https://secure.notion-static.com/e6a352a8-8381-44d0-a1dc-9ed80e62b53d.jpg", + "type": "person", + "person": { + "email": "john.doe@gmail.com" + } + } + }, + "annotations": { + "bold": false, + "italic": false, + "strikethrough": false, + "underline": false, + "code": false, + "color": "default" + }, + "plain_text": "@John Doe", + "href": null +}
\ No newline at end of file diff --git a/src/models/tests/rich_text_text.json b/src/models/tests/rich_text_text.json new file mode 100644 index 0000000..0089b47 --- /dev/null +++ b/src/models/tests/rich_text_text.json @@ -0,0 +1,19 @@ +{ + "type": "text", + "text": { + "content": "Rich", + "link": { + "url": "https://github.com/jakeswenson/notion" + } + }, + "annotations": { + "bold": true, + "italic": true, + "strikethrough": true, + "underline": true, + "code": true, + "color": "default" + }, + "plain_text": "Rich", + "href": "https://github.com/jakeswenson/notion" +}
\ No newline at end of file |