Files
services/clients/go/google/google.go

49 lines
1.0 KiB
Go
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package google
import (
"github.com/micro/micro-go/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 results 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"`
}