Skip to content

Commit 5fea60e

Browse files
committed
Merge branch 'develop'
2 parents cecd6e2 + 087b0ba commit 5fea60e

13 files changed

+278
-108
lines changed

Samples/API/Samples.API.dpr

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ uses
88
System.SysUtils,
99
System.JSON,
1010
Horse,
11-
Horse.Jhonson,
12-
Horse.HandleException;
11+
Horse.Jhonson;
1312

1413
const
1514
PORT = 9050;
@@ -24,36 +23,36 @@ begin
2423
Res.Send('pong');
2524
end);
2625

27-
THorse.Get('/clientes',
26+
THorse.Get('/clients',
2827
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
2928
var
30-
LJSONObjectRetorno: TJSONObject;
31-
LJSONObjectCliente: TJSONObject;
29+
LJSONObjectResult: TJSONObject;
30+
LJSONObjectClient: TJSONObject;
3231
LJSONArray: TJSONArray;
33-
LNumRegistrosGerar: Integer;
32+
LNumberRecords: Integer;
3433
i: Integer;
3534
begin
36-
LNumRegistrosGerar := 10;
37-
if Req.Query.ContainsKey('numero-registros-gerar') then
38-
LNumRegistrosGerar := Req.Query.Field('numero-registros-gerar').AsInteger;
35+
LNumberRecords := 10;
36+
if Req.Query.ContainsKey('number-records') then
37+
LNumberRecords := Req.Query.Field('number-records').AsInteger;
3938

4039
LJSONArray := TJSONArray.Create;
41-
for i := 1 to LNumRegistrosGerar do
40+
for i := 1 to LNumberRecords do
4241
begin
43-
LJSONObjectCliente := TJSONObject.Create;
44-
LJSONObjectCliente.AddPair('id', TJSONNumber.Create(i));
45-
LJSONObjectCliente.AddPair('nome', 'Nome cliente ' + i.ToString);
46-
LJSONObjectCliente.AddPair('email','nome' + i.ToString + '@code4delphi.com.br');
47-
LJSONArray.AddElement(LJSONObjectCliente);
42+
LJSONObjectClient := TJSONObject.Create;
43+
LJSONObjectClient.AddPair('id', TJSONNumber.Create(i));
44+
LJSONObjectClient.AddPair('name', 'Name Client ' + i.ToString);
45+
LJSONObjectClient.AddPair('email', 'name' + i.ToString + '@code4delphi.com.br');
46+
LJSONArray.AddElement(LJSONObjectClient);
4847
end;
4948

50-
LJSONObjectRetorno := TJSONObject.Create;
51-
LJSONObjectRetorno.AddPair('data', LJSONArray);
52-
LJSONObjectRetorno.AddPair('records', TJSONNumber.Create(LNumRegistrosGerar));
53-
Res.Send<TJSONObject>(LJSONObjectRetorno);
49+
LJSONObjectResult := TJSONObject.Create;
50+
LJSONObjectResult.AddPair('data', LJSONArray);
51+
LJSONObjectResult.AddPair('records', TJSONNumber.Create(LNumberRecords));
52+
Res.Send<TJSONObject>(LJSONObjectResult);
5453
end);
5554

56-
THorse.Get('/clientes/:id',
55+
THorse.Get('/clients/:id',
5756
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
5857
var
5958
LJSONObject: TJSONObject;
@@ -63,14 +62,14 @@ begin
6362

6463
LJSONObject := TJSONObject.Create;
6564
LJSONObject.AddPair('id', TJSONNumber.Create(LId.ToInteger));
66-
LJSONObject.AddPair('nome', 'Nome cliente ' + LId);
67-
LJSONObject.AddPair('email','nome' + LId + '@code4delphi.com.br');
65+
LJSONObject.AddPair('name', 'Name Client ' + LId);
66+
LJSONObject.AddPair('email', 'name' + LId + '@code4delphi.com.br');
6867
Res.Send<TJSONObject>(LJSONObject);
6968
end);
7069

7170
THorse.Listen(PORT,
7271
procedure
7372
begin
74-
Writeln('Porta atual: ' + PORT.ToString);
73+
Writeln('CSV Adapter For RESTRequest4D is running on the port ' + PORT.ToString);
7574
end);
7675
end.

Samples/API/Samples.API.dproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<DCC_K>false</DCC_K>
6565
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
6666
<SanitizedProjectName>Samples_API</SanitizedProjectName>
67-
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;modules;modules\handle-exception\src;modules\horse\src;modules\jhonson\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
67+
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;modules;modules\horse\src;modules\jhonson\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
6868
</PropertyGroup>
6969
<PropertyGroup Condition="'$(Base_Android)'!=''">
7070
<DCC_UsePackage>DBXSqliteDriver;tethering;FireDACDBXDriver;RESTBackendComponents;bindengine;CloudService;DataSnapClient;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FMXTee;soaprtl;DbxCommonDriver;xmlrtl;DataSnapNativeClient;soapmidas;rtl;DbxClientDriver;IndyIPClient;DataSnapProviderClient;RESTComponents;ZComponent;DBXInterBaseDriver;ZCore;emsclientfiredac;DataSnapFireDAC;FmxTeeUI;FireDACIBDriver;fmx;dbexpress;IndyCore;ZParseSql;dsnap;DataSnapCommon;emsclient;FireDACCommon;soapserver;FireDACCommonDriver;inet;IndyIPCommon;ZDbc;FireDAC;FireDACSqliteDriver;ibmonitor;ibxpress;ibxbindings;FireDACDSDriver;CustomIPTransport;bindcomp;ZPlain;dbxcds;dsnapxml;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>

Samples/API/boss-lock.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
"hash": "d41d8cd98f00b204e9800998ecf8427e",
33
"updated": "2024-05-27T14:16:49.6796117-03:00",
44
"installedModules": {
5-
"github.com/hashload/handle-exception": {
6-
"name": "handle-exception",
7-
"version": "0.1.9",
8-
"hash": "b7878eb4d418c67420daf8cc2e7f9dda",
9-
"artifacts": {},
10-
"failed": false,
11-
"changed": false
12-
},
135
"github.com/hashload/horse": {
146
"name": "horse",
157
"version": "3.1.6",

Samples/API/boss.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"mainsrc": "./src",
77
"projects": [],
88
"dependencies": {
9-
"github.com/hashload/handle-exception": "^0.1.9",
109
"github.com/hashload/horse": "^3.1.6",
1110
"github.com/hashload/jhonson": "^1.1.8"
1211
}

Samples/Client/Samples.Client.dpr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ program Samples.Client;
33
uses
44
Vcl.Forms,
55
View.Main in 'Src\View\View.Main.pas' {ViewMain},
6-
CSV.Adapter.RESTRequest4D in '..\..\Src\CSV.Adapter.RESTRequest4D.pas';
6+
CSV.Adapter.RESTRequest4D in '..\..\Src\CSV.Adapter.RESTRequest4D.pas',
7+
CSV.Adapter.RESTRequest4D.Config in '..\..\Src\CSV.Adapter.RESTRequest4D.Config.pas',
8+
CSV.Adapter.RESTRequest4D.Utils in '..\..\Src\CSV.Adapter.RESTRequest4D.Utils.pas';
79

810
{$R *.res}
911

Samples/Client/Samples.Client.dproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
<FormType>dfm</FormType>
105105
</DCCReference>
106106
<DCCReference Include="..\..\Src\CSV.Adapter.RESTRequest4D.pas"/>
107+
<DCCReference Include="..\..\Src\CSV.Adapter.RESTRequest4D.Config.pas"/>
108+
<DCCReference Include="..\..\Src\CSV.Adapter.RESTRequest4D.Utils.pas"/>
107109
<BuildConfiguration Include="Release">
108110
<Key>Cfg_2</Key>
109111
<CfgParent>Base</CfgParent>

Samples/Client/Src/View/View.Main.dfm

Lines changed: 91 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ object ViewMain: TViewMain
1717
TextHeight = 13
1818
object Panel9: TPanel
1919
Left = 0
20-
Top = 0
20+
Top = 49
2121
Width = 984
2222
Height = 41
2323
Align = alTop
@@ -26,17 +26,15 @@ object ViewMain: TViewMain
2626
BevelOuter = bvNone
2727
ParentBackground = False
2828
TabOrder = 0
29-
ExplicitTop = -1
3029
object Label1: TLabel
3130
AlignWithMargins = True
32-
Left = 239
31+
Left = 454
3332
Top = 3
34-
Width = 93
33+
Width = 80
3534
Height = 33
3635
Align = alLeft
37-
Caption = 'Registros a buscar:'
36+
Caption = 'Number records:'
3837
Layout = tlCenter
39-
ExplicitLeft = 243
4038
ExplicitHeight = 13
4139
end
4240
object Label3: TLabel
@@ -50,9 +48,20 @@ object ViewMain: TViewMain
5048
Caption = 'Base URL:'
5149
Layout = tlCenter
5250
end
51+
object Label5: TLabel
52+
AlignWithMargins = True
53+
Left = 239
54+
Top = 3
55+
Width = 50
56+
Height = 33
57+
Align = alLeft
58+
AutoSize = False
59+
Caption = 'Resource:'
60+
Layout = tlCenter
61+
end
5362
object edtNumRegistros: TEdit
5463
AlignWithMargins = True
55-
Left = 338
64+
Left = 540
5665
Top = 8
5766
Width = 54
5867
Height = 23
@@ -62,6 +71,7 @@ object ViewMain: TViewMain
6271
NumbersOnly = True
6372
TabOrder = 0
6473
Text = '5'
74+
ExplicitHeight = 21
6575
end
6676
object edtBaseURL: TEdit
6777
AlignWithMargins = True
@@ -75,23 +85,36 @@ object ViewMain: TViewMain
7585
NumbersOnly = True
7686
TabOrder = 1
7787
Text = 'http://localhost:9050/'
88+
ExplicitHeight = 21
89+
end
90+
object edtResource: TEdit
91+
AlignWithMargins = True
92+
Left = 295
93+
Top = 8
94+
Width = 153
95+
Height = 23
96+
Margins.Top = 8
97+
Margins.Bottom = 8
98+
Align = alLeft
99+
NumbersOnly = True
100+
TabOrder = 2
101+
Text = 'clients'
102+
ExplicitHeight = 21
78103
end
79104
end
80105
object Panel1: TPanel
81106
Left = 0
82-
Top = 123
107+
Top = 172
83108
Width = 984
84-
Height = 418
109+
Height = 369
85110
Align = alClient
86111
BevelOuter = bvNone
87112
ParentBackground = False
88113
TabOrder = 1
89-
ExplicitTop = 41
90-
ExplicitHeight = 500
91114
object Splitter1: TSplitter
92115
Left = 505
93116
Top = 0
94-
Height = 418
117+
Height = 369
95118
ExplicitLeft = 480
96119
ExplicitTop = 200
97120
ExplicitHeight = 100
@@ -100,46 +123,42 @@ object ViewMain: TViewMain
100123
Left = 0
101124
Top = 0
102125
Width = 505
103-
Height = 418
126+
Height = 369
104127
Align = alLeft
105128
Caption = ' JSON '
106129
TabOrder = 0
107-
ExplicitHeight = 500
108130
object mmJSON: TMemo
109131
Left = 2
110132
Top = 15
111133
Width = 501
112-
Height = 401
134+
Height = 352
113135
Align = alClient
114136
ScrollBars = ssVertical
115137
TabOrder = 0
116-
ExplicitLeft = 3
117138
end
118139
end
119140
object GroupBox2: TGroupBox
120141
Left = 508
121142
Top = 0
122143
Width = 476
123-
Height = 418
144+
Height = 369
124145
Align = alClient
125146
Caption = ' CSV '
126147
TabOrder = 1
127-
ExplicitHeight = 500
128148
object mmCSV: TMemo
129149
Left = 2
130150
Top = 15
131151
Width = 472
132-
Height = 401
152+
Height = 352
133153
Align = alClient
134154
ScrollBars = ssVertical
135155
TabOrder = 0
136-
ExplicitHeight = 483
137156
end
138157
end
139158
end
140159
object Panel2: TPanel
141160
Left = 0
142-
Top = 41
161+
Top = 90
143162
Width = 984
144163
Height = 41
145164
Align = alTop
@@ -183,15 +202,14 @@ object ViewMain: TViewMain
183202
end
184203
object Panel3: TPanel
185204
Left = 0
186-
Top = 82
205+
Top = 131
187206
Width = 984
188207
Height = 41
189208
Align = alTop
190209
BevelKind = bkTile
191210
BevelOuter = bvNone
192211
ParentBackground = False
193212
TabOrder = 3
194-
ExplicitTop = 49
195213
object Label4: TLabel
196214
AlignWithMargins = True
197215
Left = 3
@@ -227,4 +245,54 @@ object ViewMain: TViewMain
227245
OnClick = btnGetArrayToTStringClick
228246
end
229247
end
248+
object GroupBox1: TGroupBox
249+
Left = 0
250+
Top = 0
251+
Width = 984
252+
Height = 49
253+
Align = alTop
254+
Caption = ' Configuration '
255+
TabOrder = 4
256+
object Label6: TLabel
257+
AlignWithMargins = True
258+
Left = 5
259+
Top = 18
260+
Width = 71
261+
Height = 26
262+
Align = alLeft
263+
AutoSize = False
264+
Caption = 'Separator:'
265+
Layout = tlCenter
266+
ExplicitLeft = 3
267+
ExplicitTop = 3
268+
ExplicitHeight = 33
269+
end
270+
object cBoxSeparator: TComboBox
271+
AlignWithMargins = True
272+
Left = 82
273+
Top = 20
274+
Width = 47
275+
Height = 21
276+
Margins.Top = 5
277+
Margins.Bottom = 8
278+
Align = alLeft
279+
ItemIndex = 0
280+
TabOrder = 0
281+
Text = ';'
282+
Items.Strings = (
283+
';'
284+
'|')
285+
end
286+
object edtApplyConfigs: TButton
287+
AlignWithMargins = True
288+
Left = 135
289+
Top = 18
290+
Width = 100
291+
Height = 26
292+
Align = alLeft
293+
Caption = 'Apply Config'
294+
TabOrder = 1
295+
OnClick = edtApplyConfigsClick
296+
end
297+
end
230298
end

0 commit comments

Comments
 (0)