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 = ; var partyflockInstance = consumerKey consumerSecret endpoint /* optional */ debug /* optional */
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 = ;
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
partyflockInstanceartist;
partyflockInstance.artist.search
partyflockInstanceartist;
Date
partyflockInstancedate;
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))))))'; // alternativelyvar headers = 'Pf-HourOffset': '6' 'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(certain(user(id))))))'; // alternativelyvar headers = 'Pf-HourOffset': '6' 'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(user(id)))))'; // alternativelyvar headers = 'Pf-HourOffset': '6' 'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(maybe(user(id))))))'; // alternativelyvar headers = 'Pf-HourOffset': '6' 'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitors(maybe(user(id)),certain(user(id))))))'; // alternativelyvar 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))))))'; // alternativelyvar 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))))))'; // alternatively, single date, limit to max distance of 50 km to amsterdamvar 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))))))'; // alternatively, visitor countsvar headers = 'Pf-HourOffset': '6' 'Pf-ResultWish': 'date(agenda(party(name,stamp,location(name),visitorcounts(maybe,certain))))'; // alternatively, ticketsvar 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))))))'; partyflockInstancedate;
Location
partyflockInstancelocation;
Two locations in the same requests:
partyflockInstancelocation;
partyflockInstancelocation;
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))))))'; // alternativelyvar headers = 'Pf-ResultWish': 'location(name,address)'; partyflockInstancelocation; // when sending custom headers for search, don't forget to add your search parameter (ziggo%)var headers = 'Pf-ResultWish': 'location(name=ziggo%,address,city(country(name)))'; partyflockInstancelocation;
Party
partyflockInstanceparty
Alternative headers
// when sending custom headers for search, don't forget to add your search parameter (unlocked)var headers = 'Pf-ResultWish': 'party(name=unlocked,stamp<'+moment+')'; // alternativelyvar headers = 'Pf-Latitude': '52.1080891' 'Pf-Longitude': '4.2730927' 'Pf-Radius': '10' 'Pf-ResultWish': 'party(name,location(name,locationtype=%beach%),stamp>'+moment+',duration_secs,lineup(artist(name)))'; partyflockInstanceparty;
User
partyflockInstanceuser;