update go mod (#334)

This commit is contained in:
Asim Aslam
2021-12-16 12:31:04 +00:00
committed by GitHub
parent f9e539ad88
commit 527dcc12c3
16 changed files with 164 additions and 165 deletions

View File

@@ -28,7 +28,7 @@ type GoogleApp struct {
// eg. https://us-central1-m3o-apis.cloudfunctions.net/ // eg. https://us-central1-m3o-apis.cloudfunctions.net/
address string address string
// max number of apps per user // max number of apps per user
limit int limit int
// custom domain for apps // custom domain for apps
domain string domain string
// the service account for the app // the service account for the app
@@ -143,12 +143,12 @@ func New() *GoogleApp {
log.Info(string(outp)) log.Info(string(outp))
return &GoogleApp{ return &GoogleApp{
domain: domain, domain: domain,
project: project, project: project,
address: address, address: address,
limit: limit, limit: limit,
identity: identity, identity: identity,
App: new(App), App: new(App),
} }
} }

View File

@@ -26,7 +26,7 @@ type GoogleFunction struct {
// eg. https://us-central1-m3o-apis.cloudfunctions.net/ // eg. https://us-central1-m3o-apis.cloudfunctions.net/
address string address string
// max functions deployed // max functions deployed
limit int limit int
// function identity // function identity
identity string identity string
} }
@@ -126,9 +126,9 @@ func NewFunction() *GoogleFunction {
} }
log.Info(string(outp)) log.Info(string(outp))
return &GoogleFunction{ return &GoogleFunction{
project: project, project: project,
address: address, address: address,
limit: limit, limit: limit,
identity: identity, identity: identity,
} }
} }

2
go.mod
View File

@@ -31,7 +31,7 @@ require (
github.com/m3o/goduckgo v0.0.0-20210630141545-c760fe67b945 github.com/m3o/goduckgo v0.0.0-20210630141545-c760fe67b945
github.com/mattheath/base62 v0.0.0-20150408093626-b80cdc656a7a // indirect github.com/mattheath/base62 v0.0.0-20150408093626-b80cdc656a7a // indirect
github.com/mattheath/kala v0.0.0-20171219141654-d6276794bf0e github.com/mattheath/kala v0.0.0-20171219141654-d6276794bf0e
github.com/micro/micro/v3 v3.8.0 github.com/micro/micro/v3 v3.8.1-0.20211216122745-2e7245423520
github.com/miekg/dns v1.1.31 // indirect github.com/miekg/dns v1.1.31 // indirect
github.com/minio/minio-go/v7 v7.0.16 github.com/minio/minio-go/v7 v7.0.16
github.com/o1egl/govatar v0.3.0 github.com/o1egl/govatar v0.3.0

2
go.sum
View File

@@ -495,6 +495,8 @@ github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4f
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/micro/micro/v3 v3.8.0 h1:RTH2835RJ4/aqLZGMjGCIf7HroCmYlJh2KRHHuSL/AE= github.com/micro/micro/v3 v3.8.0 h1:RTH2835RJ4/aqLZGMjGCIf7HroCmYlJh2KRHHuSL/AE=
github.com/micro/micro/v3 v3.8.0/go.mod h1:gjFa8T2ouD6BvorPTVPXLWtrRJwSKT5KxUNuu23Kkts= github.com/micro/micro/v3 v3.8.0/go.mod h1:gjFa8T2ouD6BvorPTVPXLWtrRJwSKT5KxUNuu23Kkts=
github.com/micro/micro/v3 v3.8.1-0.20211216122745-2e7245423520 h1:LtErHRofRQf5damrjb5AkpvmklaIhx3anLJ9sN4fMrI=
github.com/micro/micro/v3 v3.8.1-0.20211216122745-2e7245423520/go.mod h1:gjFa8T2ouD6BvorPTVPXLWtrRJwSKT5KxUNuu23Kkts=
github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo= github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo=

View File

@@ -1,2 +1,3 @@
package main package main
//go:generate make proto //go:generate make proto

View File

@@ -1,2 +1,3 @@
package main package main
//go:generate make proto //go:generate make proto

View File

@@ -9,58 +9,58 @@ type CollectionsResponse struct {
} }
type Asset struct { type Asset struct {
Id int32 `json:"id"` Id int32 `json:"id"`
TokenId string `json:"token_id"` TokenId string `json:"token_id"`
Sales int32 `json:"num_sales"` Sales int32 `json:"num_sales"`
ImageUrl string `json:"image_url"` ImageUrl string `json:"image_url"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
Permalink string `json:"permalink"` Permalink string `json:"permalink"`
Contract *Contract `json:"asset_contract"` Contract *Contract `json:"asset_contract"`
Collection *Collection `json:"collection"` Collection *Collection `json:"collection"`
Creator *User `json:"creator"` Creator *User `json:"creator"`
Owner *User `json:"owner"` Owner *User `json:"owner"`
LastSale *Sale `json:"last_sale,omitempty"` LastSale *Sale `json:"last_sale,omitempty"`
Presale bool `json:"is_presale"` Presale bool `json:"is_presale"`
ListingDate string `json:"listing_date,omitempty"` ListingDate string `json:"listing_date,omitempty"`
} }
type Contract struct { type Contract struct {
// name of contract // name of contract
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
// ethereum address // ethereum address
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`
// type of contract e.g "semi-fungible" // type of contract e.g "semi-fungible"
Type string `json:"asset_contract_type,omitempty"` Type string `json:"asset_contract_type,omitempty"`
// timestamp of creation // timestamp of creation
CreatedAt string `json:"created_date,omitempty"` CreatedAt string `json:"created_date,omitempty"`
// owner id // owner id
Owner int32 `json:"owner,omitempty"` Owner int32 `json:"owner,omitempty"`
// aka "ERC1155" // aka "ERC1155"
Schema string `json:"schema_name,omitempty"` Schema string `json:"schema_name,omitempty"`
// related symbol // related symbol
Symbol string `json:"symbol,omitempty"` Symbol string `json:"symbol,omitempty"`
// description of contract // description of contract
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
// payout address // payout address
PayoutAddress string `json:"payout_address,omitempty"` PayoutAddress string `json:"payout_address,omitempty"`
// seller fees // seller fees
SellerFees string `json:"seller_fees_basis_points,omitempty"` SellerFees string `json:"seller_fees_basis_points,omitempty"`
} }
type Collection struct { type Collection struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Slug string `json:"slug,omitempty"` Slug string `json:"slug,omitempty"`
ImageUrl string `json:"image_url,omitempty"` ImageUrl string `json:"image_url,omitempty"`
CreatedAt string `json:"created_date,omitempty"` CreatedAt string `json:"created_date,omitempty"`
PayoutAddress string `json:"payout_address,omitempty"` PayoutAddress string `json:"payout_address,omitempty"`
} }
type User struct { type User struct {
User *Username `json:"user"` User *Username `json:"user"`
ProfileUrl string `json:"profile_img_url,omitempty"` ProfileUrl string `json:"profile_img_url,omitempty"`
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`
} }
type Username struct { type Username struct {
@@ -68,40 +68,39 @@ type Username struct {
} }
type SaleAsset struct { type SaleAsset struct {
TokenId string `json:"token_id"` TokenId string `json:"token_id"`
Decimals int32 `json:"decimals"` Decimals int32 `json:"decimals"`
} }
type Sale struct { type Sale struct {
Asset *SaleAsset `json:"asset"` Asset *SaleAsset `json:"asset"`
EventType string `json:"event_type,omitempty"` EventType string `json:"event_type,omitempty"`
EventTimestamp string `json:"event_timestamp,omitempty"` EventTimestamp string `json:"event_timestamp,omitempty"`
TotalPrice string `json:"total_price,omitempty"` TotalPrice string `json:"total_price,omitempty"`
Quantity string `json:"quantity,omitempty"` Quantity string `json:"quantity,omitempty"`
CreatedAt string `json:"created_date,omitempty"` CreatedAt string `json:"created_date,omitempty"`
Transaction *Transaction `json:"transaction,omitempty"` Transaction *Transaction `json:"transaction,omitempty"`
PaymentToken *Token `json:"payment_token,omitempty"` PaymentToken *Token `json:"payment_token,omitempty"`
} }
type Transaction struct { type Transaction struct {
Id int32 `json:"id,omitempty"` Id int32 `json:"id,omitempty"`
Timestamp string `json:"timestamp,omitempty"` Timestamp string `json:"timestamp,omitempty"`
BlockHash string `json:"block_hash,omitempty"` BlockHash string `json:"block_hash,omitempty"`
BlockNumber string `json:"block_number,omitempty"` BlockNumber string `json:"block_number,omitempty"`
FromAccount *User `json:"from_account,omitempty"` FromAccount *User `json:"from_account,omitempty"`
ToAccount *User `json:"to_account,omitempty"` ToAccount *User `json:"to_account,omitempty"`
TransactionHash string `json:"transaction_hash,omitempty"` TransactionHash string `json:"transaction_hash,omitempty"`
TransactionIndex string `json:"transaction_index,omitempty"` TransactionIndex string `json:"transaction_index,omitempty"`
} }
type Token struct { type Token struct {
Id int32 `json:"id,omitempty"` Id int32 `json:"id,omitempty"`
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Symbol string `json:"symbol,omitempty"` Symbol string `json:"symbol,omitempty"`
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`
ImageUrl string `json:"image_url,omitempty"` ImageUrl string `json:"image_url,omitempty"`
Decimals int32 `json:"decimals,omitempty"` Decimals int32 `json:"decimals,omitempty"`
EthPrice string `json:"eth_price,omitempty"` EthPrice string `json:"eth_price,omitempty"`
UsdPrice string `json:"usd_price,omitempty"` UsdPrice string `json:"usd_price,omitempty"`
} }

