8000 first commit · arduino/iot-client-js@3b19509 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b19509

Browse files
author
Massimiliano Pippi
committed
first commit
0 parents  commit 3b19509

File tree

119 files changed

+12517
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+12517
-0
lines changed

.apigentools-info

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"additional_stamps": [],
3+
"apigentools_version": "0.3.0.dev1",
4+
"codegen_version": "4.1.1",
5+
"info_version": "1",
6+
"image": null,
7+
"spec_repo_commit": "5f841e6"
8+
}

.babelrc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env"
4+
],
5+
"plugins": [
6+
"@babel/plugin-syntax-dynamic-import",
7+
"@babel/plugin-syntax-import-meta",
8+
"@babel/plugin-proposal-class-properties",
9+
"@babel/plugin-proposal-json-strings",
10+
[
11+
"@babel/plugin-proposal-decorators",
12+
{
13+
"legacy": true
14+
}
15+
],
16+
"@babel/plugin-proposal-function-sent",
17+
"@babel/plugin-proposal-export-namespace-from",
18+
"@babel/plugin-proposal-numeric-separator",
19+
"@babel/plugin-proposal-throw-expressions",
20+
"@babel/plugin-proposal-export-default-from",
21+
"@babel/plugin-proposal-logical-assignment-operators",
22+
"@babel/plugin-proposal-optional-chaining",
23+
[
24+
"@babel/plugin-proposal-pipeline-operator",
25+
{
26+
"proposal": "minimal"
27+
}
28+
],
29+
"@babel/plugin-proposal-nullish-coalescing-operator",
30+
"@babel/plugin-proposal-do-expressions",
31+
"@babel/plugin-proposal-function-bind"
32+
]
33+
}

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.1.1

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: node_js
2+
cache: npm
3+
node_js:
4+
- "6"
5+
- "6.1"

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Arduino iot-api Javscript client
2+
3+
## Installation
4+
5+
For the time being and untile we publish a package on Npm, install it via:
6+
7+
```shell
8+
npm install bcmi-labs/clients-iot-api --save
9+
```
10+
11+
### For browser
12+
13+
The library also works in the browser environment via npm and [browserify](http://browserify.org/). After following
14+
the above steps with Node.js and installing browserify with `npm install -g browserify`,
15+
perform the following (assuming *main.js* is your entry file):
16+
17+
```shell
18+
browserify main.js > bundle.js
19+
```
20+
21+
Then include *bundle.js* in the HTML pages.
22+
23+
### Webpack Configuration
24+
25+
Using Webpack you may encounter the following error: "Module not found: Error:
26+
Cannot resolve module", most certainly you should disable AMD loader. Add/merge
27+
the following section to your webpack config:
28+
29+
```javascript
30+
module: {
31+
rules: [
32+
{
33+
parser: {
34+
amd: false
35+
}
36+
}
37+
]
38+
}
39+
```
40+
41+
## Getting Started
42+
43+
Please follow the [installation](#installation) instruction and execute the following JS code:
44+
45+
```javascript
46+
47+
var IotApi = require('iot_api');
48+
49+
var client = IotApi.ApiClient.instance;
50+
// Configure OAuth2 access token for authorization: oauth2
51+
var oauth2 = client.authentications['oauth2'];
52+
oauth2.accessToken = "YOUR ACCESS TOKEN";
53+
54+
var api = new IotApi.DevicesV2Api(client)
55+
var callback = function (error, data, response) {
56+
if (error) {
57+
console.error(response.error);
58+
} else {
59+
console.log(data);
60+
}
61+
};
62+
api.devicesV2List(null, callback);
63+
```
64+
65+
For a working example, see [the example folder](./example) in this repo.
66+
67+
## Authentication
68+
69+
The client requires a valid OAuth2 access token, you can get one like this:
70+
71+
```javascript
72+
73+
var rp = require('request-promise');
74+
75+
var options = {
76+
method: 'POST',
77+
url: 'https://login.oniudra.cc/oauth/token',
78+
headers: { 'content-type': 'application/x-www-form-urlencoded' },
79+
json: true,
80+
form: {
81+
grant_type: 'client_credentials',
82+
client_id: 'yr9Tb0P4qFOI3cziKizqUFZTrUvaeL47',
83+
client_secret: 'D-P2atuyJEZpB64_vymSQQYr1MPMuZhhK0e1U3jgPGVLRBSMH5jhKaivyRybu_4I',
84+
audience: 'https://api.arduino.cc'
85+
}
86+
};
87+
88+
try {
89+
const response = await rp(options);
90+
console.log("Access token: " + response['access_token']);
91+
}
92+
catch (error) {
93+
console.error("Failed getting an access token: " + error)
94+
}
95+
```

docs/ArduinoDevicev2.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# IotApi.ArduinoDevicev2
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**createdAt** | **Date** | Creation date of the device | [optional]
8+
**href** | **String** | The api reference of this device |
9+
**id** | **String** | The arn of the device |
10+
**metadata** | **{String: Object}** | The metadata of the device | [optional]
11+
**name** | **String** | The friendly name of the device |
12+
**serial** | **String** | The serial uuid of the device |
13+
**type** | **String** | The type of the device |
14+
**userId** | **String** | The id of the user |
15+
**webhooks** | [**[ArduinoDevicev2Webhook]**](ArduinoDevicev2Webhook.md) | ArduinoDevicev2WebhookCollection is the media type for an array of ArduinoDevicev2Webhook (default view) | [optional]
16+
17+

docs/ArduinoDevicev2Webhook.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# IotApi.ArduinoDevicev2Webhook
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**active** | **Boolean** | Whether the webhook is active | [optional] [default to true]
8+
**id** | **String** | The uuid of the webhook |
9+
**uri** | **String** | The uri of the webhook |
10+
11+

docs/ArduinoDevicev2properties.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# IotApi.ArduinoDevicev2properties
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**dataRetentionDays** | **Number** | How many days the data will be kept |
8+
**deviceId** | **String** | The device of the property |
9+
**properties** | [**[ArduinoProperty]**](ArduinoProperty.md) | ArduinoPropertyCollection is the media type for an array of ArduinoProperty (default view) |
10+
**userId** | **String** | The user id of the owner |
11+
12+

docs/ArduinoDevicev2propertyvalue.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 10000 ,10 @@
1+
# IotApi.ArduinoDevicev2propertyvalue
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**createdAt** | **Date** | | [optional]
8+
**value** | [**ArduinoDevicev2propertyvalueValue**](ArduinoDevicev2propertyvalueValue.md) | | [optional]
9+
10+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# IotApi.ArduinoDevicev2propertyvalueValue
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**payload** | **String** | | [optional]
8+
**seqno** | **Number** | | [optional]
9+
**statistics** | [**ArduinoDevicev2propertyvalueValueStatistics**](ArduinoDevicev2propertyvalueValueStatistics.md) | | [optional]
10+
11+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# IotApi.ArduinoDevicev2propertyvalueValueStatistics
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**adr** | **Number** | | [optional]
8+
**channel** | **Number** | | [optional]
9+
**duplicate** | **Number** | | [optional]
10+
**freq** | **Number** | | [optional]
11+
**modBW** | **Number** | | [optional]
12+
**rssi** | **Number** | | [optional]
13+
**seqno** | **Number** | | [optional]
14+
**sf** | **Number** | | [optional]
15+
**snr** | **Number** | | [optional]
16+
**time** | **Number** | | [optional]
17+
18+

docs/ArduinoDevicev2propertyvalues.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# IotApi.ArduinoDevicev2propertyvalues
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**id** | **String** | |
8+
**lastEvaluatedKey** | [**ArduinoDevicev2propertyvaluesLastEvaluatedKey**](ArduinoDevicev2propertyvaluesLastEvaluatedKey.md) | |
9+
**name** | **String** | |
10+
**values** | [**[ArduinoDevicev2propertyvalue]**](ArduinoDevicev2propertyvalue.md) | ArduinoDevicev2propertyvalueCollection is the media type for an array of ArduinoDevicev2propertyvalue (default view) |
11+
12+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# IotApi.ArduinoDevicev2propertyvaluesLastEvaluatedKey
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**createdAt** | **Date** | | [optional]
8+
**id** | **String** | | [optional]
9+
**name** | **String** | | [optional]
10+
11+

docs/ArduinoProperty.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# IotApi.ArduinoProperty
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**createdAt** | **Date** | Creation date of the property | [optional]
8+
**deletedAt** | **Date** | Delete date of the property | [optional]
9+
**href** | **String** | The api reference of this property |
10+
**id** | **String** | The id of the property |
11+
**lastValue** | **Object** | Last value of this property | [optional]
12+
**maxValue** | **Number** | Maximum value of this property | [optional]
13+
**minValue** | **Number** | Minimum value of this property | [optional]
14+
**name** | **String** | The friendly name of the property |
15+
**permission** | **String** | The permission of the property |
16+
**persist** | **Boolean** | If true, data will persist into a timeseries database | [optional]
17+
**thingId** | **String** | The id of the thing |
18+
**type** | **String** | The type of the property |
19+
**updateParameter** | **Number** | The update frequency in seconds, or the amount of the property has to change in order to trigger an update | [optional]
20+
**updateStrategy** | **String** | The update strategy for the property value |
21+
**updatedAt** | **Date** | Update date of the property | [optional]
22+
**valueUpdatedAt** | **Date** | Last update timestamp of this property | [optional]
23+
**variableName** | **String** | The sketch variable name of the property | [optional]
24+
25+

docs/ArduinoSeriesBatch.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# IotApi.ArduinoSeriesBatch
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**responses** | [**[ArduinoSeriesResponse]**](ArduinoSeriesResponse.md) | Responses of the request |
8+
9+

docs/ArduinoSeriesRawBatch.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# IotApi.ArduinoSeriesRawBatch
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**respVersion** | **Number** | Response version |
8+
**responses** | [**[ArduinoSeriesRawResponse]**](ArduinoSeriesRawResponse.md) | Responses of the request |
9+
10+

docs/ArduinoSeriesRawResponse.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# IotApi.ArduinoSeriesRawResponse
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**countValues** | **Number** | Total number of values in the array 'values' |
8+
**fromDate** | **Date** | From date |
9+
**message** | **String** | If the response is different than 'ok' | [optional] [default to '']
10+
**query** | **String** | Query of for the data |
11+
**respVersion** | **Number** | Response version |
12+
**series** | [**BatchQueryRawResponseSeriesMediaV1**](BatchQueryRawResponseSeriesMediaV1.md) | |
13+
**seriesLimit** | **Number** | Max of values | [optional]
14+
**sort** | **String** | Sorting |
15+
**status** | **String** | Status of the response |
16+
**times** | **[Date]** | Timestamp in RFC3339 |
17+
**toDate** | **Date** | To date |
18+
**values** | **[Object]** | Values can be in Float, String, Bool, Object |
19+
20+
21+
22+
## Enum: SortEnum
23+
24+
25+
* `ASC` (value: `"ASC"`)
26+
27+
* `DESC` (value: `"DESC"`)
28+
29+
30+
31+

docs/ArduinoSeriesResponse.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# IotApi.ArduinoSeriesResponse
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**fromDate** | **Date** | From date |
8+
**interval** | **Number** | Resolution in seconds |
9+
**query** | **String** | Query of for the data |
10+
**respVersion** | **Number** | Response version |
11+
**series** | [**[BatchQueryResponseSeriesMediaV1]**](BatchQueryResponseSeriesMediaV1.md) | Series information |
12+
**status** | **String** | Status of the response |
13+
**times** | **[Date]** | Timestamp in RFC3339 |
14+
**toDate** | **Date** | To date |
15+
**values** | **[[Number]]** | Values in Float |
16+
17+

0 commit comments

Comments
 (0)
0