Skip to content

Commit 1c59cc3

Browse files
committed
feat(api): Add .wit interface
1 parent e3684d0 commit 1c59cc3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

api/env.wit

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
enum log-level {
2+
null,
3+
error,
4+
warn,
5+
info,
6+
debug
7+
}
8+
enum http-method {
9+
get,
10+
head,
11+
options,
12+
post,
13+
put,
14+
patch,
15+
delete
16+
}
17+
enum field-type {
18+
meta,
19+
body,
20+
header,
21+
params,
22+
state,
23+
query
24+
}
25+
enum query-type {
26+
select,
27+
insert,
28+
update,
29+
delete
30+
}
31+
32+
return-result: function(res: list<u8>, ident: u32)
33+
return-error: function(code: s32, res: string, ident: u32)
34+
log-msg: function(msg: string, level: log-level, ident: u32)
35+
fetch-url: function(method: http-method, url: string, body: list<u8>, ident: u32) -> s32
36+
graphql-query: function(endpoint: string, query: string, ident: u32) -> s32
37+
cache-set: function(key: string, value: list<u8>, ttl: u32, ident: u32) -> s32
38+
cache-get: function(key: string, ident: u32) -> s32
39+
request-get-field: function(field-type: field-type, key: string, ident: u32) -> s32
40+
request-set-field: function(field-type: field-type, key: string, value: list<u8>, ident: u32) -> s32
41+
resp-set-header: function(key: string, value: list<u8>, ident: u32)
42+
get-static-file: function(name: string, ident: u32) -> s32
43+
db-exec: function(query-type: query-type, name: string, ident: u32) -> s32
44+
get-ffi-result: function(ptr: u32, ident: u32) -> s32
45+
add-ffi-var: function(name: string, val: string, ident: u32) -> s32
46+
return-abort: function(msg: string, file: string, line-num: u32, col-num: u32, ident: u32)

0 commit comments

Comments
 (0)