Struct Client

Source
pub struct Client { /* private fields */ }

Implementations§

Source§

impl Client

Source

pub fn new() -> Self

Source

pub fn secret<T>(self, notion_api_key: T) -> Self
where T: AsRef<str>,

This method sets the token used for calling the Notion API. If you don’t set it, the client will automatically read and use the environment variable named NOTION_TOKEN during initialization.

For details on obtaining a Notion token, please refer to the Notion Developer Documentation.

use notionrs::client::Client;
// ...
let client = Client::new().secret("secret_XXXXXXXXXXXXXX");
Source

pub fn list_users(&self) -> ListUsersClient

Source

pub fn get_user(&self) -> GetUserClient

Source

pub fn get_self(&self) -> GetSelfClient

Source

pub fn get_page(&self) -> GetPageClient

Source

pub fn get_page_property_item(&self) -> GetPagePropertyItemClient

Source

pub fn create_page(&self) -> CreatePageClient

Source

pub fn update_page(&self) -> UpdatePageClient

Source

pub fn query_database(&self) -> QueryDatabaseClient

Source

pub fn create_database(&self) -> CreateDatabaseClient

Source

pub fn update_database(&self) -> UpdateDatabaseClient

Source

pub fn retrieve_database(&self) -> RetrieveDatabaseClient

Source

pub fn get_block(&self) -> GetBlockClient

Source

pub fn get_block_children(&self) -> GetBlockChildrenClient

Source

pub fn delete_block(&self) -> DeleteBlockClient

Source

pub fn append_block_children(&self) -> AppendBlockChildrenClient

Source

pub fn update_block(&self) -> UpdateBlockClient

Source

pub fn search(&self) -> SearchClient

Source

pub fn search_database(&self) -> SearchDatabaseClient

Source

pub fn search_page(&self) -> SearchPageClient

Source

pub fn create_comment(&self) -> CreateCommentClient

Source

pub fn retrieve_comments(&self) -> RetrieveCommentsClient

Source

pub fn create_file_upload(&self) -> CreateFileUploadClient

Source

pub fn send_file_upload(&self) -> SendFileUploadClient

Source

pub fn complete_file_upload(&self) -> CompleteFileUploadClient

Source

pub fn retrieve_file_upload(&self) -> RetrieveFileUploadClient

Source

pub fn list_file_uploads(&self) -> ListFileUploadClient

Source

pub async fn paginate<C, T>(client: C) -> Result<Vec<T>, Error>
where C: Paginate<T> + Clone + Send + 'static, T: Send + 'static,

Source

pub fn paginate_stream<C, T>( client: C, ) -> Pin<Box<dyn Stream<Item = Result<T, Error>> + Send>>
where C: Paginate<T> + Clone + Send + 'static, T: Send + 'static,

Trait Implementations§

Source§

impl Debug for Client

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Client

Source§

fn default() -> Client

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Client

§

impl !RefUnwindSafe for Client

§

impl Send for Client

§

impl Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T