feat: made most methods not consume the client itself

This commit is contained in:
Bram Dingelstad 2025-02-06 18:51:21 +01:00
parent cb2295e780
commit 19db7a6731

View file

@ -181,7 +181,7 @@ impl<'a> Client {
}
pub async fn search<'b, T: std::fmt::Debug + for<'de> serde::Deserialize<'de>>(
self,
&self,
options: SearchOptions<'b>,
) -> Result<QueryResponse<T>> {
let request = self
@ -212,7 +212,7 @@ pub struct Pages {
}
impl Pages {
pub async fn retrieve(self, options: PageOptions<'_>) -> Result<Page> {
pub async fn retrieve(&self, options: PageOptions<'_>) -> Result<Page> {
let url = format!(
"https://api.notion.com/v1/pages/{page_id}",
page_id = options.page_id
@ -253,7 +253,10 @@ pub struct BlockChildrenListOptions<'a> {
}
impl BlockChildren {
pub async fn list(self, options: BlockChildrenListOptions<'_>) -> Result<QueryResponse<Block>> {
pub async fn list(
&self,
options: BlockChildrenListOptions<'_>,
) -> Result<QueryResponse<Block>> {
let url = format!(
"https://api.notion.com/v1/blocks/{block_id}/children",
block_id = options.block_id