Billing api sdk
Source code in unicboard_billing_sdk/billing_api_sdk.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
__init__(api_billing_url, api_token)
This function initializes the class with the billing API URL and the API token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_billing_url |
str
|
The URL of the API Billing endpoint. |
required |
api_token |
str
|
The API token you received from the billing system. |
required |
Source code in unicboard_billing_sdk/billing_api_sdk.py
19 20 21 22 23 24 25 26 27 28 | |
get_device_battery_level(device_id, limit=None, offset=None)
It gets the battery level value of device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
limit |
Optional[int]
|
The maximum number of devices battery level value to return. |
None
|
offset |
Optional[int]
|
The offset of the first device battery level value to return. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceBatteryLevelResponse |
GetDeviceBatteryLevelResponse
|
response about device battery level value |
Source code in unicboard_billing_sdk/billing_api_sdk.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
get_device_clock(device_id, limit=None, offset=None)
It gets the clock data of device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
limit |
Optional[int]
|
The maximum number of devices clock data value to return. |
None
|
offset |
Optional[int]
|
The offset of the first device clock data value to return. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceClockResponse |
GetDeviceClockResponse
|
response about device clock data |
Source code in unicboard_billing_sdk/billing_api_sdk.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
get_device_event(device_id, limit=None, offset=None)
It gets events of device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
limit |
Optional[int]
|
The maximum number of devices events value to return. |
None
|
offset |
Optional[int]
|
The offset of the first device events value to return. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceEventResponse |
GetDeviceEventResponse
|
response about device events |
Source code in unicboard_billing_sdk/billing_api_sdk.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
get_device_info(device_id)
This function takes a device ID and returns a
GetDeviceInfoResponseobject
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
Returns:
| Type | Description |
|---|---|
GetDeviceInfoResponse
|
A GetDeviceInfoResponse object. Status of payload information in device list) |
Source code in unicboard_billing_sdk/billing_api_sdk.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
get_device_list_by_id_info(device_ids)
It takes a list of device IDs and returns a list of device info objects
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_ids |
List[UUID]
|
List[UUID] |
required |
Returns:
| Type | Description |
|---|---|
GetDeviceListInfoResponse
|
A list of devices. |
Source code in unicboard_billing_sdk/billing_api_sdk.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
get_device_list_info(resource_type, limit=None, offset=None, filters=None, sorts=None)
It makes a GET request to the /api/v1/devices/info endpoint, and returns the response as a
GetDeviceListInfoResponse object
Args:
resource_type (Optional[str]): filter by resource type - use ResourceTypeEnum for choose value
limit (Optional[int]): The maximum number of devices to return.
offset (Optional[int]): The offset of the first device to return.
filters (Optional[List[Dict[str, Any]]]): A list of dictionaries, each of which contains a key and a value.
The key is the name of the field to filter on, and the value is the value to filter on.
sorts (Optional[List[Tuple[str, str]]]): A list of tuples, where each tuple is a field name and a sort direction.
Returns:
| Type | Description |
|---|---|
GetDeviceListInfoResponse
|
A list of devices. |
Source code in unicboard_billing_sdk/billing_api_sdk.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
get_device_profile(device_id, limit=None, offset=None)
It gets the time profiles of device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
limit |
Optional[int]
|
The maximum number of devices time profiles value to return. |
None
|
offset |
Optional[int]
|
The offset of the first device time profiles value to return. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceProfileResponse |
GetDeviceProfileResponse
|
response about device time profiles |
Source code in unicboard_billing_sdk/billing_api_sdk.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
get_device_temperature(device_id, limit=None, offset=None)
It gets the temperature info of device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
limit |
Optional[int]
|
The maximum number of devices time profiles value to return. |
None
|
offset |
Optional[int]
|
The offset of the first device time profiles value to return. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceTemperatureResponse |
GetDeviceTemperatureResponse
|
response about device temperature info |
Source code in unicboard_billing_sdk/billing_api_sdk.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
get_device_uptime(device_id, limit=None, offset=None)
It gets the temperature info of device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device_id |
UUID
|
The UUID of the device you want to get information about. |
required |
limit |
Optional[int]
|
The maximum number of devices time profiles value to return. |
None
|
offset |
Optional[int]
|
The offset of the first device time profiles value to return. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceTemperatureResponse |
GetDeviceUptimeResponse
|
response about device temperature info |
Source code in unicboard_billing_sdk/billing_api_sdk.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
get_device_value(devices_id, period_from, iteration_interval=IntervalSelectValue.day, period_to=None, end_of_day=True)
It gets the value of a device
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
devices_id |
List[UUID]
|
List[UUID] - list of device IDs |
required |
period_from |
datetime
|
The start of the period for which you want to get the data. |
required |
period_to |
datetime
|
datetime = None |
None
|
iteration_interval |
IntervalSelectValue
|
= IntervalSelectValue.day iteration interval |
day
|
end_of_day |
bool
|
= True Show values of the end of day |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
GetDeviceValueResponse |
GetDeviceValueResponse
|
response about device value |
Source code in unicboard_billing_sdk/billing_api_sdk.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |