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.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/docs/_schemas.md +872 -38
  3. data/docs/applications.md +49 -0
  4. data/docs/device.md +12 -3
  5. data/docs/me.md +116 -0
  6. data/lib/losant_rest/version.rb +1 -1
  7. data/lib/platform_rest/application.rb +932 -0
  8. data/lib/platform_rest/application_api_token.rb +176 -0
  9. data/lib/platform_rest/application_api_tokens.rb +136 -0
  10. data/lib/platform_rest/application_certificate.rb +176 -0
  11. data/lib/platform_rest/application_certificate_authorities.rb +138 -0
  12. data/lib/platform_rest/application_certificate_authority.rb +176 -0
  13. data/lib/platform_rest/application_certificates.rb +138 -0
  14. data/lib/platform_rest/application_dashboard.rb +225 -0
  15. data/lib/platform_rest/application_dashboards.rb +138 -0
  16. data/lib/platform_rest/application_key.rb +176 -0
  17. data/lib/platform_rest/application_keys.rb +141 -0
  18. data/lib/platform_rest/application_template.rb +79 -0
  19. data/lib/platform_rest/application_templates.rb +176 -0
  20. data/lib/platform_rest/applications.rb +209 -0
  21. data/lib/platform_rest/audit_log.rb +81 -0
  22. data/lib/platform_rest/audit_logs.rb +93 -0
  23. data/lib/platform_rest/auth.rb +245 -0
  24. data/lib/platform_rest/client.rb +410 -0
  25. data/lib/platform_rest/credential.rb +224 -0
  26. data/lib/platform_rest/credentials.rb +138 -0
  27. data/lib/platform_rest/dashboard.rb +268 -0
  28. data/lib/platform_rest/dashboards.rb +136 -0
  29. data/lib/platform_rest/data.rb +176 -0
  30. data/lib/platform_rest/data_table.rb +274 -0
  31. data/lib/platform_rest/data_table_row.rb +182 -0
  32. data/lib/platform_rest/data_table_rows.rb +343 -0
  33. data/lib/platform_rest/data_tables.rb +138 -0
  34. data/lib/platform_rest/device.rb +767 -0
  35. data/lib/platform_rest/device_recipe.rb +234 -0
  36. data/lib/platform_rest/device_recipes.rb +146 -0
  37. data/lib/platform_rest/devices.rb +707 -0
  38. data/lib/platform_rest/edge_deployment.rb +81 -0
  39. data/lib/platform_rest/edge_deployments.rb +236 -0
  40. data/lib/platform_rest/embedded_deployment.rb +81 -0
  41. data/lib/platform_rest/embedded_deployments.rb +280 -0
  42. data/lib/platform_rest/error.rb +34 -0
  43. data/lib/platform_rest/event.rb +176 -0
  44. data/lib/platform_rest/events.rb +341 -0
  45. data/lib/platform_rest/experience.rb +142 -0
  46. data/lib/platform_rest/experience_domain.rb +176 -0
  47. data/lib/platform_rest/experience_domains.rb +126 -0
  48. data/lib/platform_rest/experience_endpoint.rb +230 -0
  49. data/lib/platform_rest/experience_endpoints.rb +200 -0
  50. data/lib/platform_rest/experience_group.rb +180 -0
  51. data/lib/platform_rest/experience_groups.rb +141 -0
  52. data/lib/platform_rest/experience_slug.rb +176 -0
  53. data/lib/platform_rest/experience_slugs.rb +126 -0
  54. data/lib/platform_rest/experience_user.rb +176 -0
  55. data/lib/platform_rest/experience_users.rb +142 -0
  56. data/lib/platform_rest/experience_version.rb +176 -0
  57. data/lib/platform_rest/experience_versions.rb +138 -0
  58. data/lib/platform_rest/experience_view.rb +228 -0
  59. data/lib/platform_rest/experience_views.rb +142 -0
  60. data/lib/platform_rest/file.rb +226 -0
  61. data/lib/platform_rest/files.rb +144 -0
  62. data/lib/platform_rest/flow.rb +580 -0
  63. data/lib/platform_rest/flow_version.rb +352 -0
  64. data/lib/platform_rest/flow_versions.rb +201 -0
  65. data/lib/platform_rest/flows.rb +310 -0
  66. data/lib/platform_rest/instance.rb +377 -0
  67. data/lib/platform_rest/instance_api_token.rb +176 -0
  68. data/lib/platform_rest/instance_api_tokens.rb +136 -0
  69. data/lib/platform_rest/instance_custom_node.rb +282 -0
  70. data/lib/platform_rest/instance_custom_nodes.rb +136 -0
  71. data/lib/platform_rest/instance_member.rb +176 -0
  72. data/lib/platform_rest/instance_members.rb +134 -0
  73. data/lib/platform_rest/instance_org.rb +336 -0
  74. data/lib/platform_rest/instance_org_invite.rb +182 -0
  75. data/lib/platform_rest/instance_org_invites.rb +138 -0
  76. data/lib/platform_rest/instance_org_member.rb +182 -0
  77. data/lib/platform_rest/instance_org_members.rb +138 -0
  78. data/lib/platform_rest/instance_orgs.rb +139 -0
  79. data/lib/platform_rest/instance_sandbox.rb +181 -0
  80. data/lib/platform_rest/instance_sandboxes.rb +98 -0
  81. data/lib/platform_rest/instances.rb +88 -0
  82. data/lib/platform_rest/integration.rb +178 -0
  83. data/lib/platform_rest/integrations.rb +138 -0
  84. data/lib/platform_rest/me.rb +923 -0
  85. data/lib/platform_rest/notebook.rb +423 -0
  86. data/lib/platform_rest/notebooks.rb +138 -0
  87. data/lib/platform_rest/org.rb +663 -0
  88. data/lib/platform_rest/org_invites.rb +124 -0
  89. data/lib/platform_rest/orgs.rb +140 -0
  90. data/lib/platform_rest/resource_job.rb +326 -0
  91. data/lib/platform_rest/resource_jobs.rb +138 -0
  92. data/lib/platform_rest/user_api_token.rb +170 -0
  93. data/lib/platform_rest/user_api_tokens.rb +132 -0
  94. data/lib/platform_rest/utils.rb +44 -0
  95. data/lib/platform_rest/webhook.rb +178 -0
  96. data/lib/platform_rest/webhooks.rb +138 -0
  97. data/lib/platform_rest.rb +129 -0
  98. data/schemas/apiTokenPost.json +4 -0
  99. data/schemas/applicationDashboardPost.json +66 -0
  100. data/schemas/dashboard.json +66 -0
  101. data/schemas/dashboardPatch.json +66 -0
  102. data/schemas/dashboardPost.json +66 -0
  103. data/schemas/dashboards.json +66 -0
  104. data/schemas/deviceConnectionStatus.json +10 -0
  105. data/schemas/deviceLog.json +3 -0
  106. data/schemas/event.json +8 -0
  107. data/schemas/eventPlusNewCount.json +8 -0
  108. data/schemas/events.json +8 -0
  109. data/schemas/githubLogin.json +4 -0
  110. data/schemas/integrationPatch.json +0 -10
  111. data/schemas/orgInviteActionUser.json +18 -0
  112. data/schemas/orgInviteResultUser.json +18 -0
  113. data/schemas/orgInviteUser.json +51 -0
  114. data/schemas/orgInvitesUser.json +59 -0
  115. data/schemas/payloadCountsBreakdown.json +1 -25
  116. data/schemas/periodSummaries.json +172 -0
  117. data/schemas/samlResponse.json +4 -0
  118. data/schemas/userCredentials.json +4 -0
  119. data/schemas/userPost.json +4 -0
  120. metadata +98 -2
