losant-rest
Advanced tools
Comparing version 1.4.3 to 1.4.9
@@ -12,2 +12,3 @@ # Application Actions | ||
* [Patch](#patch) | ||
* [Payload Counts](#payload-counts) | ||
@@ -141,1 +142,45 @@ <br/> | ||
| 404 | [Error](_schemas.md#error) | Error if application was not found | | ||
<br/> | ||
## Payload Counts | ||
Returns payload counts for the time range specified for this application | ||
```javascript | ||
var params = { | ||
applicationId: myApplicationId | ||
}; | ||
// with callbacks | ||
client.application.payloadCounts(params, function (err, result) { | ||
if (err) { return console.error(err); } | ||
console.log(result); | ||
}); | ||
// with promises | ||
client.application.payloadCounts(params) | ||
.then(console.log) | ||
.catch(console.error); | ||
``` | ||
#### Available Parameters | ||
| Name | Type | Required | Description | Default | Example | | ||
| ---- | ---- | -------- | ----------- | ------- | ------- | | ||
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 | | ||
| start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 | | ||
| end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 | | ||
#### Successful Responses | ||
| Code | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| 200 | [Payload Counts](_schemas.md#payload-counts) | Payload counts, by type and source | | ||
#### Error Responses | ||
| Code | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| 400 | [Error](_schemas.md#error) | Error if malformed request | | ||
| 404 | [Error](_schemas.md#error) | Error if application was not found | |
@@ -461,3 +461,3 @@ # Device Actions | ||
| deviceId | string | Y | ID associated with the device | | 575ecf887ae143cd83dc4aa2 | | ||
| deviceState | [Device State](_schemas.md#device-state) | Y | Object containing the current state of the device | | [Device State Example](_schemas.md#device-state-example) | | ||
| deviceState | [Single or Multiple Device States](_schemas.md#single-or-multiple-device-states) | Y | A single device state object, or an array of device state objects | | [Single or Multiple Device States Example](_schemas.md#single-or-multiple-device-states-example) | | ||
@@ -464,0 +464,0 @@ #### Successful Responses |
@@ -109,3 +109,3 @@ # Events Actions | ||
Updates information for matching events by subject and/or current state | ||
Asynchronously updates information for matching events by subject and/or current state | ||
@@ -144,3 +144,3 @@ ```javascript | ||
| ---- | ---- | ----------- | | ||
| 200 | [Success](_schemas.md#success) | If updates were successfully applied | | ||
| 200 | [Success](_schemas.md#success) | If the bulk update has been successfully started | | ||
@@ -147,0 +147,0 @@ #### Error Responses |
@@ -18,2 +18,3 @@ # Me Actions | ||
* [Patch](#patch) | ||
* [Payload Counts](#payload-counts) | ||
* [Verify Email](#verify-email) | ||
@@ -382,2 +383,43 @@ | ||
## Payload Counts | ||
Returns payload counts for the time range specified for all applications the current user owns | ||
```javascript | ||
var params = {}; // all params are optional | ||
// with callbacks | ||
client.me.payloadCounts(params, function (err, result) { | ||
if (err) { return console.error(err); } | ||
console.log(result); | ||
}); | ||
// with promises | ||
client.me.payloadCounts(params) | ||
.then(console.log) | ||
.catch(console.error); | ||
``` | ||
#### Available Parameters | ||
| Name | Type | Required | Description | Default | Example | | ||
| ---- | ---- | -------- | ----------- | ------- | ------- | | ||
| start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 | | ||
| end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 | | ||
#### Successful Responses | ||
| Code | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| 200 | [Payload Counts](_schemas.md#payload-counts) | Payload counts, by type and source | | ||
#### Error Responses | ||
| Code | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| 400 | [Error](_schemas.md#error) | Error if malformed request | | ||
| 404 | [Error](_schemas.md#error) | Error if application was not found | | ||
<br/> | ||
## Verify Email | ||
@@ -384,0 +426,0 @@ |
@@ -14,2 +14,3 @@ # Org Actions | ||
* [Patch](#patch) | ||
* [Payload Counts](#payload-counts) | ||
* [Pending Invites](#pending-invites) | ||
@@ -237,2 +238,46 @@ * [Remove Member](#remove-member) | ||
## Payload Counts | ||
Returns payload counts for the time range specified for all applications this organization owns | ||
```javascript | ||
var params = { | ||
orgId: myOrgId | ||
}; | ||
// with callbacks | ||
client.org.payloadCounts(params, function (err, result) { | ||
if (err) { return console.error(err); } | ||
console.log(result); | ||
}); | ||
// with promises | ||
client.org.payloadCounts(params) | ||
.then(console.log) | ||
.catch(console.error); | ||
``` | ||
#### Available Parameters | ||
| Name | Type | Required | Description | Default | Example | | ||
| ---- | ---- | -------- | ----------- | ------- | ------- | | ||
| orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 | | ||
| start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 | | ||
| end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 | | ||
#### Successful Responses | ||
| Code | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| 200 | [Payload Counts](_schemas.md#payload-counts) | Payload counts, by type and source | | ||
#### Error Responses | ||
| Code | Type | Description | | ||
| ---- | ---- | ----------- | | ||
| 400 | [Error](_schemas.md#error) | Error if malformed request | | ||
| 404 | [Error](_schemas.md#error) | Error if application was not found | | ||
<br/> | ||
## Pending Invites | ||
@@ -239,0 +284,0 @@ |
@@ -139,3 +139,50 @@ var uriTemplate = require('uri-template'); | ||
/** | ||
* Returns payload counts for the time range specified for this application | ||
* | ||
* Parameters: | ||
* {string} applicationId - ID of the associated application | ||
* {string} start - Start of range for payload count query (ms since epoch) | ||
* {string} end - End of range for payload count query (ms since epoch) | ||
* {string} losantdomain - Domain scope of request (rarely needed) | ||
* {boolean} _actions - Return resource actions in response | ||
* {boolean} _links - Return resource link in response | ||
* {boolean} _embedded - Return embedded resources in response | ||
* | ||
* Responses: | ||
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadCounts) | ||
* | ||
* Errors: | ||
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error) | ||
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error) | ||
*/ | ||
internals.payloadCounts = function (params, opts, cb) { | ||
if ('function' === typeof params) { | ||
cb = params; | ||
params = {}; | ||
opts = {}; | ||
} else if ('function' === typeof opts) { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
params = params || {}; | ||
var tpl = uriTemplate.parse('/applications/{applicationId}/payloadCounts'); | ||
var pathParams = {}; | ||
var req = { | ||
method: 'GET', | ||
headers: {}, | ||
params: { _actions: false, _links: true, _embedded: true } | ||
}; | ||
if ('undefined' !== typeof params.applicationId) { pathParams.applicationId = params.applicationId; } | ||
if ('undefined' !== typeof params.start) { req.params.start = params.start; } | ||
if ('undefined' !== typeof params.end) { req.params.end = params.end; } | ||
if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; } | ||
if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; } | ||
if ('undefined' !== typeof params._links) { req.params._links = params._links; } | ||
if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; } | ||
req.url = tpl.expand(pathParams); | ||
return client.request(req, opts, cb); | ||
}; | ||
return internals; | ||
}; |
@@ -446,3 +446,3 @@ var uriTemplate = require('uri-template'); | ||
* {string} deviceId - ID associated with the device | ||
* {hash} deviceState - Object containing the current state of the device (https://api.losant.com/#/definitions/deviceState) | ||
* {hash} deviceState - A single device state object, or an array of device state objects (https://api.losant.com/#/definitions/deviceStateOrStates) | ||
* {string} losantdomain - Domain scope of request (rarely needed) | ||
@@ -449,0 +449,0 @@ * {boolean} _actions - Return resource actions in response |
@@ -108,3 +108,3 @@ var uriTemplate = require('uri-template'); | ||
/** | ||
* Updates information for matching events by subject and/or current state | ||
* Asynchronously updates information for matching events by subject and/or current state | ||
* | ||
@@ -123,3 +123,3 @@ * Parameters: | ||
* Responses: | ||
* 200 - If updates were successfully applied (https://api.losant.com/#/definitions/success) | ||
* 200 - If the bulk update has been successfully started (https://api.losant.com/#/definitions/success) | ||
* | ||
@@ -126,0 +126,0 @@ * Errors: |
@@ -7,3 +7,3 @@ var axios = require('axios'); | ||
* User API for accessing Losant data | ||
* version: 1.4.3 | ||
* version: 1.4.9 | ||
*/ | ||
@@ -54,3 +54,3 @@ module.exports = function (options) { | ||
Accept: 'application/json', | ||
'Accept-Version': '^1.4.3' | ||
'Accept-Version': '^1.4.9' | ||
}); | ||
@@ -57,0 +57,0 @@ if (opts.accessToken) { |
@@ -389,2 +389,47 @@ var uriTemplate = require('uri-template'); | ||
/** | ||
* Returns payload counts for the time range specified for all applications the current user owns | ||
* | ||
* Parameters: | ||
* {string} start - Start of range for payload count query (ms since epoch) | ||
* {string} end - End of range for payload count query (ms since epoch) | ||
* {string} losantdomain - Domain scope of request (rarely needed) | ||
* {boolean} _actions - Return resource actions in response | ||
* {boolean} _links - Return resource link in response | ||
* {boolean} _embedded - Return embedded resources in response | ||
* | ||
* Responses: | ||
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadCounts) | ||
* | ||
* Errors: | ||
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error) | ||
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error) | ||
*/ | ||
internals.payloadCounts = function (params, opts, cb) { | ||
if ('function' === typeof params) { | ||
cb = params; | ||
params = {}; | ||
opts = {}; | ||
} else if ('function' === typeof opts) { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
params = params || {}; | ||
var tpl = uriTemplate.parse('/me/payloadCounts'); | ||
var pathParams = {}; | ||
var req = { | ||
method: 'GET', | ||
headers: {}, | ||
params: { _actions: false, _links: true, _embedded: true } | ||
}; | ||
if ('undefined' !== typeof params.start) { req.params.start = params.start; } | ||
if ('undefined' !== typeof params.end) { req.params.end = params.end; } | ||
if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; } | ||
if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; } | ||
if ('undefined' !== typeof params._links) { req.params._links = params._links; } | ||
if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; } | ||
req.url = tpl.expand(pathParams); | ||
return client.request(req, opts, cb); | ||
}; | ||
/** | ||
* Sends an email verification to the user | ||
@@ -391,0 +436,0 @@ * |
@@ -232,2 +232,49 @@ var uriTemplate = require('uri-template'); | ||
/** | ||
* Returns payload counts for the time range specified for all applications this organization owns | ||
* | ||
* Parameters: | ||
* {string} orgId - ID associated with the organization | ||
* {string} start - Start of range for payload count query (ms since epoch) | ||
* {string} end - End of range for payload count query (ms since epoch) | ||
* {string} losantdomain - Domain scope of request (rarely needed) | ||
* {boolean} _actions - Return resource actions in response | ||
* {boolean} _links - Return resource link in response | ||
* {boolean} _embedded - Return embedded resources in response | ||
* | ||
* Responses: | ||
* 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadCounts) | ||
* | ||
* Errors: | ||
* 400 - Error if malformed request (https://api.losant.com/#/definitions/error) | ||
* 404 - Error if application was not found (https://api.losant.com/#/definitions/error) | ||
*/ | ||
internals.payloadCounts = function (params, opts, cb) { | ||
if ('function' === typeof params) { | ||
cb = params; | ||
params = {}; | ||
opts = {}; | ||
} else if ('function' === typeof opts) { | ||
cb = opts; | ||
opts = {}; | ||
} | ||
params = params || {}; | ||
var tpl = uriTemplate.parse('/orgs/{orgId}/payloadCounts'); | ||
var pathParams = {}; | ||
var req = { | ||
method: 'GET', | ||
headers: {}, | ||
params: { _actions: false, _links: true, _embedded: true } | ||
}; | ||
if ('undefined' !== typeof params.orgId) { pathParams.orgId = params.orgId; } | ||
if ('undefined' !== typeof params.start) { req.params.start = params.start; } | ||
if ('undefined' !== typeof params.end) { req.params.end = params.end; } | ||
if ('undefined' !== typeof params.losantdomain) { req.headers.losantdomain = params.losantdomain; } | ||
if ('undefined' !== typeof params._actions) { req.params._actions = params._actions; } | ||
if ('undefined' !== typeof params._links) { req.params._links = params._links; } | ||
if ('undefined' !== typeof params._embedded) { req.params._embedded = params._embedded; } | ||
req.url = tpl.expand(pathParams); | ||
return client.request(req, opts, cb); | ||
}; | ||
/** | ||
* Gets the current pending invites | ||
@@ -234,0 +281,0 @@ * |
@@ -79,4 +79,22 @@ { | ||
}, | ||
"applicationkey": { | ||
"type": "number" | ||
}, | ||
"dashboard": { | ||
"type": "number" | ||
}, | ||
"device": { | ||
"type": "number" | ||
}, | ||
"devicerecipe": { | ||
"type": "number" | ||
}, | ||
"flow": { | ||
"type": "number" | ||
}, | ||
"webhook": { | ||
"type": "number" | ||
}, | ||
"dataTTL": { | ||
"type": "number" | ||
} | ||
@@ -158,3 +176,2 @@ }, | ||
}, | ||
"defaults": {}, | ||
"summary": { | ||
@@ -171,2 +188,20 @@ "type": "object", | ||
"type": "number" | ||
}, | ||
"deviceCount": { | ||
"type": "number" | ||
}, | ||
"flowCount": { | ||
"type": "number" | ||
}, | ||
"webhookCount": { | ||
"type": "number" | ||
}, | ||
"keyCount": { | ||
"type": "number" | ||
}, | ||
"eventCount": { | ||
"type": "number" | ||
}, | ||
"deviceRecipeCount": { | ||
"type": "number" | ||
} | ||
@@ -173,0 +208,0 @@ } |
@@ -72,2 +72,31 @@ { | ||
}, | ||
"limits": { | ||
"application": { | ||
"type": "number" | ||
}, | ||
"applicationkey": { | ||
"type": "number" | ||
}, | ||
"dashboard": { | ||
"type": "number" | ||
}, | ||
"device": { | ||
"type": "number" | ||
}, | ||
"devicerecipe": { | ||
"type": "number" | ||
}, | ||
"flow": { | ||
"type": "number" | ||
}, | ||
"solution": { | ||
"type": "number" | ||
}, | ||
"webhook": { | ||
"type": "number" | ||
}, | ||
"dataTTL": { | ||
"type": "number" | ||
} | ||
}, | ||
"summary": { | ||
@@ -81,2 +110,23 @@ "type": "object", | ||
"type": "number" | ||
}, | ||
"solutionCount": { | ||
"type": "number" | ||
}, | ||
"deviceCount": { | ||
"type": "number" | ||
}, | ||
"flowCount": { | ||
"type": "number" | ||
}, | ||
"webhookCount": { | ||
"type": "number" | ||
}, | ||
"keyCount": { | ||
"type": "number" | ||
}, | ||
"eventCount": { | ||
"type": "number" | ||
}, | ||
"deviceRecipeCount": { | ||
"type": "number" | ||
} | ||
@@ -83,0 +133,0 @@ } |
@@ -79,2 +79,31 @@ { | ||
}, | ||
"limits": { | ||
"application": { | ||
"type": "number" | ||
}, | ||
"applicationkey": { | ||
"type": "number" | ||
}, | ||
"dashboard": { | ||
"type": "number" | ||
}, | ||
"device": { | ||
"type": "number" | ||
}, | ||
"devicerecipe": { | ||
"type": "number" | ||
}, | ||
"flow": { | ||
"type": "number" | ||
}, | ||
"solution": { | ||
"type": "number" | ||
}, | ||
"webhook": { | ||
"type": "number" | ||
}, | ||
"dataTTL": { | ||
"type": "number" | ||
} | ||
}, | ||
"summary": { | ||
@@ -88,2 +117,23 @@ "type": "object", | ||
"type": "number" | ||
}, | ||
"solutionCount": { | ||
"type": "number" | ||
}, | ||
"deviceCount": { | ||
"type": "number" | ||
}, | ||
"flowCount": { | ||
"type": "number" | ||
}, | ||
"webhookCount": { | ||
"type": "number" | ||
}, | ||
"keyCount": { | ||
"type": "number" | ||
}, | ||
"eventCount": { | ||
"type": "number" | ||
}, | ||
"deviceRecipeCount": { | ||
"type": "number" | ||
} | ||
@@ -90,0 +140,0 @@ } |
{ | ||
"name": "losant-rest", | ||
"version": "1.4.3", | ||
"version": "1.4.9", | ||
"description": "REST client for accessing the Losant API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -28,3 +28,3 @@ # Losant Javascript REST API Client | ||
Below is a high-level example of using the Losant Ruby REST API client to | ||
Below is a high-level example of using the Losant JavaScript REST API client to | ||
authenticate against the Losant Platform and report state for a device. | ||
@@ -31,0 +31,0 @@ |
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
695130
155
10320
0