Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions docs/DatabasesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion examples/quickstart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async fn resolve_database_id(client: &Client) -> Result<Option<String>, Box<dyn
return Ok(Some(id));
}
}
let databases = client.databases().list(None, None).await?;
let databases = client.databases().list(None, None, None).await?;
Ok(databases.databases.into_iter().next().map(|db| db.id))
}

Expand Down
7 changes: 6 additions & 1 deletion src/apis/databases_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,15 +631,17 @@ pub async fn get_database(
}
}

/// 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).
pub async fn list_databases(
configuration: &configuration::Configuration,
limit: Option<i32>,
cursor: Option<&str>,
search: Option<&str>,
) -> Result<models::ListDatabasesResponse, Error<ListDatabasesError>> {
Comment thread
anoop-narang marked this conversation as resolved.
// 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);
Expand All @@ -650,6 +652,9 @@ pub async fn list_databases(
if let Some(ref param_value) = p_query_cursor {
req_builder = req_builder.query(&[("cursor", &param_value.to_string())]);
}
if let Some(ref param_value) = p_query_search {
req_builder = req_builder.query(&[("search", &param_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
Expand Down
7 changes: 5 additions & 2 deletions src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i32>,
cursor: Option<&str>,
search: Option<&str>,
) -> Result<models::ListDatabasesResponse, Error<apis::databases_api::ListDatabasesError>> {
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.
Expand Down
2 changes: 1 addition & 1 deletion tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/databases_lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
Loading