Skip to main content

Complex Requests

Some operations require structured inputs to describe the request. Data types with fluent factory methods help construct these inputs. The following example uses TRekognitionImage.FromFile to construct an image input for label detection:

var
Client: IRekognitionClient;
Request: IRekognitionDetectLabelsRequest;
Response: IRekognitionDetectLabelsResponse;
begin
Client := TRekognitionClient.Create;

Request := TRekognitionDetectLabelsRequest.Create;
Request.Image := TRekognitionImage.FromFile('Photo.jpg');
Request.MaxLabels := 10;
Request.MinConfidence := 75;

Response := Client.DetectLabels(Request);
for var LLabel in Response.Labels do
Writeln(Format('%s: %.1f%%', [LLabel.Name, LLabel.Confidence.Value]));
end.