@chenglou do the docs reflect this yet?
So trying to apply bs.deriving abstract
. This is what I have:
//AWS.re
module AppSyncConfig = {
[@bs.deriving abstract]
type auth = {
type_: string,
apiKey: string,
};
[@bs.deriving abstract]
type t = {
url: string,
region: string,
auth,
};
let make = t;
};
module AppSync = {
[@bs.module "aws-appsync"] [@bs.new]
external makeAWSAppSyncClient : AppSyncConfig.t => 'a = "AWSAppSyncClient";
let createAWSAppSyncClient = (~url, ~region, ~auth, ()) => {
let appSyncClientOptions = AppSyncConfig.t(~url, ~region, ~auth);
makeAWSAppSyncClient(appSyncClientOptions);
};
};
Then in Client.re
//Client.re
open AWS.AppSyncConfig;
let auth = auth(~type_="API_KEY", ~apiKey="da2-2ajoq2qmsvgspdw6hljfdj2lb4");
let config =
AWS.AppSyncConfig.t(
~url=
"https://h25cvu6lonfilcrryg7xo5fjne.appsync-api.eu-west-1.amazonaws.com/graphql",
~region="eu-west-1",
~auth,
(),
);
let client = AWS.AppSync.createAWSAppSyncClient(config, ());
Sidenote:
The reason I the auth
variable is that I cant figure out the syntax for passing directly like this:
...
~auth=auth(~type_="API_KEY", ~apiKey="da2-2ajoq2qmsvgspdw6hljfdj2lb4"),
How do we do that?
End Sidenote
At any rate, running the above produced the following error which I am not understanding what it means and how to fix it:
We've found a bug for you!
/Users/prisc_000/code/APPSYNC/re-aws-events-demo/src/AWS/Client.re 3:24-32
1 │ open AWS.AppSyncConfig;
2 │
3 │ let auth = auth(~type_="API_KEY", ~apiKey="da2-2ajoq2qmsvgspdw6hljfdj2l
b4");
4 │
5 │ let config =
The function applied to this argument has type
AWS.AppSyncConfig.t => AWS.AppSyncConfig.auth
This argument cannot be applied with label ~type_
My understanding is that im defining auth
as of type AppSyncConfig.auth which has the ~type_
and ~apiKey
properties. So what does it mean that the argument can not be applied with label ~type_
?
Thanks for the guidance?