losant_rest 1.19.0 → 1.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_schemas.md +872 -38
- data/docs/applications.md +49 -0
- data/docs/device.md +12 -3
- data/docs/me.md +116 -0
- data/lib/losant_rest/version.rb +1 -1
- data/lib/platform_rest/application.rb +932 -0
- data/lib/platform_rest/application_api_token.rb +176 -0
- data/lib/platform_rest/application_api_tokens.rb +136 -0
- data/lib/platform_rest/application_certificate.rb +176 -0
- data/lib/platform_rest/application_certificate_authorities.rb +138 -0
- data/lib/platform_rest/application_certificate_authority.rb +176 -0
- data/lib/platform_rest/application_certificates.rb +138 -0
- data/lib/platform_rest/application_dashboard.rb +225 -0
- data/lib/platform_rest/application_dashboards.rb +138 -0
- data/lib/platform_rest/application_key.rb +176 -0
- data/lib/platform_rest/application_keys.rb +141 -0
- data/lib/platform_rest/application_template.rb +79 -0
- data/lib/platform_rest/application_templates.rb +176 -0
- data/lib/platform_rest/applications.rb +209 -0
- data/lib/platform_rest/audit_log.rb +81 -0
- data/lib/platform_rest/audit_logs.rb +93 -0
- data/lib/platform_rest/auth.rb +245 -0
- data/lib/platform_rest/client.rb +410 -0
- data/lib/platform_rest/credential.rb +224 -0
- data/lib/platform_rest/credentials.rb +138 -0
- data/lib/platform_rest/dashboard.rb +268 -0
- data/lib/platform_rest/dashboards.rb +136 -0
- data/lib/platform_rest/data.rb +176 -0
- data/lib/platform_rest/data_table.rb +274 -0
- data/lib/platform_rest/data_table_row.rb +182 -0
- data/lib/platform_rest/data_table_rows.rb +343 -0
- data/lib/platform_rest/data_tables.rb +138 -0
- data/lib/platform_rest/device.rb +767 -0
- data/lib/platform_rest/device_recipe.rb +234 -0
- data/lib/platform_rest/device_recipes.rb +146 -0
- data/lib/platform_rest/devices.rb +707 -0
- data/lib/platform_rest/edge_deployment.rb +81 -0
- data/lib/platform_rest/edge_deployments.rb +236 -0
- data/lib/platform_rest/embedded_deployment.rb +81 -0
- data/lib/platform_rest/embedded_deployments.rb +280 -0
- data/lib/platform_rest/error.rb +34 -0
- data/lib/platform_rest/event.rb +176 -0
- data/lib/platform_rest/events.rb +341 -0
- data/lib/platform_rest/experience.rb +142 -0
- data/lib/platform_rest/experience_domain.rb +176 -0
- data/lib/platform_rest/experience_domains.rb +126 -0
- data/lib/platform_rest/experience_endpoint.rb +230 -0
- data/lib/platform_rest/experience_endpoints.rb +200 -0
- data/lib/platform_rest/experience_group.rb +180 -0
- data/lib/platform_rest/experience_groups.rb +141 -0
- data/lib/platform_rest/experience_slug.rb +176 -0
- data/lib/platform_rest/experience_slugs.rb +126 -0
- data/lib/platform_rest/experience_user.rb +176 -0
- data/lib/platform_rest/experience_users.rb +142 -0
- data/lib/platform_rest/experience_version.rb +176 -0
- data/lib/platform_rest/experience_versions.rb +138 -0
- data/lib/platform_rest/experience_view.rb +228 -0
- data/lib/platform_rest/experience_views.rb +142 -0
- data/lib/platform_rest/file.rb +226 -0
- data/lib/platform_rest/files.rb +144 -0
- data/lib/platform_rest/flow.rb +580 -0
- data/lib/platform_rest/flow_version.rb +352 -0
- data/lib/platform_rest/flow_versions.rb +201 -0
- data/lib/platform_rest/flows.rb +310 -0
- data/lib/platform_rest/instance.rb +377 -0
- data/lib/platform_rest/instance_api_token.rb +176 -0
- data/lib/platform_rest/instance_api_tokens.rb +136 -0
- data/lib/platform_rest/instance_custom_node.rb +282 -0
- data/lib/platform_rest/instance_custom_nodes.rb +136 -0
- data/lib/platform_rest/instance_member.rb +176 -0
- data/lib/platform_rest/instance_members.rb +134 -0
- data/lib/platform_rest/instance_org.rb +336 -0
- data/lib/platform_rest/instance_org_invite.rb +182 -0
- data/lib/platform_rest/instance_org_invites.rb +138 -0
- data/lib/platform_rest/instance_org_member.rb +182 -0
- data/lib/platform_rest/instance_org_members.rb +138 -0
- data/lib/platform_rest/instance_orgs.rb +139 -0
- data/lib/platform_rest/instance_sandbox.rb +181 -0
- data/lib/platform_rest/instance_sandboxes.rb +98 -0
- data/lib/platform_rest/instances.rb +88 -0
- data/lib/platform_rest/integration.rb +178 -0
- data/lib/platform_rest/integrations.rb +138 -0
- data/lib/platform_rest/me.rb +923 -0
- data/lib/platform_rest/notebook.rb +423 -0
- data/lib/platform_rest/notebooks.rb +138 -0
- data/lib/platform_rest/org.rb +663 -0
- data/lib/platform_rest/org_invites.rb +124 -0
- data/lib/platform_rest/orgs.rb +140 -0
- data/lib/platform_rest/resource_job.rb +326 -0
- data/lib/platform_rest/resource_jobs.rb +138 -0
- data/lib/platform_rest/user_api_token.rb +170 -0
- data/lib/platform_rest/user_api_tokens.rb +132 -0
- data/lib/platform_rest/utils.rb +44 -0
- data/lib/platform_rest/webhook.rb +178 -0
- data/lib/platform_rest/webhooks.rb +138 -0
- data/lib/platform_rest.rb +129 -0
- data/schemas/apiTokenPost.json +4 -0
- data/schemas/applicationDashboardPost.json +66 -0
- data/schemas/dashboard.json +66 -0
- data/schemas/dashboardPatch.json +66 -0
- data/schemas/dashboardPost.json +66 -0
- data/schemas/dashboards.json +66 -0
- data/schemas/deviceConnectionStatus.json +10 -0
- data/schemas/deviceLog.json +3 -0
- data/schemas/event.json +8 -0
- data/schemas/eventPlusNewCount.json +8 -0
- data/schemas/events.json +8 -0
- data/schemas/githubLogin.json +4 -0
- data/schemas/integrationPatch.json +0 -10
- data/schemas/orgInviteActionUser.json +18 -0
- data/schemas/orgInviteResultUser.json +18 -0
- data/schemas/orgInviteUser.json +51 -0
- data/schemas/orgInvitesUser.json +59 -0
- data/schemas/payloadCountsBreakdown.json +1 -25
- data/schemas/periodSummaries.json +172 -0
- data/schemas/samlResponse.json +4 -0
- data/schemas/userCredentials.json +4 -0
- data/schemas/userPost.json +4 -0
- metadata +98 -2
@@ -0,0 +1,580 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2023 Losant IoT, Inc.
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require "json"
|
24
|
+
|
25
|
+
module PlatformRest
|
26
|
+
|
27
|
+
# Class containing all the actions for the Flow Resource
|
28
|
+
class Flow
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Clear all storage entries
|
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, flow.*, or flow.clearStorageEntries.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} applicationId - ID associated with the application
|
44
|
+
# * {string} flowId - ID associated with the flow
|
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 - The current storage entries (https://api.losant.com/#/definitions/flowStorageEntries)
|
52
|
+
#
|
53
|
+
# Errors:
|
54
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
55
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
56
|
+
def clear_storage_entries(params = {})
|
57
|
+
params = Utils.symbolize_hash_keys(params)
|
58
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
59
|
+
headers = {}
|
60
|
+
body = nil
|
61
|
+
|
62
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
63
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
64
|
+
|
65
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
66
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
67
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
68
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
69
|
+
|
70
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/storage"
|
71
|
+
|
72
|
+
@client.request(
|
73
|
+
method: :delete,
|
74
|
+
path: path,
|
75
|
+
query: query_params,
|
76
|
+
headers: headers,
|
77
|
+
body: body)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Deletes a flow
|
81
|
+
#
|
82
|
+
# Authentication:
|
83
|
+
# The client must be configured with a valid api
|
84
|
+
# access token to call this action. The token
|
85
|
+
# must include at least one of the following scopes:
|
86
|
+
# all.Application, all.Organization, all.User, flow.*, or flow.delete.
|
87
|
+
#
|
88
|
+
# Parameters:
|
89
|
+
# * {string} applicationId - ID associated with the application
|
90
|
+
# * {string} flowId - ID associated with the flow
|
91
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
92
|
+
# * {boolean} _actions - Return resource actions in response
|
93
|
+
# * {boolean} _links - Return resource link in response
|
94
|
+
# * {boolean} _embedded - Return embedded resources in response
|
95
|
+
#
|
96
|
+
# Responses:
|
97
|
+
# * 200 - If flow was successfully deleted (https://api.losant.com/#/definitions/success)
|
98
|
+
#
|
99
|
+
# Errors:
|
100
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
101
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
102
|
+
def delete(params = {})
|
103
|
+
params = Utils.symbolize_hash_keys(params)
|
104
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
105
|
+
headers = {}
|
106
|
+
body = nil
|
107
|
+
|
108
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
109
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
110
|
+
|
111
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
112
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
113
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
114
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
115
|
+
|
116
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}"
|
117
|
+
|
118
|
+
@client.request(
|
119
|
+
method: :delete,
|
120
|
+
path: path,
|
121
|
+
query: query_params,
|
122
|
+
headers: headers,
|
123
|
+
body: body)
|
124
|
+
end
|
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 or embedded workflows, the Device ID for which to return workflow errors. 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
|
+
|
184
|
+
# Retrieves information on a flow
|
185
|
+
#
|
186
|
+
# Authentication:
|
187
|
+
# The client must be configured with a valid api
|
188
|
+
# access token to call this action. The token
|
189
|
+
# must include at least one of the following scopes:
|
190
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.get.
|
191
|
+
#
|
192
|
+
# Parameters:
|
193
|
+
# * {string} applicationId - ID associated with the application
|
194
|
+
# * {string} flowId - ID associated with the flow
|
195
|
+
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
196
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
197
|
+
# * {boolean} _actions - Return resource actions in response
|
198
|
+
# * {boolean} _links - Return resource link in response
|
199
|
+
# * {boolean} _embedded - Return embedded resources in response
|
200
|
+
#
|
201
|
+
# Responses:
|
202
|
+
# * 200 - Flow information (https://api.losant.com/#/definitions/flow)
|
203
|
+
#
|
204
|
+
# Errors:
|
205
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
206
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
207
|
+
def get(params = {})
|
208
|
+
params = Utils.symbolize_hash_keys(params)
|
209
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
210
|
+
headers = {}
|
211
|
+
body = nil
|
212
|
+
|
213
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
214
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
215
|
+
|
216
|
+
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
217
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
218
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
219
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
220
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
221
|
+
|
222
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}"
|
223
|
+
|
224
|
+
@client.request(
|
225
|
+
method: :get,
|
226
|
+
path: path,
|
227
|
+
query: query_params,
|
228
|
+
headers: headers,
|
229
|
+
body: body)
|
230
|
+
end
|
231
|
+
|
232
|
+
# Retrieve the recent log entries about runs of this workflow
|
233
|
+
#
|
234
|
+
# Authentication:
|
235
|
+
# The client must be configured with a valid api
|
236
|
+
# access token to call this action. The token
|
237
|
+
# must include at least one of the following scopes:
|
238
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.log.
|
239
|
+
#
|
240
|
+
# Parameters:
|
241
|
+
# * {string} applicationId - ID associated with the application
|
242
|
+
# * {string} flowId - ID associated with the flow
|
243
|
+
# * {string} limit - Max log entries to return (ordered by time descending)
|
244
|
+
# * {string} since - Look for log entries since this time (ms since epoch)
|
245
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
246
|
+
# * {boolean} _actions - Return resource actions in response
|
247
|
+
# * {boolean} _links - Return resource link in response
|
248
|
+
# * {boolean} _embedded - Return embedded resources in response
|
249
|
+
#
|
250
|
+
# Responses:
|
251
|
+
# * 200 - Recent log entries (https://api.losant.com/#/definitions/flowLog)
|
252
|
+
#
|
253
|
+
# Errors:
|
254
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
255
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
256
|
+
def get_log_entries(params = {})
|
257
|
+
params = Utils.symbolize_hash_keys(params)
|
258
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
259
|
+
headers = {}
|
260
|
+
body = nil
|
261
|
+
|
262
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
263
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
264
|
+
|
265
|
+
query_params[:limit] = params[:limit] if params.has_key?(:limit)
|
266
|
+
query_params[:since] = params[:since] if params.has_key?(:since)
|
267
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
268
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
269
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
270
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
271
|
+
|
272
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/logs"
|
273
|
+
|
274
|
+
@client.request(
|
275
|
+
method: :get,
|
276
|
+
path: path,
|
277
|
+
query: query_params,
|
278
|
+
headers: headers,
|
279
|
+
body: body)
|
280
|
+
end
|
281
|
+
|
282
|
+
# Gets the current values in persistent storage
|
283
|
+
#
|
284
|
+
# Authentication:
|
285
|
+
# The client must be configured with a valid api
|
286
|
+
# access token to call this action. The token
|
287
|
+
# must include at least one of the following scopes:
|
288
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntries.
|
289
|
+
#
|
290
|
+
# Parameters:
|
291
|
+
# * {string} applicationId - ID associated with the application
|
292
|
+
# * {string} flowId - ID associated with the flow
|
293
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
294
|
+
# * {boolean} _actions - Return resource actions in response
|
295
|
+
# * {boolean} _links - Return resource link in response
|
296
|
+
# * {boolean} _embedded - Return embedded resources in response
|
297
|
+
#
|
298
|
+
# Responses:
|
299
|
+
# * 200 - The current storage entries (https://api.losant.com/#/definitions/flowStorageEntries)
|
300
|
+
#
|
301
|
+
# Errors:
|
302
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
303
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
304
|
+
def get_storage_entries(params = {})
|
305
|
+
params = Utils.symbolize_hash_keys(params)
|
306
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
307
|
+
headers = {}
|
308
|
+
body = nil
|
309
|
+
|
310
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
311
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
312
|
+
|
313
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
314
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
315
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
316
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
317
|
+
|
318
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/storage"
|
319
|
+
|
320
|
+
@client.request(
|
321
|
+
method: :get,
|
322
|
+
path: path,
|
323
|
+
query: query_params,
|
324
|
+
headers: headers,
|
325
|
+
body: body)
|
326
|
+
end
|
327
|
+
|
328
|
+
# Gets metadata about storage for this flow
|
329
|
+
#
|
330
|
+
# Authentication:
|
331
|
+
# The client must be configured with a valid api
|
332
|
+
# access token to call this action. The token
|
333
|
+
# must include at least one of the following scopes:
|
334
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.getStorageEntriesMetadata.
|
335
|
+
#
|
336
|
+
# Parameters:
|
337
|
+
# * {string} applicationId - ID associated with the application
|
338
|
+
# * {string} flowId - ID associated with the flow
|
339
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
340
|
+
# * {boolean} _actions - Return resource actions in response
|
341
|
+
# * {boolean} _links - Return resource link in response
|
342
|
+
# * {boolean} _embedded - Return embedded resources in response
|
343
|
+
#
|
344
|
+
# Responses:
|
345
|
+
# * 200 - The meta data for the current storage entries (https://api.losant.com/#/definitions/flowStorageMetadata)
|
346
|
+
#
|
347
|
+
# Errors:
|
348
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
349
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
350
|
+
def get_storage_entries_metadata(params = {})
|
351
|
+
params = Utils.symbolize_hash_keys(params)
|
352
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
353
|
+
headers = {}
|
354
|
+
body = nil
|
355
|
+
|
356
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
357
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
358
|
+
|
359
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
360
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
361
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
362
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
363
|
+
|
364
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/storage-metadata"
|
365
|
+
|
366
|
+
@client.request(
|
367
|
+
method: :get,
|
368
|
+
path: path,
|
369
|
+
query: query_params,
|
370
|
+
headers: headers,
|
371
|
+
body: body)
|
372
|
+
end
|
373
|
+
|
374
|
+
# Updates information about a flow
|
375
|
+
#
|
376
|
+
# Authentication:
|
377
|
+
# The client must be configured with a valid api
|
378
|
+
# access token to call this action. The token
|
379
|
+
# must include at least one of the following scopes:
|
380
|
+
# all.Application, all.Organization, all.User, flow.*, or flow.patch.
|
381
|
+
#
|
382
|
+
# Parameters:
|
383
|
+
# * {string} applicationId - ID associated with the application
|
384
|
+
# * {string} flowId - ID associated with the flow
|
385
|
+
# * {string} includeCustomNodes - If the result of the request should also include the details of any custom nodes referenced by the returned workflows
|
386
|
+
# * {hash} flow - Object containing new properties of the flow (https://api.losant.com/#/definitions/flowPatch)
|
387
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
388
|
+
# * {boolean} _actions - Return resource actions in response
|
389
|
+
# * {boolean} _links - Return resource link in response
|
390
|
+
# * {boolean} _embedded - Return embedded resources in response
|
391
|
+
#
|
392
|
+
# Responses:
|
393
|
+
# * 200 - Updated flow information (https://api.losant.com/#/definitions/flow)
|
394
|
+
#
|
395
|
+
# Errors:
|
396
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
397
|
+
# * 404 - Error if flow is not found (https://api.losant.com/#/definitions/error)
|
398
|
+
def patch(params = {})
|
399
|
+
params = Utils.symbolize_hash_keys(params)
|
400
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
401
|
+
headers = {}
|
402
|
+
body = nil
|
403
|
+
|
404
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
405
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
406
|
+
raise ArgumentError.new("flow is required") unless params.has_key?(:flow)
|
407
|
+
|
408
|
+
query_params[:includeCustomNodes] = params[:includeCustomNodes] if params.has_key?(:includeCustomNodes)
|
409
|
+
body = params[:flow] if params.has_key?(:flow)
|
410
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
411
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
412
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
413
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
414
|
+
|
415
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}"
|
416
|
+
|
417
|
+
@client.request(
|
418
|
+
method: :patch,
|
419
|
+
path: path,
|
420
|
+
query: query_params,
|
421
|
+
headers: headers,
|
422
|
+
body: body)
|
423
|
+
end
|
424
|
+
|
425
|
+
# Presses the specified virtual button on the flow
|
426
|
+
#
|
427
|
+
# Authentication:
|
428
|
+
# The client must be configured with a valid api
|
429
|
+
# access token to call this action. The token
|
430
|
+
# must include at least one of the following scopes:
|
431
|
+
# all.Application, all.Organization, all.User, flow.*, or flow.pressVirtualButton.
|
432
|
+
#
|
433
|
+
# Parameters:
|
434
|
+
# * {string} applicationId - ID associated with the application
|
435
|
+
# * {string} flowId - ID associated with the flow
|
436
|
+
# * {hash} button - Object containing button key and payload (https://api.losant.com/#/definitions/virtualButtonPress)
|
437
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
438
|
+
# * {boolean} _actions - Return resource actions in response
|
439
|
+
# * {boolean} _links - Return resource link in response
|
440
|
+
# * {boolean} _embedded - Return embedded resources in response
|
441
|
+
#
|
442
|
+
# Responses:
|
443
|
+
# * 200 - Virtual button was pressed (https://api.losant.com/#/definitions/success)
|
444
|
+
#
|
445
|
+
# Errors:
|
446
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
447
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
448
|
+
def press_virtual_button(params = {})
|
449
|
+
params = Utils.symbolize_hash_keys(params)
|
450
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
451
|
+
headers = {}
|
452
|
+
body = nil
|
453
|
+
|
454
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
455
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
456
|
+
raise ArgumentError.new("button is required") unless params.has_key?(:button)
|
457
|
+
|
458
|
+
body = params[:button] if params.has_key?(:button)
|
459
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
460
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
461
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
462
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
463
|
+
|
464
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/virtualButton"
|
465
|
+
|
466
|
+
@client.request(
|
467
|
+
method: :post,
|
468
|
+
path: path,
|
469
|
+
query: query_params,
|
470
|
+
headers: headers,
|
471
|
+
body: body)
|
472
|
+
end
|
473
|
+
|
474
|
+
# Sets a storage value
|
475
|
+
#
|
476
|
+
# Authentication:
|
477
|
+
# The client must be configured with a valid api
|
478
|
+
# access token to call this action. The token
|
479
|
+
# must include at least one of the following scopes:
|
480
|
+
# all.Application, all.Organization, all.User, flow.*, or flow.setStorageEntry.
|
481
|
+
#
|
482
|
+
# Parameters:
|
483
|
+
# * {string} applicationId - ID associated with the application
|
484
|
+
# * {string} flowId - ID associated with the flow
|
485
|
+
# * {hash} entry - Object containing storage entry (https://api.losant.com/#/definitions/flowStorageEntry)
|
486
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
487
|
+
# * {boolean} _actions - Return resource actions in response
|
488
|
+
# * {boolean} _links - Return resource link in response
|
489
|
+
# * {boolean} _embedded - Return embedded resources in response
|
490
|
+
#
|
491
|
+
# Responses:
|
492
|
+
# * 200 - Value was successfully stored (https://api.losant.com/#/definitions/success)
|
493
|
+
#
|
494
|
+
# Errors:
|
495
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
496
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
497
|
+
def set_storage_entry(params = {})
|
498
|
+
params = Utils.symbolize_hash_keys(params)
|
499
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
500
|
+
headers = {}
|
501
|
+
body = nil
|
502
|
+
|
503
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
504
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
505
|
+
raise ArgumentError.new("entry is required") unless params.has_key?(:entry)
|
506
|
+
|
507
|
+
body = params[:entry] if params.has_key?(:entry)
|
508
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
509
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
510
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
511
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
512
|
+
|
513
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/storage"
|
514
|
+
|
515
|
+
@client.request(
|
516
|
+
method: :patch,
|
517
|
+
path: path,
|
518
|
+
query: query_params,
|
519
|
+
headers: headers,
|
520
|
+
body: body)
|
521
|
+
end
|
522
|
+
|
523
|
+
# Get statistics about workflow runs for this workflow
|
524
|
+
#
|
525
|
+
# Authentication:
|
526
|
+
# The client must be configured with a valid api
|
527
|
+
# access token to call this action. The token
|
528
|
+
# must include at least one of the following scopes:
|
529
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, flow.*, or flow.stats.
|
530
|
+
#
|
531
|
+
# Parameters:
|
532
|
+
# * {string} applicationId - ID associated with the application
|
533
|
+
# * {string} flowId - ID associated with the flow
|
534
|
+
# * {string} duration - Duration of time range in milliseconds
|
535
|
+
# * {string} end - End of time range in milliseconds since epoch
|
536
|
+
# * {string} resolution - Resolution in milliseconds
|
537
|
+
# * {string} flowVersion - Flow version name or ID. When not included, will be aggregate for all versions. Pass develop for just the develop version.
|
538
|
+
# * {string} deviceId - For edge or embedded workflows, the device ID to return workflow stats for. When not included, will be aggregate for all device IDs.
|
539
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
540
|
+
# * {boolean} _actions - Return resource actions in response
|
541
|
+
# * {boolean} _links - Return resource link in response
|
542
|
+
# * {boolean} _embedded - Return embedded resources in response
|
543
|
+
#
|
544
|
+
# Responses:
|
545
|
+
# * 200 - Statistics for workflow runs (https://api.losant.com/#/definitions/flowStats)
|
546
|
+
#
|
547
|
+
# Errors:
|
548
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
549
|
+
# * 404 - Error if flow was not found (https://api.losant.com/#/definitions/error)
|
550
|
+
def stats(params = {})
|
551
|
+
params = Utils.symbolize_hash_keys(params)
|
552
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
553
|
+
headers = {}
|
554
|
+
body = nil
|
555
|
+
|
556
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
557
|
+
raise ArgumentError.new("flowId is required") unless params.has_key?(:flowId)
|
558
|
+
|
559
|
+
query_params[:duration] = params[:duration] if params.has_key?(:duration)
|
560
|
+
query_params[:end] = params[:end] if params.has_key?(:end)
|
561
|
+
query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
|
562
|
+
query_params[:flowVersion] = params[:flowVersion] if params.has_key?(:flowVersion)
|
563
|
+
query_params[:deviceId] = params[:deviceId] if params.has_key?(:deviceId)
|
564
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
565
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
566
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
567
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
568
|
+
|
569
|
+
path = "/applications/#{params[:applicationId]}/flows/#{params[:flowId]}/stats"
|
570
|
+
|
571
|
+
@client.request(
|
572
|
+
method: :get,
|
573
|
+
path: path,
|
574
|
+
query: query_params,
|
575
|
+
headers: headers,
|
576
|
+
body: body)
|
577
|
+
end
|
578
|
+
|
579
|
+
end
|
580
|
+
end
|