losant_rest 1.10.2 → 1.10.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,6 +79,64 @@ module LosantRest
79
79
  body: body)
80
80
  end
81
81
 
82
+ # Get information about errors that occurred during runs of this workflow version
83
+ #
84
+ # Authentication:
85
+ # The client must be configured with a valid api
86
+ # access token to call this action. The token
87
+ # must include at least one of the following scopes:
88
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.errors.
89
+ #
90
+ # Parameters:
91
+ # * {string} applicationId - ID associated with the application
92
+ # * {string} flowId - ID associated with the flow
93
+ # * {string} flowVersionId - Version ID or version name associated with the flow version
94
+ # * {string} duration - Duration of time range in milliseconds
95
+ # * {string} end - End of time range in milliseconds since epoch
96
+ # * {string} limit - Maximum number of errors to return
97
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
98
+ # * {string} deviceId - For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs.
99
+ # * {string} losantdomain - Domain scope of request (rarely needed)
100
+ # * {boolean} _actions - Return resource actions in response
101
+ # * {boolean} _links - Return resource link in response
102
+ # * {boolean} _embedded - Return embedded resources in response
103
+ #
104
+ # Responses:
105
+ # * 200 - Workflow error information (https://api.losant.com/#/definitions/flowErrors)
106
+ #
107
+ # Errors:
108
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
109
+ # * 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
110
+ def errors(params = {})
111
+ params = Utils.symbolize_hash_keys(params)
112
+ query_params = { _actions: false, _links: true, _embedded: true }
113
+ headers = {}
114
+ body = nil
115
+
116
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
117
+ raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
118
+ raise ArgumentError.new("flowVersionId is required") unless params.has_key?(:flowVersionId)
119
+
120
+ query_params[:duration] = params[:duration] if params.has_key?(:duration)
121
+ query_params[:end] = params[:end] if params.has_key?(:end)
122
+ query_params[:limit] = params[:limit] if params.has_key?(:limit)
123
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
124
+ query_params[:deviceId] = params[:deviceId] if params.has_key?(:deviceId)
125
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
126
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
127
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
128
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
129
+
130
+ path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/versions/#{params[:flowVersionId]}/errors"
131
+
132
+ @client.request(
133
+ method: :get,
134
+ path: path,
135
+ query: query_params,
136
+ headers: headers,
137
+ body: body)
138
+ end
139
+
82
140
  # Retrieves information on a flow version
83
141
  #
84
142
  # Authentication:
@@ -153,7 +211,7 @@ module LosantRest
153
211
  #
154
212
  # Errors:
155
213
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
156
- # * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
214
+ # * 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
157
215
  def get_log_entries(params = {})
158
216
  params = Utils.symbolize_hash_keys(params)
159
217
  query_params = { _actions: false, _links: true, _embedded: true }
@@ -234,5 +292,61 @@ module LosantRest
234
292
  body: body)
235
293
  end
236
294
 
295
+ # Get statistics about workflow runs for this workflow version
296
+ #
297
+ # Authentication:
298
+ # The client must be configured with a valid api
299
+ # access token to call this action. The token
300
+ # must include at least one of the following scopes:
301
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.stats.
302
+ #
303
+ # Parameters:
304
+ # * {string} applicationId - ID associated with the application
305
+ # * {string} flowId - ID associated with the flow
306
+ # * {string} flowVersionId - Version ID or version name associated with the flow version
307
+ # * {string} duration - Duration of time range in milliseconds
308
+ # * {string} end - End of time range in milliseconds since epoch
309
+ # * {string} resolution - Resolution in milliseconds
310
+ # * {string} deviceId - For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
311
+ # * {string} losantdomain - Domain scope of request (rarely needed)
312
+ # * {boolean} _actions - Return resource actions in response
313
+ # * {boolean} _links - Return resource link in response
314
+ # * {boolean} _embedded - Return embedded resources in response
315
+ #
316
+ # Responses:
317
+ # * 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
318
+ #
319
+ # Errors:
320
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
321
+ # * 404 - Error if flow version was not found (https://api.losant.com/#/definitions/error)
322
+ def stats(params = {})
323
+ params = Utils.symbolize_hash_keys(params)
324
+ query_params = { _actions: false, _links: true, _embedded: true }
325
+ headers = {}
326
+ body = nil
327
+
328
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
329
+ raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
330
+ raise ArgumentError.new("flowVersionId is required") unless params.has_key?(:flowVersionId)
331
+
332
+ query_params[:duration] = params[:duration] if params.has_key?(:duration)
333
+ query_params[:end] = params[:end] if params.has_key?(:end)
334
+ query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
335
+ query_params[:deviceId] = params[:deviceId] if params.has_key?(:deviceId)
336
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
337
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
338
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
339
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
340
+
341
+ path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/versions/#{params[:flowVersionId]}/stats"
342
+
343
+ @client.request(
344
+ method: :get,
345
+ path: path,
346
+ query: query_params,
347
+ headers: headers,
348
+ body: body)
349
+ end
350
+
237
351
  end
