Features
Key features that make up the main value proposition for Lore
Key features that make up the main value proposition for Lore
A collection
in Lore represents a collection of resources, such as a list of Posts
the API might return from https://api.myapp.com/posts
. The default data structure for a collection looks like this:
post = {
state: 'FETCHING',
data: [],
query: {
where: { authorId: '123' },
pagination: { page: 1 }
},
meta: {},
error: {}
}
Similar to models, each property was chosen to address a different use case and all are necessary to make sure components can be entirely data-driven.
This field represents what is happening to the resource, such as whether it is being fetched, or whether there was an API error while fetching the resources. It is necessary in order to communicate to the user what is happening to data.
This field contains the JSON data returned by the server and is necessary to display meaningful content in the application. When the array is populated, it is populated with a list of model
resources, each having the data structure described above.
This field contains a description of what this data is. Specifically, it contains the where
clause that describe what criteria the data matches (such as posts by a specific author) and a pagination
clause that describes the slice of data (such as which page and how many results exists in a page). It is necessary for displaying information about the data and for creating pagination controls.
This field contains any metadata information provided by the server that you need to associate with the data. It is necessary for communicating to the user the total number of matching resources (when the API provides it) or something like rate-limiting information, if the API communicates the number of requests left in the allotted period.
This field captures any API errors that are returned (400/500 errors) and is necessary to communicate to the user what went wrong.