@onfleet/node-onfleet
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -45,3 +45,3 @@ class ValidationError extends Error { | ||
super(message, status, cause, request); | ||
this.name = 'RateLimitError'; | ||
this.name = 'ServiceError'; | ||
this.message = message; | ||
@@ -48,0 +48,0 @@ this.status = status; |
@@ -108,3 +108,3 @@ const fetch = require('node-fetch'); | ||
}).catch((error) => { | ||
throw new Error(error); | ||
throw (error); | ||
}); | ||
@@ -111,0 +111,0 @@ }; |
{ | ||
"name": "@onfleet/node-onfleet", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Official client library for accessing the Onfleet API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,12 +27,12 @@ # Onfleet Node.js Wrapper | ||
- [Requêtes GET](#requêtes-get) | ||
* [Exemples de get()](#exemples-de-get---) | ||
* [Exemples de get(param)](#exemples-de-get-param-) | ||
* [Exemples de get()](#exemples-de-get) | ||
* [Exemples de get(param)](#exemples-de-get-param) | ||
* [Exemples de getByLocation](#exemples-de-getbylocation) | ||
- [Requêtes POST](#requêtes-post) | ||
* [Exemples de create()](#exemples-de-create---) | ||
* [Exemples de create()](#exemples-de-create) | ||
- [Demandes PUT](#demandes-put) | ||
* [Exemples de update()](#exemples-de-update---) | ||
* [Exemples de insertTask()](#exemples-de-inserttask--) | ||
* [Exemples de update()](#exemples-de-update) | ||
* [Exemples de insertTask()](#exemples-de-inserttask) | ||
- [DELETE Demandes](#delete-demandes) | ||
* [Exemples de deleteOne()](#exemples-de-deleteone---) | ||
* [Exemples de deleteOne()](#exemples-de-deleteone) | ||
+ [Exemples d'utilisation de vos opérations CRUD](#exemples-d-utilisation-de-vos-opérations-crud) | ||
@@ -51,2 +51,10 @@ + [Choses à ne pas faire](#choses-à-ne-pas-faire) | ||
Pour TypeScript, installez la [typed definition](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/onfleet__node-onfleet): | ||
``` | ||
npm install @types/onfleet__node-onfleet | ||
``` | ||
(Bravo à @marcobeltempo pour la contribution!) | ||
## Utilisation | ||
@@ -71,3 +79,3 @@ Avant d'utiliser le wrapper de l'API, vous devez vous procurer une clé API auprès de votre administrateur d'organisation. La création et l'intégration des clés API sont effectuées via le [tableau de bord Onfleet](https://onfleet.com/dashboard#/manage). | ||
### étranglement | ||
La limitation de débit est appliquée par l'API avec un seuil de 20 demandes par seconde pour toutes les clés d'API de votre organisation. Pour en savoir plus, [cliquez ici](http://docs.onfleet.com/docs/throttling). | ||
La limitation de débit est appliquée par l'API avec un seuil de 20 demandes par seconde pour toutes les clés d'API de votre organisation. Pour en savoir plus, [cliquez ici](https://docs.onfleet.com/reference#throttling). | ||
@@ -82,12 +90,12 @@ ### Réponses | ||
|:------------:|:---------------------------------------------------:|:----------------------------------------------------------------------:|:------------------------------------:|:-------------:| | ||
| [Admins](http://docs.onfleet.com/docs/administrators) | get() | create(obj) | update(id, obj) | deleteOne(id) | | ||
| [Containers](http://docs.onfleet.com/docs/containers) | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x | | ||
| [Destinations](http://docs.onfleet.com/docs/destinations) | get(id) | create(obj) | x | x | | ||
| [Hubs](http://docs.onfleet.com/docs/hubs) | get() | x | x | x | | ||
| [Organization](http://docs.onfleet.com/docs/organizations) | get(), get(id) | x | insertTask(id, obj) | x | | ||
| [Recipients](http://docs.onfleet.com/docs/recipients) | get(id), get(name, 'name'), get(phone, 'phone') | create(obj) | update(id, obj) | x | | ||
| [Tasks](http://docs.onfleet.com/docs/tasks) | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj) | update(id, obj) | deleteOne(id) | | ||
| [Teams](http://docs.onfleet.com/docs/teams) | get(), get(id) | create(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Webhooks](http://docs.onfleet.com/docs/webhooks) | get() | create(obj) | x | deleteOne(id) | | ||
| [Workers](http://docs.onfleet.com/docs/workers) | get(), get(query), get(id), getByLocation(obj), getSchedule(id) | create(obj), setSchedule(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Admins](https://docs.onfleet.com/reference#administrators) | get() | create(obj) | update(id, obj) | deleteOne(id) | | ||
| [Containers](https://docs.onfleet.com/reference#containers) | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x | | ||
| [Destinations](https://docs.onfleet.com/reference#destinations) | get(id) | create(obj) | x | x | | ||
| [Hubs](https://docs.onfleet.com/reference#hubs) | get() | x | x | x | | ||
| [Organization](https://docs.onfleet.com/reference#organizations) | get(), get(id) | x | insertTask(id, obj) | x | | ||
| [Recipients](https://docs.onfleet.com/reference#recipients) | get(id), get(name, 'name'), get(phone, 'phone') | create(obj) | update(id, obj) | x | | ||
| [Tasks](https://docs.onfleet.com/reference#tasks) | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj) | update(id, obj) | deleteOne(id) | | ||
| [Teams](https://docs.onfleet.com/reference#teams) | get(), get(id) | create(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Webhooks](https://docs.onfleet.com/reference#webhooks) | get() | create(obj) | x | deleteOne(id) | | ||
| [Workers](https://docs.onfleet.com/reference#workers) | get(), get(query), get(id), getByLocation(obj), getSchedule(id) | create(obj), setSchedule(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
@@ -214,5 +222,4 @@ #### Requêtes GET | ||
Pour plus de détails, consultez notre documentation sur [clone](http://docs.onfleet.com/docs/tasks#clone-task), [forceComplete](http://docs.onfleet.com/docs/tasks#complete-task), [batchCreate](http://docs.onfleet.com/docs/tasks#create-tasks-in-batch), [autoAssign](http://docs.onfleet.com/docs/tasks#automatically-assign-list-of-tasks), [setSchedule](http://docs.onfleet.com/docs/workers#update-workers-schedule) | ||
Pour plus de détails, consultez notre documentation sur [clone](https://docs.onfleet.com/reference#clone-task), [forceComplete](https://docs.onfleet.com/reference#complete-task), [batchCreate](https://docs.onfleet.com/reference#create-tasks-in-batch), [autoAssign](https://docs.onfleet.com/reference#automatically-assign-list-of-tasks), and [setSchedule](https://docs.onfleet.com/reference#set-workers-schedule) | ||
#### Demandes PUT | ||
@@ -219,0 +226,0 @@ Pour mettre à jour un document dans un noeud final: |
@@ -26,12 +26,12 @@ # Onfleet Node.js Wrapper | ||
- [GET Requests](#get-requests) | ||
* [Examples of get()](#examples-of-get--) | ||
* [Examples of get(param)](#examples-of-get-param-) | ||
* [Examples of get()](#examples-of-get) | ||
* [Examples of get(param)](#examples-of-get-param) | ||
* [Examples of getByLocation](#examples-of-getbylocation) | ||
- [POST Requests](#post-requests) | ||
* [Examples of create()](#examples-of-create--) | ||
* [Examples of create()](#examples-of-create) | ||
- [PUT Requests](#put-requests) | ||
* [Examples of update()](#examples-of-update--) | ||
* [Examples of insertTask()](#examples-of-inserttask--) | ||
* [Examples of update()](#examples-of-update) | ||
* [Examples of insertTask()](#examples-of-inserttask) | ||
- [DELETE Requests](#delete-requests) | ||
* [Examples of deleteOne()](#examples-of-deleteone--) | ||
* [Examples of deleteOne()](#examples-of-deleteone) | ||
+ [Examples of utilizing your CRUD operations](#examples-of-utilizing-your-crud-operations) | ||
@@ -50,2 +50,10 @@ + [Things NOT to do](#things-not-to-do) | ||
For TypeScript, install the [typed definition](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/onfleet__node-onfleet): | ||
``` | ||
npm install @types/onfleet__node-onfleet | ||
``` | ||
(Kudos to @marcobeltempo for the contribution!) | ||
## Usage | ||
@@ -64,3 +72,3 @@ Before using the API wrapper, you will need to obtain an API key from your organization admin. Creation and integration of API keys are performed through the [Onfleet dashboard](https://onfleet.com/dashboard#/manage). | ||
Once the Onfleet object is created, you will get access to all the API endpoints as documented in the [Onfleet API documentation](http://docs.onfleet.com/). Here are some usage case: | ||
Once the Onfleet object is created, you will get access to all the API endpoints as documented in the [Onfleet API documentation](https://docs.onfleet.com/). Here are some usage case: | ||
@@ -71,3 +79,3 @@ ### Unit Testing | ||
### Throttling | ||
Rate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys, learn more about it [here](http://docs.onfleet.com/docs/throttling). | ||
Rate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys, learn more about it [here](https://docs.onfleet.com/reference#throttling). | ||
@@ -83,12 +91,12 @@ ### Responses | ||
|:------------:|:---------------------------------------------------:|:----------------------------------------------------------------------:|:------------------------------------:|:-------------:| | ||
| [Admins](http://docs.onfleet.com/docs/administrators) | get() | create(obj) | update(id, obj) | deleteOne(id) | | ||
| [Containers](http://docs.onfleet.com/docs/containers) | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x | | ||
| [Destinations](http://docs.onfleet.com/docs/destinations) | get(id) | create(obj) | x | x | | ||
| [Hubs](http://docs.onfleet.com/docs/hubs) | get() | x | x | x | | ||
| [Organization](http://docs.onfleet.com/docs/organizations) | get(), get(id) | x | insertTask(id, obj) | x | | ||
| [Recipients](http://docs.onfleet.com/docs/recipients) | get(id), get(name, 'name'), get(phone, 'phone') | create(obj) | update(id, obj) | x | | ||
| [Tasks](http://docs.onfleet.com/docs/tasks) | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj) | update(id, obj) | deleteOne(id) | | ||
| [Teams](http://docs.onfleet.com/docs/teams) | get(), get(id) | create(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Webhooks](http://docs.onfleet.com/docs/webhooks) | get() | create(obj) | x | deleteOne(id) | | ||
| [Workers](http://docs.onfleet.com/docs/workers) | get(), get(query), get(id), getByLocation(obj), getSchedule(id) | create(obj), setSchedule(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Admins](https://docs.onfleet.com/reference#administrators) | get() | create(obj) | update(id, obj) | deleteOne(id) | | ||
| [Containers](https://docs.onfleet.com/reference#containers) | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x | | ||
| [Destinations](https://docs.onfleet.com/reference#destinations) | get(id) | create(obj) | x | x | | ||
| [Hubs](https://docs.onfleet.com/reference#hubs) | get() | x | x | x | | ||
| [Organization](https://docs.onfleet.com/reference#organizations) | get(), get(id) | x | insertTask(id, obj) | x | | ||
| [Recipients](https://docs.onfleet.com/reference#recipients) | get(id), get(name, 'name'), get(phone, 'phone') | create(obj) | update(id, obj) | x | | ||
| [Tasks](https://docs.onfleet.com/reference#tasks) | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj) | update(id, obj) | deleteOne(id) | | ||
| [Teams](https://docs.onfleet.com/reference#teams) | get(), get(id) | create(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Webhooks](https://docs.onfleet.com/reference#webhooks) | get() | create(obj) | x | deleteOne(id) | | ||
| [Workers](https://docs.onfleet.com/reference#workers) | get(), get(query), get(id), getByLocation(obj), getSchedule(id) | create(obj), setSchedule(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
@@ -218,3 +226,3 @@ #### GET Requests | ||
``` | ||
For more details, check our documentation on [clone](http://docs.onfleet.com/docs/tasks#clone-task), [forceComplete](http://docs.onfleet.com/docs/tasks#complete-task), [batchCreate](http://docs.onfleet.com/docs/tasks#create-tasks-in-batch), [autoAssign](http://docs.onfleet.com/docs/tasks#automatically-assign-list-of-tasks), and [setSchedule](http://docs.onfleet.com/docs/workers#update-workers-schedule) | ||
For more details, check our documentation on [clone](https://docs.onfleet.com/reference#clone-task), [forceComplete](https://docs.onfleet.com/reference#complete-task), [batchCreate](https://docs.onfleet.com/reference#create-tasks-in-batch), [autoAssign](https://docs.onfleet.com/reference#automatically-assign-list-of-tasks), and [setSchedule](https://docs.onfleet.com/reference#set-workers-schedule) | ||
@@ -291,2 +299,2 @@ #### PUT Requests | ||
}); | ||
``` | ||
``` |
@@ -49,2 +49,11 @@ # Onfleet Node.js Wrapper | ||
``` | ||
若是使用`TypeScript`,則需另外安裝[typed definition](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/onfleet__node-onfleet): | ||
``` | ||
npm install @types/onfleet__node-onfleet | ||
``` | ||
(感謝 @marcobeltempo 的開源贊助) | ||
我們選用了`node-fetch`當作我們HTTP請求的工具,它使用了原生的Fetch API,支援promise,跟其他工具組相比依賴性上也較低。 | ||
@@ -71,3 +80,3 @@ | ||
### API速限 | ||
原則上API的速限為每秒鐘20次請求,詳情請參考[官方文件](http://docs.onfleet.com/docs/throttling) | ||
原則上API的速限為每秒鐘20次請求,詳情請參考[官方文件](https://docs.onfleet.com/reference#throttling) | ||
@@ -82,12 +91,12 @@ ### 請求回應 | ||
|:------------:|:---------------------------------------------------:|:----------------------------------------------------------------------:|:------------------------------------:|:-------------:| | ||
| [Admins](http://docs.onfleet.com/docs/administrators) | get() | create(obj) | update(id, obj) | deleteOne(id) | | ||
| [Containers](http://docs.onfleet.com/docs/containers) | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x | | ||
| [Destinations](http://docs.onfleet.com/docs/destinations) | get(id) | create(obj) | x | x | | ||
| [Hubs](http://docs.onfleet.com/docs/hubs) | get() | x | x | x | | ||
| [Organization](http://docs.onfleet.com/docs/organizations) | get(), get(id) | x | insertTask(id, obj) | x | | ||
| [Recipients](http://docs.onfleet.com/docs/recipients) | get(id), get(name, 'name'), get(phone, 'phone') | create(obj) | update(id, obj) | x | | ||
| [Tasks](http://docs.onfleet.com/docs/tasks) | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj) | update(id, obj) | deleteOne(id) | | ||
| [Teams](http://docs.onfleet.com/docs/teams) | get(), get(id) | create(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Webhooks](http://docs.onfleet.com/docs/webhooks) | get() | create(obj) | x | deleteOne(id) | | ||
| [Workers](http://docs.onfleet.com/docs/workers) | get(), get(query), get(id), getByLocation(obj), getSchedule(id) | create(obj), setSchedule(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Admins](https://docs.onfleet.com/reference#administrators) | get() | create(obj) | update(id, obj) | deleteOne(id) | | ||
| [Containers](https://docs.onfleet.com/reference#containers) | get(id, 'workers'), get(id, 'teams'), get(id, 'organizations') | x | update(id, obj) | x | | ||
| [Destinations](https://docs.onfleet.com/reference#destinations) | get(id) | create(obj) | x | x | | ||
| [Hubs](https://docs.onfleet.com/reference#hubs) | get() | x | x | x | | ||
| [Organization](https://docs.onfleet.com/reference#organizations) | get(), get(id) | x | insertTask(id, obj) | x | | ||
| [Recipients](https://docs.onfleet.com/reference#recipients) | get(id), get(name, 'name'), get(phone, 'phone') | create(obj) | update(id, obj) | x | | ||
| [Tasks](https://docs.onfleet.com/reference#tasks) | get(query), get(id), get(shortId, 'shortId') | create(obj), clone(id), forceComplete(id), batch(obj), autoAssign(obj) | update(id, obj) | deleteOne(id) | | ||
| [Teams](https://docs.onfleet.com/reference#teams) | get(), get(id) | create(obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
| [Webhooks](https://docs.onfleet.com/reference#webhooks) | get() | create(obj) | x | deleteOne(id) | | ||
| [Workers](https://docs.onfleet.com/reference#workers) | get(), get(query), get(id), getByLocation(obj), getSchedule(id) | create(obj), setSchedule(id, obj) | update(id, obj), insertTask(id, obj) | deleteOne(id) | | ||
@@ -216,3 +225,3 @@ #### GET 請求 | ||
``` | ||
參考資料:[clone](http://docs.onfleet.com/docs/tasks#clone-task), [forceComplete](http://docs.onfleet.com/docs/tasks#complete-task), [batchCreate](http://docs.onfleet.com/docs/tasks#create-tasks-in-batch), [autoAssign](http://docs.onfleet.com/docs/tasks#automatically-assign-list-of-tasks), 以及[setSchedule](http://docs.onfleet.com/docs/workers#update-workers-schedule)。 | ||
參考資料:[clone](https://docs.onfleet.com/reference#clone-task), [forceComplete](https://docs.onfleet.com/reference#complete-task), [batchCreate](https://docs.onfleet.com/reference#create-tasks-in-batch), [autoAssign](https://docs.onfleet.com/reference#automatically-assign-list-of-tasks), 以及[setSchedule](https://docs.onfleet.com/reference#set-workers-schedule)。 | ||
@@ -288,2 +297,2 @@ #### PUT 請求 | ||
}); | ||
``` | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63712
293