Skip to content

botic/stadtkatalog-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@stadtkatalog/stadtkatalog

A client library for the 📖StadtKatalog.

Installation

$ npm install @stadtkatalog/stadtkatalog

Functions

The following functions provide access to the StadtKatalog Open Data REST API:

Some functions use the REST API's Standard Query Parameters to paginate or scroll through query results.

This library is written in TypeScript and provides enumerations and interfaces to work with API responses.

Examples

// Retrieve a single entry with its metadata
const seesternEntry = await getEntry("100105");

// Retrieve only the entry's data
const seesternData = await getEntryData("100105");

// Export all entries inside the Seestadt geofence,
// including entry assets and with export page size 500
const seestadtAspern = await exportEntries(true, 500, "seestadt");

// Fulltext search over the whole StadtKatalog
const results = await searchFulltext("Seestern");

// Fulltext search with the Seestadt geofence
const resultsSeestadt = await searchFulltext(
    "Seestern",
    SortField.relevance, // TypeScript enum
    SortOrder.desc, // TypeScript enum
    100,
    0,
    "seestadt"
);

Configuration

The base URL and the HTTP client timeout can be changed with the following environment variable (process.env in Node):

  • STADTKATALOG_ENDPOINT – defaults to https://app.stadtkatalog.org/opendata/v1
  • STADTKATALOG_CLIENT_TIMEOUT – defaults to 60000 ms

Use a webpack plugin variable to switch to a different base URL in client-side projects:

plugins: [
  new webpack.DefinePlugin({
    'process.env': {
      'STADTKATALOG_ENDPOINT': '"https://example.com/opendata/v1"',
      'STADTKATALOG_CLIENT_TIMEOUT': '10000'
    }
  })
]

Compatibility

This library has been compiled from TypeScript to JavaScript with the ES5 target. You still need to provide polyfills for e.g. Promise and Symbol.

License

ISC – StadtKatalog.org / Philipp Naderer-Puiu

About

📖StadtKatalog library for JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published