losant_rest 1.20.0 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +139 -13
- data/docs/_schemas.md +7585 -2999
- data/docs/instanceNotificationRule.md +219 -0
- data/docs/instanceNotificationRules.md +91 -0
- data/lib/platform_rest/client.rb +10 -2
- data/lib/platform_rest/instance_notification_rule.rb +275 -0
- data/lib/platform_rest/instance_notification_rules.rb +136 -0
- data/lib/platform_rest/version.rb +1 -1
- data/lib/platform_rest.rb +2 -0
- data/schemas/apiTokenPost.json +9 -0
- data/schemas/applicationDashboardPost.json +94 -8
- data/schemas/applicationSearchResult.json +46 -6
- data/schemas/credentialLinkedResources.json +426 -0
- data/schemas/dashboard.json +94 -8
- data/schemas/dashboardPatch.json +94 -8
- data/schemas/dashboardPost.json +94 -8
- data/schemas/dashboards.json +94 -8
- data/schemas/experienceEndpoint.json +6 -1
- data/schemas/experienceEndpointPatch.json +6 -1
- data/schemas/experienceEndpointPost.json +6 -1
- data/schemas/experienceEndpoints.json +6 -1
- data/schemas/experienceLinkedResources.json +432 -1
- data/schemas/flow.json +142 -0
- data/schemas/flowPatch.json +142 -0
- data/schemas/flowPost.json +142 -0
- data/schemas/flowVersion.json +284 -0
- data/schemas/flowVersionPost.json +142 -0
- data/schemas/flowVersions.json +284 -0
- data/schemas/flows.json +142 -0
- data/schemas/flowsImportPost.json +284 -0
- data/schemas/flowsImportResult.json +426 -0
- data/schemas/githubLogin.json +9 -0
- data/schemas/instance.json +9 -0
- data/schemas/instanceAuditLog.json +2 -1
- data/schemas/instanceAuditLogFilter.json +2 -1
- data/schemas/instanceOrg.json +4 -0
- data/schemas/instanceOrgs.json +4 -0
- data/schemas/instances.json +9 -0
- data/schemas/notificationRule.json +161 -0
- data/schemas/notificationRuleDeliveryLogs.json +123 -0
- data/schemas/notificationRuleEvaluationOptions.json +10 -0
- data/schemas/notificationRulePatch.json +128 -0
- data/schemas/notificationRulePost.json +140 -0
- data/schemas/notificationRules.json +212 -0
- data/schemas/samlResponse.json +9 -0
- data/schemas/userCredentials.json +9 -0
- data/schemas/userPost.json +9 -0
- metadata +12 -2
@@ -0,0 +1,136 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
#
|
3
|
+
# Copyright (c) 2024 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 Instance Notification Rules Resource
|
28
|
+
class InstanceNotificationRules
|
29
|
+
|
30
|
+
def initialize(client)
|
31
|
+
@client = client
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the notification rules for an instance
|
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.Instance, all.Instance.read, all.User, all.User.read, instanceNotificationRules.*, or instanceNotificationRules.get.
|
41
|
+
#
|
42
|
+
# Parameters:
|
43
|
+
# * {string} instanceId - ID associated with the instance
|
44
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated
|
45
|
+
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
46
|
+
# * {string} page - Which page of results to return
|
47
|
+
# * {string} perPage - How many items to return per page
|
48
|
+
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
49
|
+
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
50
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
51
|
+
# * {boolean} _actions - Return resource actions in response
|
52
|
+
# * {boolean} _links - Return resource link in response
|
53
|
+
# * {boolean} _embedded - Return embedded resources in response
|
54
|
+
#
|
55
|
+
# Responses:
|
56
|
+
# * 200 - Collection of notification rules (https://api.losant.com/#/definitions/notificationRules)
|
57
|
+
#
|
58
|
+
# Errors:
|
59
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
60
|
+
def get(params = {})
|
61
|
+
params = Utils.symbolize_hash_keys(params)
|
62
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
63
|
+
headers = {}
|
64
|
+
body = nil
|
65
|
+
|
66
|
+
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
67
|
+
|
68
|
+
query_params[:sortField] = params[:sortField] if params.has_key?(:sortField)
|
69
|
+
query_params[:sortDirection] = params[:sortDirection] if params.has_key?(:sortDirection)
|
70
|
+
query_params[:page] = params[:page] if params.has_key?(:page)
|
71
|
+
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
72
|
+
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
73
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
74
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
75
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
76
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
77
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
78
|
+
|
79
|
+
path = "/instances/#{params[:instanceId]}/notification-rules"
|
80
|
+
|
81
|
+
@client.request(
|
82
|
+
method: :get,
|
83
|
+
path: path,
|
84
|
+
query: query_params,
|
85
|
+
headers: headers,
|
86
|
+
body: body)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Create a new notification rule for an instance
|
90
|
+
#
|
91
|
+
# Authentication:
|
92
|
+
# The client must be configured with a valid api
|
93
|
+
# access token to call this action. The token
|
94
|
+
# must include at least one of the following scopes:
|
95
|
+
# all.Instance, all.User, instanceNotificationRules.*, or instanceNotificationRules.post.
|
96
|
+
#
|
97
|
+
# Parameters:
|
98
|
+
# * {string} instanceId - ID associated with the instance
|
99
|
+
# * {hash} notificationRule - Notification rule information (https://api.losant.com/#/definitions/notificationRulePost)
|
100
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
101
|
+
# * {boolean} _actions - Return resource actions in response
|
102
|
+
# * {boolean} _links - Return resource link in response
|
103
|
+
# * {boolean} _embedded - Return embedded resources in response
|
104
|
+
#
|
105
|
+
# Responses:
|
106
|
+
# * 201 - The successfully created notification rule (https://api.losant.com/#/definitions/notificationRule)
|
107
|
+
#
|
108
|
+
# Errors:
|
109
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
110
|
+
def post(params = {})
|
111
|
+
params = Utils.symbolize_hash_keys(params)
|
112
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
113
|
+
headers = {}
|
114
|
+
body = nil
|
115
|
+
|
116
|
+
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
117
|
+
raise ArgumentError.new("notificationRule is required") unless params.has_key?(:notificationRule)
|
118
|
+
|
119
|
+
body = params[:notificationRule] if params.has_key?(:notificationRule)
|
120
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
121
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
122
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
123
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
124
|
+
|
125
|
+
path = "/instances/#{params[:instanceId]}/notification-rules"
|
126
|
+
|
127
|
+
@client.request(
|
128
|
+
method: :post,
|
129
|
+
path: path,
|
130
|
+
query: query_params,
|
131
|
+
headers: headers,
|
132
|
+
body: body)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
end
|
data/lib/platform_rest.rb
CHANGED
@@ -89,6 +89,8 @@ require_relative "platform_rest/instance_custom_node"
|
|
89
89
|
require_relative "platform_rest/instance_custom_nodes"
|
90
90
|
require_relative "platform_rest/instance_member"
|
91
91
|
require_relative "platform_rest/instance_members"
|
92
|
+
require_relative "platform_rest/instance_notification_rule"
|
93
|
+
require_relative "platform_rest/instance_notification_rules"
|
92
94
|
require_relative "platform_rest/instance_org"
|
93
95
|
require_relative "platform_rest/instance_org_invite"
|
94
96
|
require_relative "platform_rest/instance_org_invites"
|
data/schemas/apiTokenPost.json
CHANGED
@@ -430,6 +430,15 @@
|
|
430
430
|
"instanceCustomNode.delete",
|
431
431
|
"instanceCustomNode.errors",
|
432
432
|
"instanceCustomNode.stats",
|
433
|
+
"instanceNotificationRules.*",
|
434
|
+
"instanceNotificationRules.get",
|
435
|
+
"instanceNotificationRules.post",
|
436
|
+
"instanceNotificationRule.*",
|
437
|
+
"instanceNotificationRule.get",
|
438
|
+
"instanceNotificationRule.patch",
|
439
|
+
"instanceNotificationRule.delete",
|
440
|
+
"instanceNotificationRule.evaluate",
|
441
|
+
"instanceNotificationRule.logs",
|
433
442
|
"instanceSandbox.*",
|
434
443
|
"instanceSandbox.get",
|
435
444
|
"instanceSandbox.delete",
|
@@ -303,6 +303,10 @@
|
|
303
303
|
"additionalProperties": false
|
304
304
|
}
|
305
305
|
},
|
306
|
+
"query": {
|
307
|
+
"type": "string",
|
308
|
+
"maxLength": 32767
|
309
|
+
},
|
306
310
|
"label": {
|
307
311
|
"type": "string",
|
308
312
|
"maxLength": 255
|
@@ -563,6 +567,10 @@
|
|
563
567
|
"additionalProperties": false
|
564
568
|
}
|
565
569
|
},
|
570
|
+
"query": {
|
571
|
+
"type": "string",
|
572
|
+
"maxLength": 32767
|
573
|
+
},
|
566
574
|
"duration": {
|
567
575
|
"oneOf": [
|
568
576
|
{
|
@@ -746,6 +754,10 @@
|
|
746
754
|
"additionalProperties": false
|
747
755
|
}
|
748
756
|
},
|
757
|
+
"query": {
|
758
|
+
"type": "string",
|
759
|
+
"maxLength": 32767
|
760
|
+
},
|
749
761
|
"duration": {
|
750
762
|
"oneOf": [
|
751
763
|
{
|
@@ -1488,6 +1500,32 @@
|
|
1488
1500
|
"maxLength": 255
|
1489
1501
|
}
|
1490
1502
|
},
|
1503
|
+
"deviceTags": {
|
1504
|
+
"type": "array",
|
1505
|
+
"maxItems": 100,
|
1506
|
+
"items": {
|
1507
|
+
"type": "object",
|
1508
|
+
"properties": {
|
1509
|
+
"key": {
|
1510
|
+
"type": "string",
|
1511
|
+
"maxLength": 255
|
1512
|
+
},
|
1513
|
+
"value": {
|
1514
|
+
"type": "string",
|
1515
|
+
"maxLength": 255
|
1516
|
+
},
|
1517
|
+
"fromCtx": {
|
1518
|
+
"type": "string",
|
1519
|
+
"maxLength": 255
|
1520
|
+
}
|
1521
|
+
},
|
1522
|
+
"additionalProperties": false
|
1523
|
+
}
|
1524
|
+
},
|
1525
|
+
"query": {
|
1526
|
+
"type": "string",
|
1527
|
+
"maxLength": 32767
|
1528
|
+
},
|
1491
1529
|
"includeDeviceInfo": {
|
1492
1530
|
"type": "boolean"
|
1493
1531
|
}
|
@@ -1589,6 +1627,10 @@
|
|
1589
1627
|
"additionalProperties": false
|
1590
1628
|
}
|
1591
1629
|
},
|
1630
|
+
"query": {
|
1631
|
+
"type": "string",
|
1632
|
+
"maxLength": 32767
|
1633
|
+
},
|
1592
1634
|
"duration": {
|
1593
1635
|
"oneOf": [
|
1594
1636
|
{
|
@@ -2059,6 +2101,10 @@
|
|
2059
2101
|
"additionalProperties": false
|
2060
2102
|
}
|
2061
2103
|
},
|
2104
|
+
"query": {
|
2105
|
+
"type": "string",
|
2106
|
+
"maxLength": 32767
|
2107
|
+
},
|
2062
2108
|
"label": {
|
2063
2109
|
"type": "string",
|
2064
2110
|
"maxLength": 255
|
@@ -2450,6 +2496,10 @@
|
|
2450
2496
|
},
|
2451
2497
|
"additionalProperties": false
|
2452
2498
|
}
|
2499
|
+
},
|
2500
|
+
"query": {
|
2501
|
+
"type": "string",
|
2502
|
+
"maxLength": 32767
|
2453
2503
|
}
|
2454
2504
|
},
|
2455
2505
|
"additionalProperties": false
|
@@ -2637,6 +2687,10 @@
|
|
2637
2687
|
"additionalProperties": false
|
2638
2688
|
}
|
2639
2689
|
},
|
2690
|
+
"query": {
|
2691
|
+
"type": "string",
|
2692
|
+
"maxLength": 32767
|
2693
|
+
},
|
2640
2694
|
"duration": {
|
2641
2695
|
"oneOf": [
|
2642
2696
|
{
|
@@ -2671,10 +2725,6 @@
|
|
2671
2725
|
"normal",
|
2672
2726
|
"satellite"
|
2673
2727
|
]
|
2674
|
-
},
|
2675
|
-
"query": {
|
2676
|
-
"type": "string",
|
2677
|
-
"maxLength": 32767
|
2678
2728
|
}
|
2679
2729
|
},
|
2680
2730
|
"additionalProperties": false
|
@@ -3039,6 +3089,10 @@
|
|
3039
3089
|
"additionalProperties": false
|
3040
3090
|
}
|
3041
3091
|
},
|
3092
|
+
"query": {
|
3093
|
+
"type": "string",
|
3094
|
+
"maxLength": 32767
|
3095
|
+
},
|
3042
3096
|
"duration": {
|
3043
3097
|
"oneOf": [
|
3044
3098
|
{
|
@@ -3667,6 +3721,10 @@
|
|
3667
3721
|
"additionalProperties": false
|
3668
3722
|
}
|
3669
3723
|
},
|
3724
|
+
"query": {
|
3725
|
+
"type": "string",
|
3726
|
+
"maxLength": 32767
|
3727
|
+
},
|
3670
3728
|
"label": {
|
3671
3729
|
"type": "string",
|
3672
3730
|
"maxLength": 255
|
@@ -4019,6 +4077,10 @@
|
|
4019
4077
|
},
|
4020
4078
|
"additionalProperties": false
|
4021
4079
|
}
|
4080
|
+
},
|
4081
|
+
"query": {
|
4082
|
+
"type": "string",
|
4083
|
+
"maxLength": 32767
|
4022
4084
|
}
|
4023
4085
|
},
|
4024
4086
|
"additionalProperties": false
|
@@ -4253,6 +4315,10 @@
|
|
4253
4315
|
},
|
4254
4316
|
"additionalProperties": false
|
4255
4317
|
}
|
4318
|
+
},
|
4319
|
+
"query": {
|
4320
|
+
"type": "string",
|
4321
|
+
"maxLength": 32767
|
4256
4322
|
}
|
4257
4323
|
},
|
4258
4324
|
"additionalProperties": false
|
@@ -4445,6 +4511,10 @@
|
|
4445
4511
|
},
|
4446
4512
|
"additionalProperties": false
|
4447
4513
|
}
|
4514
|
+
},
|
4515
|
+
"query": {
|
4516
|
+
"type": "string",
|
4517
|
+
"maxLength": 32767
|
4448
4518
|
}
|
4449
4519
|
},
|
4450
4520
|
"additionalProperties": false
|
@@ -4635,6 +4705,10 @@
|
|
4635
4705
|
},
|
4636
4706
|
"additionalProperties": false
|
4637
4707
|
}
|
4708
|
+
},
|
4709
|
+
"query": {
|
4710
|
+
"type": "string",
|
4711
|
+
"maxLength": 32767
|
4638
4712
|
}
|
4639
4713
|
},
|
4640
4714
|
"additionalProperties": false
|
@@ -4805,6 +4879,10 @@
|
|
4805
4879
|
"additionalProperties": false
|
4806
4880
|
}
|
4807
4881
|
},
|
4882
|
+
"query": {
|
4883
|
+
"type": "string",
|
4884
|
+
"maxLength": 32767
|
4885
|
+
},
|
4808
4886
|
"commandName": {
|
4809
4887
|
"type": "string",
|
4810
4888
|
"maxLength": 255
|
@@ -4947,6 +5025,10 @@
|
|
4947
5025
|
"additionalProperties": false
|
4948
5026
|
}
|
4949
5027
|
},
|
5028
|
+
"query": {
|
5029
|
+
"type": "string",
|
5030
|
+
"maxLength": 32767
|
5031
|
+
},
|
4950
5032
|
"duration": {
|
4951
5033
|
"oneOf": [
|
4952
5034
|
{
|
@@ -5007,10 +5089,6 @@
|
|
5007
5089
|
"type": "string",
|
5008
5090
|
"maxLength": 32767
|
5009
5091
|
},
|
5010
|
-
"query": {
|
5011
|
-
"type": "string",
|
5012
|
-
"maxLength": 32767
|
5013
|
-
},
|
5014
5092
|
"resizedPins": {
|
5015
5093
|
"type": "boolean"
|
5016
5094
|
},
|
@@ -5323,6 +5401,10 @@
|
|
5323
5401
|
"additionalProperties": false
|
5324
5402
|
}
|
5325
5403
|
},
|
5404
|
+
"query": {
|
5405
|
+
"type": "string",
|
5406
|
+
"maxLength": 32767
|
5407
|
+
},
|
5326
5408
|
"label": {
|
5327
5409
|
"type": "string",
|
5328
5410
|
"maxLength": 255
|
@@ -5483,6 +5565,10 @@
|
|
5483
5565
|
"additionalProperties": false
|
5484
5566
|
}
|
5485
5567
|
},
|
5568
|
+
"query": {
|
5569
|
+
"type": "string",
|
5570
|
+
"maxLength": 32767
|
5571
|
+
},
|
5486
5572
|
"duration": {
|
5487
5573
|
"oneOf": [
|
5488
5574
|
{
|
@@ -12,18 +12,57 @@
|
|
12
12
|
"type": "string"
|
13
13
|
},
|
14
14
|
"metadata": {
|
15
|
-
"type": "object"
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
"type": "object",
|
16
|
+
"properties": {
|
17
|
+
"descriptor": {
|
18
|
+
"type": "string"
|
19
|
+
},
|
20
|
+
"parentDirectory": {
|
21
|
+
"type": "string"
|
22
|
+
},
|
23
|
+
"contentType": {
|
24
|
+
"type": "string"
|
25
|
+
}
|
26
|
+
}
|
19
27
|
},
|
20
28
|
"version": {
|
21
29
|
"type": "string"
|
22
30
|
},
|
31
|
+
"viewType": {
|
32
|
+
"type": "string",
|
33
|
+
"enum": [
|
34
|
+
"layout",
|
35
|
+
"page",
|
36
|
+
"component"
|
37
|
+
]
|
38
|
+
},
|
39
|
+
"flowClass": {
|
40
|
+
"type": "string",
|
41
|
+
"enum": [
|
42
|
+
"standalone",
|
43
|
+
"gateway",
|
44
|
+
"peripheral",
|
45
|
+
"floating",
|
46
|
+
"edgeCompute",
|
47
|
+
"system",
|
48
|
+
"embedded"
|
49
|
+
]
|
50
|
+
},
|
51
|
+
"deviceClass": {
|
52
|
+
"type": "string",
|
53
|
+
"enum": [
|
54
|
+
"cloud",
|
55
|
+
"edge",
|
56
|
+
"embedded",
|
57
|
+
"experience",
|
58
|
+
"customNode"
|
59
|
+
]
|
60
|
+
},
|
23
61
|
"_type": {
|
24
62
|
"type": "string",
|
25
63
|
"enum": [
|
26
64
|
"applicationApiToken",
|
65
|
+
"credential",
|
27
66
|
"dashboard",
|
28
67
|
"dataTable",
|
29
68
|
"deviceRecipe",
|
@@ -39,8 +78,9 @@
|
|
39
78
|
"file",
|
40
79
|
"flow",
|
41
80
|
"integration",
|
42
|
-
"
|
43
|
-
"
|
81
|
+
"notebook",
|
82
|
+
"resourceJob",
|
83
|
+
"webhook"
|
44
84
|
]
|
45
85
|
}
|
46
86
|
},
|