View File

@@ -1,2 +1,3 @@
package main package main
//go:generate make proto //go:generate make proto

View File

@@ -3,13 +3,11 @@ package handler
import ( import (
"context" "context"
pb "github.com/micro/services/nft/proto" pb "github.com/micro/services/nft/proto"
) )
type Nft struct{} type Nft struct{}
func (n *Nft) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.AssetsResponse) error { func (n *Nft) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.AssetsResponse) error {
return nil return nil
} }

View File

@@ -4,12 +4,12 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/micro/services/pkg/api"
"github.com/micro/services/nft/domain"
"github.com/micro/micro/v3/service/config" "github.com/micro/micro/v3/service/config"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/micro/v3/service/errors" "github.com/micro/micro/v3/service/errors"
"github.com/micro/micro/v3/service/logger"
"github.com/micro/services/nft/domain"
pb "github.com/micro/services/nft/proto" pb "github.com/micro/services/nft/proto"
"github.com/micro/services/pkg/api"
) )
// OpenSea handler // OpenSea handler
@@ -23,24 +23,23 @@ var (
openseaURL = "https://api.opensea.io/api/v1" openseaURL = "https://api.opensea.io/api/v1"
) )
func New() *OpenSea { func New() *OpenSea {
v, err := config.Get("nft.key") v, err := config.Get("nft.key")
if err != nil { if err != nil {
logger.Fatal("nft.key config not found: %v", err) logger.Fatal("nft.key config not found: %v", err)
} }
key := v.String("") key := v.String("")
if len(key) == 0 { if len(key) == 0 {
logger.Fatal("nft.key config not found") logger.Fatal("nft.key config not found")
} }
// set the api key // set the api key
api.SetKey("X-API-KEY", key) api.SetKey("X-API-KEY", key)
return &OpenSea { return &OpenSea{
apiKey: key, apiKey: key,
Nft: new(Nft), Nft: new(Nft),
} }
} }
@@ -83,7 +82,7 @@ func (o *OpenSea) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.Ass
var resp domain.AssetsResponse var resp domain.AssetsResponse
if err := api.Get(uri + params, &resp); err != nil { if err := api.Get(uri+params, &resp); err != nil {
return errors.InternalServerError("nft.assets", "failed to get assets: %v", err) return errors.InternalServerError("nft.assets", "failed to get assets: %v", err)
} }
@@ -117,7 +116,7 @@ func (o *OpenSea) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.Ass
if asset.LastSale.Transaction == nil { if asset.LastSale.Transaction == nil {
asset.LastSale.Transaction = &domain.Transaction{ asset.LastSale.Transaction = &domain.Transaction{
FromAccount: &domain.User{User: new(domain.Username)}, FromAccount: &domain.User{User: new(domain.Username)},
ToAccount: &domain.User{User: new(domain.Username)}, ToAccount: &domain.User{User: new(domain.Username)},
} }
} }
if asset.LastSale.Transaction.FromAccount == nil { if asset.LastSale.Transaction.FromAccount == nil {
@@ -137,36 +136,36 @@ func (o *OpenSea) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.Ass
} }
lastSale = &pb.Sale{ lastSale = &pb.Sale{
AssetTokenId: asset.LastSale.Asset.TokenId, AssetTokenId: asset.LastSale.Asset.TokenId,
AssetDecimals: asset.LastSale.Asset.Decimals, AssetDecimals: asset.LastSale.Asset.Decimals,
EventType: asset.LastSale.EventType, EventType: asset.LastSale.EventType,
EventTimestamp: asset.LastSale.EventTimestamp, EventTimestamp: asset.LastSale.EventTimestamp,
TotalPrice: asset.LastSale.TotalPrice, TotalPrice: asset.LastSale.TotalPrice,
Quantity: asset.LastSale.Quantity, Quantity: asset.LastSale.Quantity,
CreatedAt: asset.LastSale.CreatedAt, CreatedAt: asset.LastSale.CreatedAt,
Transaction: &pb.Transaction{ Transaction: &pb.Transaction{
Id: asset.LastSale.Transaction.Id, Id: asset.LastSale.Transaction.Id,
Timestamp: asset.LastSale.Transaction.Timestamp, Timestamp: asset.LastSale.Transaction.Timestamp,
BlockHash: asset.LastSale.Transaction.BlockHash, BlockHash: asset.LastSale.Transaction.BlockHash,
BlockNumber: asset.LastSale.Transaction.BlockNumber, BlockNumber: asset.LastSale.Transaction.BlockNumber,
FromAccount: &pb.User{ FromAccount: &pb.User{
Username: asset.LastSale.Transaction.FromAccount.User.Username, Username: asset.LastSale.Transaction.FromAccount.User.Username,
ProfileUrl: asset.LastSale.Transaction.FromAccount.ProfileUrl, ProfileUrl: asset.LastSale.Transaction.FromAccount.ProfileUrl,
Address: asset.LastSale.Transaction.FromAccount.Address, Address: asset.LastSale.Transaction.FromAccount.Address,
}, },
ToAccount: &pb.User{ ToAccount: &pb.User{
Username: asset.LastSale.Transaction.ToAccount.User.Username, Username: asset.LastSale.Transaction.ToAccount.User.Username,
ProfileUrl: asset.LastSale.Transaction.ToAccount.ProfileUrl, ProfileUrl: asset.LastSale.Transaction.ToAccount.ProfileUrl,
Address: asset.LastSale.Transaction.ToAccount.Address, Address: asset.LastSale.Transaction.ToAccount.Address,
}, },
TransactionHash: asset.LastSale.Transaction.TransactionHash, TransactionHash: asset.LastSale.Transaction.TransactionHash,
TransactionIndex: asset.LastSale.Transaction.TransactionIndex, TransactionIndex: asset.LastSale.Transaction.TransactionIndex,
}, },
PaymentToken: &pb.Token{ PaymentToken: &pb.Token{
Id: asset.LastSale.PaymentToken.Id, Id: asset.LastSale.PaymentToken.Id,
Name: asset.LastSale.PaymentToken.Name, Name: asset.LastSale.PaymentToken.Name,
Symbol: asset.LastSale.PaymentToken.Symbol, Symbol: asset.LastSale.PaymentToken.Symbol,
Address: asset.LastSale.PaymentToken.Address, Address: asset.LastSale.PaymentToken.Address,
ImageUrl: asset.LastSale.PaymentToken.ImageUrl, ImageUrl: asset.LastSale.PaymentToken.ImageUrl,
Decimals: asset.LastSale.PaymentToken.Decimals, Decimals: asset.LastSale.PaymentToken.Decimals,
EthPrice: asset.LastSale.PaymentToken.EthPrice, EthPrice: asset.LastSale.PaymentToken.EthPrice,
@@ -176,45 +175,45 @@ func (o *OpenSea) Assets(ctx context.Context, req *pb.AssetsRequest, rsp *pb.Ass
} }
rsp.Assets = append(rsp.Assets, &pb.Asset{ rsp.Assets = append(rsp.Assets, &pb.Asset{
Name: asset.Name, Name: asset.Name,
Description: asset.Description, Description: asset.Description,
Id: asset.Id, Id: asset.Id,
TokenId: asset.TokenId, TokenId: asset.TokenId,
ImageUrl: asset.ImageUrl, ImageUrl: asset.ImageUrl,
Sales: asset.Sales, Sales: asset.Sales,
Permalink: asset.Permalink, Permalink: asset.Permalink,
Contract: &pb.Contract{ Contract: &pb.Contract{
Name: asset.Contract.Name, Name: asset.Contract.Name,
Description: asset.Contract.Description, Description: asset.Contract.Description,
Address: asset.Contract.Address, Address: asset.Contract.Address,
Type: asset.Contract.Type, Type: asset.Contract.Type,
CreatedAt: asset.Contract.CreatedAt, CreatedAt: asset.Contract.CreatedAt,
Owner: asset.Contract.Owner, Owner: asset.Contract.Owner,
Schema: asset.Contract.Schema, Schema: asset.Contract.Schema,
Symbol: asset.Contract.Symbol, Symbol: asset.Contract.Symbol,
PayoutAddress: asset.Contract.PayoutAddress, PayoutAddress: asset.Contract.PayoutAddress,
SellerFees: asset.Contract.SellerFees, SellerFees: asset.Contract.SellerFees,
}, },
Collection: &pb.Collection{ Collection: &pb.Collection{
Name: asset.Collection.Name, Name: asset.Collection.Name,
Description: asset.Collection.Description, Description: asset.Collection.Description,
Slug: asset.Collection.Slug, Slug: asset.Collection.Slug,
ImageUrl: asset.Collection.ImageUrl, ImageUrl: asset.Collection.ImageUrl,
CreatedAt: asset.Collection.CreatedAt, CreatedAt: asset.Collection.CreatedAt,
PayoutAddress: asset.Collection.PayoutAddress, PayoutAddress: asset.Collection.PayoutAddress,
}, },
Owner: &pb.User{ Owner: &pb.User{
Username: asset.Owner.User.Username, Username: asset.Owner.User.Username,
ProfileUrl: asset.Owner.ProfileUrl, ProfileUrl: asset.Owner.ProfileUrl,
Address: asset.Owner.Address, Address: asset.Owner.Address,
}, },
Creator: &pb.User{ Creator: &pb.User{
Username: asset.Creator.User.Username, Username: asset.Creator.User.Username,
ProfileUrl: asset.Creator.ProfileUrl, ProfileUrl: asset.Creator.ProfileUrl,
Address: asset.Creator.Address, Address: asset.Creator.Address,
}, },
LastSale: lastSale, LastSale: lastSale,
Presale: asset.Presale, Presale: asset.Presale,
ListingDate: asset.ListingDate, ListingDate: asset.ListingDate,
}) })
} }
@@ -241,25 +240,24 @@ func (o *OpenSea) Collections(ctx context.Context, req *pb.CollectionsRequest, r
offset = req.Offset offset = req.Offset
} }
params += fmt.Sprintf("limit=%d&offset=%d",limit, offset) params += fmt.Sprintf("limit=%d&offset=%d", limit, offset)
var resp domain.CollectionsResponse var resp domain.CollectionsResponse
if err := api.Get(uri + params, &resp); err != nil { if err := api.Get(uri+params, &resp); err != nil {
return errors.InternalServerError("nft.collections", "failed to get collections: %v", err) return errors.InternalServerError("nft.collections", "failed to get collections: %v", err)
} }
for _, collection := range resp.Collections { for _, collection := range resp.Collections {
rsp.Collections = append(rsp.Collections, &pb.Collection{ rsp.Collections = append(rsp.Collections, &pb.Collection{
Name: collection.Name, Name: collection.Name,
Description: collection.Description, Description: collection.Description,
Slug: collection.Slug, Slug: collection.Slug,
ImageUrl: collection.ImageUrl, ImageUrl: collection.ImageUrl,
CreatedAt: collection.CreatedAt, CreatedAt: collection.CreatedAt,
PayoutAddress: collection.PayoutAddress, PayoutAddress: collection.PayoutAddress,
}) })
} }
return nil return nil
} }

View File

@@ -1,10 +1,10 @@
package main package main
import ( import (
"github.com/micro/services/nft/handler"
pb "github.com/micro/services/nft/proto"
"github.com/micro/micro/v3/service" "github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
"github.com/micro/services/nft/handler"
pb "github.com/micro/services/nft/proto"
) )
func main() { func main() {

View File

@@ -1,2 +1,3 @@
package main package main
//go:generate make proto //go:generate make proto

View File

@@ -5,9 +5,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/micro/services/pkg/tenant"
"github.com/micro/micro/v3/service/store" "github.com/micro/micro/v3/service/store"
"github.com/micro/services/pkg/tenant"
pb "github.com/micro/services/search/proto" pb "github.com/micro/services/search/proto"
) )
@@ -20,8 +19,8 @@ var (
) )
type Vote struct { type Vote struct {
Id string `json:"id"` Id string `json:"id"`
Message string `json:"message"` Message string `json:"message"`
VotedAt time.Time `json:"voted_at"` VotedAt time.Time `json:"voted_at"`
} }
@@ -34,8 +33,8 @@ func (n *Search) Vote(ctx context.Context, req *pb.VoteRequest, rsp *pb.VoteResp
id = "micro" id = "micro"
} }
rec := store.NewRecord(voteKey + id, &Vote{ rec := store.NewRecord(voteKey+id, &Vote{
Id: id, Id: id,
Message: req.Message, Message: req.Message,
VotedAt: time.Now(), VotedAt: time.Now(),
}) })
@@ -47,4 +46,3 @@ func (n *Search) Vote(ctx context.Context, req *pb.VoteRequest, rsp *pb.VoteResp
return nil return nil
} }

