List partitions with pagination.
(
&self,
identifier: &Identifier,
max_results: Option<u32>,
page_token: Option<&str>,
)
| 404 | |
| 405 | /// List partitions with pagination. |
| 406 | pub async fn list_partitions_paged( |
| 407 | &self, |
| 408 | identifier: &Identifier, |
| 409 | max_results: Option<u32>, |
| 410 | page_token: Option<&str>, |
| 411 | ) -> Result<PagedList<Partition>> { |
| 412 | let database = identifier.database(); |
| 413 | let table = identifier.object(); |
| 414 | validate_non_empty_multi(&[(database, "database name"), (table, "table name")])?; |
| 415 | let path = self.resource_paths.partitions(database, table); |
| 416 | let mut params: Vec<(&str, String)> = Vec::new(); |
| 417 | |
| 418 | if let Some(max) = max_results { |
| 419 | params.push((Self::MAX_RESULTS, max.to_string())); |
| 420 | } |
| 421 | if let Some(token) = page_token { |
| 422 | params.push((Self::PAGE_TOKEN, token.to_string())); |
| 423 | } |
| 424 | |
| 425 | let response: ListPartitionsResponse = if params.is_empty() { |
| 426 | self.client.get(&path, None::<&[(&str, &str)]>).await? |
| 427 | } else { |
| 428 | self.client.get(&path, Some(¶ms)).await? |
| 429 | }; |
| 430 | |
| 431 | Ok(PagedList::new( |
| 432 | response.partitions.unwrap_or_default(), |
| 433 | response.next_page_token, |
| 434 | )) |
| 435 | } |
| 436 | |
| 437 | // ==================== Token Operations ==================== |
| 438 |
no test coverage detected