Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(notion): pages resource returns only meta info #460

Merged
merged 2 commits into from
Jul 10, 2024
Merged

Conversation

IlyaFaer
Copy link
Contributor

Closes #413

@IlyaFaer
Copy link
Contributor Author

@adrianbr, the thing is - I don't have straight access to the Notion account, so I can't always say if it's content or just metadata - some fields look like what's needed to me.

With new changes, it returns blocks, let's see:

[
    {
        "object": "block",
        "id": "3d28f2cb-dd86-4207-b25c-f36af16e2f8d",
        "parent": {
            "type": "page_id",
            "page_id": "29298248-6067-4332-b6db-ca516d4d9af3",
        },
        "created_time": "2023-05-08T16:10:00.000Z",
        "last_edited_time": "2023-05-08T16:10:00.000Z",
        "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
        "last_edited_by": {
            "object": "user",
            "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402",
        },
        "has_children": False,
        "archived": False,
        "in_trash": False,
        "type": "heading_1",
        "heading_1": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "Background info", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "Background info",
                    "href": None,
                }
            ],
            "is_toggleable": False,
            "color": "default",
        },
    },
    {
        "object": "block",
        "id": "944d2062-ba72-43cc-96f3-577af7c559c8",
        "parent": {
            "type": "page_id",
            "page_id": "29298248-6067-4332-b6db-ca516d4d9af3",
        },
        "created_time": "2023-05-08T16:10:00.000Z",
        "last_edited_time": "2023-05-08T16:10:00.000Z",
        "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
        "last_edited_by": {
            "object": "user",
            "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402",
        },
        "has_children": False,
        "archived": False,
        "in_trash": False,
        "type": "bulleted_list_item",
        "bulleted_list_item": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "...", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "...",
                    "href": None,
                }
            ],
            "color": "default",
        },
    },
    {
        "object": "block",
        "id": "f7eb3202-9ba5-4946-8484-134f58d95f32",
        "parent": {
            "type": "page_id",
            "page_id": "29298248-6067-4332-b6db-ca516d4d9af3",
        },
        "created_time": "2023-05-08T16:10:00.000Z",
        "last_edited_time": "2023-05-08T16:10:00.000Z",
        "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
        "last_edited_by": {
            "object": "user",
            "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402",
        },
        "has_children": False,
        "archived": False,
        "in_trash": False,
        "type": "bulleted_list_item",
        "bulleted_list_item": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "...", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "...",
                    "href": None,
                }
            ],
            "color": "default",
        },
    },
    {
        "object": "block",
        "id": "5c2df167-fea8-463f-b880-05c9e322bbe5",
        "parent": {
            "type": "page_id",
            "page_id": "29298248-6067-4332-b6db-ca516d4d9af3",
        },
        "created_time": "2023-05-08T16:10:00.000Z",
        "last_edited_time": "2023-05-08T16:10:00.000Z",
        "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
        "last_edited_by": {
            "object": "user",
            "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402",
        },
        "has_children": False,
        "archived": False,
        "in_trash": False,
        "type": "heading_1",
        "heading_1": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "History of interactions", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "History of interactions",
                    "href": None,
                }
            ],
            "is_toggleable": False,
            "color": "default",
        },
    },
    {
        "object": "block",
        "id": "22afc43a-db33-4d01-9ada-9930d4f265cc",
        "parent": {
            "type": "page_id",
            "page_id": "29298248-6067-4332-b6db-ca516d4d9af3",
        },
        "created_time": "2023-05-08T16:10:00.000Z",
        "last_edited_time": "2023-05-08T16:10:00.000Z",
        "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
        "last_edited_by": {
            "object": "user",
            "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402",
        },
        "has_children": False,
        "archived": False,
        "in_trash": False,
        "type": "bulleted_list_item",
        "bulleted_list_item": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "...", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "...",
                    "href": None,
                }
            ],
            "color": "default",
        },
    },
    {
        "object": "block",
        "id": "4d76ff34-1649-437c-900f-32cc8e0d3cc4",
        "parent": {
            "type": "page_id",
            "page_id": "29298248-6067-4332-b6db-ca516d4d9af3",
        },
        "created_time": "2023-05-08T16:10:00.000Z",
        "last_edited_time": "2023-05-08T16:10:00.000Z",
        "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
        "last_edited_by": {
            "object": "user",
            "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402",
        },
        "has_children": False,
        "archived": False,
        "in_trash": False,
        "type": "bulleted_list_item",
        "bulleted_list_item": {
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "...", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "...",
                    "href": None,
                }
            ],
            "color": "default",
        },
    },
]

@IlyaFaer IlyaFaer marked this pull request as ready for review May 13, 2024 08:59
assert cur.fetchone()[1] in requested_pages
row = cur.fetchone()
assert row[0] == "block"
assert row[3] == page_id
Copy link
Contributor Author

@IlyaFaer IlyaFaer May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the resource type and id of the parent page (as it was requested)

@rudolfix
Copy link
Contributor

rudolfix commented Jun 2, 2024

@adrianbr are you going to review it? if not please assign someone so we get exactly what you wanted :)

@IlyaFaer
Copy link
Contributor Author

This PR is a bit stuck

@rudolfix
Copy link
Contributor

rudolfix commented Jul 9, 2024

@adrianbr are you able to verify that it does what you need? if not I'll approve it. because it LGTM!

Copy link
Contributor

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! As far as I can understand it meets @adrianbr expectations

@rudolfix rudolfix merged commit d855fa1 into master Jul 10, 2024
14 checks passed
@rudolfix rudolfix deleted the notion_blocks branch July 10, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pages resource to notion
2 participants