mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-22 15:25:19 +00:00
Commit from GitHub Actions (Publish APIs & Clients)
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
|||||||
"github.com/micro/services/clients/go/location"
|
"github.com/micro/services/clients/go/location"
|
||||||
"github.com/micro/services/clients/go/otp"
|
"github.com/micro/services/clients/go/otp"
|
||||||
"github.com/micro/services/clients/go/postcode"
|
"github.com/micro/services/clients/go/postcode"
|
||||||
|
"github.com/micro/services/clients/go/qr"
|
||||||
"github.com/micro/services/clients/go/quran"
|
"github.com/micro/services/clients/go/quran"
|
||||||
"github.com/micro/services/clients/go/routing"
|
"github.com/micro/services/clients/go/routing"
|
||||||
"github.com/micro/services/clients/go/rss"
|
"github.com/micro/services/clients/go/rss"
|
||||||
@@ -56,6 +57,7 @@ func NewClient(token string) *Client {
|
|||||||
LocationService: location.NewLocationService(token),
|
LocationService: location.NewLocationService(token),
|
||||||
OtpService: otp.NewOtpService(token),
|
OtpService: otp.NewOtpService(token),
|
||||||
PostcodeService: postcode.NewPostcodeService(token),
|
PostcodeService: postcode.NewPostcodeService(token),
|
||||||
|
QrService: qr.NewQrService(token),
|
||||||
QuranService: quran.NewQuranService(token),
|
QuranService: quran.NewQuranService(token),
|
||||||
RoutingService: routing.NewRoutingService(token),
|
RoutingService: routing.NewRoutingService(token),
|
||||||
RssService: rss.NewRssService(token),
|
RssService: rss.NewRssService(token),
|
||||||
@@ -93,6 +95,7 @@ type Client struct {
|
|||||||
LocationService *location.LocationService
|
LocationService *location.LocationService
|
||||||
OtpService *otp.OtpService
|
OtpService *otp.OtpService
|
||||||
PostcodeService *postcode.PostcodeService
|
PostcodeService *postcode.PostcodeService
|
||||||
|
QrService *qr.QrService
|
||||||
QuranService *quran.QuranService
|
QuranService *quran.QuranService
|
||||||
RoutingService *routing.RoutingService
|
RoutingService *routing.RoutingService
|
||||||
RssService *rss.RssService
|
RssService *rss.RssService
|
||||||
|
|||||||
35
clients/go/qr/qr.go
Executable file
35
clients/go/qr/qr.go
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
package qr
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/m3o/m3o-go/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewQrService(token string) *QrService {
|
||||||
|
return &QrService{
|
||||||
|
client: client.NewClient(&client.Options{
|
||||||
|
Token: token,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type QrService struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
func (t *QrService) Generate(request *GenerateRequest) (*GenerateResponse, error) {
|
||||||
|
rsp := &GenerateResponse{}
|
||||||
|
return rsp, t.client.Call("qr", "Generate", request, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
type GenerateRequest struct {
|
||||||
|
// the size (height and width) in pixels of the generated QR code. Defaults to 256
|
||||||
|
Size int64 `json:"size"`
|
||||||
|
// the text to encode as a QR code (URL, phone number, email, etc)
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GenerateResponse struct {
|
||||||
|
// link to the QR code image in PNG format
|
||||||
|
Qr string `json:"qr"`
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ type Result struct {
|
|||||||
// The associated arabic text
|
// The associated arabic text
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
// The related translations to the text
|
// The related translations to the text
|
||||||
Translations []Translation `json:"translations"`
|
Translations []Interpretation `json:"translations"`
|
||||||
// The unique verse id across the Quran
|
// The unique verse id across the Quran
|
||||||
VerseId int32 `json:"verseId"`
|
VerseId int32 `json:"verseId"`
|
||||||
// The verse key e.g 1:1
|
// The verse key e.g 1:1
|
||||||
@@ -161,7 +161,7 @@ type Verse struct {
|
|||||||
// The basic translation of the verse
|
// The basic translation of the verse
|
||||||
TranslatedText string `json:"translatedText"`
|
TranslatedText string `json:"translatedText"`
|
||||||
// The alternative translations for the verse
|
// The alternative translations for the verse
|
||||||
Translations []Translation `json:"translations"`
|
Translations []Interpretation `json:"translations"`
|
||||||
// The phonetic transliteration from arabic
|
// The phonetic transliteration from arabic
|
||||||
Transliteration string `json:"transliteration"`
|
Transliteration string `json:"transliteration"`
|
||||||
// The individual words within the verse (Ayah)
|
// The individual words within the verse (Ayah)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import * as ip from "./ip";
|
|||||||
import * as location from "./location";
|
import * as location from "./location";
|
||||||
import * as otp from "./otp";
|
import * as otp from "./otp";
|
||||||
import * as postcode from "./postcode";
|
import * as postcode from "./postcode";
|
||||||
|
import * as qr from "./qr";
|
||||||
import * as quran from "./quran";
|
import * as quran from "./quran";
|
||||||
import * as routing from "./routing";
|
import * as routing from "./routing";
|
||||||
import * as rss from "./rss";
|
import * as rss from "./rss";
|
||||||
@@ -50,6 +51,7 @@ export class Client {
|
|||||||
this.locationService = new location.LocationService(token);
|
this.locationService = new location.LocationService(token);
|
||||||
this.otpService = new otp.OtpService(token);
|
this.otpService = new otp.OtpService(token);
|
||||||
this.postcodeService = new postcode.PostcodeService(token);
|
this.postcodeService = new postcode.PostcodeService(token);
|
||||||
|
this.qrService = new qr.QrService(token);
|
||||||
this.quranService = new quran.QuranService(token);
|
this.quranService = new quran.QuranService(token);
|
||||||
this.routingService = new routing.RoutingService(token);
|
this.routingService = new routing.RoutingService(token);
|
||||||
this.rssService = new rss.RssService(token);
|
this.rssService = new rss.RssService(token);
|
||||||
@@ -83,6 +85,7 @@ export class Client {
|
|||||||
locationService: location.LocationService;
|
locationService: location.LocationService;
|
||||||
otpService: otp.OtpService;
|
otpService: otp.OtpService;
|
||||||
postcodeService: postcode.PostcodeService;
|
postcodeService: postcode.PostcodeService;
|
||||||
|
qrService: qr.QrService;
|
||||||
quranService: quran.QuranService;
|
quranService: quran.QuranService;
|
||||||
routingService: routing.RoutingService;
|
routingService: routing.RoutingService;
|
||||||
rssService: rss.RssService;
|
rssService: rss.RssService;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
"./otp": "./dist/otp/index.js",
|
"./otp": "./dist/otp/index.js",
|
||||||
"./pkg": "./dist/pkg/index.js",
|
"./pkg": "./dist/pkg/index.js",
|
||||||
"./postcode": "./dist/postcode/index.js",
|
"./postcode": "./dist/postcode/index.js",
|
||||||
|
"./qr": "./dist/qr/index.js",
|
||||||
"./quran": "./dist/quran/index.js",
|
"./quran": "./dist/quran/index.js",
|
||||||
"./routing": "./dist/routing/index.js",
|
"./routing": "./dist/routing/index.js",
|
||||||
"./rss": "./dist/rss/index.js",
|
"./rss": "./dist/rss/index.js",
|
||||||
@@ -57,5 +58,5 @@
|
|||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"version": "1.0.514"
|
"version": "1.0.515"
|
||||||
}
|
}
|
||||||
29
clients/ts/qr/index.ts
Executable file
29
clients/ts/qr/index.ts
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
import * as m3o from "@m3o/m3o-node";
|
||||||
|
|
||||||
|
export class QrService {
|
||||||
|
private client: m3o.Client;
|
||||||
|
|
||||||
|
constructor(token: string) {
|
||||||
|
this.client = new m3o.Client({ token: token });
|
||||||
|
}
|
||||||
|
//
|
||||||
|
generate(request: GenerateRequest): Promise<GenerateResponse> {
|
||||||
|
return this.client.call(
|
||||||
|
"qr",
|
||||||
|
"Generate",
|
||||||
|
request
|
||||||
|
) as Promise<GenerateResponse>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GenerateRequest {
|
||||||
|
// the size (height and width) in pixels of the generated QR code. Defaults to 256
|
||||||
|
size?: number;
|
||||||
|
// the text to encode as a QR code (URL, phone number, email, etc)
|
||||||
|
text?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GenerateResponse {
|
||||||
|
// link to the QR code image in PNG format
|
||||||
|
qr?: string;
|
||||||
|
}
|
||||||
@@ -87,7 +87,7 @@ export interface Result {
|
|||||||
// The associated arabic text
|
// The associated arabic text
|
||||||
text?: string;
|
text?: string;
|
||||||
// The related translations to the text
|
// The related translations to the text
|
||||||
translations?: Translation[];
|
translations?: Interpretation[];
|
||||||
// The unique verse id across the Quran
|
// The unique verse id across the Quran
|
||||||
verseId?: number;
|
verseId?: number;
|
||||||
// The verse key e.g 1:1
|
// The verse key e.g 1:1
|
||||||
@@ -161,7 +161,7 @@ export interface Verse {
|
|||||||
// The basic translation of the verse
|
// The basic translation of the verse
|
||||||
translatedText?: string;
|
translatedText?: string;
|
||||||
// The alternative translations for the verse
|
// The alternative translations for the verse
|
||||||
translations?: Translation[];
|
translations?: Interpretation[];
|
||||||
// The phonetic transliteration from arabic
|
// The phonetic transliteration from arabic
|
||||||
transliteration?: string;
|
transliteration?: string;
|
||||||
// The individual words within the verse (Ayah)
|
// The individual words within the verse (Ayah)
|
||||||
|
|||||||
7
examples/qr/generate/curl/generateAQrCode.sh
Executable file
7
examples/qr/generate/curl/generateAQrCode.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
curl "https://api.m3o.com/v1/qr/Generate" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||||
|
-d '{
|
||||||
|
"size": 300,
|
||||||
|
"text": "https://m3o.com/qr"
|
||||||
|
}'
|
||||||
17
examples/qr/generate/go/generateAQrCode.go
Executable file
17
examples/qr/generate/go/generateAQrCode.go
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
package example
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/micro/services/clients/go/qr"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
func GenerateAqrCode() {
|
||||||
|
qrService := qr.NewQrService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
|
rsp, err := qrService.Generate(&qr.GenerateRequest{
|
||||||
|
Size: 300,
|
||||||
|
Text: "https://m3o.com/qr",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
13
examples/qr/generate/node/generateAQrCode.js
Executable file
13
examples/qr/generate/node/generateAQrCode.js
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
import * as qr from "m3o/qr";
|
||||||
|
|
||||||
|
//
|
||||||
|
async function GenerateAqrCode() {
|
||||||
|
let qrService = new qr.QrService(process.env.MICRO_API_TOKEN);
|
||||||
|
let rsp = await qrService.generate({
|
||||||
|
size: 300,
|
||||||
|
text: "https://m3o.com/qr",
|
||||||
|
});
|
||||||
|
console.log(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
await GenerateAqrCode();
|
||||||
Reference in New Issue
Block a user