aboutsummaryrefslogtreecommitdiff
path: root/core/http
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-01 16:37:50 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-01 16:37:50 +0200
commitce9e0788317b25e5d297ed38d9fed0754a341288 (patch)
tree29563a39c73ded16cd93eb7b5c5664d1ece944ac /core/http
parent8ff39cbe6300ca479584fe7d85ff03a1f65bc9b0 (diff)
WIP sentence API
Diffstat (limited to 'core/http')
-rw-r--r--core/http/client.ts8
-rw-r--r--core/http/server.ts3
-rw-r--r--core/http/types.ts4
3 files changed, 9 insertions, 6 deletions
diff --git a/core/http/client.ts b/core/http/client.ts
index 118e8f5..6b4e1a3 100644
--- a/core/http/client.ts
+++ b/core/http/client.ts
@@ -1,4 +1,6 @@
+import { InputSentenceProps } from "../../language/types.ts";
import "../../util/array.ts";
+import { DeepPartial } from "../../util/types.ts";
import Core from "../api.ts";
import { ConnectionProps, ConnectionPropsDefault } from "./props.ts";
@@ -30,12 +32,10 @@ export default class RemoteCoreClient implements Core {
return response.json();
}
- async parseSentence(input: string) {
+ async parseSentence(input: string, options?: DeepPartial<InputSentenceProps>) {
var request: CoreRequestParseSentence = {
command: "parseSentence",
- options: {
- input: input,
- },
+ options: { input, options, },
};
var { response } = await this.request(request) as CoreResponseParseSentence;
return response;
diff --git a/core/http/server.ts b/core/http/server.ts
index 0a9a082..7781a22 100644
--- a/core/http/server.ts
+++ b/core/http/server.ts
@@ -13,10 +13,11 @@ export default class RemoteCoreServer extends RawCore {
parseSentence: async _req => {
var req = _req as CoreRequestParseSentence;
var input = req.options?.input
+ var options = req.options?.options;
if (!input) return new Response("", { status: 404 });
return new Response(JSON.stringify({
command: "parseSentence",
- response: await this.parseSentence(input),
+ response: await this.parseSentence(input, options),
} as CoreResponseParseSentence));
},
};
diff --git a/core/http/types.ts b/core/http/types.ts
index af2cfea..3d55a98 100644
--- a/core/http/types.ts
+++ b/core/http/types.ts
@@ -1,4 +1,5 @@
-import { ParseResult } from "../../language/types.ts";
+import { InputSentenceProps, ParseResult } from "../../language/types.ts";
+import { DeepPartial } from "../../util/types.ts";
export interface CoreRequest {
command: string;
@@ -9,6 +10,7 @@ export interface CoreRequestParseSentence extends CoreRequest {
command: "parseSentence";
options: {
input: string;
+ options?: DeepPartial<InputSentenceProps>;
};
};