losant_rest 1.9.3 → 1.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/docs/_schemas.md +17405 -2766
  3. data/docs/application.md +85 -0
  4. data/docs/applicationApiTokens.md +1 -1
  5. data/docs/applicationTemplate.md +46 -0
  6. data/docs/applicationTemplates.md +76 -1
  7. data/docs/device.md +7 -3
  8. data/docs/devices.md +92 -4
  9. data/docs/experienceEndpoints.md +1 -0
  10. data/docs/file.md +4 -4
  11. data/docs/flow.md +94 -1
  12. data/docs/flowVersion.md +96 -1
  13. data/docs/me.md +0 -36
  14. data/lib/losant_rest.rb +1 -0
  15. data/lib/losant_rest/application.rb +48 -0
  16. data/lib/losant_rest/application_api_tokens.rb +1 -1
  17. data/lib/losant_rest/application_template.rb +79 -0
  18. data/lib/losant_rest/application_templates.rb +89 -1
  19. data/lib/losant_rest/client.rb +6 -2
  20. data/lib/losant_rest/device.rb +11 -3
  21. data/lib/losant_rest/devices.rb +103 -3
  22. data/lib/losant_rest/experience_endpoints.rb +2 -0
  23. data/lib/losant_rest/file.rb +3 -3
  24. data/lib/losant_rest/flow.rb +115 -1
  25. data/lib/losant_rest/flow_version.rb +115 -1
  26. data/lib/losant_rest/me.rb +0 -41
  27. data/lib/losant_rest/version.rb +1 -1
  28. data/schemas/advancedDeviceQuery.json +117 -0
  29. data/schemas/advancedEventQuery.json +205 -0
  30. data/schemas/advancedQuery.json +34 -3
  31. data/schemas/application.json +13 -0
  32. data/schemas/applicationApiTokenPost.json +9 -1
  33. data/schemas/applicationApplyTemplatePatch.json +19 -0
  34. data/schemas/applicationCreationByTemplateResult.json +13 -0
  35. data/schemas/applicationPatch.json +5 -0
  36. data/schemas/applicationPost.json +13 -0
  37. data/schemas/applicationTemplate.json +32 -0
  38. data/schemas/applicationTemplateCategories.json +43 -0
  39. data/schemas/applicationTemplateCategory.json +23 -0
  40. data/schemas/applicationTemplates.json +44 -0
  41. data/schemas/applications.json +13 -0
  42. data/schemas/changePassword.json +2 -2
  43. data/schemas/dashboard.json +1285 -145
  44. data/schemas/dashboardPatch.json +1285 -145
  45. data/schemas/dashboardPost.json +1285 -145
  46. data/schemas/dashboards.json +1285 -145
  47. data/schemas/dataExport.json +142 -0
  48. data/schemas/dataTableRowsExport.json +34 -3
  49. data/schemas/device.json +16 -3
  50. data/schemas/devicePatch.json +16 -3
  51. data/schemas/devicePost.json +16 -3
  52. data/schemas/deviceRecipe.json +16 -3
  53. data/schemas/deviceRecipePatch.json +16 -3
  54. data/schemas/deviceRecipePost.json +16 -3
  55. data/schemas/deviceRecipes.json +16 -3
  56. data/schemas/devices.json +16 -3
  57. data/schemas/devicesDataRemoved.json +12 -0
  58. data/schemas/devicesDeletePost.json +1034 -0
  59. data/schemas/devicesDeleted.json +12 -0
  60. data/schemas/devicesExportPost.json +1035 -0
  61. data/schemas/devicesPatch.json +1773 -7
  62. data/schemas/devicesRemoveDataPost.json +1056 -0
  63. data/schemas/devicesUpdated.json +18 -0
  64. data/schemas/eventPost.json +22 -0
  65. data/schemas/eventsExport.json +205 -0
  66. data/schemas/experienceDomain.json +1 -1
  67. data/schemas/experienceDomainPatch.json +1 -1
  68. data/schemas/experienceDomainPost.json +1 -1
  69. data/schemas/experienceDomains.json +1 -1
  70. data/schemas/experienceGroup.json +7 -0
  71. data/schemas/experienceGroupPatch.json +7 -0
  72. data/schemas/experienceGroupPost.json +7 -0
  73. data/schemas/experienceGroups.json +7 -0
  74. data/schemas/experienceLinkedResources.json +348 -3
  75. data/schemas/experienceVersion.json +1 -1
  76. data/schemas/experienceVersions.json +1 -1
  77. data/schemas/flow.json +116 -1
  78. data/schemas/flowErrors.json +87 -0
  79. data/schemas/flowPatch.json +116 -1
  80. data/schemas/flowPost.json +116 -1
  81. data/schemas/flowStats.json +54 -0
  82. data/schemas/flowVersion.json +232 -2
  83. data/schemas/flowVersionPost.json +116 -1
  84. data/schemas/flowVersions.json +232 -2
  85. data/schemas/flows.json +116 -1
  86. data/schemas/flowsImportPost.json +232 -2
  87. data/schemas/flowsImportResult.json +348 -3
  88. data/schemas/githubLogin.json +15 -4
  89. data/schemas/me.json +0 -3
  90. data/schemas/mePatch.json +2 -2
  91. data/schemas/multiDeviceCommand.json +1019 -0
  92. data/schemas/notebook.json +99 -2
  93. data/schemas/notebookPatch.json +99 -2
  94. data/schemas/notebookPost.json +99 -2
  95. data/schemas/notebooks.json +99 -2
  96. data/schemas/org.json +1 -1
  97. data/schemas/orgInviteInfo.json +3 -0
  98. data/schemas/orgInvitePost.json +3 -0
  99. data/schemas/orgInvites.json +3 -0
  100. data/schemas/orgPatch.json +1 -1
  101. data/schemas/orgPost.json +0 -9
  102. data/schemas/orgs.json +1 -1
  103. data/schemas/passwordResetFinish.json +2 -2
  104. data/schemas/samlResponse.json +1 -1
  105. data/schemas/templateKeywords.json +14 -0
  106. data/schemas/timeSeriesData.json +101 -12
  107. data/schemas/timeSeriesQuery.json +101 -12
  108. data/schemas/userCredentials.json +13 -3
  109. data/schemas/userPost.json +21 -7
  110. metadata +19 -5