238
352
  end
@@ -21,5 +21,5 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  module LosantRest
24
- VERSION = "1.10.2"
24
+ VERSION = "1.10.3"
25
25
  end
@@ -221,23 +221,27 @@
221
221
  "file.upload",
222
222
  "files.get",
223
223
  "files.post",
224
+ "flow.clearStorageEntries",
224
225
  "flow.debug",
225
226
  "flow.delete",
226
- "flow.clearStorageEntries",
227
+ "flow.errors",
227
228
  "flow.get",
228
229
  "flow.getStorageEntries",
229
230
  "flow.log",
230
231
  "flow.patch",
231
232
  "flow.pressVirtualButton",
232
233
  "flow.setStorageEntry",
234
+ "flow.stats",
233
235
  "flows.get",
234
236
  "flows.getByVersion",
235
237
  "flows.import",
236
238
  "flows.post",
237
239
  "flowVersion.delete",
240
+ "flowVersion.errors",
238
241
  "flowVersion.get",
239
242
  "flowVersion.log",
240
243
  "flowVersion.patch",
244
+ "flowVersion.stats",
241
245
  "flowVersions.get",
242
246
  "flowVersions.post",
243
247
  "integration.delete",
@@ -405,6 +405,10 @@
405
405
  "type": "string",
406
406
  "maxLength": 255
407
407
  },
408
+ "expression": {
409
+ "type": "string",
410
+ "maxLength": 255
411
+ },
408
412
  "yAxisLabel": {
409
413
  "type": "string",
410
414
  "maxLength": 255
@@ -1800,6 +1804,10 @@
1800
1804
  "type": "string",
1801
1805
  "maxLength": 255
1802
1806
  },
1807
+ "expression": {
1808
+ "type": "string",
1809
+ "maxLength": 255
1810
+ },
1803
1811
  "yAxisLabel": {
1804
1812
  "type": "string",
1805
1813
  "maxLength": 255
@@ -3262,6 +3270,10 @@
3262
3270
  "type": "string",
3263
3271
  "maxLength": 255
3264
3272
  },
3273
+ "expression": {
3274
+ "type": "string",
3275
+ "maxLength": 255
3276
+ },
3265
3277
  "yAxisLabel": {
3266
3278
  "type": "string",
3267
3279
  "maxLength": 255
@@ -4838,6 +4850,10 @@
4838
4850
  "type": "string",
4839
4851
  "maxLength": 255
4840
4852
  },
4853
+ "expression": {
4854
+ "type": "string",
4855
+ "maxLength": 255
4856
+ },
4841
4857
  "yAxisLabel": {
4842
4858
  "type": "string",
4843
4859
  "maxLength": 255
@@ -287,6 +287,10 @@
287
287
  "type": "string",
288
288
  "maxLength": 255
289
289
  },
290
+ "expression": {
291
+ "type": "string",
292
+ "maxLength": 255
293
+ },
290
294
  "yAxisLabel": {
291
295
  "type": "string",
292
296
  "maxLength": 255
@@ -1682,6 +1686,10 @@
1682
1686
  "type": "string",
1683
1687
  "maxLength": 255
1684
1688
  },
