Skip to main content

ListParams

Struct ListParams 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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>

Source

pub fn with_page_size(self, size: u32) -> Self

Set pageSize.

Source

pub fn with_page_token(self, token: impl Into<String>) -> Self

Set the opaque pageToken from a previous page.

Source

pub fn with_sort_field(self, field: S) -> Self

Set sortField.

Source

pub fn with_sort_order(self, order: SortOrder) -> Self

Set sortOrder.

Source

pub fn with_id_type(self, id_type: IdentifierType) -> Self

Set the idType filter.

Source

pub fn with_id_value(self, id_value: impl Into<String>) -> Self

Set the idValue filter. Requires Self::with_id_type as well.

Source

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.

Trait Implementations§

Source§

impl<S: Clone> Clone for ListParams<S>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for ListParams<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S> Default for ListParams<S>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<S: Eq> Eq for ListParams<S>

Source§

impl<S: PartialEq> PartialEq for ListParams<S>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<S: PartialEq> StructuralPartialEq for ListParams<S>

Auto Trait Implementations§

§

impl<S> Forget for ListParams<S>

§

impl<S> Freeze for ListParams<S>
where Option<S>: Freeze,

§

impl<S> Move for ListParams<S>

§

impl<S> RefUnwindSafe for ListParams<S>

§

impl<S> Send for ListParams<S>
where Option<S>: Send,

§

impl<S> Sync for ListParams<S>
where Option<S>: Sync,

§

impl<S> Unpin for ListParams<S>
where Option<S>: Unpin,

§

impl<S> UnsafeUnpin for ListParams<S>
where Option<S>: UnsafeUnpin,

§

impl<S> UnwindSafe for ListParams<S>
where Option<S>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.