Struct notion_wasi::NotionApi

source ·
pub struct NotionApi { /* private fields */ }

Implementations§

source§

impl NotionApi

source

pub fn new<S: Into<String>>(api_token: S) -> Result<Self>

source§

impl NotionApi

source

pub async fn list_databases(&self) -> Result<ListResponse<Database>>

List all the databases shared with the supplied integration token.

This method is apparently deprecated/“not recommended” and search() should be used instead.

source

pub async fn search<T: Into<SearchRequest>>( &self, query: T ) -> Result<ListResponse<Object>>

Search all pages in notion. query can either be a SearchRequest or a slightly more convenient NotionSearch query.

source

pub async fn get_database<T: AsIdentifier<DatabaseId>>( &self, database_id: T ) -> Result<Database>

Get a database by DatabaseId.

source

pub async fn get_page<T: AsIdentifier<PageId>>( &self, page_id: T ) -> Result<Page>

Get a page by PageId.

source

pub async fn create_page<T: Into<PageCreateRequest>>( &self, page: T ) -> Result<Page>

Creates a new page and return the created page

source

pub async fn query_database<D, T>( &self, database: D, query: T ) -> Result<ListResponse<Page>>where T: Into<DatabaseQuery>, D: AsIdentifier<DatabaseId>,

Query a database and return the matching pages.

source

pub async fn get_block_children<T: AsIdentifier<BlockId>>( &self, block_id: T ) -> Result<ListResponse<Block>>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more