
node-partyflock

Node.JS Promise-based library to communicate with the Partyflock API
This library creates a new instance of "Partyflock" for you, exposing a few methods you can use to communicate.
To start a new Partyflock instance:
var Partyflock = require('partyflock');
var partyflockInstance = new Partyflock(consumerKey, consumerSecret, endpoint , debug )
consumerKey
and consumerSecret
can be requested via kantoor@partyflock.nl
, with a brief explanation for the purpose. endpoint
will usually be partyflock.nl
and can be left empty if you're using that endpoint.
Installing
Run in your project root:
~ npm install --save partyflock
Require in your code:
var Partyflock = require('partyflock');
Running the integration tests
Some of the integration tests are based off of real world data, that means that this data can change and the tests might fail over time. This is expected behaviour.
You can run the tests by copying config/data.example.js
to config/data.js
and filling out your real data.
Then it's as easy as:
~ npm test
Methods
Notes and acknowledgements:
- Every method accepts an optional
headers
parameter. This can be used to send a custom Pf header, examples will be supplied below.
- When any error occurs or no results could be found,
false
will be returned.
Artist
partyflockInstance.artist.lookup
partyflockInstance.artist.lookup('1').then(function(res) {
});
partyflockInstance.artist.search
partyflockInstance.artist.search('frontl%').then(function(res) {
});
Date
partyflockInstance.date.lookup('20151012').then(function(res) {
});
Alternative headers
var headers = {
'Pf-ResultWish': 'date(agenda(party(name,fbid,stamp,notime,door_close_hour,door_close_mins,duration_secs,genre(name),flyer(type,size=thumb,width,height,link),location(name,address,zipcode,latitude,longitude,city(name,country(name))),organization(name),area(incomplete,lineup(time_start,time_end,artist(name))))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(certain(user(id))))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(user(id)))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(maybe(user(id))))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(maybe(user(id)),certain(user(id))))))'
};
var headers = {
'Pf-ResultWish': 'date(agenda(party(name,min_age,stamp,notime,duration_secs,price(what,price,currency,membership,membership_name,available,sold_out,vip,type,access,time_hour,time_mins,consumptions,passepartout,group_amount),genre(name),flyer(type,size=thumb,width,height,link),location(name,address,zipcode,latitude,longitude,city(name,country(name))),organization(name),area(lineup(time_start,time_end,artist(name))))))'
};
var headers = {
'Pf-ResultWish': 'date(agenda(party(name,min_age,stamp,notime,duration_secs,price(what,price,currency,membership,membership_name,available,sold_out,vip,type,access,time_hour,time_mins,consumptions,passepartout,group_amount),genre(name),flyer(type,size=thumb,width,height,link),location(name,address,zipcode,latitude,longitude,city(name,country(name))),organization(name),area(lineup(time_start,time_end,artist(name))))))'
};
var headers = {
'Pf-Latitude': '52.3738',
'Pf-Longitude': '4.891',
'Pf-Radius': '50',
'Pf-ResultWish': 'date(agenda(party(name,stamp,notime,duration_secs,genre(name),flyer(type,size=thumb,width,height,link),location(name,address,zipcode,latitude,longitude,city(name,country(name))),organization(name),area(lineup(time_start,time_end,artist(name))))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitorcounts(maybe,certain))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),tickets(type,domain,data))))'
};
var headers = {
'Pf-HourOffset': '6',
'Pf-ResultWish': 'date(agenda(party(cost_door,cost_presale,sold_out,name,stamp,duration_secs,genre(name),area(lineup(time_start,time_end,artist(name),type)),min_age,site,visitorcounts(certain),tickets(type,domain,data),cancelled,flyer(id,size=thumb,link),location(name,address,zipcode,latitude,longitude,site,email,phone,city(name,country(id=1))))))'
};
partyflockInstance.date.lookup('20151012', headers).then(function(res) {
});
Location
partyflockInstance.location.lookup('7731').then(function(res) {
});
Two locations in the same requests:
partyflockInstance.location.lookup('7731, 21').then(function(res) {
});
partyflockInstance.location.search('ziggo%').then(function(res) {
});
Alternative headers
var headers = {
'Pf-ResultWish': 'location(name,flyer(type,size=thumb,width,height,link),address,zipcode,latitude,longitude,city(name,country(name)),agenda(party(name,stamp,notime,duration_secs,genre(name),flyer(type,size=thumb,width,height,link),organization(name),area(lineup(time_start,time_end,artist(name))))))'
};
var headers = {
'Pf-ResultWish': 'location(name,address)'
};
partyflockInstance.location.lookup('7731', headers).then(function(res) {
});
var headers = {
'Pf-ResultWish': 'location(name=ziggo%,address,city(country(name)))'
};
partyflockInstance.location.search('ziggo%', headers).then(function(res) {
});
Party
partyflockInstance.party.search('unlocked').then(function(res) {
})
Alternative headers
var headers = {
'Pf-ResultWish': 'party(name=unlocked,stamp<'+moment.utc().unix()+')'
};
var headers = {
'Pf-Latitude': '52.1080891',
'Pf-Longitude': '4.2730927',
'Pf-Radius': '10',
'Pf-ResultWish': 'party(name,location(name,locationtype=%beach%),stamp>'+moment.utc().unix()+',duration_secs,lineup(artist(name)))'
};
partyflockInstance.party.search('unlocked', headers).then(function(res) {
});
User
partyflockInstance.user.lookup('2269').then(function(res) {
});