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.
@@ -150,7 +150,9 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
150
150
  Update the fields of one or more devices
151
151
 
152
152
  ```ruby
153
- result = client.devices.patch(applicationId: my_application_id)
153
+ result = client.devices.patch(
154
+ applicationId: my_application_id,
155
+ patchInfo: my_patch_info)
154
156
 
155
157
  puts result
156
158
  ```
@@ -165,7 +167,7 @@ all.Application, all.Organization, all.User, devices.*, or devices.patch.
165
167
  | Name | Type | Required | Description | Default | Example |
166
168
  | ---- | ---- | -------- | ----------- | ------- | ------- |
167
169
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
168
- | patchInfo | [Devices Patch](_schemas.md#devices-patch) | N | Object containing device query or IDs and update operations | | [Devices Patch Example](_schemas.md#devices-patch-example) |
170
+ | patchInfo | [Devices Patch](_schemas.md#devices-patch) | Y | Object containing device query or IDs and update operations | | [Devices Patch Example](_schemas.md#devices-patch-example) |
169
171
  | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
170
172
 
171
173
  #### Successful Responses
@@ -261,7 +263,7 @@ all.Application, all.Organization, all.User, devices.*, or devices.removeData.
261
263
  | Code | Type | Description |
262
264
  | ---- | ---- | ----------- |
263
265
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
264
- | 404 | [Error](_schemas.md#error) | Error if device was not found |
266
+ | 404 | [Error](_schemas.md#error) | Error if application was not found |
265
267
 
266
268
  <br/>
267
269
 
@@ -118,6 +118,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
118
118
  | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
119
119
  | statGrouping | string | N | Field to group the statistics by. Accepted values are: statusCode, endpointId, version, domain | statusCode | statusCode |
120
120
  | duration | string | N | Duration in milliseconds | 86400000 | 86400000 |
121
+ | end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
121
122
  | resolution | string | N | Resolution in milliseconds | 3600000 | 3600000 |
122
123
  | versionFilter | string | N | Filters the stats to a particular experience version | | myVersion |
123
124
  | domainFilter | string | N | Filters the stats to a particular experience domain or slug | | mycustomdomain.com |
@@ -50,7 +50,7 @@ all.Application, all.Organization, all.User, file.*, or file.delete.
50
50
  | Code | Type | Description |
51
51
  | ---- | ---- | ----------- |
52
52
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
53
- | 404 | [Error](_schemas.md#error) | Error if event was not found |
53
+ | 404 | [Error](_schemas.md#error) | Error if file was not found |
54
54
 
55
55
  <br/>
56
56
 
@@ -132,7 +132,7 @@ all.Application, all.Organization, all.User, file.*, or file.move.
132
132
  | Code | Type | Description |
133
133
  | ---- | ---- | ----------- |
134
134
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
135
- | 404 | [Error](_schemas.md#error) | Error if application was not found |
135
+ | 404 | [Error](_schemas.md#error) | Error if file was not found |
136
136
 
137
137
  <br/>
138
138
 
@@ -174,7 +174,7 @@ all.Application, all.Organization, all.User, file.*, or file.patch.
174
174
  | Code | Type | Description |
175
175
  | ---- | ---- | ----------- |
176
176
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
177
- | 404 | [Error](_schemas.md#error) | Error if application was not found |
177
+ | 404 | [Error](_schemas.md#error) | Error if file was not found |
178
178
 
179
179
  <br/>
180
180
 
@@ -216,4 +216,4 @@ all.Application, all.Organization, all.User, file.*, or file.upload.
216
216
  | Code | Type | Description |
217
217
  | ---- | ---- | ----------- |
218
218
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
219
- | 404 | [Error](_schemas.md#error) | Error if application was not found |
219
+ | 404 | [Error](_schemas.md#error) | Error if file was not found |
@@ -8,12 +8,14 @@ parameters and the potential responses.
8
8
 
9
9
  * [Clear Storage Entries](#clear-storage-entries)
10
10
  * [Delete](#delete)
11
+ * [Errors](#errors)
11
12
  * [Get](#get)
12
13
  * [Get Log Entries](#get-log-entries)
13
14
  * [Get Storage Entries](#get-storage-entries)
14
15
  * [Patch](#patch)
15
16
  * [Press Virtual Button](#press-virtual-button)
16
17
  * [Set Storage Entry](#set-storage-entry)
18
+ * [Stats](#stats)
17
19
 
18
20
  <br/>
19
21
 
@@ -97,6 +99,52 @@ all.Application, all.Organization, all.User, flow.*, or flow.delete.
97
99
 
98
100
  <br/>
99
101
 
102
+ ## Errors
103
+
104
+ Get information about errors that occurred during runs of this workflow
105
+
106
+ ```ruby
107
+ result = client.flow.errors(
108
+ applicationId: my_application_id,
109
+ flowId: my_flow_id)
110
+
111
+ puts result
112
+ ```
113
+
114
+ #### Authentication
115
+ The client must be configured with a valid api access token to call this
116
+ action. The token must include at least one of the following scopes:
117
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.errors.
118
+
119
+ #### Available Parameters
120
+
121
+ | Name | Type | Required | Description | Default | Example |
122
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
123
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
124
+ | flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
125
+ | duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
126
+ | end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
127
+ | limit | string | N | Maximum number of errors to return | 25 | 25 |
128
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | desc | desc |
129
+ | flowVersion | string | N | Flow version name or ID. When not included, will be errors for all versions. Pass develop for just the develop version. | | develop |
130
+ | deviceId | string | N | For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
131
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
132
+
133
+ #### Successful Responses
134
+
135
+ | Code | Type | Description |
136
+ | ---- | ---- | ----------- |
137
+ | 200 | [Workflow Errors](_schemas.md#workflow-errors) | Workflow error information |
138
+
139
+ #### Error Responses
140
+
141
+ | Code | Type | Description |
142
+ | ---- | ---- | ----------- |
143
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
144
+ | 404 | [Error](_schemas.md#error) | Error if flow was not found |
145
+
146
+ <br/>
147
+
100
148
  ## Get
101
149
 
102
150
  Retrieves information on a flow
@@ -176,7 +224,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
176
224
  | Code | Type | Description |
177
225
  | ---- | ---- | ----------- |
178
226
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
179
- | 404 | [Error](_schemas.md#error) | Error if device was not found |
227
+ | 404 | [Error](_schemas.md#error) | Error if flow was not found |
180
228
 
181
229
  <br/>
182
230
 
@@ -344,3 +392,48 @@ all.Application, all.Organization, all.User, flow.*, or flow.setStorageEntry.
344
392
  | ---- | ---- | ----------- |
345
393
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
346
394
  | 404 | [Error](_schemas.md#error) | Error if flow was not found |
395
+
396
+ <br/>
397
+
398
+ ## Stats
399
+
400
+ Get statistics about workflow runs for this workflow
401
+
402
+ ```ruby
403
+ result = client.flow.stats(
404
+ applicationId: my_application_id,
405
+ flowId: my_flow_id)
406
+
407
+ puts result
408
+ ```
409
+
410
+ #### Authentication
411
+ The client must be configured with a valid api access token to call this
412
+ action. The token must include at least one of the following scopes:
413
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.stats.
414
+
415
+ #### Available Parameters
416
+
417
+ | Name | Type | Required | Description | Default | Example |
418
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
419
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
420
+ | flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
421
+ | duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
422
+ | end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
423
+ | resolution | string | N | Resolution in milliseconds | 3600000 | 3600000 |
424
+ | flowVersion | string | N | Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version. | | develop |
425
+ | deviceId | string | N | For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
426
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
427
+
428
+ #### Successful Responses
429
+
430
+ | Code | Type | Description |
431
+ | ---- | ---- | ----------- |
432
+ | 200 | [Workflow Statistics](_schemas.md#workflow-statistics) | Statistics for workflow runs |
433
+
434
+ #### Error Responses
435
+
436
+ | Code | Type | Description |
437
+ | ---- | ---- | ----------- |
438
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
439
+ | 404 | [Error](_schemas.md#error) | Error if flow was not found |
@@ -7,9 +7,11 @@ parameters and the potential responses.
7
7
  ##### Contents
8
8
 
9
9
  * [Delete](#delete)
10
+ * [Errors](#errors)
10
11
  * [Get](#get)
11
12
  * [Get Log Entries](#get-log-entries)
12
13
  * [Patch](#patch)
14
+ * [Stats](#stats)
13
15
 
14
16
  <br/>
15
17
 
@@ -55,6 +57,53 @@ all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.delet
55
57
 
56
58
  <br/>
57
59
 
60
+ ## Errors
61
+
62
+ Get information about errors that occurred during runs of this workflow version
63
+
64
+ ```ruby
65
+ result = client.flow_version.errors(
66
+ applicationId: my_application_id,
67
+ flowId: my_flow_id,
68
+ flowVersionId: my_flow_version_id)
69
+
70
+ puts result
71
+ ```
72
+
73
+ #### Authentication
74
+ The client must be configured with a valid api access token to call this
75
+ action. The token must include at least one of the following scopes:
76
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.errors.
77
+
78
+ #### Available Parameters
79
+
80
+ | Name | Type | Required | Description | Default | Example |
81
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
82
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
83
+ | flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
84
+ | flowVersionId | string | Y | Version ID or version name associated with the flow version | | 675ed18f7ae143cd83dc4bb7 |
85
+ | duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
86
+ | end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
87
+ | limit | string | N | Maximum number of errors to return | 25 | 25 |
88
+ | sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | desc | desc |
89
+ | deviceId | string | N | For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
90
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
91
+
92
+ #### Successful Responses
93
+
94
+ | Code | Type | Description |
95
+ | ---- | ---- | ----------- |
96
+ | 200 | [Workflow Errors](_schemas.md#workflow-errors) | Workflow error information |
97
+
98
+ #### Error Responses
99
+
100
+ | Code | Type | Description |
101
+ | ---- | ---- | ----------- |
102
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
103
+ | 404 | [Error](_schemas.md#error) | Error if flow version was not found |
104
+
105
+ <br/>
106
+
58
107
  ## Get
59
108
 
60
109
  Retrieves information on a flow version
@@ -138,7 +187,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
138
187
  | Code | Type | Description |
139
188
  | ---- | ---- | ----------- |
140
189
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
141
- | 404 | [Error](_schemas.md#error) | Error if device was not found |
190
+ | 404 | [Error](_schemas.md#error) | Error if flow version was not found |
142
191
 
143
192
  <br/>
144
193
 
@@ -184,3 +233,49 @@ all.Application, all.Organization, all.User, flowVersion.*, or flowVersion.patch
184
233
  | ---- | ---- | ----------- |
185
234
  | 400 | [Error](_schemas.md#error) | Error if malformed request |
186
235
  | 404 | [Error](_schemas.md#error) | Error if flow version was not found |
236
+
237
+ <br/>
238
+
239
+ ## Stats
240
+
241
+ Get statistics about workflow runs for this workflow version
242
+
243
+ ```ruby
244
+ result = client.flow_version.stats(
245
+ applicationId: my_application_id,
246
+ flowId: my_flow_id,
247
+ flowVersionId: my_flow_version_id)
248
+
249
+ puts result
250
+ ```
251
+
252
+ #### Authentication
253
+ The client must be configured with a valid api access token to call this
254
+ action. The token must include at least one of the following scopes:
255
+ all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flowVersion.*, or flowVersion.stats.
256
+
257
+ #### Available Parameters
258
+
259
+ | Name | Type | Required | Description | Default | Example |
260
+ | ---- | ---- | -------- | ----------- | ------- | ------- |
261
+ | applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
262
+ | flowId | string | Y | ID associated with the flow | | 575ed18f7ae143cd83dc4aa6 |
263
+ | flowVersionId | string | Y | Version ID or version name associated with the flow version | | 675ed18f7ae143cd83dc4bb7 |
264
+ | duration | string | N | Duration of time range in milliseconds | 86400000 | 86400000 |
265
+ | end | string | N | End of time range in milliseconds since epoch | 0 | 0 |
266
+ | resolution | string | N | Resolution in milliseconds | 3600000 | 3600000 |
267
+ | deviceId | string | N | For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs. | | 575ed18f7ae143cd83dc4bb6 |
268
+ | losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
269
+
270
+ #### Successful Responses
271
+
272
+ | Code | Type | Description |
273
+ | ---- | ---- | ----------- |
274
+ | 200 | [Workflow Statistics](_schemas.md#workflow-statistics) | Statistics for workflow runs |
275
+
276
+ #### Error Responses
277
+
278
+ | Code | Type | Description |
279
+ | ---- | ---- | ----------- |
280
+ | 400 | [Error](_schemas.md#error) | Error if malformed request |
281
+ | 404 | [Error](_schemas.md#error) | Error if flow version was not found |
@@ -27,7 +27,7 @@ module LosantRest
27
27
  #
28
28
  # User API for accessing Losant data
29
29
  #
30
- # Built For Version 1.17.2
30
+ # Built For Version 1.17.3
31
31
  class Client
32
32
  attr_accessor :auth_token, :url
33
33
 
@@ -278,7 +278,7 @@ module LosantRest
278
278
 
279
279
  headers["Accept"] = "application/json"
280
280
  headers["Content-Type"] = "application/json"
281
- headers["Accept-Version"] = "^1.17.2"
281
+ headers["Accept-Version"] = "^1.17.3"
282
282
  headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
283
283
  path = self.url + options.fetch(:path, "")
284
284
 
@@ -226,6 +226,7 @@ module LosantRest
226
226
  body = nil
227
227
 
228
228
  raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
229
+ raise ArgumentError.new("patchInfo is required") unless params.has_key?(:patchInfo)
229
230
 
230
231
  body = params[:patchInfo] if params.has_key?(:patchInfo)
231
232
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
@@ -312,7 +313,7 @@ module LosantRest
312
313
  #
313
314
  # Errors:
314
315
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
315
- # * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
316
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
316
317
  def remove_data(params = {})
317
318
  params = Utils.symbolize_hash_keys(params)
318
319
  query_params = { _actions: false, _links: true, _embedded: true }
@@ -148,6 +148,7 @@ module LosantRest
148
148
  # * {string} applicationId - ID associated with the application
149
149
  # * {string} statGrouping - Field to group the statistics by. Accepted values are: statusCode, endpointId, version, domain
150
150
  # * {string} duration - Duration in milliseconds
151
+ # * {string} end - End of time range in milliseconds since epoch
151
152
  # * {string} resolution - Resolution in milliseconds
152
153
  # * {string} versionFilter - Filters the stats to a particular experience version
153
154
  # * {string} domainFilter - Filters the stats to a particular experience domain or slug
@@ -174,6 +175,7 @@ module LosantRest
174
175
 
175
176
  query_params[:statGrouping] = params[:statGrouping] if params.has_key?(:statGrouping)
176
177
  query_params[:duration] = params[:duration] if params.has_key?(:duration)
178
+ query_params[:end] = params[:end] if params.has_key?(:end)
177
179
  query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
178
180
  query_params[:versionFilter] = params[:versionFilter] if params.has_key?(:versionFilter)
179
181
  query_params[:domainFilter] = params[:domainFilter] if params.has_key?(:domainFilter)
@@ -52,7 +52,7 @@ module LosantRest
52
52
  #
53
53
  # Errors:
54
54
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
55
- # * 404 - Error if event was not found (https://api.losant.com/#/definitions/error)
55
+ # * 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
56
56
  def delete(params = {})
57
57
  params = Utils.symbolize_hash_keys(params)
58
58
  query_params = { _actions: false, _links: true, _embedded: true }
@@ -146,7 +146,7 @@ module LosantRest
146
146
  #
147
147
  # Errors:
148
148
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
149
- # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
149
+ # * 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
150
150
  def move(params = {})
151
151
  params = Utils.symbolize_hash_keys(params)
152
152
  query_params = { _actions: false, _links: true, _embedded: true }
@@ -195,7 +195,7 @@ module LosantRest
195
195
  #
196
196
  # Errors:
197
197
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
198
- # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
198
+ # * 404 - Error if file was not found (https://api.losant.com/#/definitions/error)
199
199
  def patch(params = {})
200
200
  params = Utils.symbolize_hash_keys(params)
201
201
  query_params = { _actions: false, _links: true, _embedded: true }
@@ -123,6 +123,64 @@ module LosantRest
123
123
  body: body)
124
124
  end
125
125
 
126
+ # Get information about errors that occurred during runs of this workflow
127
+ #
128
+ # Authentication:
129
+ # The client must be configured with a valid api
130
+ # access token to call this action. The token
131
+ # must include at least one of the following scopes:
132
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.errors.
133
+ #
134
+ # Parameters:
135
+ # * {string} applicationId - ID associated with the application
136
+ # * {string} flowId - ID associated with the flow
137
+ # * {string} duration - Duration of time range in milliseconds
138
+ # * {string} end - End of time range in milliseconds since epoch
139
+ # * {string} limit - Maximum number of errors to return
140
+ # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
141
+ # * {string} flowVersion - Flow version name or ID. When not included, will be errors for all versions. Pass develop for just the develop version.
142
+ # * {string} deviceId - For edge workflows, the Device ID to return workflow errors for. When not included, will be errors for all device IDs.
143
+ # * {string} losantdomain - Domain scope of request (rarely needed)
144
+ # * {boolean} _actions - Return resource actions in response
145
+ # * {boolean} _links - Return resource link in response
146
+ # * {boolean} _embedded - Return embedded resources in response
147
+ #
148
+ # Responses:
149
+ # * 200 - Workflow error information (https://api.losant.com/#/definitions/flowErrors)
150
+ #
151
+ # Errors:
152
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
153
+ # * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
154
+ def errors(params = {})
155
+ params = Utils.symbolize_hash_keys(params)
156
+ query_params = { _actions: false, _links: true, _embedded: true }
157
+ headers = {}
158
+ body = nil
159
+
160
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
161
+ raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
162
+
163
+ query_params[:duration] = params[:duration] if params.has_key?(:duration)
164
+ query_params[:end] = params[:end] if params.has_key?(:end)
165
+ query_params[:limit] = params[:limit] if params.has_key?(:limit)
166
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
167
+ query_params[:flowVersion] = params[:flowVersion] if params.has_key?(:flowVersion)
168
+ query_params[:deviceId] = params[:deviceId] if params.has_key?(:deviceId)
169
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
170
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
171
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
172
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
173
+
174
+ path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/errors"
175
+
176
+ @client.request(
177
+ method: :get,
178
+ path: path,
179
+ query: query_params,
180
+ headers: headers,
181
+ body: body)
182
+ end
183
+
126
184
  # Retrieves information on a flow
127
185
  #
128
186
  # Authentication:
@@ -194,7 +252,7 @@ module LosantRest
194
252
  #
195
253
  # Errors:
196
254
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
197
- # * 404 - Error if device was not found (https://api.losant.com/#/definitions/error)
255
+ # * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
198
256
  def get_log_entries(params = {})
199
257
  params = Utils.symbolize_hash_keys(params)
200
258
  query_params = { _actions: false, _links: true, _embedded: true }
@@ -416,5 +474,61 @@ module LosantRest
416
474
  body: body)
417
475
  end
418
476
 
477
+ # Get statistics about workflow runs for this workflow
478
+ #
479
+ # Authentication:
480
+ # The client must be configured with a valid api
481
+ # access token to call this action. The token
482
+ # must include at least one of the following scopes:
483
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.stats.
484
+ #
485
+ # Parameters:
486
+ # * {string} applicationId - ID associated with the application
487
+ # * {string} flowId - ID associated with the flow
488
+ # * {string} duration - Duration of time range in milliseconds
489
+ # * {string} end - End of time range in milliseconds since epoch
490
+ # * {string} resolution - Resolution in milliseconds
491
+ # * {string} flowVersion - Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version.
492
+ # * {string} deviceId - For edge workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
493
+ # * {string} losantdomain - Domain scope of request (rarely needed)
494
+ # * {boolean} _actions - Return resource actions in response
495
+ # * {boolean} _links - Return resource link in response
496
+ # * {boolean} _embedded - Return embedded resources in response
497
+ #
498
+ # Responses:
499
+ # * 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
500
+ #
501
+ # Errors:
502
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
503
+ # * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
504
+ def stats(params = {})
505
+ params = Utils.symbolize_hash_keys(params)
506
+ query_params = { _actions: false, _links: true, _embedded: true }
507
+ headers = {}
508
+ body = nil
509
+
510
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
511
+ raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
512
+
513
+ query_params[:duration] = params[:duration] if params.has_key?(:duration)
514
+ query_params[:end] = params[:end] if params.has_key?(:end)
515
+ query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
516
+ query_params[:flowVersion] = params[:flowVersion] if params.has_key?(:flowVersion)
517
+ query_params[:deviceId] = params[:deviceId] if params.has_key?(:deviceId)
518
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
519
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
520
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
521
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
522
+
523
+ path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/stats"
524
+
525
+ @client.request(
526
+ method: :get,
527
+ path: path,
528
+ query: query_params,
529
+ headers: headers,
530
+ body: body)
531
+ end
532
+
419
533
  end
420
534
  end