Current section

Files

Jump to
notion_api lib notion_databases.ex
Raw

lib/notion_databases.ex

defmodule Notion.Databases do
def create_workspace_database(properties \\ %{}, options \\ %{}) do
parent = Notion.Object.Parent.workspace_parent()
create_database(parent, properties, options)
end
def create_database(parent \\ %{}, properties \\ %{}, options \\ %{})
when is_map(parent) and is_map(properties) and is_map(options) do
resp = Notion.V1.Databases.post(parent, properties, options)
case resp do
%{"object" => "error"} ->
{:error, resp}
_ ->
{:ok, resp}
end
end
end