Wrapper for http calls to retrieve data for the search interfaces, includes methods to handle both pagination and infinite scrolling.
Members
Methods
-
calculatePage (data, urlParams)
-
Calculate values related to pagination.
Parameters:
Name Type Description data Results object retrieved from the API
urlParams Object containing all the facets that need to be sent to the API
-
getCollectionItem (itemID)
-
Retrieve information for a given collection item.
Parameters:
Name Type Description itemID Slug identifying an item
Returns:
a promise which will resolve with data from the API or false
-
getInfinList (context, params, from)
-
Get items for search. This function is meant to be called as part of an infinite scroll setup.
Parameters:
Name Type Description context The context in which the search is being performed: events, blog, general, collections
params Object containing all the facets that need to be sent to the API
from Starting index for the returned results
Returns:
a promise which will resolve with data from the API or an empty array
-
getItemChildList (itemID, from)
-
Retrieve sub records (i.e. child list) for a given record. This function is called in conjunction with a infinite scroll setup.
Parameters:
Name Type Description itemID Slug identifying the item's id
from Starting index for the returned results
Returns:
a promise which will resolve with data from the API or an empty array
-
getItemEADFromSearch (collectionID)
-
Retrieve EAD information for a given collection item.
Parameters:
Name Type Description collectionID Slug identifying a collection
Returns:
a promise which will resolve with data from the API or an empty object
-
getResultsForPage (context, params)
-
Get items for search. This function is meant to be called as part of a paged result.
Parameters:
Name Type Description context The context in which the search is being performed: events, blog, general, collections
params Object containing all the facets that need to be sent to the API
Returns:
a promise which will resolve with data from the API or a string message
-
handleError (error, path, status)
-
If something goes wrong redirect to the resolver script.
Parameters:
Name Type Description error The problem as reported by the API
path URL which produced the error
status Status returned by the API
-
parseCommaNum (num)
-
If total results comes back as a string from the API. Remove any commas and convert it to a number.
Parameters:
Name Type Description num Total results returned from the API