grenton-ts 1.0.0

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.
Files changed (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/analog-din/fv02_01/analog-in.ts +271 -0
  4. package/dist/clu/calendar/v1/calendar.ts +308 -0
  5. package/dist/clu/clu-zwave-2/fv515_03/clu-zwave-2.ts +1302 -0
  6. package/dist/clu/event-scheduler/v1/event-scheduler.ts +537 -0
  7. package/dist/clu/multi-fan-ac-thermostat/v1/multi-fan-ac-thermostat.ts +1163 -0
  8. package/dist/clu/pid-controller/v1/pid-controller.ts +536 -0
  9. package/dist/clu/presence-sensor/v1/presence-sensor.ts +313 -0
  10. package/dist/clu/presence-sensor/v2/presence-sensor.ts +470 -0
  11. package/dist/clu/push/v1/push.ts +261 -0
  12. package/dist/clu/scheduler/v1/scheduler.ts +304 -0
  13. package/dist/clu/statistics/v1/statistics.ts +413 -0
  14. package/dist/clu/statistics-pulse/v1/statistics-pulse.ts +218 -0
  15. package/dist/clu/sunrise-sunset-calendar/v1/sunrise-sunset-calendar.ts +389 -0
  16. package/dist/clu/sunrise-sunset-calendar/v2/sunrise-sunset-calendar.ts +659 -0
  17. package/dist/clu/sunrise-sunset-calendar/v3/sunrise-sunset-calendar.ts +659 -0
  18. package/dist/clu/thermostat/v1/thermostat.ts +768 -0
  19. package/dist/clu/thermostat/v2/thermostat.ts +861 -0
  20. package/dist/clu/timer/v1/timer.ts +369 -0
  21. package/dist/core/execution-builder.ts +55 -0
  22. package/dist/core/remote-gate.ts +17 -0
  23. package/dist/digital-in-din/fv02_01/din.ts +310 -0
  24. package/dist/examples/light_turned_on_by_calendar/Clu_OnInit.ts +26 -0
  25. package/dist/examples/light_turned_on_by_presence_sensor/Clu_OnInit.ts +35 -0
  26. package/dist/examples/light_turned_on_by_switch/Clu_OnInit.ts +16 -0
  27. package/dist/gate/cool-master/v1/cool-master.ts +782 -0
  28. package/dist/gate/cool-master-net/v1/cool-master-net.ts +334 -0
  29. package/dist/gate/denon-marantz-avr/v1/denon-marantz-avr.ts +724 -0
  30. package/dist/gate/heos/v1/heos.ts +1224 -0
  31. package/dist/gate/http/fv1000_03/clu-gate-http.ts +405 -0
  32. package/dist/gate/http/fv1000_03_hv1/clu-gate-http.ts +352 -0
  33. package/dist/gate/http/fv1100_03/clu-gate-http.ts +589 -0
  34. package/dist/gate/http/fv1110_03/clu-gate-http.ts +589 -0
  35. package/dist/gate/http/fv1300_03/clu-gate-http.ts +589 -0
  36. package/dist/gate/http/fv1400_03/clu-gate-http.ts +677 -0
  37. package/dist/gate/http-listener/v1/http-listener.ts +299 -0
  38. package/dist/gate/http-listener/v2/http-listener.ts +325 -0
  39. package/dist/gate/http-request/v1/http-request.ts +645 -0
  40. package/dist/gate/http-request/v2/http-request.ts +709 -0
  41. package/dist/gate/input/v1/input.ts +171 -0
  42. package/dist/gate/jablotron/v1/jablotron.ts +100 -0
  43. package/dist/gate/jablotron-device/v1/jablotron-device.ts +171 -0
  44. package/dist/gate/jablotron-output/v1/jablotron-output.ts +240 -0
  45. package/dist/gate/jablotron-section/v1/jablotron-section.ts +260 -0
  46. package/dist/gate/modbus/v1/modbus.ts +609 -0
  47. package/dist/gate/modbus/v2/modbus.ts +690 -0
  48. package/dist/gate/modbus-client/v1/modbus-client.ts +827 -0
  49. package/dist/gate/modbus-rtu/v1/modbus-rtu.ts +911 -0
  50. package/dist/gate/modbus-server/v1/modbus-server.ts +405 -0
  51. package/dist/gate/modbus-slave-config-rtu/v1/modbus-slave-config-rtu.ts +160 -0
  52. package/dist/gate/modbus-slave-rtu/v1/modbus-slave-rtu.ts +371 -0
  53. package/dist/gate/modbus-value/v1/modbus-value.ts +856 -0
  54. package/dist/gate/music-cast/v1/music-cast.ts +1298 -0
  55. package/dist/gate/output/v1/output.ts +240 -0
  56. package/dist/gate/satel/v1/satel.ts +359 -0
  57. package/dist/gate/satel-input/v1/satel-input.ts +171 -0
  58. package/dist/gate/satel-output/v1/satel-output.ts +240 -0
  59. package/dist/gate/satel-zone/v1/satel-zone.ts +235 -0
  60. package/dist/gate/sonos/v1/sonos.ts +934 -0
  61. package/dist/gate/timer/v2/timer.ts +253 -0
  62. package/dist/gate/zone/v1/zone.ts +235 -0
  63. package/dist/io-module-din-8/fv02_02/din.ts +354 -0
  64. package/dist/io-module-din-8/fv02_02/dout.ts +360 -0
  65. package/dist/one-wire/fv01_10/onew-sensor.ts +269 -0
  66. package/dist/one-wire/fv01_28/onew-sensor.ts +269 -0
  67. package/dist/one-wire/fv02_28/onew-sensor.ts +350 -0
  68. package/dist/one-wire/fv03_28/onew-sensor.ts +435 -0
  69. package/dist/relay-din-2/fv02_02/dout.ts +544 -0
  70. package/dist/relay-din-4/fv01_02/dout.ts +340 -0
  71. package/dist/relay-din-4/fv02_02/dout.ts +368 -0
  72. package/dist/roller-shutter-din-3/fv03_02/roller-shutter.ts +1078 -0
  73. package/dist/smart-panel-fm-4/fv03_03/panel-button.ts +550 -0
  74. package/dist/smart-panel-fm-4/fv03_03/panel-sens-light.ts +238 -0
  75. package/dist/smart-panel-fm-4/fv03_03/panel-sens-temp.ts +239 -0
  76. package/dist/smart-panel-fm-4/fv03_03/panel.ts +700 -0
  77. package/dist/smart-panel-fm-4/fv04_03/panel-button.ts +567 -0
  78. package/dist/smart-panel-fm-4/fv04_03/panel-page.ts +516 -0
  79. package/dist/smart-panel-fm-4/fv04_03/panel-sens-light.ts +238 -0
  80. package/dist/smart-panel-fm-4/fv04_03/panel-sens-temp.ts +239 -0
  81. package/dist/smart-panel-fm-4/fv04_03/panel.ts +1026 -0
  82. package/dist/smart-panel-fm-4/fv05_03/panel-button.ts +567 -0
  83. package/dist/smart-panel-fm-4/fv05_03/panel-page.ts +620 -0
  84. package/dist/smart-panel-fm-4/fv05_03/panel-sens-light.ts +238 -0
  85. package/dist/smart-panel-fm-4/fv05_03/panel-sens-temp.ts +266 -0
  86. package/dist/smart-panel-fm-4/fv05_03/panel.ts +1109 -0
  87. package/dist/smart-panel-fm-4/fv06_03/panel-button.ts +567 -0
  88. package/dist/smart-panel-fm-4/fv06_03/panel-page.ts +877 -0
  89. package/dist/smart-panel-fm-4/fv06_03/panel-sens-light.ts +238 -0
  90. package/dist/smart-panel-fm-4/fv06_03/panel-sens-temp.ts +297 -0
  91. package/dist/smart-panel-fm-4/fv06_03/panel.ts +1138 -0
  92. package/dist/smart-panel-fm-4/fv07_03/panel-button.ts +567 -0
  93. package/dist/smart-panel-fm-4/fv07_03/panel-page.ts +864 -0
  94. package/dist/smart-panel-fm-4/fv07_03/panel-sens-light.ts +238 -0
  95. package/dist/smart-panel-fm-4/fv07_03/panel-sens-temp.ts +297 -0
  96. package/dist/smart-panel-fm-4/fv07_03/panel.ts +1135 -0
  97. package/dist/touch-panel-fm-4/fv01_02/panel-button.ts +418 -0
  98. package/dist/touch-panel-fm-4/fv01_02/panel-sens-light.ts +238 -0
  99. package/dist/touch-panel-fm-4/fv01_02/panel-sens-temp.ts +257 -0
  100. package/dist/touch-panel-fm-4/fv01_02/panel.ts +75 -0
  101. package/dist/touch-panel-fm-4/fv01_02/power-supply-voltage.ts +322 -0
  102. package/dist/touch-panel-fm-8/fv01_02/panel-button.ts +418 -0
  103. package/dist/touch-panel-fm-8/fv01_02/panel-sens-light.ts +238 -0
  104. package/dist/touch-panel-fm-8/fv01_02/panel-sens-temp.ts +270 -0
  105. package/dist/touch-panel-fm-8/fv01_02/panel.ts +75 -0
  106. package/dist/touch-panel-fm-8/fv01_02/power-supply-voltage.ts +322 -0
  107. package/package.json +16 -0
@@ -0,0 +1,709 @@
1
+ // Created from: packages/grenton-api/interfaces/object_http_request_v2.xml, object name="HttpRequest" version="2"
2
+
3
+ import { rawExecutionBuilderFactory } from "../../../core/execution-builder"
4
+ import { RemoteGate } from "../../../core/remote-gate"
5
+
6
+ enum EventType {
7
+ OnRequestSent = 0,
8
+ OnResponse = 1
9
+ }
10
+
11
+ enum PropertyType {
12
+ Host = 0,
13
+ Path = 1,
14
+ QueryStringParams = 2,
15
+ Method = 3,
16
+ Timeout = 4,
17
+ RequestType = 5,
18
+ ResponseType = 6,
19
+ RequestHeaders = 7,
20
+ RequestBody = 8,
21
+ ResponseHeaders = 9,
22
+ ResponseBody = 10,
23
+ StatusCode = 11,
24
+ IsActive = 12
25
+ }
26
+
27
+ enum MethodType {
28
+ SendRequest = 0,
29
+ AbortRequest = 1,
30
+ Clear = 2
31
+ }
32
+
33
+ enum RequestType {
34
+ None = 0,
35
+ Text = 1,
36
+ JSON = 2,
37
+ XML = 3,
38
+ FormData = 4,
39
+ Other = 5
40
+ }
41
+
42
+ enum ResponseType {
43
+ None = 0,
44
+ Text = 1,
45
+ JSON = 2,
46
+ XML = 3,
47
+ FormData = 4,
48
+ Other = 5
49
+ }
50
+
51
+ declare class HttpRequestRaw {
52
+ add_event(event: EventType, callback: () => void): void;
53
+ get(property: PropertyType): any;
54
+ set(property: PropertyType, value: any): void;
55
+ execute(method: MethodType, ...args: any[]): any;
56
+ }
57
+
58
+ interface IHttpRequest {
59
+ /**
60
+ * Zdarzenie wywoływane w momencie wysłania zapytania
61
+ * @param callback
62
+ */
63
+ addOnRequestSent: (callback: () => void) => void
64
+ /**
65
+ * Zdarzenie wywoływane w momencie otrzymania odpowiedzi
66
+ * @param callback
67
+ */
68
+ addOnResponse: (callback: () => void) => void
69
+ /** Wysyła zapytanie */
70
+ sendRequest: () => void
71
+ /** Przerywa obsługę zapytania */
72
+ abortRequest: () => void
73
+ /** Usuwa treść zapytania */
74
+ clear: () => void
75
+ /** Adres hosta */
76
+ host: string
77
+ /** Ustawia adres hosta */
78
+ setHost: (value: string) => void
79
+ /** Ścieżka zapytania */
80
+ path: string
81
+ /** Ustawia ścieżkę zapytania */
82
+ setPath: (value: string) => void
83
+ /** Parametry zapytania */
84
+ queryStringParams: string
85
+ /** Ustawia parametry zapytania */
86
+ setQueryStringParams: (value: string) => void
87
+ /** Typ metody wysyłanej w zapytaniu np. GET, POST */
88
+ method: string
89
+ /** Ustawia metodę zapytania */
90
+ setMethod: (value: string) => void
91
+ /** Dopuszczalny czas odpowiedzi */
92
+ timeout: number
93
+ /** Ustawia dopuszczalny czas odpowiedzi */
94
+ setTimeout: (value: number) => void
95
+ /** Typ zawartości wysyłanego zapytania. Definiuje parametr content-type w nagłówku zapytania. W zależności od wybranego typu zawartość cechy RequestBody jest odpowiednio serializowana: 0 - None - niezdefiniowany. W nagłówku nie jest wysyłane content-type. Zawartość cechy RequestBody nie jest serializowana. 1 - Text - content-type: text/plain. Zawartość cechy RequestBody nie jest serializowana. 2 - JSON - content-type: application/json. Zawartość cechy RequestBody jest serializowana do formatu JSON. 3 - XML - content-type: text/xml. Zawartość cechy RequestBody jest serializowana do formatu XML. 4 - FormData - content-type: application/x-www-form-urlencoded. Zawartość cechy RequestBody jest serializowana do tabeli. 5 - Other - typ zawartości (content-type) jest inny niż wbudowany. Typ można zdefiniować umieszczając go w nagłówku (cecha RequestHeaders). Zawartość nie jest serializowana. */
96
+ requestType: RequestType
97
+ /** Ustawia typ zawartości wysyłanego zapytania (content-type) */
98
+ setRequestType: (value: RequestType) => void
99
+ /** Typ oczekiwanej odpowiedzi. Definiuje parametr Accept w nagłówku zapytania. W zależności od wybranego typu zawartość otrzymanej odpowiedzi (cechy ResponseBody) jest odpowiednio parsowana do tabeli: 0 - None - parametr Accept nie jest wysyłany w nagłówku wysyłanego zapytania. Odpowiedź (cecha ResponseBody) nie jest parsowana. 1 - Text - Accept: text/plain. Odpowiedź (cecha ResponseBody) nie jest parsowana. 2 - JSON - Accept: application/json. Odpowiedź (cecha ResponseBody) jest parsowana z JSON. 3 - XML - Accept: text/xml. Odpowiedź (cecha ResponseBody) jest parsowana z XML. 4 - FormData - Accept: application/x-www-form-urlencoded. Odpowiedź (cecha ResponseBody) jest parsowana. 5 - Other - parametr Accept nagłówka jest inny niż wbudowany. Parametr można zdefiniować umieszczając go w nagłówku (cecha RequestHeaders) */
100
+ responseType: ResponseType
101
+ /** Ustawia typ oczekiwanej odpowiedzi na zapytanie */
102
+ setResponseType: (value: ResponseType) => void
103
+ /** Dodatkowe nagłówki zapytania HTTP */
104
+ requestHeaders: string
105
+ /** Ustawia dodatkowe nagłówki HTTP w zapytaniu */
106
+ setRequestHeaders: (value: string) => void
107
+ /** Zawartość wiadomości wysyłanej w zapytaniu */
108
+ requestBody: string
109
+ /** Ustawia zawartość wiadomości w zapytaniu */
110
+ setRequestBody: (value: string) => void
111
+ /** Nagłówki odpowiedzi HTTP */
112
+ responseHeaders: string
113
+ /** Ustawia nagłówki odpowiedzi HTTP */
114
+ setResponseHeaders: (value: string) => void
115
+ /** Zawartość wiadomości otrzymanej po wysłaniu zapytania */
116
+ responseBody: string
117
+ /** Ustawia zawartość wiadomości w odpowiedzi */
118
+ setResponseBody: (value: string) => void
119
+ /** Status odpowiedzi HTTP */
120
+ readonly statusCode: number
121
+ /** Stan aktywności zapytania HTTP */
122
+ readonly isActive: number
123
+ }
124
+
125
+ class HttpRequest implements IHttpRequest {
126
+ private onRequestSentCallbacks: Array<() => void> = [];
127
+ private onResponseCallbacks: Array<() => void> = [];
128
+
129
+ constructor(private raw: HttpRequestRaw) {
130
+ this.raw.add_event(EventType.OnRequestSent, () => {
131
+ this.onRequestSentCallbacks.forEach(callback => { callback(); });
132
+ });
133
+ this.raw.add_event(EventType.OnResponse, () => {
134
+ this.onResponseCallbacks.forEach(callback => { callback(); });
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Zdarzenie wywoływane w momencie wysłania zapytania
140
+ * @param callback
141
+ */
142
+ addOnRequestSent(callback: () => void): void {
143
+ this.onRequestSentCallbacks.push(callback);
144
+ }
145
+ /**
146
+ * Zdarzenie wywoływane w momencie otrzymania odpowiedzi
147
+ * @param callback
148
+ */
149
+ addOnResponse(callback: () => void): void {
150
+ this.onResponseCallbacks.push(callback);
151
+ }
152
+ /** Wysyła zapytanie */
153
+ sendRequest(): void {
154
+ this.raw.execute(MethodType.SendRequest);
155
+ }
156
+ /** Przerywa obsługę zapytania */
157
+ abortRequest(): void {
158
+ this.raw.execute(MethodType.AbortRequest);
159
+ }
160
+ /** Usuwa treść zapytania */
161
+ clear(): void {
162
+ this.raw.execute(MethodType.Clear);
163
+ }
164
+ /**
165
+ * Adres hosta
166
+ * @returns {string}
167
+ */
168
+ get host(): string {
169
+ return this.raw.get(PropertyType.Host);
170
+ }
171
+ set host(value: string) {
172
+ this.raw.set(PropertyType.Host, value);
173
+ }
174
+ /** Ustawia adres hosta */
175
+ setHost(value: string): void {
176
+ this.raw.set(PropertyType.Host, value);
177
+ }
178
+ /**
179
+ * Ścieżka zapytania
180
+ * @returns {string}
181
+ */
182
+ get path(): string {
183
+ return this.raw.get(PropertyType.Path);
184
+ }
185
+ set path(value: string) {
186
+ this.raw.set(PropertyType.Path, value);
187
+ }
188
+ /** Ustawia ścieżkę zapytania */
189
+ setPath(value: string): void {
190
+ this.raw.set(PropertyType.Path, value);
191
+ }
192
+ get queryStringParams(): string {
193
+ return this.raw.get(PropertyType.QueryStringParams);
194
+ }
195
+ set queryStringParams(value: string) {
196
+ this.raw.set(PropertyType.QueryStringParams, value);
197
+ }
198
+ /** Ustawia parametry zapytania */
199
+ setQueryStringParams(value: string): void {
200
+ this.raw.set(PropertyType.QueryStringParams, value);
201
+ }
202
+ /**
203
+ * Typ metody wysyłanej w zapytaniu np. GET, POST
204
+ * @returns {string}
205
+ */
206
+ get method(): string {
207
+ return this.raw.get(PropertyType.Method);
208
+ }
209
+ set method(value: string) {
210
+ this.raw.set(PropertyType.Method, value);
211
+ }
212
+ /** Ustawia metodę zapytania */
213
+ setMethod(value: string): void {
214
+ this.raw.set(PropertyType.Method, value);
215
+ }
216
+ /**
217
+ * Dopuszczalny czas odpowiedzi
218
+ * @returns {number}
219
+ */
220
+ get timeout(): number {
221
+ return this.raw.get(PropertyType.Timeout);
222
+ }
223
+ set timeout(value: number) {
224
+ this.raw.set(PropertyType.Timeout, value);
225
+ }
226
+ /** Ustawia dopuszczalny czas odpowiedzi */
227
+ setTimeout(value: number): void {
228
+ this.raw.set(PropertyType.Timeout, value);
229
+ }
230
+ /**
231
+ * Typ zawartości wysyłanego zapytania. Definiuje parametr content-type w nagłówku zapytania. W zależności od wybranego typu zawartość cechy RequestBody jest odpowiednio serializowana: 0 - None - niezdefiniowany. W nagłówku nie jest wysyłane content-type. Zawartość cechy RequestBody nie jest serializowana. 1 - Text - content-type: text/plain. Zawartość cechy RequestBody nie jest serializowana. 2 - JSON - content-type: application/json. Zawartość cechy RequestBody jest serializowana do formatu JSON. 3 - XML - content-type: text/xml. Zawartość cechy RequestBody jest serializowana do formatu XML. 4 - FormData - content-type: application/x-www-form-urlencoded. Zawartość cechy RequestBody jest serializowana do tabeli. 5 - Other - typ zawartości (content-type) jest inny niż wbudowany. Typ można zdefiniować umieszczając go w nagłówku (cecha RequestHeaders). Zawartość nie jest serializowana.
232
+ * @returns {RequestType}
233
+ */
234
+ get requestType(): RequestType {
235
+ return this.raw.get(PropertyType.RequestType);
236
+ }
237
+ set requestType(value: RequestType) {
238
+ this.raw.set(PropertyType.RequestType, value);
239
+ }
240
+ /** Ustawia typ zawartości wysyłanego zapytania (content-type) */
241
+ setRequestType(value: RequestType): void {
242
+ this.raw.set(PropertyType.RequestType, value);
243
+ }
244
+ /**
245
+ * Typ oczekiwanej odpowiedzi. Definiuje parametr Accept w nagłówku zapytania. W zależności od wybranego typu zawartość otrzymanej odpowiedzi (cechy ResponseBody) jest odpowiednio parsowana do tabeli: 0 - None - parametr Accept nie jest wysyłany w nagłówku wysyłanego zapytania. Odpowiedź (cecha ResponseBody) nie jest parsowana. 1 - Text - Accept: text/plain. Odpowiedź (cecha ResponseBody) nie jest parsowana. 2 - JSON - Accept: application/json. Odpowiedź (cecha ResponseBody) jest parsowana z JSON. 3 - XML - Accept: text/xml. Odpowiedź (cecha ResponseBody) jest parsowana z XML. 4 - FormData - Accept: application/x-www-form-urlencoded. Odpowiedź (cecha ResponseBody) jest parsowana. 5 - Other - parametr Accept nagłówka jest inny niż wbudowany. Parametr można zdefiniować umieszczając go w nagłówku (cecha RequestHeaders)
246
+ * @returns {ResponseType}
247
+ */
248
+ get responseType(): ResponseType {
249
+ return this.raw.get(PropertyType.ResponseType);
250
+ }
251
+ set responseType(value: ResponseType) {
252
+ this.raw.set(PropertyType.ResponseType, value);
253
+ }
254
+ /** Ustawia typ oczekiwanej odpowiedzi na zapytanie */
255
+ setResponseType(value: ResponseType): void {
256
+ this.raw.set(PropertyType.ResponseType, value);
257
+ }
258
+ get requestHeaders(): string {
259
+ return this.raw.get(PropertyType.RequestHeaders);
260
+ }
261
+ set requestHeaders(value: string) {
262
+ this.raw.set(PropertyType.RequestHeaders, value);
263
+ }
264
+ /** Ustawia dodatkowe nagłówki HTTP w zapytaniu */
265
+ setRequestHeaders(value: string): void {
266
+ this.raw.set(PropertyType.RequestHeaders, value);
267
+ }
268
+ get requestBody(): string {
269
+ return this.raw.get(PropertyType.RequestBody);
270
+ }
271
+ set requestBody(value: string) {
272
+ this.raw.set(PropertyType.RequestBody, value);
273
+ }
274
+ /** Ustawia zawartość wiadomości w zapytaniu */
275
+ setRequestBody(value: string): void {
276
+ this.raw.set(PropertyType.RequestBody, value);
277
+ }
278
+ get responseHeaders(): string {
279
+ return this.raw.get(PropertyType.ResponseHeaders);
280
+ }
281
+ set responseHeaders(value: string) {
282
+ this.raw.set(PropertyType.ResponseHeaders, value);
283
+ }
284
+ /** Ustawia nagłówki odpowiedzi HTTP */
285
+ setResponseHeaders(value: string): void {
286
+ this.raw.set(PropertyType.ResponseHeaders, value);
287
+ }
288
+ get responseBody(): string {
289
+ return this.raw.get(PropertyType.ResponseBody);
290
+ }
291
+ set responseBody(value: string) {
292
+ this.raw.set(PropertyType.ResponseBody, value);
293
+ }
294
+ /** Ustawia zawartość wiadomości w odpowiedzi */
295
+ setResponseBody(value: string): void {
296
+ this.raw.set(PropertyType.ResponseBody, value);
297
+ }
298
+ /**
299
+ * Status odpowiedzi HTTP
300
+ * @returns {number}
301
+ */
302
+ get statusCode(): number {
303
+ return this.raw.get(PropertyType.StatusCode);
304
+ }
305
+ /**
306
+ * Stan aktywności zapytania HTTP
307
+ * @returns {number}
308
+ */
309
+ get isActive(): number {
310
+ return this.raw.get(PropertyType.IsActive);
311
+ }
312
+ }
313
+
314
+ class HttpRequestRemote implements IHttpRequest {
315
+ constructor(private objectName: string, private gate: RemoteGate) {
316
+
317
+ }
318
+
319
+ /**
320
+ * Zdarzenie wywoływane w momencie wysłania zapytania
321
+ * @param callback
322
+ */
323
+ addOnRequestSent(_callback: () => void): void {
324
+ // Remote events are not supported
325
+ }
326
+ /**
327
+ * Zdarzenie wywoływane w momencie otrzymania odpowiedzi
328
+ * @param callback
329
+ */
330
+ addOnResponse(_callback: () => void): void {
331
+ // Remote events are not supported
332
+ }
333
+
334
+ /** Wysyła zapytanie */
335
+ sendRequest(): void {
336
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
337
+ .execute()
338
+ .addParameter(MethodType.SendRequest)
339
+ .build();
340
+ this.gate.runScript(cmd!);
341
+ }
342
+
343
+ /** Przerywa obsługę zapytania */
344
+ abortRequest(): void {
345
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
346
+ .execute()
347
+ .addParameter(MethodType.AbortRequest)
348
+ .build();
349
+ this.gate.runScript(cmd!);
350
+ }
351
+
352
+ /** Usuwa treść zapytania */
353
+ clear(): void {
354
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
355
+ .execute()
356
+ .addParameter(MethodType.Clear)
357
+ .build();
358
+ this.gate.runScript(cmd!);
359
+ }
360
+
361
+ /**
362
+ * Adres hosta
363
+ * @returns {string}
364
+ */
365
+ get host(): string {
366
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
367
+ .get()
368
+ .addParameter(PropertyType.Host)
369
+ .build();
370
+ return this.gate.runScript(cmd!);
371
+ }
372
+
373
+ set host(value: string) {
374
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
375
+ .set()
376
+ .addParameter(PropertyType.Host)
377
+ .addParameter(value)
378
+ .build();
379
+ this.gate.runScript(cmd!);
380
+ }
381
+
382
+ /** Ustawia adres hosta */
383
+ setHost(value: string): void {
384
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
385
+ .set()
386
+ .addParameter(PropertyType.Host)
387
+ .addParameter(value)
388
+ .build();
389
+ this.gate.runScript(cmd!);
390
+ }
391
+
392
+ /**
393
+ * Ścieżka zapytania
394
+ * @returns {string}
395
+ */
396
+ get path(): string {
397
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
398
+ .get()
399
+ .addParameter(PropertyType.Path)
400
+ .build();
401
+ return this.gate.runScript(cmd!);
402
+ }
403
+
404
+ set path(value: string) {
405
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
406
+ .set()
407
+ .addParameter(PropertyType.Path)
408
+ .addParameter(value)
409
+ .build();
410
+ this.gate.runScript(cmd!);
411
+ }
412
+
413
+ /** Ustawia ścieżkę zapytania */
414
+ setPath(value: string): void {
415
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
416
+ .set()
417
+ .addParameter(PropertyType.Path)
418
+ .addParameter(value)
419
+ .build();
420
+ this.gate.runScript(cmd!);
421
+ }
422
+
423
+ get queryStringParams(): string {
424
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
425
+ .get()
426
+ .addParameter(PropertyType.QueryStringParams)
427
+ .build();
428
+ return this.gate.runScript(cmd!);
429
+ }
430
+
431
+ set queryStringParams(value: string) {
432
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
433
+ .set()
434
+ .addParameter(PropertyType.QueryStringParams)
435
+ .addParameter(value)
436
+ .build();
437
+ this.gate.runScript(cmd!);
438
+ }
439
+
440
+ /** Ustawia parametry zapytania */
441
+ setQueryStringParams(value: string): void {
442
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
443
+ .set()
444
+ .addParameter(PropertyType.QueryStringParams)
445
+ .addParameter(value)
446
+ .build();
447
+ this.gate.runScript(cmd!);
448
+ }
449
+
450
+ /**
451
+ * Typ metody wysyłanej w zapytaniu np. GET, POST
452
+ * @returns {string}
453
+ */
454
+ get method(): string {
455
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
456
+ .get()
457
+ .addParameter(PropertyType.Method)
458
+ .build();
459
+ return this.gate.runScript(cmd!);
460
+ }
461
+
462
+ set method(value: string) {
463
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
464
+ .set()
465
+ .addParameter(PropertyType.Method)
466
+ .addParameter(value)
467
+ .build();
468
+ this.gate.runScript(cmd!);
469
+ }
470
+
471
+ /** Ustawia metodę zapytania */
472
+ setMethod(value: string): void {
473
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
474
+ .set()
475
+ .addParameter(PropertyType.Method)
476
+ .addParameter(value)
477
+ .build();
478
+ this.gate.runScript(cmd!);
479
+ }
480
+
481
+ /**
482
+ * Dopuszczalny czas odpowiedzi
483
+ * @returns {number}
484
+ */
485
+ get timeout(): number {
486
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
487
+ .get()
488
+ .addParameter(PropertyType.Timeout)
489
+ .build();
490
+ return this.gate.runScript(cmd!);
491
+ }
492
+
493
+ set timeout(value: number) {
494
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
495
+ .set()
496
+ .addParameter(PropertyType.Timeout)
497
+ .addParameter(value)
498
+ .build();
499
+ this.gate.runScript(cmd!);
500
+ }
501
+
502
+ /** Ustawia dopuszczalny czas odpowiedzi */
503
+ setTimeout(value: number): void {
504
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
505
+ .set()
506
+ .addParameter(PropertyType.Timeout)
507
+ .addParameter(value)
508
+ .build();
509
+ this.gate.runScript(cmd!);
510
+ }
511
+
512
+ /**
513
+ * Typ zawartości wysyłanego zapytania. Definiuje parametr content-type w nagłówku zapytania. W zależności od wybranego typu zawartość cechy RequestBody jest odpowiednio serializowana: 0 - None - niezdefiniowany. W nagłówku nie jest wysyłane content-type. Zawartość cechy RequestBody nie jest serializowana. 1 - Text - content-type: text/plain. Zawartość cechy RequestBody nie jest serializowana. 2 - JSON - content-type: application/json. Zawartość cechy RequestBody jest serializowana do formatu JSON. 3 - XML - content-type: text/xml. Zawartość cechy RequestBody jest serializowana do formatu XML. 4 - FormData - content-type: application/x-www-form-urlencoded. Zawartość cechy RequestBody jest serializowana do tabeli. 5 - Other - typ zawartości (content-type) jest inny niż wbudowany. Typ można zdefiniować umieszczając go w nagłówku (cecha RequestHeaders). Zawartość nie jest serializowana.
514
+ * @returns {RequestType}
515
+ */
516
+ get requestType(): RequestType {
517
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
518
+ .get()
519
+ .addParameter(PropertyType.RequestType)
520
+ .build();
521
+ return this.gate.runScript(cmd!);
522
+ }
523
+
524
+ set requestType(value: RequestType) {
525
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
526
+ .set()
527
+ .addParameter(PropertyType.RequestType)
528
+ .addParameter(value)
529
+ .build();
530
+ this.gate.runScript(cmd!);
531
+ }
532
+
533
+ /** Ustawia typ zawartości wysyłanego zapytania (content-type) */
534
+ setRequestType(value: RequestType): void {
535
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
536
+ .set()
537
+ .addParameter(PropertyType.RequestType)
538
+ .addParameter(value)
539
+ .build();
540
+ this.gate.runScript(cmd!);
541
+ }
542
+
543
+ /**
544
+ * Typ oczekiwanej odpowiedzi. Definiuje parametr Accept w nagłówku zapytania. W zależności od wybranego typu zawartość otrzymanej odpowiedzi (cechy ResponseBody) jest odpowiednio parsowana do tabeli: 0 - None - parametr Accept nie jest wysyłany w nagłówku wysyłanego zapytania. Odpowiedź (cecha ResponseBody) nie jest parsowana. 1 - Text - Accept: text/plain. Odpowiedź (cecha ResponseBody) nie jest parsowana. 2 - JSON - Accept: application/json. Odpowiedź (cecha ResponseBody) jest parsowana z JSON. 3 - XML - Accept: text/xml. Odpowiedź (cecha ResponseBody) jest parsowana z XML. 4 - FormData - Accept: application/x-www-form-urlencoded. Odpowiedź (cecha ResponseBody) jest parsowana. 5 - Other - parametr Accept nagłówka jest inny niż wbudowany. Parametr można zdefiniować umieszczając go w nagłówku (cecha RequestHeaders)
545
+ * @returns {ResponseType}
546
+ */
547
+ get responseType(): ResponseType {
548
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
549
+ .get()
550
+ .addParameter(PropertyType.ResponseType)
551
+ .build();
552
+ return this.gate.runScript(cmd!);
553
+ }
554
+
555
+ set responseType(value: ResponseType) {
556
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
557
+ .set()
558
+ .addParameter(PropertyType.ResponseType)
559
+ .addParameter(value)
560
+ .build();
561
+ this.gate.runScript(cmd!);
562
+ }
563
+
564
+ /** Ustawia typ oczekiwanej odpowiedzi na zapytanie */
565
+ setResponseType(value: ResponseType): void {
566
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
567
+ .set()
568
+ .addParameter(PropertyType.ResponseType)
569
+ .addParameter(value)
570
+ .build();
571
+ this.gate.runScript(cmd!);
572
+ }
573
+
574
+ get requestHeaders(): string {
575
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
576
+ .get()
577
+ .addParameter(PropertyType.RequestHeaders)
578
+ .build();
579
+ return this.gate.runScript(cmd!);
580
+ }
581
+
582
+ set requestHeaders(value: string) {
583
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
584
+ .set()
585
+ .addParameter(PropertyType.RequestHeaders)
586
+ .addParameter(value)
587
+ .build();
588
+ this.gate.runScript(cmd!);
589
+ }
590
+
591
+ /** Ustawia dodatkowe nagłówki HTTP w zapytaniu */
592
+ setRequestHeaders(value: string): void {
593
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
594
+ .set()
595
+ .addParameter(PropertyType.RequestHeaders)
596
+ .addParameter(value)
597
+ .build();
598
+ this.gate.runScript(cmd!);
599
+ }
600
+
601
+ get requestBody(): string {
602
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
603
+ .get()
604
+ .addParameter(PropertyType.RequestBody)
605
+ .build();
606
+ return this.gate.runScript(cmd!);
607
+ }
608
+
609
+ set requestBody(value: string) {
610
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
611
+ .set()
612
+ .addParameter(PropertyType.RequestBody)
613
+ .addParameter(value)
614
+ .build();
615
+ this.gate.runScript(cmd!);
616
+ }
617
+
618
+ /** Ustawia zawartość wiadomości w zapytaniu */
619
+ setRequestBody(value: string): void {
620
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
621
+ .set()
622
+ .addParameter(PropertyType.RequestBody)
623
+ .addParameter(value)
624
+ .build();
625
+ this.gate.runScript(cmd!);
626
+ }
627
+
628
+ get responseHeaders(): string {
629
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
630
+ .get()
631
+ .addParameter(PropertyType.ResponseHeaders)
632
+ .build();
633
+ return this.gate.runScript(cmd!);
634
+ }
635
+
636
+ set responseHeaders(value: string) {
637
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
638
+ .set()
639
+ .addParameter(PropertyType.ResponseHeaders)
640
+ .addParameter(value)
641
+ .build();
642
+ this.gate.runScript(cmd!);
643
+ }
644
+
645
+ /** Ustawia nagłówki odpowiedzi HTTP */
646
+ setResponseHeaders(value: string): void {
647
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
648
+ .set()
649
+ .addParameter(PropertyType.ResponseHeaders)
650
+ .addParameter(value)
651
+ .build();
652
+ this.gate.runScript(cmd!);
653
+ }
654
+
655
+ get responseBody(): string {
656
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
657
+ .get()
658
+ .addParameter(PropertyType.ResponseBody)
659
+ .build();
660
+ return this.gate.runScript(cmd!);
661
+ }
662
+
663
+ set responseBody(value: string) {
664
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
665
+ .set()
666
+ .addParameter(PropertyType.ResponseBody)
667
+ .addParameter(value)
668
+ .build();
669
+ this.gate.runScript(cmd!);
670
+ }
671
+
672
+ /** Ustawia zawartość wiadomości w odpowiedzi */
673
+ setResponseBody(value: string): void {
674
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
675
+ .set()
676
+ .addParameter(PropertyType.ResponseBody)
677
+ .addParameter(value)
678
+ .build();
679
+ this.gate.runScript(cmd!);
680
+ }
681
+
682
+ /**
683
+ * Status odpowiedzi HTTP
684
+ * @returns {number}
685
+ */
686
+ get statusCode(): number {
687
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
688
+ .get()
689
+ .addParameter(PropertyType.StatusCode)
690
+ .build();
691
+ return this.gate.runScript(cmd!);
692
+ }
693
+
694
+ /**
695
+ * Stan aktywności zapytania HTTP
696
+ * @returns {number}
697
+ */
698
+ get isActive(): number {
699
+ const cmd: string | null = rawExecutionBuilderFactory(this.objectName)
700
+ .get()
701
+ .addParameter(PropertyType.IsActive)
702
+ .build();
703
+ return this.gate.runScript(cmd!);
704
+ }
705
+ }
706
+
707
+ export {
708
+ HttpRequest, HttpRequestRaw, HttpRequestRemote, RequestType, ResponseType
709
+ }