Skip to main content

ListParams

Struct ListParams 

Source
pub struct ListParams {
    pub filter: Option<String>,
    pub search: Option<String>,
    pub sort: Option<String>,
    pub per_page: Option<u32>,
    pub page: Option<u32>,
    pub cursor: Option<String>,
    pub sample: Option<u32>,
    pub seed: Option<u32>,
    pub select: Option<String>,
    pub group_by: Option<String>,
}
Expand description

Query parameters shared by all 7 list endpoints (works, authors, sources, institutions, topics, publishers, funders). All fields are optional.

Supports both struct-update syntax and the bon builder pattern:

use papers_openalex::ListParams;

// Struct-update syntax
let params = ListParams {
    search: Some("machine learning".into()),
    per_page: Some(10),
    ..Default::default()
};

// Builder syntax
let params = ListParams::builder()
    .search("machine learning")
    .filter("publication_year:2024,is_oa:true")
    .sort("cited_by_count:desc")
    .per_page(10)
    .page(1)
    .build();

§Pagination

Two pagination modes are available (mutually exclusive):

  • Offset pagination: set page (max page * per_page <= 10,000)
  • Cursor pagination: set cursor to "*" for the first page, then pass ListMeta::next_cursor from the previous response. When next_cursor is None, there are no more results.

§Sampling

Set sample to get a random sample instead of paginated results. Use seed for reproducibility.

§Grouping

Set group_by to aggregate results by a field. The response will include a group_by array with key, display name, and count for each group.

Fields§

§filter: Option<String>

Filter expression. Comma-separated AND conditions, pipe (|) for OR (max 50 alternatives). Supports negation (!), comparison (>, <), and ranges (2020-2023).

Example: "publication_year:2024,is_oa:true" or "type:article|preprint"

§search: Option<String>

Full-text search query. For works, searches across title, abstract, and fulltext. For other entities, searches display_name. Supports stemming and stop-word removal.

§sort: Option<String>

Sort field with optional direction suffix. Append :desc for descending order. Multiple fields can be comma-separated.

Available fields: display_name, cited_by_count, works_count, publication_date, relevance_score (only with active search).

Example: "cited_by_count:desc"

§per_page: Option<u32>

Results per page (1-200, default 25).

Note: the API query key is per-page (hyphenated); this field handles the mapping automatically.

§page: Option<u32>

Page number for offset pagination. Maximum accessible: page * per_page <= 10,000. For deeper results, use cursor pagination.

§cursor: Option<String>

Cursor for cursor-based pagination. Start with "*", then pass meta.next_cursor from the previous response. When next_cursor is None, there are no more results. Mutually exclusive with page.

§sample: Option<u32>

Return a random sample of this many results instead of paginated results. Use with seed for reproducibility.

§seed: Option<u32>

Seed value for reproducible random sampling. Only meaningful when sample is set.

§select: Option<String>

Comma-separated list of fields to include in the response. Reduces payload size. Unselected fields will be omitted.

Example: "id,display_name,cited_by_count"

§group_by: Option<String>

Aggregate results by a field and return counts. The response will include a group_by array with key, key_display_name, and count for each group.

Example: "type" groups works by article/preprint/etc.

Implementations§

Source§

impl ListParams

Source

pub fn builder() -> ListParamsBuilder

Create an instance of ListParams using the builder syntax

Trait Implementations§

Source§

impl Clone for ListParams

Source§

fn clone(&self) -> ListParams

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ListParams

Source§

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

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

impl Default for ListParams

Source§

fn default() -> ListParams

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

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more