1689
+ "expression": {
1690
+ "type": "string",
1691
+ "maxLength": 255
1692
+ },
1685
1693
  "yAxisLabel": {
1686
1694
  "type": "string",
1687
1695
  "maxLength": 255
@@ -3144,6 +3152,10 @@
3144
3152
  "type": "string",
3145
3153
  "maxLength": 255
3146
3154
  },
3155
+ "expression": {
3156
+ "type": "string",
3157
+ "maxLength": 255
3158
+ },
3147
3159
  "yAxisLabel": {
3148
3160
  "type": "string",
3149
3161
  "maxLength": 255
@@ -4720,6 +4732,10 @@
4720
4732
  "type": "string",
4721
4733
  "maxLength": 255
4722
4734
  },
4735
+ "expression": {
4736
+ "type": "string",
4737
+ "maxLength": 255
4738
+ },
4723
4739
  "yAxisLabel": {
4724
4740
  "type": "string",
4725
4741
  "maxLength": 255
@@ -295,6 +295,10 @@
295
295
  "type": "string",
296
296
  "maxLength": 255
297
297
  },
298
+ "expression": {
299
+ "type": "string",
300
+ "maxLength": 255
301
+ },
298
302
  "yAxisLabel": {
299
303
  "type": "string",
300
304
  "maxLength": 255
@@ -1690,6 +1694,10 @@
1690
1694
  "type": "string",
1691
1695
  "maxLength": 255
1692
1696
  },
1697
+ "expression": {
1698
+ "type": "string",
1699
+ "maxLength": 255
1700
+ },
1693
1701
  "yAxisLabel": {
1694
1702
  "type": "string",
1695
1703
  "maxLength": 255
@@ -3152,6 +3160,10 @@
3152
3160
  "type": "string",
3153
3161
  "maxLength": 255
3154
3162
  },
3163
+ "expression": {
3164
+ "type": "string",
3165
+ "maxLength": 255
3166
+ },
3155
3167
  "yAxisLabel": {
3156
3168
  "type": "string",
3157
3169
  "maxLength": 255
@@ -4728,6 +4740,10 @@
4728
4740
  "type": "string",
4729
4741
  "maxLength": 255
4730
4742
  },
4743
+ "expression": {
4744
+ "type": "string",
4745
+ "maxLength": 255
4746
+ },
4731
4747
  "yAxisLabel": {
4732
4748
  "type": "string",
4733
4749
  "maxLength": 255
@@ -412,6 +412,10 @@
412
412
  "type": "string",
413
413
  "maxLength": 255
414
414
  },
415
+ "expression": {
416
+ "type": "string",
417
+ "maxLength": 255
418
+ },
415
419
  "yAxisLabel": {
416
420
  "type": "string",
417
421
  "maxLength": 255
@@ -1807,6 +1811,10 @@
1807
1811
  "type": "string",
1808
1812
  "maxLength": 255
1809
1813
  },
1814
+ "expression": {
1815
+ "type": "string",
1816
+ "maxLength": 255
1817
+ },
1810
1818
  "yAxisLabel": {
1811
1819
  "type": "string",
1812
1820
  "maxLength": 255
@@ -3269,6 +3277,10 @@
3269
3277
  "type": "string",
3270
3278
  "maxLength": 255
3271
3279
  },
3280
+ "expression": {
3281
+ "type": "string",
3282
+ "maxLength": 255
3283
+ },
3272
3284
  "yAxisLabel": {
3273
3285
  "type": "string",
3274
3286
  "maxLength": 255
@@ -4845,6 +4857,10 @@
4845
4857
  "type": "string",
4846
4858
  "maxLength": 255
4847
4859
  },
4860
+ "expression": {
4861
+ "type": "string",
4862
+ "maxLength": 255
4863
+ },
4848
4864
  "yAxisLabel": {
4849
4865
  "type": "string",
4850
4866
  "maxLength": 255
@@ -43,6 +43,28 @@
43
43
  }
