diff --git a/CHANGELOG.md b/CHANGELOG.md index b6e3eea..384071a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- feat(databases): add search parameter to list endpoint + ## [0.10.0] - 2026-07-23 ### Changed diff --git a/docs/DatabasesApi.md b/docs/DatabasesApi.md index 4f09808..5e57a54 100644 --- a/docs/DatabasesApi.md +++ b/docs/DatabasesApi.md @@ -263,10 +263,10 @@ Name | Type | Description | Required | Notes ## list_databases -> models::ListDatabasesResponse list_databases(limit, cursor) +> models::ListDatabasesResponse list_databases(limit, cursor, search) List databases -List databases in the workspace, newest first, one page at a time. When no `limit` is given a default page size is applied, so a single call returns at most one page rather than every database. If the response's `has_more` is true, pass its `next_cursor` value back as the `cursor` query parameter to fetch the next page. +List databases in the workspace, newest first, one page at a time. When no `limit` is given a default page size is applied, so a single call returns at most one page rather than every database. If the response's `has_more` is true, pass its `next_cursor` value back as the `cursor` query parameter to fetch the next page. Pass `search` to return only databases whose name contains that text (case-insensitive). ### Parameters @@ -275,6 +275,7 @@ Name | Type | Description | Required | Notes ------------- | ------------- | ------------- | ------------- | ------------- **limit** | Option<**i32**> | Maximum number of databases to return in this page (1–100). Values outside the range are clamped. | | **cursor** | Option<**String**> | Opaque pagination cursor from a previous response's `next_cursor`. | | +**search** | Option<**String**> | Case-insensitive substring filter on the database name. When set, only databases whose name contains this text are returned; paging and newest-first ordering are unchanged. | | ### Return type diff --git a/examples/quickstart.rs b/examples/quickstart.rs index 7917781..7ef71c4 100644 --- a/examples/quickstart.rs +++ b/examples/quickstart.rs @@ -195,7 +195,7 @@ async fn resolve_database_id(client: &Client) -> Result, Box, cursor: Option<&str>, + search: Option<&str>, ) -> Result> { // add a prefix to parameters to efficiently prevent name collisions let p_query_limit = limit; let p_query_cursor = cursor; + let p_query_search = search; let uri_str = format!("{}/v1/databases", configuration.base_path); let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str); @@ -650,6 +652,9 @@ pub async fn list_databases( if let Some(ref param_value) = p_query_cursor { req_builder = req_builder.query(&[("cursor", ¶m_value.to_string())]); } + if let Some(ref param_value) = p_query_search { + req_builder = req_builder.query(&[("search", ¶m_value.to_string())]); + } if let Some(ref user_agent) = configuration.user_agent { req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); } diff --git a/src/resources.rs b/src/resources.rs index cd89f81..7bbc7e0 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -255,13 +255,16 @@ impl<'a> DatabasesApi<'a> { } /// List databases, newest first, one keyset page at a time. Pass `cursor` - /// (from a previous response's `next_cursor`) to fetch the next page. + /// (from a previous response's `next_cursor`) to fetch the next page, and + /// `search` to return only databases whose name contains that text + /// (case-insensitive). pub async fn list( &self, limit: Option, cursor: Option<&str>, + search: Option<&str>, ) -> Result> { - apis::databases_api::list_databases(self.config, limit, cursor).await + apis::databases_api::list_databases(self.config, limit, cursor, search).await } /// Delete a database by id. diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 48aefd8..79a8b02 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -184,7 +184,7 @@ pub async fn shared_database_id(client: &Client) -> String { use hotdata::apis::databases_api; let config = client.configuration(); - let listing = databases_api::list_databases(config, None, None) + let listing = databases_api::list_databases(config, None, None, None) .await .expect("list_databases should succeed"); if let Some(db) = listing diff --git a/tests/databases_lifecycle.rs b/tests/databases_lifecycle.rs index fb78a53..710a0eb 100644 --- a/tests/databases_lifecycle.rs +++ b/tests/databases_lifecycle.rs @@ -23,7 +23,7 @@ async fn databases_lifecycle() { .expect("get_database should succeed"); assert_eq!(fetched.id, database_id); - let listing = databases_api::list_databases(config, None, None) + let listing = databases_api::list_databases(config, None, None, None) .await .expect("list_databases should succeed"); assert!(