Skip to content

Commit 0b418ec

Browse files
authored
Merge pull request #36 from tago-io/feat/methods-device/SDKPY-115
feat/methods-device/SDKPY-115
2 parents 8704fae + 65b4ee9 commit 0b418ec

File tree

14 files changed

+481
-410
lines changed

14 files changed

+481
-410
lines changed

.flake8

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ extend-ignore =
1717
ANN101,
1818
# ANN102: Missing type annotation for cls in classmethod
1919
ANN102,
20-
E722
20+
E722,
21+
BLK100,
22+
# BLK100: Missing type annotation for public function
2123
per-file-ignores =
2224
# F401: Module imported by unused (non-implicit modules)
2325
# TC002: Move third-party import '...' into a type-checking block

README.md

+12-15
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,29 @@ If you have any questions, feel free to check our [Help Center](https://help.tag
2020
### Insert Device Data
2121

2222
```python
23-
from tagoio_sdk import Device
23+
from tagoio_sdk import Resources
2424

25-
myDevice = Device({ "token": "my_device_token" })
26-
result = myDevice.sendData({
25+
resources = Resources()
26+
resource.devices.sendDeviceData("myDeviceID", {
2727
"variable": "temperature",
2828
"unit": "F",
2929
"value": 55,
3030
"time": "2015-11-03 13:44:33",
31-
"location": { "lat": 42.2974279, "lng": -85.628292 },
31+
"location": {"lat": 42.2974279, "lng": -85.628292},
3232
})
3333
```
3434

3535
### Edit Device Data
3636

3737
```python
38-
from tagoio_sdk import Device
39-
40-
myDevice = Device({"token": "my_device_token"})
41-
result = myDevice.editData(
42-
{
43-
"id": "id_of_the_data_item",
44-
"value": "123",
45-
"time": "2022-04-01 12:34:56",
46-
"location": {"lat": 42.2974279, "lng": -85.628292},
47-
}
48-
)
38+
from tagoio_sdk import Resources
39+
40+
resources = Resource()
41+
resource.devices.editDeviceData("myDeviceID", {
42+
"id": "idOfTheRecord",
43+
"value": "new value",
44+
"unit": "new unit"
45+
})
4946
```
5047

5148
## Development Commands

docs/source/Resources/Dashboards/Dashboard_Type.rst

+8-5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ DashboardCreateInfo
2424

2525
**Attributes:**
2626

27-
| **label**: str
28-
| **arrangement**: list[Arrangement]
29-
| **tags**: list[TagsObj]
30-
| **visible**: bool
27+
**label**: str
28+
29+
**arrangement**: list[Arrangement]
30+
31+
**tags**: list[:ref:`TagsObj`]
32+
33+
**visible**: bool
3134

3235
.. _icon:
3336

@@ -137,7 +140,7 @@ WidgetResource
137140

138141
**Attributes:**
139142

140-
| **filter**: list[TagsObj]
143+
filter: list[:ref:`TagsObj`]
141144

142145
.. _DeviceResourceView:
143146

docs/source/Resources/Devices/Devices_Type.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ DeviceCreateInfoBasic
205205
| **configuration_params**: Optional[list[ConfigurationParams]]
206206
| [Optional] An array of configuration params
207207
208-
| **tags**: Optional[list[TagsObj]]
208+
| **tags**: Optional[list[:ref:`TagsObj`]]
209209
| [Optional] An array of tags
210210
211211
| **serie_number**: Optional[str]

docs/source/Resources/Devices/index.rst

+74
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,77 @@ Retrieves a list of all tokens
206206
"amount": 20,
207207
"orderBy": "created_at,desc",
208208
}
209+
210+
==========
211+
sendDeviceData
212+
==========
213+
214+
Send data to a device.
215+
216+
**Parameters:**
217+
218+
| **deviceID**: GenericID: str
219+
| Device ID
220+
221+
| **data**: Union[:ref:`DataCreate`, list[:ref:`DataCreate`]]
222+
| An array or one object with data to be send to TagoIO.
223+
224+
.. code-block::
225+
:caption: **Example:**
226+
227+
from tagoio_sdk import Resources
228+
229+
resources = Resources()
230+
resource.devices.sendDeviceData("myDeviceID", {
231+
"variable": "temperature",
232+
"unit": "F",
233+
"value": 55,
234+
"time": "2015-11-03 13:44:33",
235+
"location": { "lat": 42.2974279, "lng": -85.628292 },
236+
})
237+
238+
==========
239+
editDeviceData
240+
==========
241+
242+
Edit data in a device.
243+
244+
**Parameters:**
245+
246+
| **deviceID**: GenericID: str
247+
| Device ID
248+
249+
| **updatedData**: Union[:ref:`DataEdit`, list[:ref:`DataEdit`]]
250+
| An array or one object with data to be send to TagoIO.
251+
252+
.. code-block::
253+
:caption: **Example:**
254+
255+
resources = Resource()
256+
resource.devices.editDeviceData("myDeviceID", {
257+
"id": "idOfTheRecord",
258+
"value": "new value",
259+
"unit": "new unit"
260+
})
261+
262+
==========
263+
deleteDeviceData
264+
==========
265+
266+
Delete data from a device.
267+
268+
**Parameters:**
269+
270+
| **deviceID**: GenericID: str
271+
| Device ID
272+
273+
| *Optional* **queryParams**: :ref:`DataQuery`
274+
| Query parameters to filter the results.
275+
276+
.. code-block::
277+
:caption: **Example:**
278+
279+
resources = Resource()
280+
resource.devices.deleteDeviceData("myDeviceID", {
281+
"ids": ["recordIdToDelete", "anotherRecordIdToDelete" ]
282+
})

docs/source/Resources/Run/Run_Types.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ UserCreateInfo
266266
| **company**: Optional[str]
267267
| **phone**: Optional[str]
268268
| **language**: Optional[str]
269-
| **tags**: Optional[list[TagsObj]]
269+
| **tags**: Optional[list[:ref:`TagsObj`]]
270270
| **active**: Optional[bool]
271271
272272
.. _UserInfo:
@@ -282,7 +282,7 @@ UserInfo
282282
| **company**: Optional[str]
283283
| **phone**: Optional[str]
284284
| **language**: Optional[str]
285-
| **tags**: Optional[list[TagsObj]]
285+
| **tags**: Optional[list[:ref:`TagsObj`]]
286286
| **active**: Optional[bool]
287287
| **id**: GenericID
288288
| **profile**: GenericID
@@ -292,7 +292,7 @@ UserInfo
292292
| **created_at**: datetime
293293
| **updated_at**: datetime
294294
| **options**: object
295-
| **tags**: list[TagsObj]
295+
| **tags**: list[:ref:`TagsObj`]
296296
297297
.. _LoginResponse:
298298

0 commit comments

Comments
 (0)