mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 14:35:07 +00:00
Generate clients (#206)
This commit is contained in:
6
examples/answer/question/curl/askAQuestion.sh
Executable file
6
examples/answer/question/curl/askAQuestion.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
curl "https://api.m3o.com/v1/answer/Question" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"query": "google"
|
||||
}'
|
||||
16
examples/answer/question/go/askAQuestion.go
Executable file
16
examples/answer/question/go/askAQuestion.go
Executable file
@@ -0,0 +1,16 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/answer"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Ask a question and receive an instant answer
|
||||
func AskAquestion() {
|
||||
answerService := answer.NewAnswerService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := answerService.Question(&answer.QuestionRequest{
|
||||
Query: "google",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
12
examples/answer/question/node/askAQuestion.js
Executable file
12
examples/answer/question/node/askAQuestion.js
Executable file
@@ -0,0 +1,12 @@
|
||||
import * as answer from "m3o/answer";
|
||||
|
||||
// Ask a question and receive an instant answer
|
||||
async function AskAquestion() {
|
||||
let answerService = new answer.AnswerService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await answerService.question({
|
||||
query: "google",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await AskAquestion();
|
||||
Reference in New Issue
Block a user