Code Monkey home page Code Monkey logo

onfleet.js's Introduction

Onfleet API for Node.js

Getting Started

npm install https://github.com/CityPantry/onfleet.js/tarball/v3.0.0
var Onfleet = require('onfleet');
var onfleet = new Onfleet('<your api key>', 'https://onfleet.com/api/v2')

Documentation

Workers

Get worker by id:

onfleet.workers.get('<worker id>')
    .then(worker => {...})
    .catch(...);

Get all workers:

onfleet.workers.all()
    .then(workers => {...})
    .catch(...);

Tasks

Get task by id:

onfleet.tasks.get('<task id>')
    .then(task => {...})
    .catch(...);

Get all tasks: Note: lastId is used for pagination. It is null when the last page of data has been fetched

onfleet.tasks.all(from, to=null, lastId=null)
    .then(result => {
        var lastId = result.lastId;
        var tasks = result.tasks;
        ...
    })
    .catch(...);

Get task by short id:

onfleet.workers.byShortId('<task short id>')
    .then(task => {...})
    .catch(...);

Get all tasks on certain day:

onfleet.workers.onDay(moment())
    .then(tasks => {...})
    .catch(...);

Get all today's tasks:

onfleet.workers.today()
    .then(tasks => {...})
    .catch(...);

Webhooks

Get all webhooks:

onfleet.webhooks.all()
    .then(tasks => {...})
    .catch(...);

Create webhook:

onfleet.webhooks.create('<webhook url>', triggerId, threshold=null)
    .then(() => {...})
    .catch(...);

Delete webhook:

onfleet.webhooks.delete('<webhook id>')
    .then(() => {...})
    .catch(...);

Onfleet API docs

http://docs.onfleet.com/v2.0/docs/introduction

onfleet.js's People

Contributors

julianstier avatar stefda avatar davidwneary avatar

Stargazers

Olivier JM Maniraho avatar Michael Lungu avatar  avatar

Watchers

Ben Cross avatar Jak S avatar  avatar Al Stuart avatar Andrew Williams avatar James Cloos avatar Rhys Streefland avatar  avatar  avatar Adriano di Lauro avatar Lewis Wilcock avatar Mag Leahy - Agile Team Creator & Coaching Lead avatar Rhys Devine-Davies avatar Jacopo Lanzoni avatar  avatar Elliot Lewis avatar Ed Hathaway avatar Will Edmondson avatar Ade avatar  avatar Rafael Murad avatar Randeep Matharu avatar

Forkers

julianstier

onfleet.js's Issues

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.