Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions api/env.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
enum log-level {
null,
error,
warn,
info,
debug
}
enum http-method {
get,
head,
options,
post,
put,
patch,
delete
}
enum field-type {
meta,
body,
header,
params,
state,
query
}
enum query-type {
select,
insert,
update,
delete
}

return-result: function(res: list<u8>, ident: u32)
return-error: function(code: s32, res: string, ident: u32)
log-msg: function(msg: string, level: log-level, ident: u32)
fetch-url: function(method: http-method, url: string, body: list<u8>, ident: u32) -> s32
graphql-query: function(endpoint: string, query: string, ident: u32) -> s32
cache-set: function(key: string, value: list<u8>, ttl: u32, ident: u32) -> s32
cache-get: function(key: string, ident: u32) -> s32
request-get-field: function(field-type: field-type, key: string, ident: u32) -> s32
request-set-field: function(field-type: field-type, key: string, value: list<u8>, ident: u32) -> s32
resp-set-header: function(key: string, value: string, ident: u32)
get-static-file: function(name: string, ident: u32) -> s32
db-exec: function(query-type: query-type, name: string, ident: u32) -> s32
get-ffi-result: function(ptr: u32, ident: u32) -> s32
add-ffi-var: function(name: string, val: string, ident: u32) -> s32
return-abort: function(msg: string, file: string, line-num: u32, col-num: u32, ident: u32)