aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/net/http.d.tl
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-07-24 21:25:03 +0200
committerKim Alvefur <zash@zash.se>2022-07-24 21:25:03 +0200
commitd459ec2f5dcf600840c44b75ff175c349b105bef (patch)
treebdd530318f8e56c5a555638e371ebde82f8fb7bc /teal-src/net/http.d.tl
parent185b679953985197b6c087487c01e269c749e5c4 (diff)
downloadprosody-d459ec2f5dcf600840c44b75ff175c349b105bef.tar.gz
prosody-d459ec2f5dcf600840c44b75ff175c349b105bef.zip
net.http: Add teal description files
Diffstat (limited to 'teal-src/net/http.d.tl')
-rw-r--r--teal-src/net/http.d.tl88
1 files changed, 88 insertions, 0 deletions
diff --git a/teal-src/net/http.d.tl b/teal-src/net/http.d.tl
new file mode 100644
index 00000000..38da56b6
--- /dev/null
+++ b/teal-src/net/http.d.tl
@@ -0,0 +1,88 @@
+local record Promise
+ -- util.promise
+end
+
+local record sslctx -- from LuaSec
+end
+
+local record lib
+
+ enum http_method
+ "GET"
+ "HEAD"
+ "POST"
+ "PUT"
+ "OPTIONS"
+ "DELETE"
+ -- etc?
+ end
+
+ record http_client_options
+ sslctx : sslctx
+ end
+
+ record http_options
+ id : string
+ onlystatus : boolean
+ body : string
+ method : http_method
+ headers : { string : string }
+ insecure : boolean
+ suppress_errors : boolean
+ streaming_handler : function
+ suppress_url : boolean
+ sslctx : sslctx
+ end
+
+ record http_request
+ host : string
+ port : string
+ enum scheme
+ "http"
+ "https"
+ end
+ scheme : scheme
+ url : string
+ userinfo : string
+ path : string
+
+ method : http_method
+ headers : { string : string }
+
+ insecure : boolean
+ suppress_errors : boolean
+ streaming_handler : function
+ http : http_client
+ time : integer
+ id : string
+ callback : http_callback
+ end
+
+ record http_response
+ end
+
+ type http_callback = function (string, number, http_response, http_request)
+
+ record http_client
+ options : http_client_options
+ request : function (http_client, string, http_options, http_callback)
+ end
+
+ request : function (string, http_options, http_callback) : Promise, string
+ default : http_client
+ new : function (http_client_options) : http_client
+ events : table
+ -- COMPAT
+ urlencode : function (string) : string
+ urldecode : function (string) : string
+ formencode : function ({ string : string }) : string
+ formdecode : function (string) : { string : string }
+ destroy_request : function (http_request)
+
+ enum available_features
+ "sni"
+ end
+ features : { available_features : boolean }
+end
+
+return lib