diff --git a/examples/todo/README.md b/examples/todo/README.md index b22d08b..13ba76e 100644 --- a/examples/todo/README.md +++ b/examples/todo/README.md @@ -2,7 +2,7 @@ This example is builds a todo list using a notion database. -## Setup your notion api token +## Setup your Notion API token Create an `internal` integration here: https://www.notion.so/my-integrations diff --git a/src/ids.rs b/src/ids.rs index 611212e..3bbd420 100644 --- a/src/ids.rs +++ b/src/ids.rs @@ -1,9 +1,13 @@ +//! Identification types, traits and utilities. +//! use std::fmt::Display; use std::fmt::Error; +/// A wrapper for arbitrary identification types pub trait Identifier: Display { fn value(&self) -> &str; } + /// Meant to be a helpful trait allowing anything that can be /// identified by the type specified in `ById`. pub trait AsIdentifier { diff --git a/src/lib.rs b/src/lib.rs index b836a45..6ca76d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,23 @@ +//! A client API for Notion. +//! +//! ### Example +//! ```rust,ignore +//! use rusticnotion; +//! use rusticnotion::models::search::*; +//! use rusticnotion::models::*; +//! use std::env; +//! let notion_api_token = env::var("NOTION_API_TOKEN").expect("NOTION_API_TOKEN env var not set"); +//! let notion = rusticnotion::NotionApi::new(notion_api_token).unwrap(); +//! +//! // List all databases +//! let databases = notion.search(NotionSearch::filter_by_databases()).await.unwrap(); +//! +//! // List all pages +//! let pages = notion.search(NotionSearch::filter_by_pages()).await.unwrap(); +//! +//! // See examples for more +//! ``` + use crate::ids::{BlockId, DatabaseId}; use crate::models::error::ErrorResponse; use crate::models::search::{DatabaseQuery, SearchRequest}; diff --git a/src/models/search.rs b/src/models/search.rs index 1fadc91..8bd59b7 100644 --- a/src/models/search.rs +++ b/src/models/search.rs @@ -334,6 +334,7 @@ impl Pageable for DatabaseQuery { } } +/// Parameters for search #[derive(Debug, Eq, PartialEq)] pub enum NotionSearch { /// When supplied, limits which pages are returned by comparing the query to the page title.