pub struct NotionApi { /* private fields */ }Expand description
An API client for Notion. Create a client by using new(api_token: String).
Implementations§
Source§impl NotionApi
impl NotionApi
Sourcepub fn new(api_token: String) -> Result<Self, Error>
pub fn new(api_token: String) -> Result<Self, Error>
Creates an instance of NotionApi. May fail if the provided api_token is an improper value.
Sourcepub async fn list_databases(&self) -> Result<ListResponse<Database>, Error>
👎Deprecated: This method is deprecated. Please use search() with a filter on databases instead.
pub async fn list_databases(&self) -> Result<ListResponse<Database>, Error>
search() with a filter on databases instead.List all the databases shared with the supplied integration token. Because of the deprecation of the original endpoint this just calls search() with a filter on databases
Sourcepub async fn search<T: Into<SearchRequest>>(
&self,
query: T,
) -> Result<ListResponse<Object>, Error>
pub async fn search<T: Into<SearchRequest>>( &self, query: T, ) -> Result<ListResponse<Object>, Error>
Search all pages in notion.
query can either be a SearchRequest or a slightly more convenient
NotionSearch query.
Sourcepub async fn get_database<T: AsIdentifier<DatabaseId>>(
&self,
database_id: T,
) -> Result<Database, Error>
pub async fn get_database<T: AsIdentifier<DatabaseId>>( &self, database_id: T, ) -> Result<Database, Error>
Get a database by DatabaseId.
Sourcepub async fn get_page<T: AsIdentifier<PageId>>(
&self,
page_id: T,
) -> Result<Page, Error>
pub async fn get_page<T: AsIdentifier<PageId>>( &self, page_id: T, ) -> Result<Page, Error>
Get a page by PageId.
Sourcepub async fn create_page<T: Into<PageCreateRequest>>(
&self,
page: T,
) -> Result<Page, Error>
pub async fn create_page<T: Into<PageCreateRequest>>( &self, page: T, ) -> Result<Page, Error>
Creates a new page and return the created page
Sourcepub async fn query_database<D, T>(
&self,
database: D,
query: T,
) -> Result<ListResponse<Page>, Error>
pub async fn query_database<D, T>( &self, database: D, query: T, ) -> Result<ListResponse<Page>, Error>
Query a database and return the matching pages.
pub async fn get_block_children<T: AsIdentifier<BlockId>>( &self, block_id: T, ) -> Result<ListResponse<Block>, Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NotionApi
impl !RefUnwindSafe for NotionApi
impl Send for NotionApi
impl Sync for NotionApi
impl Unpin for NotionApi
impl !UnwindSafe for NotionApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more