View File

@@ -1,10 +1,10 @@
package main package main
import ( import (
"github.com/micro/services/search/handler"
pb "github.com/micro/services/search/proto"
"github.com/micro/micro/v3/service" "github.com/micro/micro/v3/service"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
"github.com/micro/services/search/handler"
pb "github.com/micro/services/search/proto"
) )
func main() { func main() {

View File

@@ -3,8 +3,8 @@ package handler
import ( import (
"context" "context"
me "github.com/micro/micro/v3/service/errors"
"github.com/micro/micro/v3/service/config" "github.com/micro/micro/v3/service/config"
me "github.com/micro/micro/v3/service/errors"
"github.com/micro/micro/v3/service/logger" "github.com/micro/micro/v3/service/logger"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/text/language" "golang.org/x/text/language"
@@ -17,7 +17,7 @@ import (
type translation struct { type translation struct {
ApiKey string ApiKey string
Limit int Limit int
} }
func NewTranslation() *translation { func NewTranslation() *translation {
@@ -39,7 +39,7 @@ func NewTranslation() *translation {
return &translation{ return &translation{
ApiKey: key, ApiKey: key,
Limit: limit, Limit: limit,
} }
} }

View File

@@ -50,7 +50,7 @@ func (y *Youtube) Embed(ctx context.Context, req *pb.EmbedRequest, rsp *pb.Embed
} }
} }
rsp.LongUrl = "https://www.youtube.com/watch?v="+id rsp.LongUrl = "https://www.youtube.com/watch?v=" + id
rsp.ShortUrl = "https://youtu.be/" + id rsp.ShortUrl = "https://youtu.be/" + id
rsp.EmbedUrl = "https://www.youtube.com/embed/" + id rsp.EmbedUrl = "https://www.youtube.com/embed/" + id
rsp.HtmlScript = `<iframe width="560" height="315" src="` + rsp.EmbedUrl + `" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>` rsp.HtmlScript = `<iframe width="560" height="315" src="` + rsp.EmbedUrl + `" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`