diff --git a/src/core/RESTRequest4D.Request.Params.pas b/src/core/RESTRequest4D.Request.Params.pas
index afd1864..65f8ed1 100644
--- a/src/core/RESTRequest4D.Request.Params.pas
+++ b/src/core/RESTRequest4D.Request.Params.pas
@@ -12,7 +12,8 @@ TRequestParams = class(TInterfacedObject, IRequestParams)
function Clear: IRequestParams;
function Add(const AName, AValue: string; const AKind: TRESTRequestParameterKind = TRESTRequestParameterKind.pkQUERY): IRequestParams; overload;
function Add(const AName: string; const AValue: Currency; const AKind: TRESTRequestParameterKind = TRESTRequestParameterKind.pkQUERY): IRequestParams; overload;
- function Add(const AName: string; const AValue: TStream): IRequestParams; overload;
+ function AddFile(const AName: string; const AValue: TStream): IRequestParams;
+ function AddText(const AName, AValue: string; const AContentType: TRESTContentType = TRESTContentType.ctAPPLICATION_JSON): IRequestParams;
public
constructor Create(const ARESTRequest: TRESTRequest);
destructor Destroy; override;
@@ -39,7 +40,7 @@ function TRequestParams.Add(const AName: string; const AValue: Currency; const A
Result := Self.Add(AName, CurrToStr(AValue), AKind);
end;
-function TRequestParams.Add(const AName: string; const AValue: TStream): IRequestParams;
+function TRequestParams.AddFile(const AName: string; const AValue: TStream): IRequestParams;
begin
Result := Self;
if not Assigned(AValue) then
@@ -54,6 +55,18 @@ function TRequestParams.Add(const AName: string; const AValue: TStream): IReques
end;
end;
+function TRequestParams.AddText(const AName, AValue: string; const AContentType: TRESTContentType = TRESTContentType.ctAPPLICATION_JSON): IRequestParams;
+begin
+ Result := Self;
+ with FRESTRequest.Params.AddItem do
+ begin
+ Name := AName;
+ Value := AValue;
+ Kind := TRESTRequestParameterKind.pkREQUESTBODY;
+ ContentType := AContentType;
+ end;
+end;
+
function TRequestParams.Clear: IRequestParams;
var
I: Integer;
@@ -76,4 +89,4 @@ destructor TRequestParams.Destroy;
inherited;
end;
-end.
+end.
\ No newline at end of file
diff --git a/src/interfaces/RESTRequest4D.Request.Params.Intf.pas b/src/interfaces/RESTRequest4D.Request.Params.Intf.pas
index ce2fcdb..f817a1d 100644
--- a/src/interfaces/RESTRequest4D.Request.Params.Intf.pas
+++ b/src/interfaces/RESTRequest4D.Request.Params.Intf.pas
@@ -56,7 +56,20 @@ interface
///
function Add(const AName: string; const AValue: Currency; const AKind: TRESTRequestParameterKind = TRESTRequestParameterKind.pkQUERY): IRequestParams; overload;
///
- /// Adds a new parameter.
+ /// Adds a new file multi part param.
+ ///
+ ///
+ /// Name of the parameter.
+ ///
+ ///
+ /// Parameter value.
+ ///
+ ///
+ /// Returns the instance itself following the fluent API pattern.
+ ///
+ function AddFile(const AName: string; const AValue: TStream): IRequestParams;
+ ///
+ /// Adds a new text multi part param.
///
///
/// Name of the parameter.
@@ -67,9 +80,9 @@ interface
///
/// Returns the instance itself following the fluent API pattern.
///
- function Add(const AName: string; const AValue: TStream): IRequestParams; overload;
+ function AddText(const AName: string; const AValue: string; const AContentType: TRESTContentType = TRESTContentType.ctAPPLICATION_JSON): IRequestParams;
end;
implementation
-end.
+end.
\ No newline at end of file