0.1.0 • Published 5 years ago

rijksmuseum-typescript-api v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

rijksmuseum-typescript-api

Rijksmuseum API Wrapper made with Typescript and RxJS

Quality Gate Status Security Rating

Install

npm i rijksmuseum-typescript-api

Usage

let api: RijksmuseumClient = new RijksmuseumClient('<API_KEY>');

// Get a artwork by it's ID:

api.artwork.getById('SK-C-1454').subscribe(artwork => {  
    console.log(`"${artwork.title}" was created by ${artwork.principalMaker}`);
});

// Get artwork by artist (paged result: page 1, 25 results)
// note: because of limitations of the Rijksmuseum api, you need to provide the exact name of the artist.
artApi.getByArtist('Rembrandt van Rijn', 1, 25).subscribe(pagedResult => {
    pagedResult.results.forEach((artwork) => { 
        console.log(artwork.title); 
    }); 
});

// Search for artworks by criteria:
const criteria = new SearchCriteria();
criteria.page = 1;
criteria.page_size = 25;
criteria.type = "painting";

api.artwork.search().subscribe(searchResults => {  
    console.log(`A total of ${searchResults.total_results} artworks have been found`);
});