NotionElixir.Database (notion_elixir v0.1.2) View Source

Link to this section Summary

Functions

Build a database struct

Build a list of database structs from an API list response

Get a database object by ID from the API

Get a database object by ID from the API using the provided client

List all database object from the API using the provided client

List all database object from the API using the provided client

Perform a query against the passed database, returning a ListResponse from the API. Will only return the first page of results.

Perform a query against the passed database, returning a ListResponse from the API. Will only return all pages of results.

Link to this section Types

Specs

t() :: %NotionElixir.Database{
  cover: term(),
  created_time: DateTime.t(),
  icon: term(),
  id: String.t(),
  last_edited_time: DateTime.t(),
  object: String.t(),
  parent: term(),
  photo: map(),
  properties: map(),
  title: map()
}

Link to this section Functions

Specs

build(NotionElixir.Response.t()) :: t()
build(obj :: map()) :: t()

Build a database struct

Link to this function

build_all(list_response)

View Source

Specs

build_all(NotionElixir.ListResponse.t()) :: [t()]

Build a list of database structs from an API list response

Specs

get(obj :: String.t()) :: {:ok, t()} | {:error, any()}

Get a database object by ID from the API

Specs

get(client :: Tesla.Client.t(), obj :: String.t()) ::
  {:ok, t()} | {:error, any()}

Get a database object by ID from the API using the provided client

Specs

list_databases() :: {:ok, [t()]} | {:error, any()}

List all database object from the API using the provided client

Specs

list_databases(client :: Tesla.Client.t()) :: {:ok, [t()]} | {:error, any()}

List all database object from the API using the provided client

Link to this function

query(database, data, opts)

View Source

Specs

query(database :: t(), data :: map(), opts :: NotionElixir.options()) ::
  NotionElixir.ListResponse.t()
query(database_id :: String.t(), data :: map(), opts :: NotionElixir.options()) ::
  NotionElixir.ListResponse.t()

Perform a query against the passed database, returning a ListResponse from the API. Will only return the first page of results.

Options

  • :api_key - API key to use with the request.
  • :api_version - Version of the notion API
  • :base_url - API base url, defaults to "https://api.notion.com/v1"
Link to this function

query_all(database, data, opts)

View Source

Specs

query_all(database :: t(), data :: map(), opts :: NotionElixir.options()) ::
  NotionElixir.ListResponse.t()
query_all(
  database_id :: String.t(),
  data :: map(),
  opts :: NotionElixir.options()
) :: NotionElixir.ListResponse.t()

Perform a query against the passed database, returning a ListResponse from the API. Will only return all pages of results.

Options

  • :api_key - API key to use with the request.
  • :api_version - Version of the notion API
  • :base_url - API base url, defaults to "https://api.notion.com/v1"