Interfaces in Delphi for working with AWS SDK for .NET using Hydra

Hi,

I’m looking for a way to use AWS’s SDK for .NET from a DA/RO server written in Delphi. Hydra seems like a good fit for this. However, as I’m a Hydra newbie, I need some help creating the interfaces in Delphi to match the classes in .NET.

For example, the following are some interfaces I created for the SendRawEmailRequest class in the SimpleEmail library in the AWS SDK for .NET:

public interface ISendRawEmailRequest
{
    string ConfigurationSetName { get; set; }
    List<string> Destinations { get; set; }
    string FromArn { get; set; }
    RawMessage RawMessage { get; set; }
    string ReturnPathArn { get; set; }
    string Source { get; set; }
    string SourceArn { get; set; }
    List<MessageTag> Tags { get; set; }
}

public interface IRawMessage
{
    MemoryStream Data { get; set; }
}

public interface IMessageTag
{
    string Name { get; set; }
    string Value { get; set; }
}

How can I map the List property to an interface in Delphi? Or the MemoryStream property? And how can I create the interfaces in Delphi for the main class, as it uses two additional classes that need to be passed to the Delphi host as properties of the main class?

Thanks,
Arturo.

Hello

You need to switch from List<T> to T[] in the cross-platform interfaces. MemoryStream can be replaced with byte[]. Also you need to use ’RawMessage interface instead of class name if the property definition:

RawMessage RawMessage { get; set; }

Then set IHYCrossPlatformInterface as base interfaces for your interfaces and add the Guid attribute as described in https://docs.hydra4.com/HowTos/PassingInterfacesBetweenHostAndPlugins/

Then build the plugin assembly and in RAD Studio use the menu command Tools -> Hydra -> Import interfaces from .NET Assemblies . This command will import .NET defined interfaces as Delphi code.

Regards

Ok, perfect. I’ll test this and let you know if I have any problems getting this to work.

Thanks!

Arturo.