-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ?as=iiif param to top level collections endpoint.
- Loading branch information
1 parent
df48b0f
commit 9d1c62d
Showing
5 changed files
with
168 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
const { doSearch } = require("./search-runner"); | ||
const { wrap } = require("./middleware"); | ||
|
||
const getCollections = async (event) => { | ||
event.pathParameters.models = "collections"; | ||
event.body = { query: { match_all: {} } }; | ||
return doSearch(event, { includeToken: false }); | ||
}; | ||
|
||
const getCollectionsAsIiif = async (event) => { | ||
event.pathParameters.models = "collections"; | ||
event.body = { query: { match_all: {} } }; | ||
event.queryStringParameters.collectionLabel = | ||
"Northwestern Digital Collections"; | ||
event.queryStringParameters.collectionSummary = "Something fancy"; | ||
|
||
return doSearch(event, { | ||
includeToken: false, | ||
parameterOverrides: { as: "iiif" }, | ||
}); | ||
}; | ||
|
||
/** | ||
* A simple function to get Collections | ||
*/ | ||
exports.handler = wrap(async (event) => { | ||
event.pathParameters.models = "collections"; | ||
event.body = { query: { match_all: {} } }; | ||
return doSearch(event, { includeToken: false }); | ||
return event.queryStringParameters?.as === "iiif" | ||
? getCollectionsAsIiif(event) | ||
: getCollections(event); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters