From 1c59cc34fc436954c702d6f77e917c496bc9a92d Mon Sep 17 00:00:00 2001 From: Oscar Spencer Date: Tue, 1 Feb 2022 13:17:37 -0500 Subject: [PATCH 1/2] feat(api): Add .wit interface --- api/env.wit | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 api/env.wit diff --git a/api/env.wit b/api/env.wit new file mode 100644 index 0000000..01272d2 --- /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: list, 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) From d229f72e3a5e5bce49d1597afbad277ae7f6754a Mon Sep 17 00:00:00 2001 From: Oscar Spencer Date: Mon, 1 Aug 2022 12:16:02 -0400 Subject: [PATCH 2/2] Update api/env.wit --- api/env.wit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/env.wit b/api/env.wit index 01272d2..64e1889 100644 --- a/api/env.wit +++ b/api/env.wit @@ -38,7 +38,7 @@ 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: list, ident: u32) +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