Generate clients (#206)

This commit is contained in:
Janos Dobronszki
2021-09-16 12:52:36 +01:00
committed by GitHub
parent 552c321dd7
commit d4d9c1c176
334 changed files with 9334 additions and 45 deletions

View File

@@ -0,0 +1,6 @@
curl "https://api.m3o.com/v1/emoji/Find" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"alias": ":beer:"
}'

View File

@@ -0,0 +1,16 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/emoji"
"os"
)
// Find an emoji by its alias e.g :beer:
func FindEmoji() {
emojiService := emoji.NewEmojiService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := emojiService.Find(&emoji.FindRequest{
Alias: ":beer:",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,12 @@
import * as emoji from "m3o/emoji";
// Find an emoji by its alias e.g :beer:
async function FindEmoji() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.find({
alias: ":beer:",
});
console.log(rsp);
}
await FindEmoji();

View File

@@ -0,0 +1,6 @@
curl "https://api.m3o.com/v1/emoji/Flag" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"alias": "GB"
}'

View File

@@ -0,0 +1,14 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/emoji"
"os"
)
// Get the flag for a country. Requires country code e.g GB for great britain
func GetFlagByCountryCode() {
emojiService := emoji.NewEmojiService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := emojiService.Flag(&emoji.FlagRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,12 @@
import * as emoji from "m3o/emoji";
// Get the flag for a country. Requires country code e.g GB for great britain
async function GetFlagByCountryCode() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.flag({
alias: "GB",
});
console.log(rsp);
}
await GetFlagByCountryCode();

View File

@@ -0,0 +1,6 @@
curl "https://api.m3o.com/v1/emoji/Print" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"text": "let's grab a :beer:"
}'

View File

@@ -0,0 +1,17 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/emoji"
"os"
)
// Print text and renders the emojis with aliases e.g
// let's grab a :beer: becomes let's grab a 🍺
func PrintTextIncludingEmoji() {
emojiService := emoji.NewEmojiService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := emojiService.Print(&emoji.PrintRequest{
Text: "let's grab a :beer:",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,13 @@
import * as emoji from "m3o/emoji";
// Print text and renders the emojis with aliases e.g
// let's grab a :beer: becomes let's grab a 🍺
async function PrintTextIncludingEmoji() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.print({
text: "let's grab a :beer:",
});
console.log(rsp);
}
await PrintTextIncludingEmoji();

View File

@@ -0,0 +1,8 @@
curl "https://api.m3o.com/v1/emoji/Send" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"from": "Alice",
"message": "let's grab a :beer:",
"to": "+44782669123"
}'

View File

@@ -0,0 +1,18 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/emoji"
"os"
)
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
func SendAtextContainingAnEmojiToAnyoneViaSms() {
emojiService := emoji.NewEmojiService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := emojiService.Send(&emoji.SendRequest{
From: "Alice",
Message: "let's grab a :beer:",
To: "+44782669123",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,14 @@
import * as emoji from "m3o/emoji";
// Send an emoji to anyone via SMS. Messages are sent in the form '<message> Sent from <from>'
async function SendAtextContainingAnEmojiToAnyoneViaSms() {
let emojiService = new emoji.EmojiService(process.env.MICRO_API_TOKEN);
let rsp = await emojiService.send({
from: "Alice",
message: "let's grab a :beer:",
to: "+44782669123",
});
console.log(rsp);
}
await SendAtextContainingAnEmojiToAnyoneViaSms();