Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Shortcut multiple @get and @send

$
0
0

Hello,

I’m trying to create the following binding:

  const session = await stripe.checkout.sessions.create({
     ....
  });

I have the stripe type can achieve this via:

type checkout

@get
external checkout: stripe => checkout = "checkout"

type sessions

@get 
external sessions : checkout => sessions = "sessions"

@send
external create : (sessions, {..}) => Promise.t<string> = "create"

Usage:

let session = s->Stripe.checkout->Stripe.sessions->Stripe.create({ "key": "value"})

This works, but I’m not sure if this is idiomatic or not.
Can I not add the additional path to my @send somehow? type checkout and type sessions don’t really mean much in this case.


Viewing all articles
Browse latest Browse all 2592

Trending Articles