dlt-hub / verified-sources

Contribute to dlt verified sources ๐Ÿ”ฅ
https://dlthub.com/docs/walkthroughs/add-a-verified-source
Apache License 2.0
50 stars 40 forks source link

feat(notion): add pages resource #429

Closed IlyaFaer closed 2 months ago

IlyaFaer commented 2 months ago

Closes #413

IlyaFaer commented 2 months ago

I made a raw PR for the task, let's see if it's close to what is wanted. There is not much requested in the issue, but I suspect it's a bit more than this ๐Ÿคจ

That's what we'll get in the destination:

{
    "object": "page",
    "id": "06e48554-9585-415b-bffe-aad4b2244f20",
    "created_time": "2023-05-10T16:33:00.000Z",
    "last_edited_time": "2023-05-21T16:19:00.000Z",
    "created_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
    "last_edited_by": {"object": "user", "id": "4625a1c7-b3f5-44d2-a0ed-c50f33882402"},
    "cover": None,
    "icon": None,
    "parent": {
        "type": "database_id",
        "database_id": "a9422353-5c67-4d33-a24e-313e7921ce15",
    },
    "archived": False,
    "in_trash": False,
    "properties": {
        "Formula": {
            "id": "%3AbHJ",
            "type": "formula",
            "formula": {"type": "string", "string": None},
        },
        "Select Property": {
            "id": "%3FWbI",
            "type": "select",
            "select": {"id": "]T~s", "name": "1", "color": "purple"},
        },
        "Number Property": {"id": "L%3FwE", "type": "number", "number": 42},
        "Number With Commas": {"id": "P_br", "type": "number", "number": 122.23},
        "Tags": {"id": "Qpsy", "type": "multi_select", "multi_select": []},
        "Text Property": {
            "id": "U%3ES~",
            "type": "rich_text",
            "rich_text": [
                {
                    "type": "text",
                    "text": {"content": "Another String", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "Another String",
                    "href": None,
                }
            ],
        },
        "Status Property": {
            "id": "UG%7CD",
            "type": "status",
            "status": {
                "id": "cfce0ad7-1246-4681-a7ce-fa3a0da7defa",
                "name": "Not started",
                "color": "default",
            },
        },
        "Date Property": {
            "id": "Ykm%3B",
            "type": "date",
            "date": {"start": "2023-05-18", "end": None, "time_zone": None},
        },
        "Second DB Related": {
            "id": "yF%3BQ",
            "type": "relation",
            "relation": [{"id": "20f2cb86-ac50-45e8-b22f-5fa1aaac0599"}],
            "has_more": False,
        },
        "Name": {
            "id": "title",
            "type": "title",
            "title": [
                {
                    "type": "text",
                    "text": {"content": "Second", "link": None},
                    "annotations": {
                        "bold": False,
                        "italic": False,
                        "strikethrough": False,
                        "underline": False,
                        "code": False,
                        "color": "default",
                    },
                    "plain_text": "Second",
                    "href": None,
                }
            ],
        },
    },
    "url": "https://www.notion.so/Second-06e485549585415bbffeaad4b2244f20",
    "public_url": None,
}

As far as I can tell, all the data about the page is returned (all the same will be returned in case of NotionClient.fetch_resource() - I already tried it).

adrianbr commented 2 months ago

This does what was requested

IlyaFaer commented 2 months ago

@adrianbr, @rudolfix, okay un-drafting it then, ready to merge ๐Ÿ‘Œ