@@ -44,8 +44,10 @@ module LosantRest
44
44
  # * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
45
45
  # * {string} page - Which page of results to return
46
46
  # * {string} perPage - How many items to return per page
47
- # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
47
+ # * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, authorName
48
48
  # * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
49
+ # * {array} keywords - List of keywords to filter by. Matches all provided keywords.
50
+ # * {string} categoryId - ID of a category to filter by.
49
51
  # * {string} losantdomain - Domain scope of request (rarely needed)
50
52
  # * {boolean} _actions - Return resource actions in response
51
53
  # * {boolean} _links - Return resource link in response
@@ -69,6 +71,8 @@ module LosantRest
69
71
  query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
70
72
  query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
71
73
  query_params[:filter] = params[:filter] if params.has_key?(:filter)
74
+ query_params[:keywords] = params[:keywords] if params.has_key?(:keywords)
75
+ query_params[:categoryId] = params[:categoryId] if params.has_key?(:categoryId)
72
76
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
73
77
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
74
78
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -84,5 +88,89 @@ module LosantRest
84
88
  body: body)
85
89
  end
86
90
 
91
+ # Returns a category list, beginning at the specified category
92
+ #
93
+ # Authentication:
94
+ # The client must be configured with a valid api
95
+ # access token to call this action. The token
96
+ # must include at least one of the following scopes:
97
+ # all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getCategories.
98
+ #
99
+ # Parameters:
100
+ # * {string} baseId - ID of the category to begin from
101
+ # * {string} losantdomain - Domain scope of request (rarely needed)
102
+ # * {boolean} _actions - Return resource actions in response
103
+ # * {boolean} _links - Return resource link in response
104
+ # * {boolean} _embedded - Return embedded resources in response
105
+ #
106
+ # Responses:
107
+ # * 200 - Collection of application categories (https://api.losant.com/#/definitions/applicationTemplateCategories)
108
+ #
109
+ # Errors:
110
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
111
+ def get_categories(params = {})
112
+ params = Utils.symbolize_hash_keys(params)
113
+ query_params = { _actions: false, _links: true, _embedded: true }
114
+ headers = {}
115
+ body = nil
116
+
117
+
118
+ query_params[:baseId] = params[:baseId] if params.has_key?(:baseId)
119
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
120
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
121
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
122
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
123
+
124
+ path = "/applicationTemplates/categories"
125
+
126
+ @client.request(
127
+ method: :get,
128
+ path: path,
129
+ query: query_params,
130
+ headers: headers,
131
+ body: body)
132
+ end
133
+
134
+ # Returns an array of all unique keywords currently in use by templates
135
+ #
136
+ # Authentication:
137
+ # The client must be configured with a valid api
138
+ # access token to call this action. The token
139
+ # must include at least one of the following scopes:
140
+ # all.User, all.User.read, applicationTemplates.*, or applicationTemplates.getUniqueKeywords.
141
+ #
142
+ # Parameters:
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 - Array of all unique template keywords (https://api.losant.com/#/definitions/templateKeywords)
150
+ #
151
+ # Errors:
152
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
153
+ def get_unique_keywords(params = {})
154
+ params = Utils.symbolize_hash_keys(params)
155
+ query_params = { _actions: false, _links: true, _embedded: true }
156
+ headers = {}
157
+ body = nil
158
+
159
+
160
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
161
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
162
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
163
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
164
+
165
+ path = "/applicationTemplates/keywords"
166
+
167
+ @client.request(
168
+ method: :get,
169
+ path: path,
170
+ query: query_params,
171
+ headers: headers,
172
+ body: body)
173
+ end
174
+
87
175
  end
88
176
  end
@@ -27,7 +27,7 @@ module LosantRest
27
27
  #
28
28
  # User API for accessing Losant data
29
29
  #
30
- # Built For Version 1.16.4
30
+ # Built For Version 1.17.4
31
31
  class Client
32
32
  attr_accessor :auth_token, :url
33
33
 
@@ -72,6 +72,10 @@ module LosantRest
72
72
  @application_keys ||= ApplicationKeys.new(self)
73
73
  end
74
74
 
75
+ def application_template
76
+ @application_template ||= ApplicationTemplate.new(self)
77
+ end
78
+
75
79
  def application_templates
76
80
  @application_templates ||= ApplicationTemplates.new(self)
77
81
  end
@@ -278,7 +282,7 @@ module LosantRest
278
282
 
279
283
  headers["Accept"] = "application/json"
280
284
  headers["Content-Type"] = "application/json"
281
- headers["Accept-Version"] = "^1.16.4"
285
+ headers["Accept-Version"] = "^1.17.4"
282
286
  headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
283
287
  path = self.url + options.fetch(:path, "")
284
288
 
@@ -92,6 +92,7 @@ module LosantRest
92
92
  # * {string} end - End time of export (ms since epoch - 0 means now, negative is relative to now)
93
93
  # * {string} email - Email address to send export to. Defaults to current user's email.
94
94
  # * {string} callbackUrl - Callback URL to call with export result
95
+ # * {string} includeBlobData - If set will export any blob attributes in base64 form, otherwise they will be downloadable links which will expire.
95
96
  # * {string} losantdomain - Domain scope of request (rarely needed)
96
97
  # * {boolean} _actions - Return resource actions in response
97
98
  # * {boolean} _links - Return resource link in response
@@ -116,6 +117,7 @@ module LosantRest
116
117
  query_params[:end] = params[:end] if params.has_key?(:end)
117
118
  query_params[:email] = params[:email] if params.has_key?(:email)
118
119
  query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
120
+ query_params[:includeBlobData] = params[:includeBlobData] if params.has_key?(:includeBlobData)
119
121
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
120
122
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
121
123
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -190,8 +192,9 @@ module LosantRest
190
192
  # Parameters:
191
193
  # * {string} applicationId - ID associated with the application
192
194
  # * {string} deviceId - ID associated with the device
193
- # * {string} limit - Max command entries to return (ordered by time descending)
195
+ # * {string} limit - Maximum number of command entries to return
194
196
  # * {string} since - Look for command entries since this time (ms since epoch)
197
+ # * {string} sortDirection - Direction to sort the command entries (by time). Accepted values are: asc, desc
195
198
  # * {string} losantdomain - Domain scope of request (rarely needed)
196
199
  # * {boolean} _actions - Return resource actions in response
197
200
  # * {boolean} _links - Return resource link in response
@@ -214,6 +217,7 @@ module LosantRest
214
217
 
215
218
  query_params[:limit] = params[:limit] if params.has_key?(:limit)
216
219
  query_params[:since] = params[:since] if params.has_key?(:since)
220
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
217
221
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
218
222
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
219
223
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -292,8 +296,9 @@ module LosantRest
292
296
  # Parameters:
293
297
  # * {string} applicationId - ID associated with the application
294
298
  # * {string} deviceId - ID associated with the device
295
- # * {string} limit - Max log entries to return (ordered by time descending)
299
+ # * {string} limit - Maximum number of log entries to return
296
300
  # * {string} since - Look for log entries since this time (ms since epoch)
301
+ # * {string} sortDirection - Direction to sort the log entries (by time). Accepted values are: asc, desc
297
302
  # * {string} losantdomain - Domain scope of request (rarely needed)
298
303
  # * {boolean} _actions - Return resource actions in response
299
304
  # * {boolean} _links - Return resource link in response
@@ -316,6 +321,7 @@ module LosantRest
316
321
 
317
322
  query_params[:limit] = params[:limit] if params.has_key?(:limit)
318
323
  query_params[:since] = params[:since] if params.has_key?(:since)
324
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
319
325
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
320
326
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
321
327
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -342,8 +348,9 @@ module LosantRest
342
348
  # Parameters:
343
349
  # * {string} applicationId - ID associated with the application
344
350
  # * {string} deviceId - ID associated with the device
345
- # * {string} limit - Max state entries to return (ordered by time descending)
351
+ # * {string} limit - Maximum number of state entries to return
346
352
  # * {string} since - Look for state entries since this time (ms since epoch)
353
+ # * {string} sortDirection - Direction to sort the state entries (by time). Accepted values are: asc, desc
347
354
  # * {string} losantdomain - Domain scope of request (rarely needed)
348
355
  # * {boolean} _actions - Return resource actions in response
349
356
  # * {boolean} _links - Return resource link in response
@@ -366,6 +373,7 @@ module LosantRest
366
373
 
367
374
  query_params[:limit] = params[:limit] if params.has_key?(:limit)
368
375
  query_params[:since] = params[:since] if params.has_key?(:since)
376
+ query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
369
377
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
370
378
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
371
379
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -31,6 +31,54 @@ module LosantRest
31
31
  @client = client
32
32
  end
33
33
 
34
+ # Delete devices
35
+ #
36
+ # Authentication:
37
+ # The client must be configured with a valid api
38
+ # access token to call this action. The token
39
+ # must include at least one of the following scopes:
40
+ # all.Application, all.Organization, all.User, devices.*, or devices.delete.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID associated with the application
44
+ # * {hash} options - Object containing device query and email (https://api.losant.com/#/definitions/devicesDeletePost)
45
+ # * {string} losantdomain - Domain scope of request (rarely needed)
46
+ # * {boolean} _actions - Return resource actions in response
47
+ # * {boolean} _links - Return resource link in response
48
+ # * {boolean} _embedded - Return embedded resources in response
49
+ #
50
+ # Responses:
51
+ # * 200 - Object indicating number of devices deleted or failed (https://api.losant.com/#/definitions/devicesDeleted)
52
+ # * 202 - If a job was enqueued for the devices to be deleted (https://api.losant.com/#/definitions/jobEnqueuedResult)
53
+ #
54
+ # Errors:
55
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
56
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
57
+ def delete(params = {})
58
+ params = Utils.symbolize_hash_keys(params)
59
+ query_params = { _actions: false, _links: true, _embedded: true }
60
+ headers = {}
61
+ body = nil
62
+
63
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
64
+ raise ArgumentError.new("options is required") unless params.has_key?(:options)
65
+
66
+ body = params[:options] if params.has_key?(:options)
67
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
68
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
69
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
70
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
71
+
72
+ path = "/applications/#{params[:applicationId]}/devices/delete"
73
+
74
+ @client.request(
75
+ method: :post,
76
+ path: path,
77
+ query: query_params,
78
+ headers: headers,
79
+ body: body)
80
+ end
81
+
34
82
  # Creates an export of all device metadata
35
83
  #
36
84
  # Authentication:
@@ -43,6 +91,7 @@ module LosantRest
43
91
  # * {string} applicationId - ID associated with the application
44
92
  # * {string} email - Email address to send export to. Defaults to current user's email.
45
93
  # * {string} callbackUrl - Callback URL to call with export result
94
+ # * {hash} options - Object containing device query and optionally email or callback (https://api.losant.com/#/definitions/devicesExportPost)
46
95
  # * {string} losantdomain - Domain scope of request (rarely needed)
47
96
  # * {boolean} _actions - Return resource actions in response
48
97
  # * {boolean} _links - Return resource link in response
@@ -64,6 +113,7 @@ module LosantRest
64
113
 
65
114
  query_params[:email] = params[:email] if params.has_key?(:email)
66
115
  query_params[:callbackUrl] = params[:callbackUrl] if params.has_key?(:callbackUrl)
116
+ body = params[:options] if params.has_key?(:options)
67
117
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
68
118
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
69
119
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
@@ -99,7 +149,7 @@ module LosantRest
99
149
  # * {hash} tagFilter - Array of tag pairs to filter by (https://api.losant.com/#/definitions/deviceTagFilter)
100
150
  # * {string} excludeConnectionInfo - If set, do not return connection info
101
151
  # * {string} parentId - Filter devices as children of a given system id
102
- # * {hash} query - Device filter JSON object which overides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
152
+ # * {hash} query - Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
103
153
  # * {string} losantdomain - Domain scope of request (rarely needed)
104
154
  # * {boolean} _actions - Return resource actions in response
105
155
  # * {boolean} _links - Return resource link in response
@@ -156,14 +206,15 @@ module LosantRest
156
206
  #
157
207
  # Parameters:
158
208
  # * {string} applicationId - ID associated with the application
159
- # * {hash} patchInfo - Object containing device filter fields and updated properties (https://api.losant.com/#/definitions/devicesPatch)
209
+ # * {hash} patchInfo - Object containing device query or IDs and update operations (https://api.losant.com/#/definitions/devicesPatch)
160
210
  # * {string} losantdomain - Domain scope of request (rarely needed)
161
211
  # * {boolean} _actions - Return resource actions in response
162
212
  # * {boolean} _links - Return resource link in response
163
213
  # * {boolean} _embedded - Return embedded resources in response
164
214
  #
165
215
  # Responses:
166
- # * 201 - Successfully queued bulk update job (https://api.losant.com/#/definitions/success)
216
+ # * 200 - Object including an update log link and the number of devices updated, failed, and skipped (https://api.losant.com/#/definitions/devicesUpdated)
217
+ # * 202 - Successfully queued bulk update job (https://api.losant.com/#/definitions/jobEnqueuedResult)
167
218
  #
168
219
  # Errors:
169
220
  # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
@@ -175,6 +226,7 @@ module LosantRest
175
226
  body = nil
176
227
 
177
228
  raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
229
+ raise ArgumentError.new("patchInfo is required") unless params.has_key?(:patchInfo)
178
230
 
179
231
  body = params[:patchInfo] if params.has_key?(:patchInfo)
180
232
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
@@ -239,6 +291,54 @@ module LosantRest
239
291
  body: body)
