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

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