View Source ThinNotionApi.Pages (thin_notion_api v1.0.1)
Module for interacting with the Notion pages.
Link to this section Summary
Functions
Create a page with a page or database as its parent type.
Retrieves a Page object using the ID specified.
Retrieves a property_item object for a given page_id and property_id. Depending on the property type, the object returned will either be a value or a paginated list of property item values.
Update a pages properties or archive (delete) it.
Link to this section Functions
Create a page with a page or database as its parent type.
If the parent is a database, the property values of the new page in the properties parameter must conform to the parent database's property schema.
If the parent is a page, the only valid property is title.
When creating a Database you must specify a title property.
examples
Examples:
iex> ThinNotionApi.Pages.create_page(:page, "9b4a624d5a18482ab2187e54166edda7")
{:ok, %{...}}
iex> ThinNotionApi.Pages.create_page(:database, "ee90be7f3fd14fd5961ef4203c7d9a81", %{ "title": %{ "title": [%{ "type": "text", "text": %{ "content": "Create Page Database" } }] } })
{:ok, %{...}}
@spec retrieve_page(String.t()) :: ThinNotionApi.Types.Response.t()
Retrieves a Page object using the ID specified.
Responses contains page properties, not page content. To fetch page content, use the retrieve block children endpoint.
examples
Examples:
iex> ThinNotionApi.Pages.retrieve_page("9b4a624d5a18482ab2187e54166edda7")
{:ok, %{...}}
@spec retrieve_page_property_item( String.t(), String.t(), ThinNotionApi.Types.PaginationParams.t() | %{} ) :: ThinNotionApi.Types.Response.t()
Retrieves a property_item object for a given page_id and property_id. Depending on the property type, the object returned will either be a value or a paginated list of property item values.
examples
Examples:
iex> ThinNotionApi.Pages.retrieve_page_property_item("c8445875c2cc424eb9eacba94cac667d", "title")
{:ok, %{...}}
@spec update_page(String.t(), map() | nil, boolean() | nil) :: ThinNotionApi.Types.Response.t()
Update a pages properties or archive (delete) it.
Properties that are not set via the properties parameter will remain unchanged.
If the parent is a database, the new property values in the properties parameter must conform to the parent database's property schema.
This endpoint is for updating page properties, not page content. To fetch page content, use the retrieve block children endpoint. To append page content, use the append block children endpoint.
examples
Examples:
iex> ThinNotionApi.Pages.update_page("c8445875c2cc424eb9eacba94cac667d", properties, false)
{:ok, %{...}}