mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
m3o client changed
This commit is contained in:
parent
adaa98e6cf
commit
3c70d23a1d
2
go.mod
2
go.mod
@ -19,7 +19,6 @@ require (
|
||||
github.com/google/uuid v1.2.0
|
||||
github.com/gorilla/handlers v1.5.1
|
||||
github.com/imdario/mergo v0.3.12
|
||||
github.com/m3o/m3o-go/client v0.0.0-20210421144725-8bfd7992ada3
|
||||
github.com/miekg/dns v1.1.43
|
||||
github.com/nxadm/tail v1.4.8
|
||||
github.com/opentracing/opentracing-go v1.2.0
|
||||
@ -30,6 +29,7 @@ require (
|
||||
github.com/uber/jaeger-client-go v2.29.1+incompatible
|
||||
github.com/uber/jaeger-lib v2.4.1+incompatible
|
||||
github.com/urfave/cli/v2 v2.3.0
|
||||
go.m3o.com v0.1.0
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a
|
||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
|
5
go.sum
5
go.sum
@ -260,7 +260,6 @@ github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
@ -343,8 +342,6 @@ github.com/liquidweb/go-lwApi v0.0.0-20190605172801-52a4864d2738/go.mod h1:0sYF9
|
||||
github.com/liquidweb/go-lwApi v0.0.5/go.mod h1:0sYF9rMXb0vlG+4SzdiGMXHheCZxjguMq+Zb4S2BfBs=
|
||||
github.com/liquidweb/liquidweb-cli v0.6.9/go.mod h1:cE1uvQ+x24NGUL75D0QagOFCG8Wdvmwu8aL9TLmA/eQ=
|
||||
github.com/liquidweb/liquidweb-go v1.6.3/go.mod h1:SuXXp+thr28LnjEw18AYtWwIbWMHSUiajPQs8T9c/Rc=
|
||||
github.com/m3o/m3o-go/client v0.0.0-20210421144725-8bfd7992ada3 h1:RVt7rqWl4al36BH9OY9k7IXnnooOP0Feanu1bed6X2s=
|
||||
github.com/m3o/m3o-go/client v0.0.0-20210421144725-8bfd7992ada3/go.mod h1:vmeaYrKYpgVNhny/l7iH8mXS88S7ijUiYni3gZUrCq0=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
|
||||
@ -542,6 +539,8 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.m3o.com v0.1.0 h1:vYYcMtUzkkl8/zQcLIZFakBvNO/wSrMcNHRySAmEh9E=
|
||||
go.m3o.com v0.1.0/go.mod h1:p8FdLqZH3R9a0y04qiMNT+clw69d3SxyQPFzCNbDRtk=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
|
@ -1,7 +1,7 @@
|
||||
package address
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewAddressService(token string) *AddressService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package answer
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewAnswerService(token string) *AnswerService {
|
||||
|
2
services/cache/cache.go
vendored
2
services/cache/cache.go
vendored
@ -1,7 +1,7 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewCacheService(token string) *CacheService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewCryptoService(token string) *CryptoService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package currency
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewCurrencyService(token string) *CurrencyService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewDbService(token string) *DbService {
|
||||
@ -16,6 +16,12 @@ type DbService struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
// Count records in a table
|
||||
func (t *DbService) Count(request *CountRequest) (*CountResponse, error) {
|
||||
rsp := &CountResponse{}
|
||||
return rsp, t.client.Call("db", "Count", request, rsp)
|
||||
}
|
||||
|
||||
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
|
||||
func (t *DbService) Create(request *CreateRequest) (*CreateResponse, error) {
|
||||
rsp := &CreateResponse{}
|
||||
@ -46,6 +52,16 @@ func (t *DbService) Update(request *UpdateRequest) (*UpdateResponse, error) {
|
||||
return rsp, t.client.Call("db", "Update", request, rsp)
|
||||
}
|
||||
|
||||
type CountRequest struct {
|
||||
// specify the table name
|
||||
Table string `json:"table"`
|
||||
}
|
||||
|
||||
type CountResponse struct {
|
||||
// the number of records in the table
|
||||
Count int32 `json:"count"`
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
// JSON encoded record or records (can be array or object)
|
||||
Record map[string]interface{} `json:"record"`
|
||||
|
@ -1,7 +1,7 @@
|
||||
package email
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewEmailService(token string) *EmailService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package emoji
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewEmojiService(token string) *EmojiService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package evchargers
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewEvchargersService(token string) *EvchargersService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewFileService(token string) *FileService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package forex
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewForexService(token string) *ForexService {
|
||||
|
151
services/function/function.go
Executable file
151
services/function/function.go
Executable file
@ -0,0 +1,151 @@
|
||||
package function
|
||||
|
||||
import (
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewFunctionService(token string) *FunctionService {
|
||||
return &FunctionService{
|
||||
client: client.NewClient(&client.Options{
|
||||
Token: token,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
type FunctionService struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
// Call a function by name
|
||||
func (t *FunctionService) Call(request *CallRequest) (*CallResponse, error) {
|
||||
rsp := &CallResponse{}
|
||||
return rsp, t.client.Call("function", "Call", request, rsp)
|
||||
}
|
||||
|
||||
// Delete a function by name
|
||||
func (t *FunctionService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
||||
rsp := &DeleteResponse{}
|
||||
return rsp, t.client.Call("function", "Delete", request, rsp)
|
||||
}
|
||||
|
||||
// Deploy a group of functions
|
||||
func (t *FunctionService) Deploy(request *DeployRequest) (*DeployResponse, error) {
|
||||
rsp := &DeployResponse{}
|
||||
return rsp, t.client.Call("function", "Deploy", request, rsp)
|
||||
}
|
||||
|
||||
// Get the info for a deployed function
|
||||
func (t *FunctionService) Describe(request *DescribeRequest) (*DescribeResponse, error) {
|
||||
rsp := &DescribeResponse{}
|
||||
return rsp, t.client.Call("function", "Describe", request, rsp)
|
||||
}
|
||||
|
||||
// List all the deployed functions
|
||||
func (t *FunctionService) List(request *ListRequest) (*ListResponse, error) {
|
||||
rsp := &ListResponse{}
|
||||
return rsp, t.client.Call("function", "List", request, rsp)
|
||||
}
|
||||
|
||||
type CallRequest struct {
|
||||
// Name of the function
|
||||
Name string `json:"name"`
|
||||
// Request body that will be passed to the function
|
||||
Request map[string]interface{} `json:"request"`
|
||||
}
|
||||
|
||||
type CallResponse struct {
|
||||
// Response body that the function returned
|
||||
Response map[string]interface{} `json:"response"`
|
||||
}
|
||||
|
||||
type DeleteRequest struct {
|
||||
// The name of the function
|
||||
Name string `json:"name"`
|
||||
// Optional project name
|
||||
Project string `json:"project"`
|
||||
}
|
||||
|
||||
type DeleteResponse struct {
|
||||
}
|
||||
|
||||
type DeployRequest struct {
|
||||
// entry point, ie. handler name in the source code
|
||||
// if not provided, defaults to the name parameter
|
||||
Entrypoint string `json:"entrypoint"`
|
||||
// environment variables to pass in at runtime
|
||||
EnvVars map[string]string `json:"envVars"`
|
||||
// function name
|
||||
Name string `json:"name"`
|
||||
// project is used for namespacing your functions
|
||||
// optional. defaults to "default".
|
||||
Project string `json:"project"`
|
||||
// github url to repo
|
||||
Repo string `json:"repo"`
|
||||
// runtime/language of the function
|
||||
// eg: php74,
|
||||
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16
|
||||
// dotnet3
|
||||
// java11
|
||||
// ruby26, ruby27
|
||||
// go111, go113, go116
|
||||
// python37, python38, python39
|
||||
Runtime string `json:"runtime"`
|
||||
// optional subfolder path
|
||||
Subfolder string `json:"subfolder"`
|
||||
}
|
||||
|
||||
type DeployResponse struct {
|
||||
}
|
||||
|
||||
type DescribeRequest struct {
|
||||
// The name of the function
|
||||
Name string `json:"name"`
|
||||
// Optional project name
|
||||
Project string `json:"project"`
|
||||
}
|
||||
|
||||
type DescribeResponse struct {
|
||||
// The function requested
|
||||
Function *Func `json:"function"`
|
||||
// The timeout for requests to the function
|
||||
Timeout string `json:"timeout"`
|
||||
// The time at which the function was updated
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type Func struct {
|
||||
// name of handler in source code
|
||||
Entrypoint string `json:"entrypoint"`
|
||||
// function name
|
||||
// limitation: must be unique across projects
|
||||
Name string `json:"name"`
|
||||
// project of function, optional
|
||||
// defaults to literal "default"
|
||||
// used to namespace functions
|
||||
Project string `json:"project"`
|
||||
// git repo address
|
||||
Repo string `json:"repo"`
|
||||
// runtime/language of the function
|
||||
// eg: php74,
|
||||
// nodejs6, nodejs8, nodejs10, nodejs12, nodejs14, nodejs16
|
||||
// dotnet3
|
||||
// java11
|
||||
// ruby26, ruby27
|
||||
// go111, go113, go116
|
||||
// python37, python38, python39
|
||||
Runtime string `json:"runtime"`
|
||||
// eg. ACTIVE, DEPLOY_IN_PROGRESS, OFFLINE etc
|
||||
Status string `json:"status"`
|
||||
// subfolder path to entrypoint
|
||||
Subfolder string `json:"subfolder"`
|
||||
}
|
||||
|
||||
type ListRequest struct {
|
||||
// optional project name
|
||||
Project string `json:"project"`
|
||||
}
|
||||
|
||||
type ListResponse struct {
|
||||
// List of functions deployed
|
||||
Functions []Func `json:"functions"`
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package geocoding
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewGeocodingService(token string) *GeocodingService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package gifs
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewGifsService(token string) *GifsService {
|
||||
@ -16,7 +16,7 @@ type GifsService struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
// Search for a gif
|
||||
// Search for a GIF
|
||||
func (t *GifsService) Search(request *SearchRequest) (*SearchResponse, error) {
|
||||
rsp := &SearchResponse{}
|
||||
return rsp, t.client.Call("gifs", "Search", request, rsp)
|
||||
|
48
services/google/google.go
Executable file
48
services/google/google.go
Executable file
@ -0,0 +1,48 @@
|
||||
package google
|
||||
|
||||
import (
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewGoogleService(token string) *GoogleService {
|
||||
return &GoogleService{
|
||||
client: client.NewClient(&client.Options{
|
||||
Token: token,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
type GoogleService struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
// Search for videos on Google
|
||||
func (t *GoogleService) Search(request *SearchRequest) (*SearchResponse, error) {
|
||||
rsp := &SearchResponse{}
|
||||
return rsp, t.client.Call("google", "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 {
|
||||
// abridged version of this search result’s URL, e.g. www.exampe.com
|
||||
DisplayUrl string `json:"displayUrl"`
|
||||
// id of the result
|
||||
Id string `json:"id"`
|
||||
// kind of result; "search"
|
||||
Kind string `json:"kind"`
|
||||
// the result snippet
|
||||
Snippet string `json:"snippet"`
|
||||
// title of the result
|
||||
Title string `json:"title"`
|
||||
// the full url for the result
|
||||
Url string `json:"url"`
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package helloworld
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewHelloworldService(token string) *HelloworldService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package holidays
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewHolidaysService(token string) *HolidaysService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package id
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewIdService(token string) *IdService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewImageService(token string) *ImageService {
|
||||
@ -40,7 +40,6 @@ func (t *ImageService) Upload(request *UploadRequest) (*UploadResponse, error) {
|
||||
|
||||
type ConvertRequest struct {
|
||||
// base64 encoded image to resize,
|
||||
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
|
||||
Base64 string `json:"base64"`
|
||||
// output name of the image including extension, ie. "cat.png"
|
||||
Name string `json:"name"`
|
||||
@ -79,7 +78,6 @@ type Rectangle struct {
|
||||
|
||||
type ResizeRequest struct {
|
||||
// base64 encoded image to resize,
|
||||
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
|
||||
Base64 string `json:"base64"`
|
||||
// optional crop options
|
||||
// if provided, after resize, the image
|
||||
@ -102,7 +100,6 @@ type ResizeResponse struct {
|
||||
|
||||
type UploadRequest struct {
|
||||
// Base64 encoded image to upload,
|
||||
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
|
||||
Base64 string `json:"base64"`
|
||||
// Output name of the image including extension, ie. "cat.png"
|
||||
Name string `json:"name"`
|
||||
|
@ -1,7 +1,7 @@
|
||||
package ip
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewIpService(token string) *IpService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package location
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewLocationService(token string) *LocationService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package notes
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewNotesService(token string) *NotesService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package otp
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewOtpService(token string) *OtpService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package postcode
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewPostcodeService(token string) *PostcodeService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package prayer
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewPrayerService(token string) *PrayerService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package qr
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewQrService(token string) *QrService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package quran
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewQuranService(token string) *QuranService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package routing
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewRoutingService(token string) *RoutingService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package rss
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewRssService(token string) *RssService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package sentiment
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewSentimentService(token string) *SentimentService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package sms
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewSmsService(token string) *SmsService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package stock
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewStockService(token string) *StockService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package stream
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewStreamService(token string) *StreamService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package sunnah
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewSunnahService(token string) *SunnahService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package thumbnail
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewThumbnailService(token string) *ThumbnailService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package time
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewTimeService(token string) *TimeService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package twitter
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewTwitterService(token string) *TwitterService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package url
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewUrlService(token string) *UrlService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewUserService(token string) *UserService {
|
||||
@ -95,9 +95,11 @@ type Account struct {
|
||||
// unix timestamp
|
||||
Updated int64 `json:"updated,string"`
|
||||
// alphanumeric username
|
||||
Username string `json:"username"`
|
||||
VerificationDate int64 `json:"verificationDate,string"`
|
||||
Verified bool `json:"verified"`
|
||||
Username string `json:"username"`
|
||||
// date of verification
|
||||
VerificationDate int64 `json:"verificationDate,string"`
|
||||
// if the account is verified
|
||||
Verified bool `json:"verified"`
|
||||
}
|
||||
|
||||
type CreateRequest struct {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package vehicle
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewVehicleService(token string) *VehicleService {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package weather
|
||||
|
||||
import (
|
||||
"github.com/m3o/m3o-go/client"
|
||||
"go.m3o.com/client"
|
||||
)
|
||||
|
||||
func NewWeatherService(token string) *WeatherService {
|
||||
|
55
services/youtube/youtube.go
Executable file
55
services/youtube/youtube.go
Executable file
@ -0,0 +1,55 @@
|
||||
package youtube
|
||||
|
||||
import (
|
||||
"go.m3o.com/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"`
|
||||
}
|
Loading…
Reference in New Issue
Block a user