Skip to content

Commit

Permalink
SIANXSVC-1193: Add example code to the InlineHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
nachtjasmin committed Jan 31, 2024
1 parent 1e8543a commit dcd7967
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/InlineHandler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ await Host.CreateDefaultBuilder(args)
var res = E5EResponse.From("test");
return Task.FromResult(res);
});
builder.RegisterEntrypoint("Binary", request =>
{
// This entrypoint receives one file (type: binary) and returns an anonymous object with the length.
var fileData = request.Event.AsBytes();
return Task.FromResult(E5EResponse.From(new { FileLength = fileData?.LongLength }));
});
builder.RegisterEntrypoint("ReturnFirstFile", request =>
{
// This entrypoint receives multiple files as a mixed request and returns the first.
var files = request.Event.AsFiles();
return Task.FromResult(E5EResponse.From(files.First()));
});
})
.UseConsoleLifetime()
.Build()
Expand Down

0 comments on commit dcd7967

Please sign in to comment.