Fluent REST Client Interface using Delphi REST Client Components
-
Upload
cesar-romero -
Category
Software
-
view
306 -
download
4
Transcript of Fluent REST Client Interface using Delphi REST Client Components
![Page 1: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/1.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Creating Fluent REST Client Interface
using Delphi REST Client
Components
![Page 2: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/2.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Speaker
• Cesar Romero• Delphi Developer for 20 years• Embarcadero MVP• Delphi Developer at Trier Sistemas, Brazil
![Page 3: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/3.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
AGENDA
•Delphi REST Client Components
• Json Data Objects
• Fluent Interface API
•Delphi REST Client Fluent Interface API
•Examples
![Page 4: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/4.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Delphi REST Client Components
• Introduced in Delphi and C++Builder XE5• Since XE8 it is based on System.Net.HttpClient - WinHTTP
• HTTPS without OpenSSL • no more libeay32.dll and ssleay32.dll deploy
• System.Threading based• REST Debugger
• Sources available • C:\Program Files\Embarcadero\Studio\18.0\source\data\rest\restdebugger
![Page 5: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/5.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Json Data Objects
• JSON parser • Supports
• Delphi 2009-10.1 Berlin• Platforms Win32, Win64 and ARM Android (MacOS and iOS may work)
• MIT License (MIT)• Author: Andreas Hausladen• https://github.com/ahausladen/JsonDataObjects
![Page 6: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/6.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Json Data Objects - Features
• Fast dual JSON parser for parsing UTF8 and UTF16 without conversion
• Automatic creation of arrays and objects• Easy access mode with implicit operators• Compact and formatted output modes• Variants support• Null can be auto-typecasted to a value type • Progress callback support for loading large JSON strings
![Page 7: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/7.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Fluent Interface API, what is it?
“...fluent interface is an implementation of an object oriented API that aims to provide more readable code.”
https://en.wikipedia.org/wiki/Fluent_interface
• normally implemented using a method cascading/method chaining• define through the return value of a called method• self-referential, where the new context is equivalent to the last context• terminated through the result of a void context
![Page 8: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/8.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Delphi REST Client Fluent Interface
• Interface Based• Uses Delphi REST Components • Uses Json Data Objects• Flexible and extensible• Very easy to use• MIT License (MIT)• https://bitbucket.org/cesarliws/delphi-fluent-rest-client
![Page 9: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/9.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Delphi REST Client Fluent Interface - Example
![Page 10: Fluent REST Client Interface using Delphi REST Client Components](https://reader036.fdocuments.in/reader036/viewer/2022092615/5871af2e1a28abda6a8b63dd/html5/thumbnails/10.jpg)
CodeRage XI – Productivity, Platforms and Performance – embt.co/CodeRageXI
Delphi REST Client Fluent Interface - Demos
• https://bitbucket.org/cesarliws/delphi-fluent-rest-client