pub struct Collection {Show 14 fields
pub subject: String,
pub property: Option<String>,
pub value: Option<String>,
pub members: Vec<String>,
pub members_nested: Option<Vec<Resource>>,
pub sort_by: Option<String>,
pub sort_desc: bool,
pub page_size: usize,
pub current_page: usize,
pub total_items: usize,
pub total_pages: usize,
pub name: Option<String>,
pub include_nested: bool,
pub include_external: bool,
}Expand description
Dynamic resource used for ordering, filtering and querying content. Contains members / results. Use CollectionBuilder if you don’t (yet) need the results. Features pagination.
Fields§
§subject: StringFull Subject URL of the resource, including query parameters
property: Option<String>The property which the results are to be filtered by
value: Option<String>The value which the results are to be filtered by
members: Vec<String>The actual items that you’re interested in. List the member subjects of the current page.
members_nested: Option<Vec<Resource>>The members as full resources, instead of a list of subjects. Is only populated if nested is true.
sort_by: Option<String>URL of the value to sort by
sort_desc: bool§page_size: usizeHow many items per page
current_page: usizeCurrent page number, defaults to 0 (first page)
total_items: usizeTotal number of items
total_pages: usizeTotal number of pages
name: Option<String>Human readable name of a resource
include_nested: boolWhether it’s children should be included as nested resources in the response
include_external: boolInclude resources from other servers
Implementations§
Source§impl Collection
impl Collection
Sourcepub fn collect_members(
store: &impl Storelike,
collection_builder: CollectionBuilder,
for_agent: &ForAgent,
) -> AtomicResult<Collection>
pub fn collect_members( store: &impl Storelike, collection_builder: CollectionBuilder, for_agent: &ForAgent, ) -> AtomicResult<Collection>
Constructs a Collection, which is a paginated list of items with some sorting applied. Gets the required data from the store. Applies sorting settings.
pub fn to_resource(&self, store: &impl Storelike) -> AtomicResult<Resource>
Sourcepub fn add_to_resource(
&self,
resource: &mut Resource,
store: &impl Storelike,
) -> AtomicResult<Resource>
pub fn add_to_resource( &self, resource: &mut Resource, store: &impl Storelike, ) -> AtomicResult<Resource>
Adds the Collection props to an existing Resource.