duzzell 0 Posted July 16 Hello I use a number of AWS services and I use REST interfaces to implement them. Broad question: if I embed something like the DukTape javascript engine in my Delphi 12.1 fmx app, would I be able to use the AWS javascript SDKs instead of the REST API's? If so, might that extend to other javascript APIs such as Google's and Apple's? What is the basic principle that would make or break such an approach? Thanks Share this post Link to post
Pierce Ng 0 Posted August 9 I've considered such an approach though I haven't tried doing it. TL, DR: Working out how to generate and use Delphi source code from OpenAPI specifications of these cloud SDKs will give more bang for the buck and be kinder to one's sanity. Below is AWS Javascript SDK S3 example. Prerequisites include Node.js. 1st key point: The example logs to console. To do useful work, you'll have to figure out data interchange between Delphi and Javascript within your program. 2nd (but really the) key point: Because Node.js is a prerequisite for the AWS SDK, you're not just embedding Duktape in your Delphi program, you're looking at embedding Node.js, with all the work that entails, given that Duktape isn't the default Javascript engine for Node.js and may not actually be good enough for current versions of Node.js. import { S3Client, CopyObjectCommand } from "@aws-sdk/client-s3"; const client = new S3Client({}); export const main = async () => { const command = new CopyObjectCommand({ CopySource: "SOURCE_BUCKET/SOURCE_OBJECT_KEY", Bucket: "DESTINATION_BUCKET", Key: "NEW_OBJECT_KEY", }); try { const response = await client.send(command); console.log(response); } catch (err) { console.error(err); } }; Share this post Link to post
Vincent Parrett 759 Posted August 9 If you have Delphi 11 or 12 enterprise or architect edition, then there is an aws sdk library in GetIt - if not - https://www.appercept.com/ (the author of the one in getit) are close to releasing a commercial version which will work with pro edition. The library is really well thought out, follows the same conventions as the official aws sdks which makes it pretty easy to use. 1 Share this post Link to post
Patrick PREMARTIN 78 Posted August 9 On 7/16/2024 at 11:53 AM, duzzell said: Hello I use a number of AWS services and I use REST interfaces to implement them. Broad question: if I embed something like the DukTape javascript engine in my Delphi 12.1 fmx app, would I be able to use the AWS javascript SDKs instead of the REST API's? If so, might that extend to other javascript APIs such as Google's and Apple's? What is the basic principle that would make or break such an approach? Thanks Hi Why do you want to add more complexity to your program ? Did you tried the REST API of the AWS service you need or did you have problems with it ? 1 Share this post Link to post
David Schwartz 427 Posted August 9 Have you looked at TMS WEB Core? You can write your code in Dephi and it transpiles it into JS. You can use pretty much any 3rd-party JS lib. I use HTTP for I/O, but you could use JS just as easily. And the language has been extended to support async requests in-line. Share this post Link to post