#[non_exhaustive]pub struct ListParams<S> {
pub page_size: Option<u32>,
pub page_token: Option<String>,
pub sort_field: Option<S>,
pub sort_order: Option<SortOrder>,
pub id_type: Option<IdentifierType>,
pub id_value: Option<String>,
}Expand description
Query parameters shared by list operations.
Default leaves every field unset. The request then carries no list
query parameters, and the server applies its own page size and sort. S
does not need to implement Default, so this works for enums::ComponentSort
and the other built-in sort enums.
§Continuing a page
Keep the same ListParams value and replace only page_token
with Page::next_page_token. That preserves
pageSize, sort fields, and identifier filters. Building a new value that
sets only the token drops those fields and can change the result set.
Callers must detect pagination anomalies themselves (empty intermediate pages,
repeated tokens, missing tokens when has_next is true, or server errors).
This crate does not auto-paginate and does not break loops on a repeated token.
let mut query = ListParams::default()
.with_page_size(1)
.with_id_type(IdentifierType::Purl);
let first = service.query_products(&query).await?;
query.page_token = first.next_page_token.clone();
let second = service.query_products(&query).await?;The struct is #[non_exhaustive]: build it with ListParams::default
and the with_* setters, or assign the public fields of a default value.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.page_size: Option<u32>pageSize, from 1 to 100.
page_token: Option<String>Opaque pageToken copied from the previous page.
sort_field: Option<S>Resource-specific sortField.
sort_order: Option<SortOrder>sortOrder.
id_type: Option<IdentifierType>idType filter.
This may be sent without id_value. TEA 1.0 uses that
form for compliance-document discovery (idType=COMPLIANCE_DOCUMENT).
id_value: Option<String>idValue filter.
Sent only together with id_type. This SDK rejects a
value with no type before the request. The pinned specification does
not settle that value-only case, so the rejection is not a claim that
TEA 1.0 forbids it.
Implementations§
Source§impl<S> ListParams<S>
impl<S> ListParams<S>
Sourcepub fn with_page_size(self, size: u32) -> Self
pub fn with_page_size(self, size: u32) -> Self
Set pageSize.
Sourcepub fn with_page_token(self, token: impl Into<String>) -> Self
pub fn with_page_token(self, token: impl Into<String>) -> Self
Set the opaque pageToken from a previous page.
Sourcepub fn with_sort_field(self, field: S) -> Self
pub fn with_sort_field(self, field: S) -> Self
Set sortField.
Sourcepub fn with_sort_order(self, order: SortOrder) -> Self
pub fn with_sort_order(self, order: SortOrder) -> Self
Set sortOrder.
Sourcepub fn with_id_type(self, id_type: IdentifierType) -> Self
pub fn with_id_type(self, id_type: IdentifierType) -> Self
Set the idType filter.
Sourcepub fn with_id_value(self, id_value: impl Into<String>) -> Self
pub fn with_id_value(self, id_value: impl Into<String>) -> Self
Set the idValue filter. Requires Self::with_id_type as well.
Sourcepub fn validate(&self) -> Result<(), ModelError>
pub fn validate(&self) -> Result<(), ModelError>
Validate pagination bounds and identifier filters.
idType alone is accepted. Both fields together are accepted. Neither
field is accepted. idValue without idType is rejected.
§Errors
Returns an error when pageSize is outside 1..=100 or idValue is set
without idType.