Better handling of Out parameters

I have been pondering the conversion of functions with var and out parameters to the HTTP API. Currently, they are not supported, which means that the new method is not particularly handy for existing APIs, given that pretty much all of mine use these features.What I did though was, as you suggested, have a new return type, and after making new functions, I think it shows the way that this could be automatically handled quite nicely.

Given the function:

	function AccountCreate(const email: String; const password: String;  const service: String; out message: String; out continue: Integer): Integer;

I converted this to:

	function AccountCreateHTTP(const email: String; const password: String; const service: String): THTTPContinueResponse;

Where the response is:

THTTPContinueResponse = class (TROComplexType)
private
m_Result : Integer;
m_Message : String;
m_Continue : integer;
published
property result : Integer read m_Result write m_Result;
property message : String read m_Message write m_Message;
property continue : integer read m_Continue write m_Continue;
end;

It struck me, having done a load of these, that this could easily be done automatically. The result is the normal return value, and the other values are the var/out values, with the same name. All wrapped with a pretty JSON object bow. This then would allow the application of the system to any function regardless of the parameter types.

1 Like

swagger api doesn’t support out/var parameters.
I don’t think, that we want to complicate things here like soap has …

But I am not suggesting that it supports out as “out” but as an automatic JSON return with the result and the var/out parameters in it.

I’ll log an issue for investigation with low priority

Thanks, logged as bugs://79001