44
44
  },
45
45
  "additionalProperties": false
46
+ },
47
+ "creationDate": {
48
+ "oneOf": [
49
+ {
50
+ "type": "string"
51
+ },
52
+ {
53
+ "type": "number"
54
+ },
55
+ {
56
+ "type": "object",
57
+ "properties": {
58
+ "$date": {
59
+ "type": "string"
60
+ }
61
+ },
62
+ "additionalProperties": false,
63
+ "required": [
64
+ "$date"
65
+ ]
66
+ }
67
+ ]
46
68
  }
47
69
  },
48
70
  "required": [
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "domainName": {
36
36
  "type": "string",
37
- "maxLength": 1024,
37
+ "maxLength": 45,
38
38
  "minLength": 3
39
39
  },
40
40
  "version": {
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "domainName": {
54
54
  "type": "string",
55
- "maxLength": 1024,
55
+ "maxLength": 45,
56
56
  "minLength": 3
57
57
  }
58
58
  },
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "domainName": {
21
21
  "type": "string",
22
- "maxLength": 1024,
22
+ "maxLength": 45,
23
23
  "minLength": 3
24
24
  },
25
25
  "version": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "domainName": {
43
43
  "type": "string",
44
- "maxLength": 1024,
44
+ "maxLength": 45,
45
45
  "minLength": 3
46
46
  },
47
47
  "version": {
@@ -53,7 +53,7 @@
53
53
  "properties": {
54
54
  "domainName": {
55
55
  "type": "string",
56
- "maxLength": 1024,
56
+ "maxLength": 45,
57
57
  "minLength": 3
58
58
  },
59
59
  "id": {
@@ -60,7 +60,7 @@
60
60
  "properties": {
61
61
  "domainName": {
62
62
  "type": "string",
63
- "maxLength": 1024,
63
+ "maxLength": 45,
64
64
  "minLength": 3
65
65
  },
66
66
  "id": {
@@ -0,0 +1,87 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "flowVersion": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 255
9
+ },
10
+ "flowVersionId": {
11
+ "type": "string",
12
+ "pattern": "^[A-Fa-f\\d]{24}$"
13
+ },
14
+ "deviceId": {
15
+ "type": "string",
16
+ "pattern": "^[A-Fa-f\\d]{24}$"
17
+ },
18
+ "start": {
19
+ "type": "string",
20
+ "format": "date-time"
21
+ },
22
+ "end": {
23
+ "type": "string",
24
+ "format": "date-time"
25
+ },
26
+ "limit": {
27
+ "type": "number"
28
+ },
29
+ "sortDirection": {
30
+ "type": "string",
31
+ "enum": [
32
+ "asc",
33
+ "desc",
34
+ "ASC",
35
+ "DESC",
36
+ ""
37
+ ]
38
+ },
39
+ "errors": {
40
+ "type": "array",
41
+ "items": {
42
+ "type": "object",
43
+ "properties": {
44
+ "time": {
45
+ "type": "string",
46
+ "format": "date-time"
47
+ },
48
+ "deviceId": {
49
+ "type": "string",
50
+ "pattern": "^[A-Fa-f\\d]{24}$"
51
+ },
52
+ "deviceName": {
53
+ "type": "string",
54
+ "minLength": 1,
55
+ "maxLength": 255
56
+ },
57
+ "flowVersion": {
58
+ "type": "string",
59
+ "minLength": 1,
60
+ "maxLength": 255
61
+ },
62
+ "flowVersionId": {
63
+ "type": "string",
64
+ "pattern": "^[A-Fa-f\\d]{24}$"
65
+ },
66
+ "nodeId": {
67
+ "type": "string"
68
+ },
69
+ "nodeLabel": {
70
+ "type": "string"
71
+ },
72
+ "error": {
73
+ "type": "object",
74
+ "properties": {
75
+ "name": {
76
+ "type": "string"
77
+ },
78
+ "message": {
79
+ "type": "string"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }