mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
Commit from GitHub Actions (Publish APIs & Clients)
This commit is contained in:
@@ -40,6 +40,7 @@ import (
|
|||||||
"github.com/micro/services/clients/go/user"
|
"github.com/micro/services/clients/go/user"
|
||||||
"github.com/micro/services/clients/go/vehicle"
|
"github.com/micro/services/clients/go/vehicle"
|
||||||
"github.com/micro/services/clients/go/weather"
|
"github.com/micro/services/clients/go/weather"
|
||||||
|
"github.com/micro/services/clients/go/youtube"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewClient(token string) *Client {
|
func NewClient(token string) *Client {
|
||||||
@@ -85,6 +86,7 @@ func NewClient(token string) *Client {
|
|||||||
UserService: user.NewUserService(token),
|
UserService: user.NewUserService(token),
|
||||||
VehicleService: vehicle.NewVehicleService(token),
|
VehicleService: vehicle.NewVehicleService(token),
|
||||||
WeatherService: weather.NewWeatherService(token),
|
WeatherService: weather.NewWeatherService(token),
|
||||||
|
YoutubeService: youtube.NewYoutubeService(token),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,4 +132,5 @@ type Client struct {
|
|||||||
UserService *user.UserService
|
UserService *user.UserService
|
||||||
VehicleService *vehicle.VehicleService
|
VehicleService *vehicle.VehicleService
|
||||||
WeatherService *weather.WeatherService
|
WeatherService *weather.WeatherService
|
||||||
|
YoutubeService *youtube.YoutubeService
|
||||||
}
|
}
|
||||||
|
|||||||
55
clients/go/youtube/youtube.go
Executable file
55
clients/go/youtube/youtube.go
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
package youtube
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/m3o/m3o-go/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewYoutubeService(token string) *YoutubeService {
|
||||||
|
return &YoutubeService{
|
||||||
|
client: client.NewClient(&client.Options{
|
||||||
|
Token: token,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type YoutubeService struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for videos on YouTube
|
||||||
|
func (t *YoutubeService) Search(request *SearchRequest) (*SearchResponse, error) {
|
||||||
|
rsp := &SearchResponse{}
|
||||||
|
return rsp, t.client.Call("youtube", "Search", request, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchRequest struct {
|
||||||
|
// Query to search for
|
||||||
|
Query string `json:"query"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchResponse struct {
|
||||||
|
// List of results for the query
|
||||||
|
Results []SearchResult `json:"results"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SearchResult struct {
|
||||||
|
// if live broadcast then indicates activity.
|
||||||
|
// none, upcoming, live, completed
|
||||||
|
Broadcasting string `json:"broadcasting"`
|
||||||
|
// the channel id
|
||||||
|
ChannelId string `json:"channelId"`
|
||||||
|
// the channel title
|
||||||
|
ChannelTitle string `json:"channelTitle"`
|
||||||
|
// the result description
|
||||||
|
Description string `json:"description"`
|
||||||
|
// id of the result
|
||||||
|
Id string `json:"id"`
|
||||||
|
// kind of result; "video", "channel", "playlist"
|
||||||
|
Kind string `json:"kind"`
|
||||||
|
// published at time
|
||||||
|
PublishedAt string `json:"publishedAt"`
|
||||||
|
// title of the result
|
||||||
|
Title string `json:"title"`
|
||||||
|
// the associated url
|
||||||
|
Url string `json:"url"`
|
||||||
|
}
|
||||||
1
clients/ts/.gitignore
vendored
1
clients/ts/.gitignore
vendored
@@ -52,3 +52,4 @@ url
|
|||||||
user
|
user
|
||||||
vehicle
|
vehicle
|
||||||
weather
|
weather
|
||||||
|
youtube
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import * as url from "./url";
|
|||||||
import * as user from "./user";
|
import * as user from "./user";
|
||||||
import * as vehicle from "./vehicle";
|
import * as vehicle from "./vehicle";
|
||||||
import * as weather from "./weather";
|
import * as weather from "./weather";
|
||||||
|
import * as youtube from "./youtube";
|
||||||
|
|
||||||
export class Client {
|
export class Client {
|
||||||
constructor(token: string) {
|
constructor(token: string) {
|
||||||
@@ -79,6 +80,7 @@ export class Client {
|
|||||||
this.userService = new user.UserService(token);
|
this.userService = new user.UserService(token);
|
||||||
this.vehicleService = new vehicle.VehicleService(token);
|
this.vehicleService = new vehicle.VehicleService(token);
|
||||||
this.weatherService = new weather.WeatherService(token);
|
this.weatherService = new weather.WeatherService(token);
|
||||||
|
this.youtubeService = new youtube.YoutubeService(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
addressService: address.AddressService;
|
addressService: address.AddressService;
|
||||||
@@ -120,4 +122,5 @@ export class Client {
|
|||||||
userService: user.UserService;
|
userService: user.UserService;
|
||||||
vehicleService: vehicle.VehicleService;
|
vehicleService: vehicle.VehicleService;
|
||||||
weatherService: weather.WeatherService;
|
weatherService: weather.WeatherService;
|
||||||
|
youtubeService: youtube.YoutubeService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,8 @@
|
|||||||
"url",
|
"url",
|
||||||
"user",
|
"user",
|
||||||
"vehicle",
|
"vehicle",
|
||||||
"weather"
|
"weather",
|
||||||
|
"youtube"
|
||||||
],
|
],
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@@ -74,5 +75,5 @@
|
|||||||
"prepare": "npm run build"
|
"prepare": "npm run build"
|
||||||
},
|
},
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"version": "1.0.559"
|
"version": "1.0.560"
|
||||||
}
|
}
|
||||||
@@ -12,10 +12,10 @@ func CreateArecord() {
|
|||||||
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
|
"id": "1",
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
"age": 42,
|
"age": 42,
|
||||||
"isActive": true,
|
"isActive": true,
|
||||||
"id": "1",
|
|
||||||
},
|
},
|
||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
|
|||||||
6
examples/youtube/search/curl/searchForVideos.sh
Executable file
6
examples/youtube/search/curl/searchForVideos.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
curl "https://api.m3o.com/v1/youtube/Search" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||||
|
-d '{
|
||||||
|
"query": "donuts"
|
||||||
|
}'
|
||||||
17
examples/youtube/search/go/searchForVideos.go
Executable file
17
examples/youtube/search/go/searchForVideos.go
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
package example
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/micro/services/clients/go/youtube"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Search for videos on YouTube
|
||||||
|
func SearchForVideos() {
|
||||||
|
youtubeService := youtube.NewYoutubeService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
|
rsp, err := youtubeService.Search(&youtube.SearchRequest{
|
||||||
|
Query: "donuts",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
12
examples/youtube/search/node/searchForVideos.js
Executable file
12
examples/youtube/search/node/searchForVideos.js
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
const { YoutubeService } = require("m3o/youtube");
|
||||||
|
|
||||||
|
// Search for videos on YouTube
|
||||||
|
async function searchForVideos() {
|
||||||
|
let youtubeService = new YoutubeService(process.env.MICRO_API_TOKEN);
|
||||||
|
let rsp = await youtubeService.search({
|
||||||
|
query: "donuts",
|
||||||
|
});
|
||||||
|
console.log(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchForVideos();
|
||||||
5
go.mod
5
go.mod
@@ -18,8 +18,6 @@ require (
|
|||||||
github.com/getkin/kin-openapi v0.26.0
|
github.com/getkin/kin-openapi v0.26.0
|
||||||
github.com/gojuno/go.osrm v0.1.1-0.20200217151037-435fc3e1d3d4
|
github.com/gojuno/go.osrm v0.1.1-0.20200217151037-435fc3e1d3d4
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
github.com/golang/snappy v0.0.3 // indirect
|
|
||||||
github.com/google/go-cmp v0.5.6 // indirect
|
|
||||||
github.com/google/uuid v1.1.2
|
github.com/google/uuid v1.1.2
|
||||||
github.com/hablullah/go-prayer v1.0.0
|
github.com/hablullah/go-prayer v1.0.0
|
||||||
github.com/hailocab/go-geoindex v0.0.0-20160127134810-64631bfe9711
|
github.com/hailocab/go-geoindex v0.0.0-20160127134810-64631bfe9711
|
||||||
@@ -51,12 +49,10 @@ require (
|
|||||||
github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
|
github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
|
||||||
github.com/ttacon/libphonenumber v1.2.1 // indirect
|
github.com/ttacon/libphonenumber v1.2.1 // indirect
|
||||||
go.mongodb.org/mongo-driver v1.7.2
|
go.mongodb.org/mongo-driver v1.7.2
|
||||||
go.opencensus.io v0.23.0 // indirect
|
|
||||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
|
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
|
||||||
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420
|
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420
|
||||||
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
|
golang.org/x/oauth2 v0.0.0-20211005180243-6b3c2da341f1
|
||||||
google.golang.org/api v0.59.0
|
google.golang.org/api v0.59.0
|
||||||
google.golang.org/appengine v1.6.7 // indirect
|
|
||||||
google.golang.org/protobuf v1.27.1
|
google.golang.org/protobuf v1.27.1
|
||||||
googlemaps.github.io/maps v1.3.1
|
googlemaps.github.io/maps v1.3.1
|
||||||
gopkg.in/yaml.v2 v2.3.0
|
gopkg.in/yaml.v2 v2.3.0
|
||||||
@@ -65,4 +61,3 @@ require (
|
|||||||
gorm.io/driver/postgres v1.0.8
|
gorm.io/driver/postgres v1.0.8
|
||||||
gorm.io/gorm v1.21.10
|
gorm.io/gorm v1.21.10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user