New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

artsholland

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

artsholland - npm Package Compare versions

Comparing version 0.1.0 to 1.0.1

.travis.yml

440

artsholland.js
/*
Name: nodejs-artsholland
Source: https://github.com/fvdm/nodejs-artsholland
Feedback: https://github.com/fvdm/nodejs-artsholland/issues
License: Unlicense / Public Domain
Name: nodejs-artsholland
Description: Node.js module to access Arts Holland API methods
Source: https://github.com/fvdm/nodejs-artsholland
Feedback: https://github.com/fvdm/nodejs-artsholland/issues
License: Unlicense / Public Domain
Service: Arts Holland
Service URL: http://artsholland.com
Service API: http://dev.artsholland.com/documentation/restapi
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>
*/

@@ -11,69 +42,65 @@

var app = {
api: {
host: 'api.artsholland.com',
path: '/rest/',
key: ''
},
// API key
module.exports.apikey = ''
// Event
module.exports.event = function( one, two, three ) {
// Event
event: function( one, two, three ) {
if( typeof one == 'function' ) {
if( typeof one == 'function' ) {
// event( oneCallback )
talk( 'event', one )
} else if( typeof one == 'object' && typeof two == 'function' ) {
// event( oneFilter, twoCallback )
talk( 'event', one, two )
} else if( typeof one == 'string' && typeof two == 'function' ) {
// event( oneCIDN, twoCallback )
talk( 'event/'+ one, two )
} else if( typeof one == 'string' && two == undefined ) {
// var event = event( oneCIDN )
return {
// app.event( oneCallback )
app.talk( 'event', one )
// event( oneCIDN ).venue( fourCallback )
venue: function( four ) {
talk( 'event/'+ one +'/venue', four )
},
} else if( typeof one == 'object' && typeof two == 'function' ) {
// event( oneCIDN ).production( fourCallback )
production: function( four ) {
talk( 'event/'+ one +'/production', four )
},
// app.event( oneFilter, twoCallback )
app.talk( 'event', one, two )
// event( oneCIDN ).room( fourCallback )
room: function( four ) {
talk( 'event/'+ one +'/room', four )
},
// event( oneCIDN ).attachment( fourCallback )
attachment: function( four ) {
talk( 'event/'+ one +'/attachment', four )
},
} else if( typeof one == 'string' && typeof two == 'function' ) {
// app.event( oneCIDN, twoCallback )
app.talk( 'event/'+ one, two )
} else if( typeof one == 'string' && two == undefined ) {
// var event = app.event( oneCIDN )
return {
// app.event( oneCIDN ).venue( fourCallback )
venue: function( four ) {
app.talk( 'event/'+ one +'/venue', four )
},
// app.event( oneCIDN ).production( fourCallback )
production: function( four ) {
app.talk( 'event/'+ one +'/production', four )
},
// app.event( oneCIDN ).room( fourCallback )
room: function( four ) {
app.talk( 'event/'+ one +'/room', four )
},
// app.event( oneCIDN ).attachment( fourCallback )
attachment: function( four ) {
app.talk( 'event/'+ one +'/attachment', four )
},
offering: function( four ) {
if( typeof four == 'function' ) {
offering: function( four ) {
if( typeof four == 'function' ) {
// event( oneCIDN ).offering( fourCallback )
talk( 'event/'+ one +'/offering', four )
} else if( typeof four == 'string' ) {
return {
// app.event( oneCIDN ).offering( fourCallback )
app.talk( 'event/'+ one +'/offering', four )
// event( oneCIDN ).offering( fourName ).price( fiveCallback )
price: function( fcb ) {
talk( 'event/'+ one +'/offering/'+ four +'/price', five )
}
} else if( typeof four == 'string' ) {
return {
// app.event( oneCIDN ).offering( fourName ).price( fiveCallback )
price: function( fcb ) {
app.talk( 'event/'+ one +'/offering/'+ four +'/price', five )
}
}
}

@@ -83,134 +110,205 @@ }

}
},
}
}
// Venue
module.exports.venue = function( one, two, three ) {
// Venue
venue: function( one, two, three ) {
if( typeof one == 'function' ) {
if( typeof one == 'function' ) {
// venue( oneCallback )
talk( 'venue', one )
} else if( typeof one == 'object' && typeof two == 'function' ) {
// venue( oneFilter, twoCallback )
talk( 'venue', one, two )
} else if( typeof one == 'string' && typeof two == 'function' ) {
// venue( oneCIDN, twoCallback )
talk( 'venue/'+ one, two )
} else if( typeof one == 'string' && two == undefined ) {
// var venue = venue( oneCIDN )
return {
// app.venue( oneCallback )
app.talk( 'venue', one )
// venue( oneCIDN ).event( fourCallback )
event: function( four ) {
talk( 'venue/'+ one +'/event', four )
},
} else if( typeof one == 'object' && typeof two == 'function' ) {
// venue( oneCIDN ).production( fourCallback )
production: function( four ) {
talk( 'venue/'+ one +'/production', four )
},
// app.venue( oneFilter, twoCallback )
app.talk( 'venue', one, two )
// venue( oneCIDN ).room( fourCallback )
room: function( four ) {
talk( 'venue/'+ one +'/room', four )
},
// venue( oneCIDN ).attachment( fourCallback )
attachment: function( four ) {
talk( 'venue/'+ one +'/attachment', four )
}
} else if( typeof one == 'string' && typeof two == 'function' ) {
// app.venue( oneCIDN, twoCallback )
app.talk( 'venue/'+ one, two )
} else if( typeof one == 'string' && two == undefined ) {
// var venue = app.venue( oneCIDN )
return {
// app.venue( oneCIDN ).event( fourCallback )
event: function( four ) {
app.talk( 'venue/'+ one +'/event', four )
},
// app.venue( oneCIDN ).production( fourCallback )
production: function( four ) {
app.talk( 'venue/'+ one +'/production', four )
},
// app.venue( oneCIDN ).room( fourCallback )
room: function( four ) {
app.talk( 'venue/'+ one +'/room', four )
},
// app.venue( oneCIDN ).attachment( fourCallback )
attachment: function( four ) {
app.talk( 'venue/'+ one +'/attachment', four )
}
}
}
},
}
}
// Production
module.exports.production = function( one, two, three ) {
// Production
production: function( one, two, three ) {
if( typeof one == 'function' ) {
if( typeof one == 'function' ) {
// production( oneCallback )
talk( 'production', one )
} else if( typeof one == 'object' && typeof two == 'function' ) {
// production( oneFilter, twoCallback )
talk( 'production', one, two )
} else if( typeof one == 'string' && typeof two == 'function' ) {
// production( oneCIDN, twoCallback )
talk( 'production/'+ one, two )
} else if( typeof one == 'string' && two == undefined ) {
// var production = production( oneCIDN )
return {
// app.production( oneCallback )
app.talk( 'production', one )
// production( oneCIDN ).event( fourCallback )
event: function( four ) {
talk( 'production/'+ one +'/event', four )
},
} else if( typeof one == 'object' && typeof two == 'function' ) {
// production( oneCIDN ).production( fourCallback )
venue: function( four ) {
talk( 'production/'+ one +'/venue', four )
}
// app.production( oneFilter, twoCallback )
app.talk( 'production', one, two )
} else if( typeof one == 'string' && typeof two == 'function' ) {
// app.production( oneCIDN, twoCallback )
app.talk( 'production/'+ one, two )
} else if( typeof one == 'string' && two == undefined ) {
// var production = app.production( oneCIDN )
return {
// app.production( oneCIDN ).event( fourCallback )
event: function( four ) {
app.talk( 'production/'+ one +'/event', four )
},
// app.production( oneCIDN ).production( fourCallback )
venue: function( four ) {
app.talk( 'production/'+ one +'/venue', four )
}
}
}
},
}
},
module.exports.genre = function( filters, cb ) {
talk( 'genre', filters, cb )
}
module.exports.venuetype = function( filters, cb ) {
talk( 'venuetype', filters, cb )
}
// Communicate
function talk( path, fields, cb ) {
if( !cb && typeof fields == 'function' ) {
var cb = fields
var fields = {}
}
genre: function( cb ) {
app.talk( 'genre', cb )
},
// prevent multiple callbacks
var complete = false
var doCallback = function( err, data ) {
if( ! complete ) {
complete = true
cb( err, data )
}
}
venuetype: function( cb ) {
app.talk( 'venuetype', cb )
},
// build request
fields.apiKey = module.exports.apikey
fields = querystring.stringify( fields )
// Communicate
talk: function( path, fields, cb ) {
if( !cb && typeof fields == 'function' ) {
var cb = fields
var fields = {}
var options = {
host: 'api.artsholland.com',
path: '/rest/'+ path +'?'+ fields,
method: 'GET',
headers: {
'User-Agent': 'artsholland.js (https://github.com/fvdm/nodejs-artsholland)',
Accept: 'application/json'
}
}
var request = http.request( options )
// process response
request.on( 'response', function( response ) {
var data = []
var size = 0
fields.apiKey = app.api.key
fields = querystring.stringify( fields )
response.on( 'data', function( chunk ) {
data.push( chunk )
size += chunk.length
})
http.request(
{
host: app.api.host,
port: 80,
path: app.api.path + path +'?'+ fields,
method: 'GET',
headers: {
'User-Agent': 'artsholland.js (https://github.com/fvdm/nodejs-artsholland)',
Accept: 'application/json'
response.on( 'close', function() {
var err = new Error('request dropped')
err.responseCode = response.statusCode || null
err.responseHeaders = response.headers || null
doCallback( err )
})
response.on( 'end', function() {
var err = null
if( data.length >= 0 ) {
// process buffer
var buf = new Buffer( size )
var pos = 0;
for( var d in data ) {
data[d].copy( buf, pos )
pos += data[d].length
}
},
function( response ) {
var data = ''
response.on( 'data', function( chunk ) { data += chunk })
response.on( 'end', function() {
data = data.toString('utf8')
if( data.match( /^(\{.*\}|\[.*\])$/ ) ) {
cb( JSON.parse( data ) )
}
})
data = buf.toString().trim()
// validate
if( ! data.match( /^(\{.*\}|\[.*\])$/ ) ) {
err = new Error('not json')
err.responseBody = data
} else {
data = JSON.parse( data )
}
} else {
// no data
err = new Error('invalid response')
err.responseBody = null
}
).end()
}
// HTTP status
if( response.statusCode !== 200 ) {
err = new Error('http error')
err.responseBody = data
}
// do callback
if( err instanceof Error ) {
err.request = options
err.responseCode = response.statusCode || null
err.responseHeaders = response.headers || null
doCallback( err )
} else {
doCallback( null, data )
}
})
})
// request error
request.on( 'error', function( error ) {
var err = new Error('request error')
err.requestError = error
err.request = options
doCallback( err )
})
// complete request
request.end()
}
// export module
module.exports = app
{
"author": {
"name": "Franklin van de Meent",
"email": "fr@nkl.in",
"url": "http://frankl.in"
"name": "Franklin van de Meent",
"email": "fr@nkl.in",
"url": "https://frankl.in"
},
"name": "artsholland",
"description": "Access the Arts Holland API",
"version": "0.1.0",
"name": "artsholland",
"description": "DEPRECATED - Access the Arts Holland API",
"version": "1.0.1",
"repository": {
"type": "git",
"url": "git://github.com/fvdm/nodejs-artsholland.git"
"type": "git",
"url": "git://github.com/fvdm/nodejs-artsholland.git"
},
"bugs": {
"url": "https://github.com/fvdm/nodejs-artsholland/issues"
"url": "https://github.com/fvdm/nodejs-artsholland/issues"
},
"main": "artsholland.js",
"dependencies": {},
"devDependencies": {},
"main": "artsholland.js",
"scripts": {
"preinstall": "node deprecated.js",
"test": "echo 'Error: no test specified'; exit 1"
},
"dependencies": {},
"devDependencies": {},
"optionalDependencies": {},
"engines": {
"node": "*"
"node": ">=0.12.0"
},
"keywords": ["artsholland", "api", "middleware", "culture", "tourism"],
"license": {
"type": "Public Domain",
"url": "https://github.com/fvdm/nodejs-artsholland/raw/master/UNLICENSE"
}
"keywords": [
"artsholland",
"api",
"culture",
"tourism",
"art",
"NL"
],
"license": "Unlicense"
}

@@ -1,17 +0,22 @@

nodejs-artsholland
==================
artsholland
===========
Unofficial API module for Arts Holland
[![Build Status](https://travis-ci.org/fvdm/nodejs-artsholland.svg?branch=master)](https://travis-ci.org/fvdm/nodejs-artsholland)
Docs: <http://dev.artsholland.com/documentation/restapi>
# BETA notice
This is beta software. Both the remote API and this module are still in early development, the methods may produce unexpected results.
DEPRECATED
----------
The Arts Holland API is no longer available rendering this module useless.
All methods provided with this module will fail.
# Usage
Usage
-----
## event ( callback )
### event ( callback )

@@ -25,3 +30,3 @@ Lists and describes all events.

## event ( cidn, callback )
### event ( cidn, callback )

@@ -34,8 +39,10 @@ Describe event with `cidn`.

## event ( cidn )
### event ( cidn )
Returns an object with the following functions:
### event().venue( callback )
### event().venue ( callback )
Lists and describes all venues in which event with `cidn` takes place.

@@ -48,3 +55,4 @@

# Unlicense
Unlicense
---------

@@ -77,1 +85,7 @@ <https://github.com/fvdm/nodejs-artsholland/blob/master/UNLICENSE>

For more information, please refer to <http://unlicense.org>
Author
------
[Franklin van de Meent](https://frankl.in)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc