I think this is a great thread to start. Thanks @thangngoc89.
I am trying to write bindings for AWS sdk. I have the CDN in my html, so the AWS
constructor object is available as a global variable.
- I am trying to compile into js something like this:
AWS.config.region = "us-west-2";
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: "xxx"
});
var lambda = new AWS.Lambda();
- So far I have been able to successful compile the
AWS.config.region
and var lambda = new AWS.Lambda();
, but for AWS.config.credentials
I am getting an error mesage:
This type constructor's parameter,
awsCognito, can't be found. Is it a typo?
Here’s my reason code so far:
type identityPool = {
identityPoolId: string
};
[@bs.new] external awsCognito : identityPool => string = "AWS.CognitoIdentityCredentials";
type awsConfig = {. [@bs.set]
"region": string,
"credentials": awsCognito(identityPool)};
type awsSDK = {. [@bs.set] "config": awsConfig};
[@bs.val] external aws : awsSDK = "AWS";
aws##config##region #= "us-west-2";
aws## config##credentials #= awsCognito({ identityPoolId: "xxx"});
type awsLambdat;
[@bs.new] external awsLambda : unit => awsLambdat = "AWS.Lambda";
let lambda = awsLambda();
What I am stumped on is, I feel that I have provided the parameter as identityPool
. Anyone have experience writing bindings for a class constructor taking an argument?