node-red-contrib-teamogy-api 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,654 +1,876 @@
1
1
  <script type="text/javascript">
2
- let requests = `[
3
- {"v":"r_companies", "e":"Contacts", "m":["GET","POST","PATCH"]},
2
+ let requests = `[
3
+ {"v":"r_users", "e":"Config - Users", "m":["GET","POST","PATCH"]},
4
+ {"v":"r_agencies", "e":"Config - Units", "m":["GET","POST","PATCH"]},
5
+
6
+ {"v":"r_companies", "e":"Contacts - Companies", "m":["GET","POST","PATCH"]},
7
+ {"v":"r_persons", "e":"Contacts - Persons", "m":["GET","POST","PATCH"]},
8
+
4
9
  {"v":"r_documents", "e":"Documents", "m":["GET","POST","PATCH"]},
5
10
  {"v":"r_jobs", "e":"Jobs", "m":["GET","POST","PATCH"]},
6
11
  {"v":"r_tasks", "e":"Tasks", "m":["GET","POST","PATCH"]},
7
- {"v":"r_time", "e":"Time", "m":["POST"]},
8
- {"v":"r_users", "e":"Users", "m":["GET","POST"]}
12
+ {"v":"r_time", "e":"Time", "m":["POST"]}
9
13
  ]`;
10
-
11
- let values1 = JSON.parse(requests)
12
-
13
- let views = `[
14
- {"v":"v_binders", "e":"Binders", "m":["GET"]},
15
- {"v":"v_brands", "e":"Brands", "m":["GET"]},
16
- {"v":"v_cashboxes", "e":"Cashboxes", "m":["GET"]},
17
- {"v":"v_companies", "e":"Companies", "m":["GET"]},
18
- {"v":"v_companies-client", "e":"Companies - client", "m":["GET"]},
19
- {"v":"v_companies-supplier", "e":"Companies - supplier", "m":["GET"]},
20
- {"v":"v_documents", "e":"Documents", "m":["GET"]},
21
- {"v":"v_documents-order-purchase", "e":"Documents order - purchase", "m":["GET"]},
22
- {"v":"v_documents-quotation-sales", "e":"Documents quotation - sales", "m":["GET"]},
23
- {"v":"v_gems", "e":"Gems", "m":["GET"]},
24
- {"v":"v_groups", "e":"Groups", "m":["GET"]},
25
- {"v":"v_internals-purchase", "e":"Internals - purchase", "m":["GET"]},
26
- {"v":"v_internals-sales", "e":"Internals - sales", "m":["GET"]},
27
- {"v":"v_intervals-absence", "e":"Intervals - absence", "m":["GET"]},
28
- {"v":"v_intervals-attendance", "e":"Intervals - attendance", "m":["GET"]},
29
- {"v":"v_intervals-track", "e":"Intervals - track", "m":["GET"]},
30
- {"v":"v_invoices-purchase", "e":"Invoices - purchase", "m":["GET"]},
31
- {"v":"v_invoices-sales", "e":"Invoices - sales", "m":["GET"]},
32
- {"v":"v_jobs", "e":"Jobs", "m":["GET"]},
33
- {"v":"v_journal", "e":"Journal", "m":["GET"]},
34
- {"v":"v_overheads-client", "e":"Overheads - client", "m":["GET"]},
35
- {"v":"v_overheads-internal", "e":"Overheads. - internal", "m":["GET"]},
14
+
15
+ let values1 = JSON.parse(requests);
16
+
17
+ let views = `[
18
+ {"v":"v_units", "e":"Config - Units", "m":["GET"]},
19
+ {"v":"v_users", "e":"Config - Users", "m":["GET"]},
20
+ {"v":"v_groups", "e":"Config - Groups", "m":["GET"]},
21
+
22
+ {"v":"v_companies", "e":"Contacts - Companies - All", "m":["GET"]},
23
+ {"v":"v_companies-client", "e":"Contacts - Companies - Clients only", "m":["GET"]},
24
+ {"v":"v_companies-supplier", "e":"Contacts - Companies - Suppliers only", "m":["GET"]},
25
+ {"v":"v_persons", "e":"Contacts - Persons", "m":["GET"]},
26
+ {"v":"v_brands", "e":"Contacts - Brands", "m":["GET"]},
27
+
28
+ {"v":"v_documents", "e":"Documents - All", "m":["GET"]},
29
+ {"v":"v_documents-order-purchase", "e":"Documents - Purchase Orders", "m":["GET"]},
30
+ {"v":"v_documents-quotation-sales", "e":"Documents - Sales Quotations", "m":["GET"]},
31
+
32
+ {"v":"v_invoices-purchase", "e":"Finance - Purchase Invoices", "m":["GET"]},
33
+ {"v":"v_invoices-sales", "e":"Finance - Sales Invoices", "m":["GET"]},
34
+ {"v":"v_internals-purchase", "e":"Finance - Purchase Internal Documents", "m":["GET"]},
35
+ {"v":"v_internals-sales", "e":"Finance - Sales Internal Documents", "m":["GET"]},
36
+ {"v":"v_overheads-client", "e":"Finance - Client Overheads", "m":["GET"]},
37
+ {"v":"v_overheads-internal", "e":"Finance - Internal Overheads", "m":["GET"]},
38
+ {"v":"v_cashboxes", "e":"Finance - Cashboxes", "m":["GET"]},
39
+ {"v":"v_journal", "e":"Finance - Journal", "m":["GET"]},
40
+
41
+ {"v":"v_intervals-absence", "e":"Time Intervals - Absences", "m":["GET"]},
42
+ {"v":"v_intervals-attendance", "e":"Time Intervals - Attendances", "m":["GET"]},
43
+ {"v":"v_intervals-track", "e":"Time Intervals - Time Tracks", "m":["GET"]},
44
+
45
+ {"v":"v_binders", "e":"Binders", "m":["GET"]},
36
46
  {"v":"v_opportunities", "e":"Opportunities", "m":["GET"]},
37
- {"v":"v_persons", "e":"Persons", "m":["GET"]},
47
+ {"v":"v_jobs", "e":"Jobs", "m":["GET"]},
38
48
  {"v":"v_tasks", "e":"Tasks", "m":["GET"]},
39
- {"v":"v_users", "e":"Users", "m":["GET"]}
49
+ {"v":"v_gems", "e":"Gems", "m":["GET"]}
50
+
40
51
  ]`;
41
-
42
- let values2 = JSON.parse(views)
43
-
44
- function decodeJwt(token) {
45
- try {
46
- return JSON.parse(atob(token.split(".")[1]));
47
- } catch (e) {
48
- return null;
49
- }
50
- }
51
52
 
53
+ let values2 = JSON.parse(views);
54
+
55
+ function decodeJwt(token) {
56
+ try {
57
+ return JSON.parse(atob(token.split(".")[1]));
58
+ } catch (e) {
59
+ return null;
60
+ }
61
+ }
52
62
  </script>
53
63
 
54
64
  <script type="text/x-red" data-template-name="teamogy-config">
55
-
65
+
56
66
  <div class="form-row">
57
67
  <label for="node-config-input-name"><i class="fa fa-tag"></i><span>Name</span></label>
58
68
  <input type="text" id="node-config-input-name" placeholder="name">
59
69
  </div>
60
-
70
+
61
71
  <div class="form-row">
62
72
  <ul style="min-width: 600px; margin-bottom: 20px;" id="config-tabs"></ul>
63
73
  </div>
64
-
74
+
65
75
  <div id="config-tabs-content" style="min-height: 170px;">
66
-
76
+
67
77
  <div id="config-tab-config" style="display: none;">
68
-
69
- <div class="form-row">
78
+
79
+ <div class="form-row">
70
80
  <label for="node-config-input-host"><i class="fa fa-server"></i> <span>Domain</span></label>
71
81
  <input type="text" id="node-config-input-host" placeholder="subdomain.teamogy.com">
72
- </div>
73
-
74
- <div class="form-row">
82
+ </div>
83
+
84
+ <div class="form-row">
75
85
  <label for="node-config-input-unit"><i class="fa fa-square-o"></i> <span>Unit/Agency</span></label>
76
86
  <input type="number" id="node-config-input-unit" min="0" max="100" step="1" placeholder="1" style="width: 20%">
77
87
  </div>
78
-
88
+
79
89
  <div class="form-row">
80
90
  <label for="node-config-input-token"><i class="fa fa-lock"></i> <span>Token</span></label>
81
91
  <input type="password" id="node-config-input-token" placeholder="token">
82
92
  </div>
83
-
84
- <div class="form-row">
85
- <label for="node-config-input-tokendata" style="vertical-align: top;"><i class="fa fa-lock"></i> <span>Token data</span></label>
86
- <label id="node-config-label-tokendata" style="width: 50%"></label>
87
- <input type="hidden" id="node-config-input-tokendata" placeholder="">
93
+
94
+ <div class="form-row">
95
+ <label for="node-config-input-tokendata" style="vertical-align: top;"><i class="fa fa-lock"></i> <span>Token data</span></label>
96
+ <label id="node-config-label-tokendata" style="width: 50%"></label>
97
+ <input type="hidden" id="node-config-input-tokendata" placeholder="">
88
98
  </div>
89
-
99
+
90
100
  <div class="form-row">
91
101
  <label for="node-config-input-apilimit"><i class="fa fa-step-forward"></i> <span>Req/min</span></label>
92
102
  <input type="number" id="node-config-input-apilimit" min="1" max="1000" step="1" placeholder="60" style="width: 20%">
93
103
  </div>
94
-
104
+
95
105
  </div>
96
-
106
+
97
107
  </div>
98
108
  </script>
99
109
 
100
110
  <script type="text/javascript">
101
- RED.nodes.registerType('teamogy-config', {
102
- category: "config",
103
- color: "#fe4c00",
104
- defaults: {
105
- name: {
106
- value: ""
107
- },
108
- host: {
109
- value: "",
110
- required: true
111
- },
112
- unit: {
113
- value: 1,
114
- required: true
115
- },
116
- tokendata: {
117
- value: "dfgd",
118
- required: false
119
- },
120
- apilimit: {
121
- value: 60,
122
- required: true
123
- }
124
- },
125
- credentials: {
126
- token: {
127
- type: "password",
128
- required: true
129
- },
130
- required: true
131
- },
132
- label: function() {
133
- if(!this.name) {
134
- this.name = this.host + "/" + this.unit;
135
- }
136
- return this.name;
137
- },
138
- labelStyle: function() {
139
- return this.name ? "node_label_italic" : "";
140
- },
141
- oneditprepare: function() {
142
- $('#node-config-label-tokendata').html(this.tokendata);
143
-
144
- $('#node-config-input-token').on('change', function() {
145
-
146
- if($(this).val() != '__PWRD__') {
147
-
148
- let pt = decodeJwt($('#node-config-input-token').val())
149
-
150
- if(pt == null) {
151
- $('#node-config-label-tokendata').html('Invalid token format')
152
- $('#node-config-input-tokendata').val('Invalid token format')
153
- } else {
154
- pt.iat = new Date(pt.iat * 1000).toISOString()
155
-
156
- let rt = ''
157
- $.each(pt, function( key, value ) {
158
- rt = rt + key + ": " + value + '<br>'
159
- });
160
-
161
- $('#node-config-label-tokendata').html(rt)
162
- $('#node-config-input-tokendata').val(rt)
163
- }
164
- }
165
-
166
- })
167
-
168
- $('#node-config-input-unit').on('change', function() {
169
- if(!$.isNumeric($(this).val())) { $(this).val(1) } else {
170
- if($(this).val() < 0 || $(this).val() > 100 ) { $(this).val(1) }
171
- }
172
- })
173
-
174
- $('#node-config-input-apilimit').on('change', function() {
175
- if(!$.isNumeric($(this).val())) { $(this).val(60) } else {
176
- if($(this).val() < 1 || $(this).val() > 1000 ) { $(this).val(60) }
177
- }
178
- })
179
-
180
- const tabs = RED.tabs.create({
181
- id: "config-tabs",
182
- onchange: function(tab) {
183
- $("#config-tabs-content").children().hide();
184
- $("#" + tab.id).show();
185
- }
186
- });
187
-
188
- tabs.addTab({
189
- id: "config-tab-config",
190
- label: "Connection"
191
- });
192
- }
193
- });
111
+ RED.nodes.registerType("teamogy-config", {
112
+ category: "config",
113
+ color: "#fe4c00",
114
+ defaults: {
115
+ name: {
116
+ value: "",
117
+ },
118
+ host: {
119
+ value: "",
120
+ required: true,
121
+ },
122
+ unit: {
123
+ value: 1,
124
+ required: true,
125
+ },
126
+ tokendata: {
127
+ value: "",
128
+ required: false,
129
+ },
130
+ apilimit: {
131
+ value: 60,
132
+ required: true,
133
+ },
134
+ },
135
+ credentials: {
136
+ token: {
137
+ type: "password",
138
+ required: true,
139
+ },
140
+ required: true,
141
+ },
142
+ label: function () {
143
+ if (!this.name) {
144
+ this.name = this.host + "/" + this.unit;
145
+ }
146
+ return this.name;
147
+ },
148
+ labelStyle: function () {
149
+ return this.name ? "node_label_italic" : "";
150
+ },
151
+ oneditprepare: function () {
152
+ $("#node-config-label-tokendata").html(this.tokendata);
153
+
154
+ $("#node-config-input-token").on("change", function () {
155
+ if ($(this).val() != "__PWRD__") {
156
+ let pt = decodeJwt($("#node-config-input-token").val());
157
+
158
+ if (pt == null) {
159
+ $("#node-config-label-tokendata").html("Invalid token format");
160
+ $("#node-config-input-tokendata").val("Invalid token format");
161
+ } else {
162
+ pt.iat = new Date(pt.iat * 1000).toISOString();
163
+
164
+ let rt = "";
165
+ $.each(pt, function (key, value) {
166
+ rt = rt + key + ": " + value + "<br>";
167
+ });
168
+
169
+ $("#node-config-label-tokendata").html(rt);
170
+ $("#node-config-input-tokendata").val(rt);
171
+ }
172
+ }
173
+ });
174
+
175
+ $("#node-config-input-unit").on("change", function () {
176
+ if (!$.isNumeric($(this).val())) {
177
+ $(this).val(1);
178
+ } else {
179
+ if ($(this).val() < 0 || $(this).val() > 100) {
180
+ $(this).val(1);
181
+ }
182
+ }
183
+ });
184
+
185
+ $("#node-config-input-apilimit").on("change", function () {
186
+ if (!$.isNumeric($(this).val())) {
187
+ $(this).val(60);
188
+ } else {
189
+ if ($(this).val() < 1 || $(this).val() > 1000) {
190
+ $(this).val(60);
191
+ }
192
+ }
193
+ });
194
+
195
+ const tabs = RED.tabs.create({
196
+ id: "config-tabs",
197
+ onchange: function (tab) {
198
+ $("#config-tabs-content").children().hide();
199
+ $("#" + tab.id).show();
200
+ },
201
+ });
202
+
203
+ tabs.addTab({
204
+ id: "config-tab-config",
205
+ label: "Connection",
206
+ });
207
+ },
208
+ });
194
209
  </script>
195
210
 
196
211
  <style type="text/css">
197
- .dynamic-dropdown-row {
198
- padding: 6px 0;
199
- }
212
+ .dynamic-dropdown-row {
213
+ padding: 6px 0;
214
+ }
200
215
  </style>
201
216
 
202
217
  <script type="text/x-red" data-template-name="teamogy-client">
203
-
204
- <div class="form-row">
205
- <label for="node-input-name" style="width: 130px"><i class="icon-tag"></i><span>Name</span></label>
206
- <input type="text" id="node-input-name" placeholder="name" style="width:65%">
207
- </div>
208
-
209
- <div class="form-row">
210
- <ul style="min-width: 600px; margin-bottom: 20px;" id="config-tabs"></ul>
211
- </div>
212
-
213
- <div id="config-tabs-content" style="min-height: 170px;">
214
-
215
- <div id="config-tab-config" style="display: none;">
216
-
217
- <div class="form-row">
218
- <label for="node-input-configuration" style="width: 130px"><i class="fa fa-globe"></i><span> Connection</span></label>
219
- <input type="text" id="node-input-configuration" style="width:65%">
220
- </div>
221
-
222
- <div class="form-row">
223
- <label for="node-input-mode" style="width: 130px"><i class="fa fa-refresh"></i> <span>Request views</span></label>
224
- <input type="checkbox" id="node-input-mode" style=" width:20px;">
225
- </div>
226
-
227
- <div class="form-row">
228
- <label for="node-input-entity" style="width: 130px"><i class="fa fa-caret-down"></i> Select entity</label>
229
- <select id="node-input-entity" style="width:65%">
230
- </select>
231
- </div>
232
-
233
- <div class="form-row">
234
- <label for="node-input-method" style="width: 130px"><i class="fa fa-caret-down"></i> Select method</label>
235
- <select id="node-input-method" style="width:65%">
236
- </select>
237
- </div>
238
-
239
- <div class="form-row">
240
- <label for="node-input-source" style="width: 130px"><i class="fa fa-caret-down"></i> Source</label>
241
- <select id="node-input-source" style='width:65%'>
242
- <option value="static">Static command</option>
243
- <option value="dynamic">Dynamic from message </option>
244
- </select>
245
- </div>
246
-
247
- <div class="form-row" id="node-row-editor">
248
- <div class="form-row">
249
- <label for="node-input-params" style="width: 130px"><i class="fa fa-code"></i> Parameters</label>
250
- </div>
251
- <div class="form-row">
252
- <div style="height: 100px; min-height:100px;" class="node-text-editor" id="node-input-params" style='width:65%'></div>
253
- </div>
254
- <div class="form-row">
255
- <label for="node-input-body" style="width: 130px"><i class="fa fa-code"></i> Body</label>
256
- </div>
257
- <div class="form-row">
258
- <div style="height: 100px; min-height:100px;" class="node-text-editor" id="node-input-body" style='width:65%'></div>
259
- </div>
260
- </div>
261
-
262
- <div class="form-row" id="node-row-response-option">
263
- <div style="margin-bottom: 10px;"></div>
264
- <label style="width: 130px"></i><span>View option</span></label>
265
- <div style="margin-bottom: 5px;"></div>
266
- <div class="form-row">
267
- <label for="node-input-merge" style="width: 130px"><i class="fa fa-compress"></i> <span> Merge</span></label>
268
- <input type="checkbox" id="node-input-merge" style=" width:20px;">
269
- </div>
270
- <div class="form-row">
271
- <label for="node-input-limit" style="width: 130px"><i class="fa fa-step-forward"></i><span> Limit</span></label>
272
- <input type="number" id="node-input-limit" min="0" step="1" style="width:20%">
273
- </div>
274
- <div class="form-row">
275
- <label for="node-input-paging" style="width: 130px"><i class="fa fa-eject"></i><span> Paging</span></label>
276
- <input type="number" id="node-input-paging" min="0" max="1000" step="1" style="width:20%">
277
- </div>
278
- <div class="form-row">
279
- <label for="node-input-offset" style="width: 130px"><i class="fa fa-forward"></i><span> Offset</span></label>
280
- <input type="number" id="node-input-offset" min="0" step="1" style="width:20%">
281
- </div>
282
- <div class="form-row">
283
- <label for="node-input-delay" style="width: 130px"><i class="fa fa-clock-o"></i><span> Pag. delay (s)</span></label>
284
- <input type="number" id="node-input-delay" min="0" max="600" step="1" style="width:20%">
285
- </div>
286
- </div>
287
-
288
- <div class="form-row" id="node-row-editor-dynamic">
289
- <div class="form-row">
290
- <label for="node-input-params" style="width: 130px"><i class="fa fa-code"></i> Source of body</label>
291
- <input type="text" id="node-input-body-source" style="width: 65%">
292
- <input type="hidden" id="node-input-body-source-type" style="width: 0px">
293
- </div>
294
- </div>
295
-
296
- <div class="form-row" id="node-row-error-option">
297
- <div style="margin-bottom: 10px;"></div>
298
- <label style="width: 130px"><span>If an error occurs</span></label>
299
- <div style="margin-bottom: 5px;"></div>
300
- <div class="form-row">
301
- <label for="node-input-repeat" style="width: 130px"><i class="fa fa-repeat"></i><span> Req. repeat</span></label>
302
- <input type="number" id="node-input-repeat" min="0" max="10" step="1" style="width:20%">
303
- </div>
304
- <div class="form-row">
305
- <label for="node-input-rdelay" style="width: 130px"><i class="fa fa-clock-o"></i><span> Req. delay (s)</span></label>
306
- <input type="number" id="node-input-rdelay" min="0" max="600" step="1" style="width:20%">
307
- </div>
308
- </div>
309
-
310
- </div>
218
+
219
+ <div class="form-row">
220
+ <label for="node-input-name" style="width: 130px"><i class="icon-tag"></i><span>Name</span></label>
221
+ <input type="text" id="node-input-name" placeholder="name" style="width:65%">
222
+ </div>
223
+
224
+ <div class="form-row">
225
+ <ul style="min-width: 600px; margin-bottom: 20px;" id="config-tabs"></ul>
226
+ </div>
227
+
228
+ <div id="config-tabs-content" style="min-height: 170px;">
229
+
230
+ <div id="config-tab-config" style="display: none;">
231
+
232
+ <div class="form-row">
233
+ <label for="node-input-configuration" style="width: 130px"><i class="fa fa-globe"></i><span> Connection</span></label>
234
+ <input type="text" id="node-input-configuration" style="width:65%">
235
+ </div>
236
+
237
+ <div class="form-row">
238
+ <label for="node-input-mode" style="width: 130px"><i class="fa fa-refresh"></i> <span>Request views</span></label>
239
+ <input type="checkbox" id="node-input-mode" style=" width:20px;">
240
+ </div>
241
+
242
+ <div class="form-row">
243
+ <label for="node-input-entity" style="width: 130px"><i class="fa fa-caret-down"></i> Select entity</label>
244
+ <select id="node-input-entity" style="width:65%">
245
+ </select>
246
+ </div>
247
+
248
+ <div class="form-row">
249
+ <label for="node-input-method" style="width: 130px"><i class="fa fa-caret-down"></i> Select method</label>
250
+ <select id="node-input-method" style="width:65%">
251
+ </select>
252
+ </div>
253
+
254
+ <div class="form-row">
255
+ <label for="node-input-source" style="width: 130px"><i class="fa fa-caret-down"></i> Source</label>
256
+ <select id="node-input-source" style='width:65%'>
257
+ <option value="static">Static command</option>
258
+ <option value="dynamic">Dynamic from message </option>
259
+ </select>
260
+ </div>
261
+
262
+ <div class="form-row" id="node-row-editor">
263
+ <div class="form-row">
264
+ <label for="node-input-params" style="width: 130px"><i class="fa fa-code"></i> Parameters</label>
265
+ </div>
266
+ <div class="form-row">
267
+ <div style="height: 100px; min-height:100px;" class="node-text-editor" id="node-input-params" style='width:65%'></div>
268
+ </div>
269
+ <div class="form-row">
270
+ <label for="node-input-body" style="width: 130px"><i class="fa fa-code"></i> Body</label>
271
+ </div>
272
+ <div class="form-row">
273
+ <div style="height: 100px; min-height:100px;" class="node-text-editor" id="node-input-body" style='width:65%'></div>
274
+ </div>
275
+ </div>
276
+
277
+ <div class="form-row" id="node-row-response-option">
278
+ <div style="margin-bottom: 10px;"></div>
279
+ <label style="width: 130px"><span>View option</span></label>
280
+ <div style="margin-bottom: 5px;"></div>
281
+ <div class="form-row">
282
+ <label for="node-input-merge" style="width: 130px"><i class="fa fa-compress"></i> <span> Merge</span></label>
283
+ <input type="checkbox" id="node-input-merge" style=" width:20px;">
284
+ </div>
285
+ <div class="form-row">
286
+ <label for="node-input-limit" style="width: 130px"><i class="fa fa-step-forward"></i><span> Limit</span></label>
287
+ <input type="number" id="node-input-limit" min="0" step="1" style="width:20%">
288
+ </div>
289
+ <div class="form-row">
290
+ <label for="node-input-paging" style="width: 130px"><i class="fa fa-eject"></i><span> Paging</span></label>
291
+ <input type="number" id="node-input-paging" min="0" max="1000" step="1" style="width:20%">
292
+ </div>
293
+ <div class="form-row">
294
+ <label for="node-input-offset" style="width: 130px"><i class="fa fa-forward"></i><span> Offset</span></label>
295
+ <input type="number" id="node-input-offset" min="0" step="1" style="width:20%">
296
+ </div>
297
+ <div class="form-row">
298
+ <label for="node-input-delay" style="width: 130px"><i class="fa fa-clock-o"></i><span> Pag. delay (s)</span></label>
299
+ <input type="number" id="node-input-delay" min="0" max="600" step="1" style="width:20%">
300
+ </div>
301
+ </div>
302
+
303
+ <div class="form-row" id="node-row-editor-dynamic">
304
+ <div class="form-row">
305
+ <label for="node-input-params" style="width: 130px"><i class="fa fa-code"></i> Source of body</label>
306
+ <input type="text" id="node-input-body-source" style="width: 65%">
307
+ <input type="hidden" id="node-input-body-source-type" style="width: 0px">
308
+ </div>
309
+ </div>
310
+
311
+ <div class="form-row" id="node-row-error-option">
312
+ <div style="margin-bottom: 10px;"></div>
313
+ <label style="width: 130px"><span>If an error occurs</span></label>
314
+ <div style="margin-bottom: 5px;"></div>
315
+ <div class="form-row">
316
+ <label for="node-input-repeat" style="width: 130px"><i class="fa fa-repeat"></i><span> Req. repeat</span></label>
317
+ <input type="number" id="node-input-repeat" min="0" max="10" step="1" style="width:20%">
318
+ </div>
319
+ <div class="form-row">
320
+ <label for="node-input-rdelay" style="width: 130px"><i class="fa fa-clock-o"></i><span> Req. delay (s)</span></label>
321
+ <input type="number" id="node-input-rdelay" min="0" max="600" step="1" style="width:20%">
322
+ </div>
323
+ </div>
324
+
311
325
  </div>
326
+ </div>
312
327
  </script>
313
328
 
314
329
  <script type="text/javascript">
315
- RED.nodes.registerType('teamogy-client',{
316
- category: 'TF collection',
317
- color: '#fe4c00',
318
- defaults: {
319
- name: {
320
- value: ""
321
- },
322
- configuration: {
323
- type: "teamogy-config",
324
- required: true
325
- },
326
- mode: {
327
- value: false
328
- },
329
- method: {
330
- value: "GET"
331
- },
332
- entity: {
333
- value: "r_users"
334
- },
335
- source: {
336
- value: "static"
337
- },
338
- cparams: {
339
- value: ""
340
- },
341
- cbody: {
342
- value: ""
343
- },
344
- bodysource: {
345
- value: "payload"
346
- },
347
- merge: {
348
- value: true
349
- },
350
- limit: {
351
- value: 0,
352
- required: true
353
- },
354
- paging: {
355
- value: 1000,
356
- required: true
357
- },
358
- offset: {
359
- value: 0,
360
- required: true
361
- },
362
- delay: {
363
- value: 0,
364
- required: true
365
- },
366
- repeat: {
367
- value: 5,
368
- required: true
369
- },
370
- rdelay: {
371
- value: 30,
372
- required: true
373
- }
374
- },
375
- inputs: 1,
376
- outputs:1,
377
- icon: "bridge.svg",
378
- align: "left",
379
- label: function() {
380
- return this.name || "teamogy";
381
- },
382
- paletteLabel: function() {
383
- return this.name || "teamogy";
384
- },
385
- labelStyle: function() {
386
- return this.name ? "node_label_italic" : "";
387
- },
388
- oneditprepare : function() {
389
- let values
390
- let mode = this.mode;
391
- let entity = this.entity;
392
- let method = this.method;
393
- let source = this.source;
394
- let params = this.cparams;
395
- let body = this.cbody;
396
-
397
- $('#node-input-source').val(this.source);
398
- $('#node-input-merge').val(this.merge);
399
- $('#node-input-limit').val(this.limit);
400
- $('#node-input-paging').val(this.paging);
401
- $('#node-input-offset').val(this.offset);
402
- $('#node-input-delay').val(this.delay);
403
- $('#node-input-repeat').val(this.repeat);
404
- $('#node-input-rdelay').val(this.rdelay);
405
-
406
- $('#node-input-mode').val(this.mode);
407
- $('#node-input-body-source').val(this.bodysource);
408
-
409
-
410
- if(this.mode===true) {
411
- values = values2;
412
- } else {
413
- values = values1;
414
- }
415
-
416
- $('#node-input-mode').on('change', function() {
417
- if ($(this).is(':checked')) {
418
- values = values2;
419
- if($('#node-input-source').val()=='static'){ $('#node-row-response-option').show(); }
420
- } else {
421
- values = values1;
422
- $('#node-row-response-option').hide();
423
- }
424
- let se = fillEntity (values)
425
- fillMethod (se)
426
- })
427
-
428
-
429
- function fillEntity (values) {
430
- $('#node-input-entity').empty()
431
- for (let value of values) {
432
- $('#node-input-entity').append($("<option></option>").attr("value", value.v).text(value.e));
433
- }
434
-
435
- const fe = $('#node-input-entity option[value=' + entity +']').val();
436
- if(fe != undefined ) {
437
- $('#node-input-entity').val(entity);
438
- } else {
439
- $('#node-input-entity').prop('selectedIndex',0);;
440
- }
441
- return $('#node-input-entity').val();
442
- }
443
-
444
- function fillMethod (entity) {
445
- $('#node-input-method').empty()
446
- for (let value of values) {
447
- if (value.v === entity) {
448
- for (let method of value.m) {
449
- $('#node-input-method').append($("<option></option>").attr("value", method).text(method));
450
- }
451
- }
452
- }
453
-
454
- const fe = $('#node-input-method option[value=' + method +']').val();
455
- if(fe != undefined ) {
456
- $('#node-input-method').val(method);
457
- } else {
458
- $('#node-input-method').prop('selectedIndex',0);;
459
- }
460
- }
461
-
462
- $('#node-input-entity').on('change', function() {
463
- fillMethod ($(this).val())
464
- })
465
-
466
- $('#node-input-source').on('change', function() {
467
- if($(this).val()=='static') {
468
- $('#node-row-editor').show();
469
- $('#node-row-editor-dynamic').hide();
470
- if($('#node-input-mode').is(':checked') == true) {
471
- $('#node-row-response-option').show();
472
- }
473
- } else {
474
- $('#node-row-editor').hide();
475
- $('#node-row-editor-dynamic').show();
476
- $('#node-row-response-option').hide();
477
- }
478
- })
479
-
480
- $("#node-input-body-source").typedInput({
481
- type:"msg",
482
- types:["msg"],
483
- typeField: "#node-input-body-source-type"
484
- })
485
-
486
- $('#node-input-limit').on('change', function() {
487
- if(!$.isNumeric($(this).val())) { $(this).val(0) }
488
- })
489
-
490
- $('#node-input-paging').on('change', function() {
491
- if(!$.isNumeric($(this).val())) { $(this).val(1000) }
492
- })
493
-
494
- $('#node-input-offset').on('change', function() {
495
- if(!$.isNumeric($(this).val())) { $(this).val(0) }
496
- })
497
-
498
- $('#node-input-delay').on('change', function() {
499
- if(!$.isNumeric($(this).val())) { $(this).val(0) }
500
- })
501
- $('#node-input-repeat').on('change', function() {
502
- if(!$.isNumeric($(this).val())) { $(this).val(5) }
503
- })
504
-
505
- $('#node-input-rdelay').on('change', function() {
506
- if(!$.isNumeric($(this).val())) { $(this).val(30) }
507
- })
508
-
509
- this.editorp = RED.editor.createEditor({
510
- id: 'node-input-params',
511
- mode: 'ace/mode/text',
512
- value: this.cparams
513
- });
514
-
515
- this.editorb = RED.editor.createEditor({
516
- id: 'node-input-body',
517
- mode: 'ace/mode/json',
518
- value: this.cbody
519
- });
520
-
521
- const tabs = RED.tabs.create({
522
- id: "config-tabs",
523
- onchange: function(tab) {
524
- $("#config-tabs-content").children().hide();
525
- $("#" + tab.id).show();
526
- }
527
- });
528
-
529
- tabs.addTab({
530
- id: "config-tab-config",
531
- label: "Configuration"
532
- });
533
- },
534
- oneditsave: function(){
535
- this.mode = $("#node-input-mode").val();
536
- this.entity = $("#node-input-entity").val();
537
- this.method = $("#node-input-method").val();
538
- this.source = $("#node-input-source").val();
539
- this.merge = $("#node-input-merge").val();
540
- this.bodysource = $("#node-input-body-source").val();
541
-
542
- if(!$("#node-input-limit").val()) {this.limit = 0} else {this.limit = $("#node-input-limit").val();}
543
- if(!$("#node-input-offset").val()) {this.offset = 0} else {this.offset = $("#node-input-offset").val();}
544
- this.paging = $("#node-input-paging").val();
545
-
546
- if(!$("#node-input-delay").val()) {this.delay = 0} else {this.delay = $("#node-input-delay").val();}
547
- if(!$("#node-input-repeat").val()) {this.repeat = 0} else {this.repeat = $("#node-input-repeat").val();}
548
- if(!$("#node-input-rdelay").val()) {this.rdelay = 0} else {this.rdelay = $("#node-input-rdelay").val();}
549
-
550
- this.cparams = this.editorp.getValue();
551
- this.editorp.destroy();
552
- delete this.editorp;
553
-
554
- this.cbody = this.editorb.getValue();
555
- this.editorb.destroy();
556
- delete this.editorb;
330
+ RED.nodes.registerType("teamogy-client", {
331
+ category: "TF collection",
332
+ color: "#fe4c00",
333
+ defaults: {
334
+ name: {
335
+ value: "",
336
+ },
337
+ configuration: {
338
+ type: "teamogy-config",
339
+ required: true,
340
+ },
341
+ mode: {
342
+ value: false,
343
+ },
344
+ method: {
345
+ value: "GET",
346
+ },
347
+ entity: {
348
+ value: "r_users",
349
+ },
350
+ source: {
351
+ value: "static",
352
+ },
353
+ cparams: {
354
+ value: "",
355
+ },
356
+ cbody: {
357
+ value: "",
358
+ },
359
+ bodysource: {
360
+ value: "payload",
361
+ },
362
+ merge: {
363
+ value: true,
364
+ },
365
+ limit: {
366
+ value: 0,
367
+ required: true,
368
+ },
369
+ paging: {
370
+ value: 1000,
371
+ required: true,
372
+ },
373
+ offset: {
374
+ value: 0,
375
+ required: true,
376
+ },
377
+ delay: {
378
+ value: 0,
379
+ required: true,
380
+ },
381
+ repeat: {
382
+ value: 5,
383
+ required: true,
384
+ },
385
+ rdelay: {
386
+ value: 30,
387
+ required: true,
388
+ },
389
+ },
390
+ inputs: 1,
391
+ outputs: 1,
392
+ icon: "bridge.svg",
393
+ align: "left",
394
+ label: function () {
395
+ return this.name || "teamogy";
396
+ },
397
+ paletteLabel: function () {
398
+ return this.name || "teamogy";
399
+ },
400
+ labelStyle: function () {
401
+ return this.name ? "node_label_italic" : "";
402
+ },
403
+ oneditprepare: function () {
404
+ let values;
405
+ let mode = this.mode;
406
+ let entity = this.entity;
407
+ let method = this.method;
408
+ let source = this.source;
409
+ let params = this.cparams;
410
+ let body = this.cbody;
411
+
412
+ $("#node-input-source").val(this.source);
413
+ $("#node-input-merge").val(this.merge);
414
+ $("#node-input-limit").val(this.limit);
415
+ $("#node-input-paging").val(this.paging);
416
+ $("#node-input-offset").val(this.offset);
417
+ $("#node-input-delay").val(this.delay);
418
+ $("#node-input-repeat").val(this.repeat);
419
+ $("#node-input-rdelay").val(this.rdelay);
420
+
421
+ $("#node-input-mode").val(this.mode);
422
+ $("#node-input-body-source").val(this.bodysource);
423
+
424
+ if (this.mode === true) {
425
+ values = values2;
426
+ } else {
427
+ values = values1;
428
+ }
429
+
430
+ $("#node-input-mode").on("change", function () {
431
+ if ($(this).is(":checked")) {
432
+ values = values2;
433
+ if ($("#node-input-source").val() == "static") {
434
+ $("#node-row-response-option").show();
435
+ }
436
+ } else {
437
+ values = values1;
438
+ $("#node-row-response-option").hide();
439
+ }
440
+ let se = fillEntity(values);
441
+ fillMethod(se);
442
+ });
443
+
444
+ function fillEntity(values) {
445
+ $("#node-input-entity").empty();
446
+ for (let value of values) {
447
+ $("#node-input-entity").append(
448
+ $("<option></option>").attr("value", value.v).text(value.e),
449
+ );
450
+ }
451
+
452
+ const fe = $("#node-input-entity option[value=" + entity + "]").val();
453
+ if (fe != undefined) {
454
+ $("#node-input-entity").val(entity);
455
+ } else {
456
+ $("#node-input-entity").prop("selectedIndex", 0);
457
+ }
458
+ return $("#node-input-entity").val();
459
+ }
460
+
461
+ function fillMethod(entity) {
462
+ $("#node-input-method").empty();
463
+ for (let value of values) {
464
+ if (value.v === entity) {
465
+ for (let method of value.m) {
466
+ $("#node-input-method").append(
467
+ $("<option></option>").attr("value", method).text(method),
468
+ );
469
+ }
470
+ }
471
+ }
472
+
473
+ const fe = $("#node-input-method option[value=" + method + "]").val();
474
+ if (fe != undefined) {
475
+ $("#node-input-method").val(method);
476
+ } else {
477
+ $("#node-input-method").prop("selectedIndex", 0);
478
+ }
479
+ }
480
+
481
+ $("#node-input-entity").on("change", function () {
482
+ fillMethod($(this).val());
483
+ });
484
+
485
+ $("#node-input-source").on("change", function () {
486
+ if ($(this).val() == "static") {
487
+ $("#node-row-editor").show();
488
+ $("#node-row-editor-dynamic").hide();
489
+ if ($("#node-input-mode").is(":checked") == true) {
490
+ $("#node-row-response-option").show();
491
+ }
492
+ } else {
493
+ $("#node-row-editor").hide();
494
+ $("#node-row-editor-dynamic").show();
495
+ $("#node-row-response-option").hide();
496
+ }
497
+ });
498
+
499
+ $("#node-input-body-source").typedInput({
500
+ type: "msg",
501
+ types: ["msg"],
502
+ typeField: "#node-input-body-source-type",
503
+ });
504
+
505
+ $("#node-input-limit").on("change", function () {
506
+ if (!$.isNumeric($(this).val())) {
507
+ $(this).val(0);
508
+ }
509
+ });
510
+
511
+ $("#node-input-paging").on("change", function () {
512
+ if (!$.isNumeric($(this).val())) {
513
+ $(this).val(1000);
514
+ }
515
+ });
516
+
517
+ $("#node-input-offset").on("change", function () {
518
+ if (!$.isNumeric($(this).val())) {
519
+ $(this).val(0);
520
+ }
521
+ });
522
+
523
+ $("#node-input-delay").on("change", function () {
524
+ if (!$.isNumeric($(this).val())) {
525
+ $(this).val(0);
526
+ }
527
+ });
528
+ $("#node-input-repeat").on("change", function () {
529
+ if (!$.isNumeric($(this).val())) {
530
+ $(this).val(5);
531
+ }
532
+ });
533
+
534
+ $("#node-input-rdelay").on("change", function () {
535
+ if (!$.isNumeric($(this).val())) {
536
+ $(this).val(30);
537
+ }
538
+ });
539
+
540
+ this.editorp = RED.editor.createEditor({
541
+ id: "node-input-params",
542
+ mode: "ace/mode/text",
543
+ value: this.cparams,
544
+ });
545
+
546
+ this.editorb = RED.editor.createEditor({
547
+ id: "node-input-body",
548
+ mode: "ace/mode/json",
549
+ value: this.cbody,
550
+ });
551
+
552
+ const tabs = RED.tabs.create({
553
+ id: "config-tabs",
554
+ onchange: function (tab) {
555
+ $("#config-tabs-content").children().hide();
556
+ $("#" + tab.id).show();
557
+ },
558
+ });
559
+
560
+ tabs.addTab({
561
+ id: "config-tab-config",
562
+ label: "Configuration",
563
+ });
557
564
  },
558
- oneditcancel: function() {
559
- this.editorp.destroy();
560
- delete this.editorp;
561
-
562
- this.editorb.destroy();
563
- delete this.editorb;
564
- }
565
- });
565
+ oneditsave: function () {
566
+ this.mode = $("#node-input-mode").is(":checked");
567
+ this.entity = $("#node-input-entity").val();
568
+ this.method = $("#node-input-method").val();
569
+ this.source = $("#node-input-source").val();
570
+ this.merge = $("#node-input-merge").val();
571
+ this.bodysource = $("#node-input-body-source").val();
572
+
573
+ if (!$("#node-input-limit").val()) {
574
+ this.limit = 0;
575
+ } else {
576
+ this.limit = $("#node-input-limit").val();
577
+ }
578
+ if (!$("#node-input-offset").val()) {
579
+ this.offset = 0;
580
+ } else {
581
+ this.offset = $("#node-input-offset").val();
582
+ }
583
+ this.paging = $("#node-input-paging").val();
584
+
585
+ if (!$("#node-input-delay").val()) {
586
+ this.delay = 0;
587
+ } else {
588
+ this.delay = $("#node-input-delay").val();
589
+ }
590
+ if (!$("#node-input-repeat").val()) {
591
+ this.repeat = 0;
592
+ } else {
593
+ this.repeat = $("#node-input-repeat").val();
594
+ }
595
+ if (!$("#node-input-rdelay").val()) {
596
+ this.rdelay = 0;
597
+ } else {
598
+ this.rdelay = $("#node-input-rdelay").val();
599
+ }
600
+
601
+ this.cparams = this.editorp.getValue();
602
+ this.editorp.destroy();
603
+ delete this.editorp;
604
+
605
+ this.cbody = this.editorb.getValue();
606
+ this.editorb.destroy();
607
+ delete this.editorb;
608
+ },
609
+ oneditcancel: function () {
610
+ this.editorp.destroy();
611
+ delete this.editorp;
612
+
613
+ this.editorb.destroy();
614
+ delete this.editorb;
615
+ },
616
+ });
566
617
  </script>
567
618
 
568
619
  <script type="text/html" data-help-name="teamogy-client">
569
- <p>Connect to a Teamogy API.</p>
570
-
571
- <p>You must configure Connection before using this node.</p>
572
-
573
- <h3>Connection configuration</h3>
574
- <dl class="message-properties">
575
- <dt class="optional">Name (optional)<span class="property-type">string</span></dt><dd> you can enter a name or it will be generated on first save</dd>
576
- <dt>Subdomain (required)<span class="property-type">string</span></dt><dd> enter the name of the subdomain and the domain, in the format: subdomain.domain.com</dd>
577
- <dt>Unit/Agency (required)<span class="property-type">number</span></dt><dd> enter the number of unit or agency</dd>
578
- <dt>Token (required)<span class="property-type">string</span></dt><dd> enter the generated API token for the given subdomain and Unit/Agency</dd>
579
- <dt>Req/min (required)<span class="property-type">number</span></dt><dd> enter the maximum number of API requests per minute for the given subdomain, if the limit is greater than allowed, further requests will be rejected (not processed)</dd>
580
- </dl>
581
-
582
- <h3>Input</h3>
583
- <dl class="message-properties">
584
- <dt class="optional">Name (optional)<span class="property-type">string</span></dt><dd> you can enter a name for the given node (recommended)</dd>
585
- <dt>Connection (required)<span class="property-type">selection - list</span></dt><dd> select the configured connection</dd>
586
- <dt>Request views (required)<span class="property-type">checkbox - yes/no</span></dt><dd> check for requests for API views (see description below)</dd>
587
- <dt>Token (required)<span class="property-type">selection - list</span></dt><dd> select the desired entity</dd>
588
- <dt>Req/min (required)<span class="property-type">selection - list</span></dt><dd> select an available method</dd>
589
- <dt>Source (required)<span class="property-type">selection - list</span></dt><dd> the parameters or even the request body can be static, i.e. from the Params and Body fields in the form, or dynamic as part of the input message.</dd>
590
- <dt>Source of body (required)<span class="property-type">string</span></dt><dd> the parameter set the source of the body, default is msg.payload</dd>
591
- <dt>Params (optional)<span class="property-type">string | object</span></dt><dd> you can enter the params in the case of a static request as a string, in the case of a dynamic also as an object, according to the API specification for the given entity</dd>
592
- <dd>&nbsp;</dd>
593
- <dd> Examples:</dd>
594
- <dd> In the case of a static request, enter the desired values ​​according to the selected entity and method in the Params field. Values ​​for Params are listed on separate lines.</dd>
595
- <dd> id=3</dd>
596
- <dd> registration=12345678</dd>
597
- <dd>&nbsp;</dd>
598
- <dd> In the case of a static request for API views </dd>
599
- <dd> columns=firstName,lastName</dd>
600
- <dd> externalFilter=id>5</dd>
601
- <dd>&nbsp;</dd>
602
- <dd> In the case of a dynamic request for API views, as string</dd>
603
- <dd> id=2&name=John</dd>
604
- <dd>&nbsp;</dd>
605
- <dd> or also as an object </dd>
606
- <dd> msg.params.id = 2</dd>
607
- <dd> msg.params.name = "John"</dd>
608
- <dd>&nbsp;</dd>
609
- <dt>Body (optional)<span class="property-type">JSON string | object</span></dt><dd> you can enter the body in the case of a static request as a JSON string, in the case of a dynamic also as an object, you can nest objects and arrays in the body without restrictions according to the API specification for the given entity</dd>
610
- <dd>&nbsp;</dd>
611
- <dd> Examples:</dd>
612
- <dd> In the case of a static request, enter the desired values ​​according to the selected entity and method in the Body field.</dd>
613
- <dd> {</dd>
614
- <dd> &nbsp;&nbsp;"id": 3,</dd>
615
- <dd> &nbsp;&nbsp;"registration": 12345678</dd>
616
- <dd> }</dd>
617
- <dd>&nbsp;</dd>
618
- <dd> In the case of a dynamic request for API views, as JSON string</dd>
619
- <dd>{"id": 3,"name": "John"}</dd>
620
- <dd>&nbsp;</dd>
621
- <dd> or also as an object </dd>
622
- <dd> msg.body.id = 2</dd>
623
- <dd> msg.body.name = "John"</dd>
624
- <dd> msg.body.address = addresses // array of objects</dd>
625
- <dd>&nbsp;</dd>
626
- <dd> If you use requests for API views you can use additional options, the options can also be used in dynamic requests</dd>
627
- <dt class="optional">Merge (optional) (also in msg.merge (boolean))<span class="property-type">checkbox - yes/no</span></dt><dd> check if you want the output message to contain all returned records. In the background, processing is still taking place according to the Paging settings, but individual messages are not sent to the output, but only the final merged one containing all the returned records. (if not specified the value no is used)</dd>
628
- <dt class="optional">Limit (optional) (also in msg.limit)<span class="property-type">number</span></dt><dd> limitation of the total number of records in the response (if not specified, the value 0 is used, the value 0 means no limit)</dd>
629
- <dt class="optional">Paging (optional) (also in msg.paging)<span class="property-type">number</span></dt><dd> division of responses into multiple parts with the number of records returned (if not specified, the value 1000 is used)</dd>
630
- <dt class="optional">Offset (optional) (also in msg.offset)<span class="property-type">number</span></dt><dd> specifies from which record to start returning data. For example, if you have 100 records total and want to return records 50-100, set Offset to 50. To return all records from the beginning, leave it at 0 (if not specified, the value 0 is used))</dd>
631
- <dt class="optional">Delay (optional) (also in msg.delay)<span class="property-type">number</span></dt><dd> specifies the delay between requests, which is used for pagination (if not specified, the value 0 is used)</dd>
632
- <dt class="optional">Req. repeat (optional) (also in msg.repeat)<span class="property-type">number</span></dt><dd> specifies the number of errors after which the request will be repeated (if not specified, the value 5 is used)</dd>
633
- <dt class="optional">Req. delay (s) (optional) (also in msg.rdelay)<span class="property-type">number</span></dt><dd> specifies the delay between requests, which is used when retrying a request in case of an error (if not specified, the value 30 is used)</dd>
634
- <dt class="optional">Skip (optional in message only, msg.skip)<span class="property-type">boolean</span></dt><dd> adding the msg.skip=true will allow the message to pass through to the output without processing</dd>
635
- <dt class="optional">Connection (optional in message, msg.connection)<span class="property-type">string</span></dt><dd> replaces connection from configuration, use connection name</dd>
636
- <dt class="optional">Unit (optional in message, msg.unit)<span class="property-type">number</span></dt><dd> replaces unit from connection configuration, use unit/agency id</dd>
637
- <dt class="optional">Entity (optional in message, msg.entity)<span class="property-type">string</span></dt><dd> replaces entity from configuration, use v_entityName for views or r_entityName</dd>
638
- <dt class="optional">Method (optional in message, msg.method)<span class="property-type">string</span></dt><dd> replaces method from configuration, use the available method for the given entity</dd>
639
- </dl>
640
-
641
- <h3>Output</h3>
642
- <dl class="message-properties">
643
- <dt>payload<span class="property-type">string | object</span></dt><dd> the standard output of the response</dd>
644
- <dt>count<span class="property-type">number</span></dt><dd> number of records in the output</dd>
645
- <dt>error<span class="property-type">string</span></dt><dd> error message</dd>
646
- <dt>msg.*<span class="property-type">string | object</span></dt><dd> all properties of the input message</dd>
647
- </dl>
648
-
649
- <h3>References</h3>
650
- <ul>
651
- <li><a href="https://teamogy.com/teamogy-flow">Teamogy Flow docs</a> - full description of Teamogy Flow</li>
652
- <li><a href="https://readme.teamogy.com/reference/integration-options">Teamogy API docs</a> - full description of parameters for <code>msg.params</code> and <code>msg.body</code> properties, and also options for API views</li>
653
- </ul>
654
- </script>
620
+ <p>Connect to a Teamogy API.</p>
621
+
622
+ <p>You must configure Connection before using this node.</p>
623
+
624
+ <h3>Connection configuration</h3>
625
+ <dl class="message-properties">
626
+ <dt class="optional">
627
+ Name (optional)<span class="property-type">string</span>
628
+ </dt>
629
+ <dd>you can enter a name or it will be generated on first save</dd>
630
+ <dt>Subdomain (required)<span class="property-type">string</span></dt>
631
+ <dd>
632
+ enter the name of the subdomain and the domain, in the format:
633
+ subdomain.domain.com
634
+ </dd>
635
+ <dt>Unit/Agency (required)<span class="property-type">number</span></dt>
636
+ <dd>enter the number of unit or agency</dd>
637
+ <dt>Token (required)<span class="property-type">string</span></dt>
638
+ <dd>
639
+ enter the generated API token for the given subdomain and Unit/Agency
640
+ </dd>
641
+ <dt>Req/min (required)<span class="property-type">number</span></dt>
642
+ <dd>
643
+ enter the maximum number of API requests per minute for the given
644
+ subdomain, if the limit is greater than allowed, further requests will be
645
+ rejected (not processed)
646
+ </dd>
647
+ </dl>
648
+
649
+ <h3>Input</h3>
650
+ <dl class="message-properties">
651
+ <dt class="optional">
652
+ Name (optional)<span class="property-type">string</span>
653
+ </dt>
654
+ <dd>you can enter a name for the given node (recommended)</dd>
655
+ <dt>
656
+ Connection (required)<span class="property-type">selection - list</span>
657
+ </dt>
658
+ <dd>select the configured connection</dd>
659
+ <dt>
660
+ Request views (required)<span class="property-type"
661
+ >checkbox - yes/no</span
662
+ >
663
+ </dt>
664
+ <dd>check for requests for API views (see description below)</dd>
665
+ <dt>Token (required)<span class="property-type">selection - list</span></dt>
666
+ <dd>select the desired entity</dd>
667
+ <dt>
668
+ Req/min (required)<span class="property-type">selection - list</span>
669
+ </dt>
670
+ <dd>select an available method</dd>
671
+ <dt>
672
+ Source (required)<span class="property-type">selection - list</span>
673
+ </dt>
674
+ <dd>
675
+ the parameters or even the request body can be static, i.e. from the
676
+ Params and Body fields in the form, or dynamic as part of the input
677
+ message.
678
+ </dd>
679
+ <dt>Source of body (required)<span class="property-type">string</span></dt>
680
+ <dd>the parameter set the source of the body, default is msg.payload</dd>
681
+ <dt>Params (optional)<span class="property-type">string | object</span></dt>
682
+ <dd>
683
+ you can enter the params in the case of a static request as a string, in
684
+ the case of a dynamic also as an object, according to the API
685
+ specification for the given entity
686
+ </dd>
687
+ <dd>&nbsp;</dd>
688
+ <dd>Examples:</dd>
689
+ <dd>
690
+ In the case of a static request, enter the desired values ​​according to
691
+ the selected entity and method in the Params field. Values ​​for Params
692
+ are listed on separate lines.
693
+ </dd>
694
+ <dd>id=3</dd>
695
+ <dd>registration=12345678</dd>
696
+ <dd>&nbsp;</dd>
697
+ <dd>In the case of a static request for API views</dd>
698
+ <dd>columns=firstName,lastName</dd>
699
+ <dd>externalFilter=id>5</dd>
700
+ <dd>&nbsp;</dd>
701
+ <dd>In the case of a dynamic request for API views, as string</dd>
702
+ <dd>id=2&name=John</dd>
703
+ <dd>&nbsp;</dd>
704
+ <dd>or also as an object</dd>
705
+ <dd>msg.params.id = 2</dd>
706
+ <dd>msg.params.name = "John"</dd>
707
+ <dd>&nbsp;</dd>
708
+ <dt>
709
+ Body (optional)<span class="property-type">JSON string | object</span>
710
+ </dt>
711
+ <dd>
712
+ you can enter the body in the case of a static request as a JSON string,
713
+ in the case of a dynamic also as an object, you can nest objects and
714
+ arrays in the body without restrictions according to the API specification
715
+ for the given entity
716
+ </dd>
717
+ <dd>&nbsp;</dd>
718
+ <dd>Examples:</dd>
719
+ <dd>
720
+ In the case of a static request, enter the desired values ​​according to
721
+ the selected entity and method in the Body field.
722
+ </dd>
723
+ <dd>{</dd>
724
+ <dd>&nbsp;&nbsp;"id": 3,</dd>
725
+ <dd>&nbsp;&nbsp;"registration": 12345678</dd>
726
+ <dd>}</dd>
727
+ <dd>&nbsp;</dd>
728
+ <dd>In the case of a dynamic request for API views, as JSON string</dd>
729
+ <dd>{"id": 3,"name": "John"}</dd>
730
+ <dd>&nbsp;</dd>
731
+ <dd>or also as an object</dd>
732
+ <dd>msg.body.id = 2</dd>
733
+ <dd>msg.body.name = "John"</dd>
734
+ <dd>msg.body.address = addresses // array of objects</dd>
735
+ <dd>&nbsp;</dd>
736
+ <dd>
737
+ If you use requests for API views you can use additional options, the
738
+ options can also be used in dynamic requests
739
+ </dd>
740
+ <dt class="optional">
741
+ Merge (optional) (also in msg.merge (boolean))<span class="property-type"
742
+ >checkbox - yes/no</span
743
+ >
744
+ </dt>
745
+ <dd>
746
+ check if you want the output message to contain all returned records. In
747
+ the background, processing is still taking place according to the Paging
748
+ settings, but individual messages are not sent to the output, but only the
749
+ final merged one containing all the returned records. (if not specified
750
+ the value no is used)
751
+ </dd>
752
+ <dt class="optional">
753
+ Limit (optional) (also in msg.limit)<span class="property-type"
754
+ >number</span
755
+ >
756
+ </dt>
757
+ <dd>
758
+ limitation of the total number of records in the response (if not
759
+ specified, the value 0 is used, the value 0 means no limit)
760
+ </dd>
761
+ <dt class="optional">
762
+ Paging (optional) (also in msg.paging)<span class="property-type"
763
+ >number</span
764
+ >
765
+ </dt>
766
+ <dd>
767
+ division of responses into multiple parts with the number of records
768
+ returned (if not specified, the value 1000 is used)
769
+ </dd>
770
+ <dt class="optional">
771
+ Offset (optional) (also in msg.offset)<span class="property-type"
772
+ >number</span
773
+ >
774
+ </dt>
775
+ <dd>
776
+ specifies from which record to start returning data. For example, if you
777
+ have 100 records total and want to return records 50-100, set Offset to
778
+ 50. To return all records from the beginning, leave it at 0 (if not
779
+ specified, the value 0 is used))
780
+ </dd>
781
+ <dt class="optional">
782
+ Delay (optional) (also in msg.delay)<span class="property-type"
783
+ >number</span
784
+ >
785
+ </dt>
786
+ <dd>
787
+ specifies the delay between requests, which is used for pagination (if not
788
+ specified, the value 0 is used)
789
+ </dd>
790
+ <dt class="optional">
791
+ Req. repeat (optional) (also in msg.repeat)<span class="property-type"
792
+ >number</span
793
+ >
794
+ </dt>
795
+ <dd>
796
+ specifies the number of errors after which the request will be repeated
797
+ (if not specified, the value 5 is used)
798
+ </dd>
799
+ <dt class="optional">
800
+ Req. delay (s) (optional) (also in msg.rdelay)<span class="property-type"
801
+ >number</span
802
+ >
803
+ </dt>
804
+ <dd>
805
+ specifies the delay between requests, which is used when retrying a
806
+ request in case of an error (if not specified, the value 30 is used)
807
+ </dd>
808
+ <dt class="optional">
809
+ Skip (optional in message only, msg.skip)<span class="property-type"
810
+ >boolean</span
811
+ >
812
+ </dt>
813
+ <dd>
814
+ adding the msg.skip=true will allow the message to pass through to the
815
+ output without processing
816
+ </dd>
817
+ <dt class="optional">
818
+ Connection (optional in message, msg.connection)<span
819
+ class="property-type"
820
+ >string</span
821
+ >
822
+ </dt>
823
+ <dd>replaces connection from configuration, use connection name</dd>
824
+ <dt class="optional">
825
+ Unit (optional in message, msg.unit)<span class="property-type"
826
+ >number</span
827
+ >
828
+ </dt>
829
+ <dd>replaces unit from connection configuration, use unit/agency id</dd>
830
+ <dt class="optional">
831
+ Entity (optional in message, msg.entity)<span class="property-type"
832
+ >string</span
833
+ >
834
+ </dt>
835
+ <dd>
836
+ replaces entity from configuration, use v_entityName for views or
837
+ r_entityName
838
+ </dd>
839
+ <dt class="optional">
840
+ Method (optional in message, msg.method)<span class="property-type"
841
+ >string</span
842
+ >
843
+ </dt>
844
+ <dd>
845
+ replaces method from configuration, use the available method for the given
846
+ entity
847
+ </dd>
848
+ </dl>
849
+
850
+ <h3>Output</h3>
851
+ <dl class="message-properties">
852
+ <dt>payload<span class="property-type">string | object</span></dt>
853
+ <dd>the standard output of the response</dd>
854
+ <dt>count<span class="property-type">number</span></dt>
855
+ <dd>number of records in the output</dd>
856
+ <dt>error<span class="property-type">string</span></dt>
857
+ <dd>error message</dd>
858
+ <dt>msg.*<span class="property-type">string | object</span></dt>
859
+ <dd>all properties of the input message</dd>
860
+ </dl>
861
+
862
+ <h3>References</h3>
863
+ <ul>
864
+ <li>
865
+ <a href="https://teamogy.com/teamogy-flow">Teamogy Flow docs</a> - full
866
+ description of Teamogy Flow
867
+ </li>
868
+ <li>
869
+ <a href="https://readme.teamogy.com/reference/integration-options"
870
+ >Teamogy API docs</a
871
+ >
872
+ - full description of parameters for <code>msg.params</code> and
873
+ <code>msg.body</code> properties, and also options for API views
874
+ </li>
875
+ </ul>
876
+ </script>