Giter Club home page Giter Club logo

sdk-js-1's Introduction

PredictHQ API Client for Javascript

Version Build Status Coverage Status FOSSA Status

PredictHQ is a global events intelligence platform that aggregates, enriches and connects scheduled and real-time event data happening both locally and globally, then predicts which ones could impact your business.

Installation

npm install predicthq

Usage

var phq = require('predicthq')
 
client = new phq.Client({access_token: "ACCESS_TOKEN"})

client.events.search({q: 'Madonna', rank_level: 5, country:'AU', 'start.gte' : '2016-01-01'})
    .then(function(results){
        var events = results.toArray()
        for(var i=0; i < events.length; i++)
            console.info(events[i].rank, events[i].category, events[i].title, events[i].start, events[i].location )
    })

88 'concerts' 'Madonna' '2016-03-27T10:00:00Z' [ 153.073, -27.3431 ]
88 'concerts' 'Madonna' '2016-03-26T10:00:00Z' [ 153.073, -27.3431 ]
88 'concerts' 'Madonna' '2016-03-16T17:30:00Z' [ 153.073, -27.3431 ]
88 'concerts' 'Madonna' '2016-03-16T10:00:00Z' [ 153.073, -27.3431 ]
89 'concerts' 'Madonna' '2016-03-12T09:00:00Z' [ 144.978, -37.8218 ]

ES6 Usage

import Client from 'predicthq'

let client = new Client({access_token="ACCESS_TOKEN"})

client.events.search({'within': '[email protected],-71.06009', 'start.gte': '2016-03-08', 'start.lt': '2016-03-09'})
    .then((results)=>{
        for (let event of results)
            console.info(event.title)
    })

NodeJS

You will need to bring your own fetch library

// npm install node-fetch
global.fetch = require('node-fetch') 
var phq = require('predicthq')
var client = new phq.Client({access_token: "ACCESS_TOKEN"})

// or
var fetch = require('node-fetch')
var phq = require('predicthq')
var client = new phq.Client({access_token: "ACCESS_TOKEN", fetch: fetch})

Endpoints

  • events
  • accounts
  • places

For a description of all available endpoints, refer to our API Documentation.

License

FOSSA Status

sdk-js-1's People

Contributors

fossabot avatar hampsterx avatar robertkern avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.