Skip to content

Commit

Permalink
feat(api): Add .wit interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ospencer committed Jun 23, 2022
1 parent e3684d0 commit 1c59cc3
Showing 1 changed file with 46 additions and 0 deletions.
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: list<u8>, 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)

0 comments on commit 1c59cc3

Please sign in to comment.