diff --git a/src/lib.rs b/src/lib.rs index 1736f88..fbeb18c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -344,6 +344,20 @@ impl Databases { json }; + let json = if let Some(cursor) = options.start_cursor { + if let Some(mut json) = json { + json.as_object_mut() + .expect("Some object to be editable") + .insert("start_cursor".to_string(), Value::String(cursor)); + + Some(json) + } else { + Some(json!({ "start_cursor": cursor })) + } + } else { + json + }; + if let Some(json) = json { request = request.json(&json); } @@ -408,6 +422,7 @@ pub struct DatabaseQueryOptions<'a> { // TODO: Implement spec for filter? pub filter: Option, pub sorts: Option, + pub start_cursor: Option, } #[derive(Clone)] @@ -967,6 +982,18 @@ impl Page { && property.id().expect("id that is_some() to be unwrappable") == id }) } + + pub fn get_title(&self) -> &Vec { + if let Property::Title { title, .. } = self + .get_property_by_id("title") + .expect("every page to have a title") + .1 + { + title + } else { + unreachable!("Expected title to be of type title") + } + } } #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]