0 | module Node.HTTPS.Static
3 | import public Node.HTTP.ClientRequest
4 | import Node.HTTPS.CreateServer
5 | import public Node.HTTPS.Request
6 | import Node.HTTPS.Server as HTTPS
7 | import Node.HTTPS.Module
9 | %foreign "node:lambda: (https, opts) => https.createServer(opts)"
10 | ffi_createServer : HTTPSModule -> Node HTTPS.CreateServer.Command.Options -> PrimIO HTTPS.Server
13 | (.createServer) : HasIO io => HTTPSModule -> HTTPS.CreateServer.Command.Options -> io HTTPS.Server
14 | (.createServer) https opts = primIO $
ffi_createServer https $
convertOptions opts
16 | %foreign "node:lambda: (https, url, t, opts, cb) => https.get(url, opts, (res) => { cb(res)() })"
17 | ffi_get : HTTPSModule -> String -> (t : SocketType) -> Node (Node.HTTPS.Request.Command.Options t) -> (IncomingMessage -> PrimIO ()) -> PrimIO ClientRequest
20 | (.get) : HasIO io => HTTPSModule -> String -> { auto t : SocketType } -> Node.HTTPS.Request.Command.Options t -> (IncomingMessage -> IO ()) -> io ClientRequest
21 | (.get) https url {t} opts cb = primIO $
ffi_get https url t (convertOptions t opts) $
\res => toPrim $
cb res
23 | %foreign "node:lambda: (https, url, t, opts, cb) => https.request(url, opts, (res) => { cb(res)() })"
24 | ffi_request : HTTPSModule -> String -> (t : SocketType) -> Node (Node.HTTPS.Request.Command.Options t) -> (IncomingMessage -> PrimIO ()) -> PrimIO ClientRequest
27 | (.request) : HasIO io => HTTPSModule -> String -> { auto t : SocketType } -> Node.HTTPS.Request.Command.Options t -> (IncomingMessage -> IO ()) -> io ClientRequest
28 | (.request) https url {t} opts cb = primIO $
ffi_request https url t (convertOptions t opts) $
\res => toPrim $
cb res
31 | (.post) : HasIO io => HTTPSModule -> String -> {auto t : SocketType} -> (Node.HTTPS.Request.Command.Options t) -> (IncomingMessage -> IO ()) -> io ClientRequest
32 | (.post) https url opts cb = https.request url ({ request.method := "POST" } opts) cb