Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/todo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions src/ids.rs
Original file line number Diff line number Diff line change
@@ -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<ById: Identifier> {
Expand Down
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
1 change: 1 addition & 0 deletions src/models/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down