@@ -0,0 +1,932 @@
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 Application Resource
28
+ class Application
29
+
30
+ def initialize(client)
31
+ @client = client
32
+ end
33
+
34
+ # Add resources to an application via an application template
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, application.*, or application.applyTemplate.
41
+ #
42
+ # Parameters:
43
+ # * {string} applicationId - ID of the associated application
44
+ # * {hash} options - Object containing template import options (https://api.losant.com/#/definitions/applicationApplyTemplatePatch)
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 - Updated application information (https://api.losant.com/#/definitions/application)
52
+ # * 202 - If a job was enqueued for the resources to be imported into the application (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 is not found (https://api.losant.com/#/definitions/error)
57
+ def apply_template(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]}/applyTemplate"
73
+
74
+ @client.request(
75
+ method: :patch,
76
+ path: path,
77
+ query: query_params,
78
+ headers: headers,
79
+ body: body)
80
+ end
81
+
82
+ # Returns success when a job has been enqueued to archive this application's device data for a given day
83
+ #
84
+ # Authentication:
85
+ # The client must be configured with a valid api
86
+ # access token to call this action. The token
87
+ # must include at least one of the following scopes:
88
+ # all.Application, all.Organization, all.User, application.*, or application.archiveData.
89
+ #
90
+ # Parameters:
91
+ # * {string} applicationId - ID of the associated application
92
+ # * {string} date - The date to archive data (ms since epoch), it must be within the archive time range older than 31 days and newer than the organizations dataTTL
93
+ # * {string} losantdomain - Domain scope of request (rarely needed)
94
+ # * {boolean} _actions - Return resource actions in response
95
+ # * {boolean} _links - Return resource link in response
96
+ # * {boolean} _embedded - Return embedded resources in response
97
+ #
98
+ # Responses:
99
+ # * 202 - Enqueued a job to archive this applications device data (https://api.losant.com/#/definitions/jobEnqueuedResult)
100
+ #
101
+ # Errors:
102
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
103
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
104
+ def archive_data(params = {})
105
+ params = Utils.symbolize_hash_keys(params)
106
+ query_params = { _actions: false, _links: true, _embedded: true }
107
+ headers = {}
108
+ body = nil
109
+
110
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
111
+ raise ArgumentError.new("date is required") unless params.has_key?(:date)
112
+
113
+ query_params[:date] = params[:date] if params.has_key?(:date)
114
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
115
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
116
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
117
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
118
+
119
+ path = "/applications/#{params[:applicationId]}/archiveData"
120
+
121
+ @client.request(
122
+ method: :get,
123
+ path: path,
124
+ query: query_params,
125
+ headers: headers,
126
+ body: body)
127
+ end
128
+
129
+ # Returns success when a job has been enqueued to backfill all current data to its archive
130
+ #
131
+ # Authentication:
132
+ # The client must be configured with a valid api
133
+ # access token to call this action. The token
134
+ # must include at least one of the following scopes:
135
+ # all.Application, all.Organization, all.User, application.*, or application.backfillArchiveData.
136
+ #
137
+ # Parameters:
138
+ # * {string} applicationId - ID of the associated application
139
+ # * {string} losantdomain - Domain scope of request (rarely needed)
140
+ # * {boolean} _actions - Return resource actions in response
141
+ # * {boolean} _links - Return resource link in response
142
+ # * {boolean} _embedded - Return embedded resources in response
143
+ #
144
+ # Responses:
145
+ # * 202 - Enqueued a job to backfill device data to this application archive location (https://api.losant.com/#/definitions/jobEnqueuedResult)
146
+ #
147
+ # Errors:
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)
150
+ def backfill_archive_data(params = {})
151
+ params = Utils.symbolize_hash_keys(params)
152
+ query_params = { _actions: false, _links: true, _embedded: true }
153
+ headers = {}
154
+ body = nil
155
+
156
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
157
+
158
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
159
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
160
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
161
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
162
+
163
+ path = "/applications/#{params[:applicationId]}/backfillArchiveData"
164
+
165
+ @client.request(
166
+ method: :get,
167
+ path: path,
168
+ query: query_params,
169
+ headers: headers,
170
+ body: body)
171
+ end
172
+
173
+ # Copy an application into a new application
174
+ #
175
+ # Authentication:
176
+ # The client must be configured with a valid api
177
+ # access token to call this action. The token
178
+ # must include at least one of the following scopes:
179
+ # all.Application, all.Organization, all.User, application.*, or application.clone.
180
+ #
181
+ # Parameters:
182
+ # * {string} applicationId - ID of the associated application
183
+ # * {hash} options - Object containing optional clone fields (https://api.losant.com/#/definitions/applicationClonePost)
184
+ # * {string} losantdomain - Domain scope of request (rarely needed)
185
+ # * {boolean} _actions - Return resource actions in response
186
+ # * {boolean} _links - Return resource link in response
187
+ # * {boolean} _embedded - Return embedded resources in response
188
+ #
189
+ # Responses:
190
+ # * 200 - if dryRun is set and successful, then return success (https://api.losant.com/#/definitions/applicationCloneDryRunResult)
191
+ # * 201 - If application was successfully cloned (https://api.losant.com/#/definitions/applicationCreationByTemplateResult)
192
+ # * 202 - If application was enqueued to be cloned (https://api.losant.com/#/definitions/jobEnqueuedResult)
193
+ #
194
+ # Errors:
195
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
196
+ # * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
197
+ # * 422 - Error if too many validation errors occurred on other resources (https://api.losant.com/#/definitions/validationErrors)
198
+ def clone(params = {})
199
+ params = Utils.symbolize_hash_keys(params)
200
+ query_params = { _actions: false, _links: true, _embedded: true }
201
+ headers = {}
202
+ body = nil
203
+
204
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
205
+
206
+ body = params[:options] if params.has_key?(:options)
207
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
208
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
209
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
210
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
211
+
212
+ path = "/applications/#{params[:applicationId]}/clone"
213
+
214
+ @client.request(
215
+ method: :post,
216
+ path: path,
217
+ query: query_params,
218
+ headers: headers,
219
+ body: body)
220
+ end
221
+
222
+ # Deletes an application
223
+ #
224
+ # Authentication:
225
+ # The client must be configured with a valid api
226
+ # access token to call this action. The token
227
+ # must include at least one of the following scopes:
228
+ # all.Application, all.Organization, all.User, application.*, or application.delete.
229
+ #
230
+ # Parameters:
231
+ # * {string} applicationId - ID of the associated application
232
+ # * {string} losantdomain - Domain scope of request (rarely needed)
233
+ # * {boolean} _actions - Return resource actions in response
234
+ # * {boolean} _links - Return resource link in response
235
+ # * {boolean} _embedded - Return embedded resources in response
236
+ #
237
+ # Responses:
238
+ # * 200 - If application was successfully deleted (https://api.losant.com/#/definitions/success)
239
+ #
240
+ # Errors:
241
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
242
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
243
+ def delete(params = {})
244
+ params = Utils.symbolize_hash_keys(params)
245
+ query_params = { _actions: false, _links: true, _embedded: true }
246
+ headers = {}
247
+ body = nil
248
+
249
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
250
+
251
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
252
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
253
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
254
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
255
+
256
+ path = "/applications/#{params[:applicationId]}"
257
+
258
+ @client.request(
259
+ method: :delete,
260
+ path: path,
261
+ query: query_params,
262
+ headers: headers,
263
+ body: body)
264
+ end
265
+
266
+ # Returns device counts by day for the time range specified for this application
267
+ #
268
+ # Authentication:
269
+ # The client must be configured with a valid api
270
+ # access token to call this action. The token
271
+ # must include at least one of the following scopes:
272
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.deviceCounts.
273
+ #
274
+ # Parameters:
275
+ # * {string} applicationId - ID of the associated application
276
+ # * {string} start - Start of range for device count query (ms since epoch)
277
+ # * {string} end - End of range for device count query (ms since epoch)
278
+ # * {string} losantdomain - Domain scope of request (rarely needed)
279
+ # * {boolean} _actions - Return resource actions in response
280
+ # * {boolean} _links - Return resource link in response
281
+ # * {boolean} _embedded - Return embedded resources in response
282
+ #
283
+ # Responses:
284
+ # * 200 - Device counts by day (https://api.losant.com/#/definitions/deviceCounts)
285
+ #
286
+ # Errors:
287
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
288
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
289
+ def device_counts(params = {})
290
+ params = Utils.symbolize_hash_keys(params)
291
+ query_params = { _actions: false, _links: true, _embedded: true }
292
+ headers = {}
293
+ body = nil
294
+
295
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
296
+
297
+ query_params[:start] = params[:start] if params.has_key?(:start)
298
+ query_params[:end] = params[:end] if params.has_key?(:end)
299
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
300
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
301
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
302
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
303
+
304
+ path = "/applications/#{params[:applicationId]}/deviceCounts"
305
+
306
+ @client.request(
307
+ method: :get,
308
+ path: path,
309
+ query: query_params,
310
+ headers: headers,
311
+ body: body)
312
+ end
313
+
314
+ # Export an application and all of its resources
315
+ #
316
+ # Authentication:
317
+ # The client must be configured with a valid api
318
+ # access token to call this action. The token
319
+ # must include at least one of the following scopes:
320
+ # all.Application, all.Organization, all.User, application.*, or application.export.
321
+ #
322
+ # Parameters:
323
+ # * {string} applicationId - ID of the associated application
324
+ # * {hash} options - Object containing export application options (https://api.losant.com/#/definitions/applicationExportPost)
325
+ # * {string} losantdomain - Domain scope of request (rarely needed)
326
+ # * {boolean} _actions - Return resource actions in response
327
+ # * {boolean} _links - Return resource link in response
328
+ # * {boolean} _embedded - Return embedded resources in response
329
+ #
330
+ # Responses:
331
+ # * 200 - a url to download the zip of exported resources (https://api.losant.com/#/definitions/applicationExportResult)
332
+ # * 202 - If application was enqueued to be exported (https://api.losant.com/#/definitions/jobEnqueuedResult)
333
+ #
334
+ # Errors:
335
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
336
+ # * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
337
+ def export(params = {})
338
+ params = Utils.symbolize_hash_keys(params)
339
+ query_params = { _actions: false, _links: true, _embedded: true }
340
+ headers = {}
341
+ body = nil
342
+
343
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
344
+ raise ArgumentError.new("options is required") unless params.has_key?(:options)
345
+
346
+ body = params[:options] if params.has_key?(:options)
347
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
348
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
349
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
350
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
351
+
352
+ path = "/applications/#{params[:applicationId]}/export"
353
+
354
+ @client.request(
355
+ method: :post,
356
+ path: path,
357
+ query: query_params,
358
+ headers: headers,
359
+ body: body)
360
+ end
361
+
362
+ # Returns success when a job has been enqueued to archive all selected data tables
363
+ #
364
+ # Authentication:
365
+ # The client must be configured with a valid api
366
+ # access token to call this action. The token
367
+ # must include at least one of the following scopes:
368
+ # all.Application, all.Organization, all.User, application.*, or application.fullDataTablesArchive.
369
+ #
370
+ # Parameters:
371
+ # * {string} applicationId - ID of the associated application
372
+ # * {string} losantdomain - Domain scope of request (rarely needed)
373
+ # * {boolean} _actions - Return resource actions in response
374
+ # * {boolean} _links - Return resource link in response
375
+ # * {boolean} _embedded - Return embedded resources in response
376
+ #
377
+ # Responses:
378
+ # * 202 - Enqueued a job to archive all selected data tables of this application archive location (https://api.losant.com/#/definitions/jobEnqueuedResult)
379
+ #
380
+ # Errors:
381
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
382
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
383
+ def full_data_tables_archive(params = {})
384
+ params = Utils.symbolize_hash_keys(params)
385
+ query_params = { _actions: false, _links: true, _embedded: true }
386
+ headers = {}
387
+ body = nil
388
+
389
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
390
+
391
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
392
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
393
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
394
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
395
+
396
+ path = "/applications/#{params[:applicationId]}/fullDataTablesArchive"
397
+
398
+ @client.request(
399
+ method: :get,
400
+ path: path,
401
+ query: query_params,
402
+ headers: headers,
403
+ body: body)
404
+ end
405
+
406
+ # Returns success when a job has been enqueued to archive all current events
407
+ #
408
+ # Authentication:
409
+ # The client must be configured with a valid api
410
+ # access token to call this action. The token
411
+ # must include at least one of the following scopes:
412
+ # all.Application, all.Organization, all.User, application.*, or application.fullEventsArchive.
413
+ #
414
+ # Parameters:
415
+ # * {string} applicationId - ID of the associated application
416
+ # * {string} losantdomain - Domain scope of request (rarely needed)
417
+ # * {boolean} _actions - Return resource actions in response
418
+ # * {boolean} _links - Return resource link in response
419
+ # * {boolean} _embedded - Return embedded resources in response
420
+ #
421
+ # Responses:
422
+ # * 202 - Enqueued a job to archive all events to this application archive location (https://api.losant.com/#/definitions/jobEnqueuedResult)
423
+ #
424
+ # Errors:
425
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
426
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
427
+ def full_events_archive(params = {})
428
+ params = Utils.symbolize_hash_keys(params)
429
+ query_params = { _actions: false, _links: true, _embedded: true }
430
+ headers = {}
431
+ body = nil
432
+
433
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
434
+
435
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
436
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
437
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
438
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
439
+
440
+ path = "/applications/#{params[:applicationId]}/fullEventsArchive"
441
+
442
+ @client.request(
443
+ method: :get,
444
+ path: path,
445
+ query: query_params,
446
+ headers: headers,
447
+ body: body)
448
+ end
449
+
450
+ # Retrieves information on an application
451
+ #
452
+ # Authentication:
453
+ # The client must be configured with a valid api
454
+ # access token to call this action. The token
455
+ # must include at least one of the following scopes:
456
+ # all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, application.*, or application.get.
457
+ #
458
+ # Parameters:
459
+ # * {string} applicationId - ID of the associated application
460
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from application summary
461
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in application summary
462
+ # * {string} losantdomain - Domain scope of request (rarely needed)
463
+ # * {boolean} _actions - Return resource actions in response
464
+ # * {boolean} _links - Return resource link in response
465
+ # * {boolean} _embedded - Return embedded resources in response
466
+ #
467
+ # Responses:
468
+ # * 200 - Application information (https://api.losant.com/#/definitions/application)
469
+ #
470
+ # Errors:
471
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
472
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
473
+ def get(params = {})
474
+ params = Utils.symbolize_hash_keys(params)
475
+ query_params = { _actions: false, _links: true, _embedded: true }
476
+ headers = {}
477
+ body = nil
478
+
479
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
480
+
481
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
482
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
483
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
484
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
485
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
486
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
487
+
488
+ path = "/applications/#{params[:applicationId]}"
489
+
490
+ @client.request(
491
+ method: :get,
492
+ path: path,
493
+ query: query_params,
494
+ headers: headers,
495
+ body: body)
496
+ end
497
+
498
+ # Updates an application global at the given key
499
+ #
500
+ # Authentication:
501
+ # The client must be configured with a valid api
502
+ # access token to call this action. The token
503
+ # must include at least one of the following scopes:
504
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, application.*, or application.patch.
505
+ #
506
+ # Parameters:
507
+ # * {string} applicationId - ID of the associated application
508
+ # * {hash} globals - Array of objects containing new application global information (https://api.losant.com/#/definitions/applicationGlobalPatch)
509
+ # * {string} losantdomain - Domain scope of request (rarely needed)
510
+ # * {boolean} _actions - Return resource actions in response
511
+ # * {boolean} _links - Return resource link in response
512
+ # * {boolean} _embedded - Return embedded resources in response
513
+ #
514
+ # Responses:
515
+ # * 200 - Updated application information (https://api.losant.com/#/definitions/application)
516
+ #
517
+ # Errors:
518
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
519
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
520
+ def globals(params = {})
521
+ params = Utils.symbolize_hash_keys(params)
522
+ query_params = { _actions: false, _links: true, _embedded: true }
523
+ headers = {}
524
+ body = nil
525
+
526
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
527
+ raise ArgumentError.new("globals is required") unless params.has_key?(:globals)
528
+
529
+ body = params[:globals] if params.has_key?(:globals)
530
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
531
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
532
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
533
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
534
+
535
+ path = "/applications/#{params[:applicationId]}/globals"
536
+
537
+ @client.request(
538
+ method: :patch,
539
+ path: path,
540
+ query: query_params,
541
+ headers: headers,
542
+ body: body)
543
+ end
544
+
545
+ # Publishes the given message to the given MQTT topic
546
+ #
547
+ # Authentication:
548
+ # The client must be configured with a valid api
549
+ # access token to call this action. The token
550
+ # must include at least one of the following scopes:
551
+ # all.Application, all.Organization, all.User, application.*, or application.mqttPublishMessage.
552
+ #
553
+ # Parameters:
554
+ # * {string} applicationId - ID of the associated application
555
+ # * {hash} payload - Object containing topic and message (https://api.losant.com/#/definitions/mqttPublishBody)
556
+ # * {string} losantdomain - Domain scope of request (rarely needed)
557
+ # * {boolean} _actions - Return resource actions in response
558
+ # * {boolean} _links - Return resource link in response
559
+ # * {boolean} _embedded - Return embedded resources in response
560
+ #
561
+ # Responses:
562
+ # * 200 - Message successfully published (https://api.losant.com/#/definitions/success)
563
+ #
564
+ # Errors:
565
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
566
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
567
+ def mqtt_publish_message(params = {})
568
+ params = Utils.symbolize_hash_keys(params)
569
+ query_params = { _actions: false, _links: true, _embedded: true }
570
+ headers = {}
571
+ body = nil
572
+
573
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
574
+ raise ArgumentError.new("payload is required") unless params.has_key?(:payload)
575
+
576
+ body = params[:payload] if params.has_key?(:payload)
577
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
578
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
579
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
580
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
581
+
582
+ path = "/applications/#{params[:applicationId]}/mqttPublishMessage"
583
+
584
+ @client.request(
585
+ method: :post,
586
+ path: path,
587
+ query: query_params,
588
+ headers: headers,
589
+ body: body)
590
+ end
591
+
592
+ # Returns notebook execution usage by day for the time range specified for this application
593
+ #
594
+ # Authentication:
595
+ # The client must be configured with a valid api
596
+ # access token to call this action. The token
597
+ # must include at least one of the following scopes:
598
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.notebookMinuteCounts.
599
+ #
600
+ # Parameters:
601
+ # * {string} applicationId - ID of the associated application
602
+ # * {string} start - Start of range for notebook execution query (ms since epoch)
603
+ # * {string} end - End of range for notebook execution query (ms since epoch)
604
+ # * {string} losantdomain - Domain scope of request (rarely needed)
605
+ # * {boolean} _actions - Return resource actions in response
606
+ # * {boolean} _links - Return resource link in response
607
+ # * {boolean} _embedded - Return embedded resources in response
608
+ #
609
+ # Responses:
610
+ # * 200 - Notebook usage information (https://api.losant.com/#/definitions/notebookMinuteCounts)
611
+ #
612
+ # Errors:
613
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
614
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
615
+ def notebook_minute_counts(params = {})
616
+ params = Utils.symbolize_hash_keys(params)
617
+ query_params = { _actions: false, _links: true, _embedded: true }
618
+ headers = {}
619
+ body = nil
620
+
621
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
622
+
623
+ query_params[:start] = params[:start] if params.has_key?(:start)
624
+ query_params[:end] = params[:end] if params.has_key?(:end)
625
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
626
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
627
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
628
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
629
+
630
+ path = "/applications/#{params[:applicationId]}/notebookMinuteCounts"
631
+
632
+ @client.request(
633
+ method: :get,
634
+ path: path,
635
+ query: query_params,
636
+ headers: headers,
637
+ body: body)
638
+ end
639
+
640
+ # Updates information about an application
641
+ #
642
+ # Authentication:
643
+ # The client must be configured with a valid api
644
+ # access token to call this action. The token
645
+ # must include at least one of the following scopes:
646
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, application.*, or application.patch.
647
+ #
648
+ # Parameters:
649
+ # * {string} applicationId - ID of the associated application
650
+ # * {hash} application - Object containing new application properties (https://api.losant.com/#/definitions/applicationPatch)
651
+ # * {string} summaryExclude - Comma-separated list of summary fields to exclude from application summary
652
+ # * {string} summaryInclude - Comma-separated list of summary fields to include in application summary
653
+ # * {string} losantdomain - Domain scope of request (rarely needed)
654
+ # * {boolean} _actions - Return resource actions in response
655
+ # * {boolean} _links - Return resource link in response
656
+ # * {boolean} _embedded - Return embedded resources in response
657
+ #
658
+ # Responses:
659
+ # * 200 - Updated application information (https://api.losant.com/#/definitions/application)
660
+ #
661
+ # Errors:
662
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
663
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
664
+ def patch(params = {})
665
+ params = Utils.symbolize_hash_keys(params)
666
+ query_params = { _actions: false, _links: true, _embedded: true }
667
+ headers = {}
668
+ body = nil
669
+
670
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
671
+ raise ArgumentError.new("application is required") unless params.has_key?(:application)
672
+
673
+ body = params[:application] if params.has_key?(:application)
674
+ query_params[:summaryExclude] = params[:summaryExclude] if params.has_key?(:summaryExclude)
675
+ query_params[:summaryInclude] = params[:summaryInclude] if params.has_key?(:summaryInclude)
676
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
677
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
678
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
679
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
680
+
681
+ path = "/applications/#{params[:applicationId]}"
682
+
683
+ @client.request(
684
+ method: :patch,
685
+ path: path,
686
+ query: query_params,
687
+ headers: headers,
688
+ body: body)
689
+ end
690
+
691
+ # Returns payload counts for the time range specified for this application
692
+ #
693
+ # Authentication:
694
+ # The client must be configured with a valid api
695
+ # access token to call this action. The token
696
+ # must include at least one of the following scopes:
697
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.payloadCounts.
698
+ #
699
+ # Parameters:
700
+ # * {string} applicationId - ID of the associated application
701
+ # * {string} start - Start of range for payload count query (ms since epoch)
702
+ # * {string} end - End of range for payload count query (ms since epoch)
703
+ # * {string} losantdomain - Domain scope of request (rarely needed)
704
+ # * {boolean} _actions - Return resource actions in response
705
+ # * {boolean} _links - Return resource link in response
706
+ # * {boolean} _embedded - Return embedded resources in response
707
+ #
708
+ # Responses:
709
+ # * 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
710
+ #
711
+ # Errors:
712
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
713
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
714
+ def payload_counts(params = {})
715
+ params = Utils.symbolize_hash_keys(params)
716
+ query_params = { _actions: false, _links: true, _embedded: true }
717
+ headers = {}
718
+ body = nil
719
+
720
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
721
+
722
+ query_params[:start] = params[:start] if params.has_key?(:start)
723
+ query_params[:end] = params[:end] if params.has_key?(:end)
724
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
725
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
726
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
727
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
728
+
729
+ path = "/applications/#{params[:applicationId]}/payloadCounts"
730
+
731
+ @client.request(
732
+ method: :get,
733
+ path: path,
734
+ query: query_params,
735
+ headers: headers,
736
+ body: body)
737
+ end
738
+
739
+ # Returns payload counts per resolution in the time range specified for this application
740
+ #
741
+ # Authentication:
742
+ # The client must be configured with a valid api
743
+ # access token to call this action. The token
744
+ # must include at least one of the following scopes:
745
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.payloadCountsBreakdown.
746
+ #
747
+ # Parameters:
748
+ # * {string} applicationId - ID of the associated application
749
+ # * {string} start - Start of range for payload count query (ms since epoch)
750
+ # * {string} end - End of range for payload count query (ms since epoch)
751
+ # * {string} resolution - Resolution in milliseconds. Accepted values are: 86400000, 3600000
752
+ # * {string} asBytes - If the resulting stats should be returned as bytes
753
+ # * {string} includeNonBillable - If non-billable payloads should be included in the result
754
+ # * {string} losantdomain - Domain scope of request (rarely needed)
755
+ # * {boolean} _actions - Return resource actions in response
756
+ # * {boolean} _links - Return resource link in response
757
+ # * {boolean} _embedded - Return embedded resources in response
758
+ #
759
+ # Responses:
760
+ # * 200 - Sum of payload counts by date (https://api.losant.com/#/definitions/payloadCountsBreakdown)
761
+ #
762
+ # Errors:
763
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
764
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
765
+ def payload_counts_breakdown(params = {})
766
+ params = Utils.symbolize_hash_keys(params)
767
+ query_params = { _actions: false, _links: true, _embedded: true }
768
+ headers = {}
769
+ body = nil
770
+
771
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
772
+
773
+ query_params[:start] = params[:start] if params.has_key?(:start)
774
+ query_params[:end] = params[:end] if params.has_key?(:end)
775
+ query_params[:resolution] = params[:resolution] if params.has_key?(:resolution)
776
+ query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes)
777
+ query_params[:includeNonBillable] = params[:includeNonBillable] if params.has_key?(:includeNonBillable)
778
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
779
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
780
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
781
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
782
+
783
+ path = "/applications/#{params[:applicationId]}/payloadCountsBreakdown"
784
+
785
+ @client.request(
786
+ method: :get,
787
+ path: path,
788
+ query: query_params,
789
+ headers: headers,
790
+ body: body)
791
+ end
792
+
793
+ # Get the current application readme information
794
+ #
795
+ # Authentication:
796
+ # The client must be configured with a valid api
797
+ # access token to call this action. The token
798
+ # must include at least one of the following scopes:
799
+ # all.Application, all.Application.cli, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.cli, all.User.read, application.*, or application.get.
800
+ #
801
+ # Parameters:
802
+ # * {string} applicationId - ID of the associated application
803
+ # * {string} losantdomain - Domain scope of request (rarely needed)
804
+ # * {boolean} _actions - Return resource actions in response
805
+ # * {boolean} _links - Return resource link in response
806
+ # * {boolean} _embedded - Return embedded resources in response
807
+ #
808
+ # Responses:
809
+ # * 200 - The application readme information (https://api.losant.com/#/definitions/applicationReadme)
810
+ #
811
+ # Errors:
812
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
813
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
814
+ def readme(params = {})
815
+ params = Utils.symbolize_hash_keys(params)
816
+ query_params = { _actions: false, _links: true, _embedded: true }
817
+ headers = {}
818
+ body = nil
819
+
820
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
821
+
822
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
823
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
824
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
825
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
826
+
827
+ path = "/applications/#{params[:applicationId]}/readme"
828
+
829
+ @client.request(
830
+ method: :get,
831
+ path: path,
832
+ query: query_params,
833
+ headers: headers,
834
+ body: body)
835
+ end
836
+
837
+ # Update the current application readme information
838
+ #
839
+ # Authentication:
840
+ # The client must be configured with a valid api
841
+ # access token to call this action. The token
842
+ # must include at least one of the following scopes:
843
+ # all.Application, all.Application.cli, all.Organization, all.User, all.User.cli, application.*, or application.patch.
844
+ #
845
+ # Parameters:
846
+ # * {string} applicationId - ID of the associated application
847
+ # * {hash} readme - Object containing new readme information (https://api.losant.com/#/definitions/applicationReadmePatch)
848
+ # * {string} losantdomain - Domain scope of request (rarely needed)
849
+ # * {boolean} _actions - Return resource actions in response
850
+ # * {boolean} _links - Return resource link in response
851
+ # * {boolean} _embedded - Return embedded resources in response
852
+ #
853
+ # Responses:
854
+ # * 200 - Updated readme information (https://api.losant.com/#/definitions/applicationReadme)
855
+ #
856
+ # Errors:
857
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
858
+ # * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
859
+ def readme_patch(params = {})
860
+ params = Utils.symbolize_hash_keys(params)
861
+ query_params = { _actions: false, _links: true, _embedded: true }
862
+ headers = {}
863
+ body = nil
864
+
865
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
866
+ raise ArgumentError.new("readme is required") unless params.has_key?(:readme)
867
+
868
+ body = params[:readme] if params.has_key?(:readme)
869
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
870
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
871
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
872
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
873
+
874
+ path = "/applications/#{params[:applicationId]}/readme"
875
+
876
+ @client.request(
877
+ method: :patch,
878
+ path: path,
879
+ query: query_params,
880
+ headers: headers,
881
+ body: body)
882
+ end
883
+
884
+ # Search across an application's resources by target identifier
885
+ #
886
+ # Authentication:
887
+ # The client must be configured with a valid api
888
+ # access token to call this action. The token
889
+ # must include at least one of the following scopes:
890
+ # all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.search.
891
+ #
892
+ # Parameters:
893
+ # * {string} applicationId - ID of the associated application
894
+ # * {string} filter - The partial resource name being searched for
895
+ # * {string} losantdomain - Domain scope of request (rarely needed)
896
+ # * {boolean} _actions - Return resource actions in response
897
+ # * {boolean} _links - Return resource link in response
898
+ # * {boolean} _embedded - Return embedded resources in response
899
+ #
900
+ # Responses:
901
+ # * 200 - An array of resource ids, names, descriptions, and types matching the search query (https://api.losant.com/#/definitions/applicationSearchResult)
902
+ #
903
+ # Errors:
904
+ # * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
905
+ # * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
906
+ def search(params = {})
907
+ params = Utils.symbolize_hash_keys(params)
908
+ query_params = { _actions: false, _links: true, _embedded: true }
909
+ headers = {}
910
+ body = nil
911
+
912
+ raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
913
+ raise ArgumentError.new("filter is required") unless params.has_key?(:filter)
914
+
915
+ query_params[:filter] = params[:filter] if params.has_key?(:filter)
916
+ headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
917
+ query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
918
+ query_params[:_links] = params[:_links] if params.has_key?(:_links)
919
+ query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
920
+
921
+ path = "/applications/#{params[:applicationId]}/search"
922
+
923
+ @client.request(
924
+ method: :get,
925
+ path: path,
926
+ query: query_params,
927
+ headers: headers,
928
+ body: body)
929
+ end
930
+
931
+ end
932
+ end