mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-23 15:51:24 +00:00
Generate clients (#206)
This commit is contained in:
31
clients/ts/answer/index.ts
Executable file
31
clients/ts/answer/index.ts
Executable file
@@ -0,0 +1,31 @@
|
||||
import * as m3o from "@m3o/m3o-node";
|
||||
|
||||
export class AnswerService {
|
||||
private client: m3o.Client;
|
||||
|
||||
constructor(token: string) {
|
||||
this.client = new m3o.Client({ token: token });
|
||||
}
|
||||
// Ask a question and receive an instant answer
|
||||
question(request: QuestionRequest): Promise<QuestionResponse> {
|
||||
return this.client.call(
|
||||
"answer",
|
||||
"Question",
|
||||
request
|
||||
) as Promise<QuestionResponse>;
|
||||
}
|
||||
}
|
||||
|
||||
export interface QuestionRequest {
|
||||
// the question to answer
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export interface QuestionResponse {
|
||||
// the answer to your question
|
||||
answer?: string;
|
||||
// any related image
|
||||
image?: string;
|
||||
// a related url
|
||||
url?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user