240
292
  end
241
293
 
294
+ # Removes all device data for the specified time range. Defaults to all data.
295
+ #
296
+ # Authentication:
297
+ # The client must be configured with a valid api
298
+ # access token to call this action. The token
299
+ # must include at least one of the following scopes:
300
+ # all.Application, all.Organization, all.User, devices.*, or devices.removeData.
301
+ #
302
+ # Parameters:
303
+ # * {string} applicationId - ID associated with the application
304
+ # * {hash} options - Object defining the device data to delete and devices to delete from (https://api.losant.com/#/definitions/devicesRemoveDataPost)
305
+ # * {string} losantdomain - Domain scope of request (rarely needed)
306
+ # * {boolean} _actions - Return resource actions in response
307
+ # * {boolean} _links - Return resource link in response
308
+ # * {boolean} _embedded - Return embedded resources in response
309
+ #
310
+ # Responses:
311
+ # * 200 - Object indicating number of devices completed or skipped (https://api.losant.com/#/definitions/devicesDataRemoved)
312
+ # * 202 - If a job was enqueued for device data to be removed (https://api.losant.com/#/definitions/jobEnqueuedResult)
313
+ #
314
+ # Errors:
315
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
316
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
317
+ def remove_data(params = {})
318
+ params = Utils.symbolize_hash_keys(params)
319
+ query_params = { _actions: false, _links: true, _embedded: true }
320
+ headers = {}
321
+ body = nil
322
+
323
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
324
+ raise ArgumentError.new("options is required") unless params.has_key?(:options)
325
+
326
+ body = params[:options] if params.has_key?(:options)
327
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
328
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
329
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
330
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
331
+
332
+ path = "/applications/#{params[:applicationId]}/devices/removeData"
333
+
334
+ @client.request(
335
+ method: :post,
336
+ path: path,
337
+ query: query_params,
338
+ headers: headers,
339
+ body: body)
340
+ end
341
+
242
342
  # Send a command to multiple devices
243
343
  #
244
344
  # Authentication:
@@ -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