diff --git a/api/env.wit b/api/env.wit new file mode 100644 index 0000000..64e1889 --- /dev/null +++ b/api/env.wit @@ -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, 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, ident: u32) -> s32 +graphql-query: function(endpoint: string, query: string, ident: u32) -> s32 +cache-set: function(key: string, value: list, 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, 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)