mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
add crypto news
This commit is contained in:
@@ -20,6 +20,20 @@ var (
|
||||
re = regexp.MustCompile(`\d{4}-\d{2}-\d{2}`)
|
||||
)
|
||||
|
||||
type Article struct {
|
||||
Title string
|
||||
Description string
|
||||
Url string
|
||||
Source string
|
||||
Date string
|
||||
}
|
||||
|
||||
type News struct {
|
||||
Ticker string
|
||||
Limit int32
|
||||
News []*Article
|
||||
}
|
||||
|
||||
type Crypto struct {
|
||||
Api string
|
||||
Key string
|
||||
@@ -76,6 +90,47 @@ func New() *Crypto {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Crypto) News(ctx context.Context, req *pb.NewsRequest, rsp *pb.NewsResponse) error {
|
||||
if len(req.Symbol) <= 0 {
|
||||
return errors.BadRequest("crypto.news", "invalid symbol")
|
||||
}
|
||||
|
||||
uri := fmt.Sprintf("%snews/cryptocurrency/%s?apikey=%s", c.Api, req.Symbol, c.Key)
|
||||
|
||||
resp, err := http.Get(uri)
|
||||
if err != nil {
|
||||
logger.Errorf("Failed to get news: %v\n", err)
|
||||
return errors.InternalServerError("crypto.news", "failed to get news")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
logger.Errorf("Failed to get news (non 200): %d %v\n", resp.StatusCode, string(b))
|
||||
return errors.InternalServerError("crypto.news", "failed to get news")
|
||||
}
|
||||
|
||||
var respBody News
|
||||
|
||||
if err := json.Unmarshal(b, &respBody); err != nil {
|
||||
logger.Errorf("Failed to unmarshal news: %v\n", err)
|
||||
return errors.InternalServerError("crypto.news", "failed to get news")
|
||||
}
|
||||
|
||||
for _, article := range respBody.News {
|
||||
rsp.Articles = append(rsp.Articles, &pb.Article{
|
||||
Title: article.Title,
|
||||
Description: article.Description,
|
||||
Url: article.Url,
|
||||
Source: article.Source,
|
||||
Date: article.Date,
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Crypto) History(ctx context.Context, req *pb.HistoryRequest, rsp *pb.HistoryResponse) error {
|
||||
if len(req.Symbol) <= 0 {
|
||||
return errors.BadRequest("crypto.history", "invalid symbol")
|
||||
|
||||
@@ -20,6 +20,196 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Article struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// title of the article
|
||||
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
|
||||
// its description
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
// the source url
|
||||
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
|
||||
// the date published
|
||||
Date string `protobuf:"bytes,4,opt,name=date,proto3" json:"date,omitempty"`
|
||||
// the source
|
||||
Source string `protobuf:"bytes,5,opt,name=source,proto3" json:"source,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Article) Reset() {
|
||||
*x = Article{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Article) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Article) ProtoMessage() {}
|
||||
|
||||
func (x *Article) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Article.ProtoReflect.Descriptor instead.
|
||||
func (*Article) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Article) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Article) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Article) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Article) GetDate() string {
|
||||
if x != nil {
|
||||
return x.Date
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Article) GetSource() string {
|
||||
if x != nil {
|
||||
return x.Source
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Get news related to a currency
|
||||
type NewsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// cryptocurrency to request news for e.g BTC
|
||||
Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NewsRequest) Reset() {
|
||||
*x = NewsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NewsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NewsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NewsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NewsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NewsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *NewsRequest) GetSymbol() string {
|
||||
if x != nil {
|
||||
return x.Symbol
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type NewsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// symbol requested for
|
||||
Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
|
||||
// list of articles
|
||||
Articles []*Article `protobuf:"bytes,2,rep,name=articles,proto3" json:"articles,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NewsResponse) Reset() {
|
||||
*x = NewsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NewsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NewsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *NewsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NewsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*NewsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *NewsResponse) GetSymbol() string {
|
||||
if x != nil {
|
||||
return x.Symbol
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NewsResponse) GetArticles() []*Article {
|
||||
if x != nil {
|
||||
return x.Articles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get the last price for a given crypto ticker
|
||||
type PriceRequest struct {
|
||||
state protoimpl.MessageState
|
||||
@@ -33,7 +223,7 @@ type PriceRequest struct {
|
||||
func (x *PriceRequest) Reset() {
|
||||
*x = PriceRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[0]
|
||||
mi := &file_proto_crypto_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -46,7 +236,7 @@ func (x *PriceRequest) String() string {
|
||||
func (*PriceRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PriceRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[0]
|
||||
mi := &file_proto_crypto_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -59,7 +249,7 @@ func (x *PriceRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PriceRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PriceRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{0}
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *PriceRequest) GetSymbol() string {
|
||||
@@ -83,7 +273,7 @@ type PriceResponse struct {
|
||||
func (x *PriceResponse) Reset() {
|
||||
*x = PriceResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[1]
|
||||
mi := &file_proto_crypto_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -96,7 +286,7 @@ func (x *PriceResponse) String() string {
|
||||
func (*PriceResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PriceResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[1]
|
||||
mi := &file_proto_crypto_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -109,7 +299,7 @@ func (x *PriceResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use PriceResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PriceResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{1}
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *PriceResponse) GetSymbol() string {
|
||||
@@ -139,7 +329,7 @@ type QuoteRequest struct {
|
||||
func (x *QuoteRequest) Reset() {
|
||||
*x = QuoteRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[2]
|
||||
mi := &file_proto_crypto_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -152,7 +342,7 @@ func (x *QuoteRequest) String() string {
|
||||
func (*QuoteRequest) ProtoMessage() {}
|
||||
|
||||
func (x *QuoteRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[2]
|
||||
mi := &file_proto_crypto_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -165,7 +355,7 @@ func (x *QuoteRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use QuoteRequest.ProtoReflect.Descriptor instead.
|
||||
func (*QuoteRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{2}
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *QuoteRequest) GetSymbol() string {
|
||||
@@ -197,7 +387,7 @@ type QuoteResponse struct {
|
||||
func (x *QuoteResponse) Reset() {
|
||||
*x = QuoteResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[3]
|
||||
mi := &file_proto_crypto_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -210,7 +400,7 @@ func (x *QuoteResponse) String() string {
|
||||
func (*QuoteResponse) ProtoMessage() {}
|
||||
|
||||
func (x *QuoteResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[3]
|
||||
mi := &file_proto_crypto_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -223,7 +413,7 @@ func (x *QuoteResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use QuoteResponse.ProtoReflect.Descriptor instead.
|
||||
func (*QuoteResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{3}
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *QuoteResponse) GetSymbol() string {
|
||||
@@ -281,7 +471,7 @@ type HistoryRequest struct {
|
||||
func (x *HistoryRequest) Reset() {
|
||||
*x = HistoryRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[4]
|
||||
mi := &file_proto_crypto_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -294,7 +484,7 @@ func (x *HistoryRequest) String() string {
|
||||
func (*HistoryRequest) ProtoMessage() {}
|
||||
|
||||
func (x *HistoryRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[4]
|
||||
mi := &file_proto_crypto_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -307,7 +497,7 @@ func (x *HistoryRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead.
|
||||
func (*HistoryRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{4}
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *HistoryRequest) GetSymbol() string {
|
||||
@@ -341,7 +531,7 @@ type HistoryResponse struct {
|
||||
func (x *HistoryResponse) Reset() {
|
||||
*x = HistoryResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_crypto_proto_msgTypes[5]
|
||||
mi := &file_proto_crypto_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -354,7 +544,7 @@ func (x *HistoryResponse) String() string {
|
||||
func (*HistoryResponse) ProtoMessage() {}
|
||||
|
||||
func (x *HistoryResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_crypto_proto_msgTypes[5]
|
||||
mi := &file_proto_crypto_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -367,7 +557,7 @@ func (x *HistoryResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead.
|
||||
func (*HistoryResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{5}
|
||||
return file_proto_crypto_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *HistoryResponse) GetSymbol() string {
|
||||
@@ -423,54 +613,73 @@ var File_proto_crypto_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_crypto_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x22, 0x26, 0x0a, 0x0c,
|
||||
0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x22, 0x7f, 0x0a, 0x07,
|
||||
0x41, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a,
|
||||
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
|
||||
0x6c, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x25, 0x0a,
|
||||
0x0b, 0x4e, 0x65, 0x77, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79,
|
||||
0x6d, 0x62, 0x6f, 0x6c, 0x22, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x70, 0x72,
|
||||
0x69, 0x63, 0x65, 0x22, 0x26, 0x0a, 0x0c, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0xb5, 0x01, 0x0a, 0x0d,
|
||||
0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
|
||||
0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x73, 0x6b, 0x5f, 0x70, 0x72, 0x69,
|
||||
0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x69,
|
||||
0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x69, 0x64, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x62, 0x69, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12,
|
||||
0x19, 0x0a, 0x08, 0x61, 0x73, 0x6b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x01, 0x52, 0x07, 0x61, 0x73, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x69,
|
||||
0x64, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x62, 0x69,
|
||||
0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
|
||||
0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x22, 0x28, 0x0a, 0x0e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0xa5, 0x01,
|
||||
0x0a, 0x0f, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6f, 0x70, 0x65,
|
||||
0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x63, 0x6c,
|
||||
0x6f, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x69, 0x67, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x01, 0x52, 0x04, 0x68, 0x69, 0x67, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x77, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x6c, 0x6f, 0x77, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x6f, 0x6c,
|
||||
0x75, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x76, 0x6f, 0x6c, 0x75, 0x6d,
|
||||
0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x64, 0x61, 0x74, 0x65, 0x32, 0xb6, 0x01, 0x0a, 0x06, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f,
|
||||
0x12, 0x36, 0x0a, 0x05, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x63, 0x72, 0x79, 0x70,
|
||||
0x74, 0x6f, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x15, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x69, 0x63,
|
||||
0x65, 0x12, 0x14, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f,
|
||||
0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x12, 0x3c, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x2e, 0x63, 0x72,
|
||||
0x79, 0x70, 0x74, 0x6f, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x48, 0x69, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10,
|
||||
0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6d, 0x62, 0x6f, 0x6c, 0x22, 0x53, 0x0a, 0x0c, 0x4e, 0x65, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x2b, 0x0a, 0x08,
|
||||
0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
|
||||
0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x52,
|
||||
0x08, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0c, 0x50, 0x72, 0x69,
|
||||
0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d,
|
||||
0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f,
|
||||
0x6c, 0x22, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72,
|
||||
0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65,
|
||||
0x22, 0x26, 0x0a, 0x0c, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0xb5, 0x01, 0x0a, 0x0d, 0x51, 0x75, 0x6f,
|
||||
0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79,
|
||||
0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62,
|
||||
0x6f, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x73, 0x6b, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x61, 0x73, 0x6b, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12,
|
||||
0x1b, 0x0a, 0x09, 0x62, 0x69, 0x64, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x01, 0x52, 0x08, 0x62, 0x69, 0x64, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x19, 0x0a, 0x08,
|
||||
0x61, 0x73, 0x6b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07,
|
||||
0x61, 0x73, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x69, 0x64, 0x5f, 0x73,
|
||||
0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x62, 0x69, 0x64, 0x53, 0x69,
|
||||
0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x22, 0x28, 0x0a, 0x0e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x22, 0xa5, 0x01, 0x0a, 0x0f, 0x48,
|
||||
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x6f, 0x70, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6c,
|
||||
0x6f, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x68, 0x69, 0x67, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04,
|
||||
0x68, 0x69, 0x67, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x77, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x01, 0x52, 0x03, 0x6c, 0x6f, 0x77, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61,
|
||||
0x74, 0x65, 0x32, 0xeb, 0x01, 0x0a, 0x06, 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x12, 0x33, 0x0a,
|
||||
0x04, 0x4e, 0x65, 0x77, 0x73, 0x12, 0x13, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x4e,
|
||||
0x65, 0x77, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x63, 0x72, 0x79,
|
||||
0x70, 0x74, 0x6f, 0x2e, 0x4e, 0x65, 0x77, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x00, 0x12, 0x36, 0x0a, 0x05, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x63, 0x72,
|
||||
0x79, 0x70, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72,
|
||||
0x69, 0x63, 0x65, 0x12, 0x14, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x69,
|
||||
0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x79, 0x70,
|
||||
0x74, 0x6f, 0x2e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x16, 0x2e,
|
||||
0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x2e, 0x48,
|
||||
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x63, 0x72, 0x79, 0x70,
|
||||
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -485,27 +694,33 @@ func file_proto_crypto_proto_rawDescGZIP() []byte {
|
||||
return file_proto_crypto_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_crypto_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_proto_crypto_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_proto_crypto_proto_goTypes = []interface{}{
|
||||
(*PriceRequest)(nil), // 0: crypto.PriceRequest
|
||||
(*PriceResponse)(nil), // 1: crypto.PriceResponse
|
||||
(*QuoteRequest)(nil), // 2: crypto.QuoteRequest
|
||||
(*QuoteResponse)(nil), // 3: crypto.QuoteResponse
|
||||
(*HistoryRequest)(nil), // 4: crypto.HistoryRequest
|
||||
(*HistoryResponse)(nil), // 5: crypto.HistoryResponse
|
||||
(*Article)(nil), // 0: crypto.Article
|
||||
(*NewsRequest)(nil), // 1: crypto.NewsRequest
|
||||
(*NewsResponse)(nil), // 2: crypto.NewsResponse
|
||||
(*PriceRequest)(nil), // 3: crypto.PriceRequest
|
||||
(*PriceResponse)(nil), // 4: crypto.PriceResponse
|
||||
(*QuoteRequest)(nil), // 5: crypto.QuoteRequest
|
||||
(*QuoteResponse)(nil), // 6: crypto.QuoteResponse
|
||||
(*HistoryRequest)(nil), // 7: crypto.HistoryRequest
|
||||
(*HistoryResponse)(nil), // 8: crypto.HistoryResponse
|
||||
}
|
||||
var file_proto_crypto_proto_depIdxs = []int32{
|
||||
2, // 0: crypto.Crypto.Quote:input_type -> crypto.QuoteRequest
|
||||
0, // 1: crypto.Crypto.Price:input_type -> crypto.PriceRequest
|
||||
4, // 2: crypto.Crypto.History:input_type -> crypto.HistoryRequest
|
||||
3, // 3: crypto.Crypto.Quote:output_type -> crypto.QuoteResponse
|
||||
1, // 4: crypto.Crypto.Price:output_type -> crypto.PriceResponse
|
||||
5, // 5: crypto.Crypto.History:output_type -> crypto.HistoryResponse
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
0, // 0: crypto.NewsResponse.articles:type_name -> crypto.Article
|
||||
1, // 1: crypto.Crypto.News:input_type -> crypto.NewsRequest
|
||||
5, // 2: crypto.Crypto.Quote:input_type -> crypto.QuoteRequest
|
||||
3, // 3: crypto.Crypto.Price:input_type -> crypto.PriceRequest
|
||||
7, // 4: crypto.Crypto.History:input_type -> crypto.HistoryRequest
|
||||
2, // 5: crypto.Crypto.News:output_type -> crypto.NewsResponse
|
||||
6, // 6: crypto.Crypto.Quote:output_type -> crypto.QuoteResponse
|
||||
4, // 7: crypto.Crypto.Price:output_type -> crypto.PriceResponse
|
||||
8, // 8: crypto.Crypto.History:output_type -> crypto.HistoryResponse
|
||||
5, // [5:9] is the sub-list for method output_type
|
||||
1, // [1:5] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_crypto_proto_init() }
|
||||
@@ -515,7 +730,7 @@ func file_proto_crypto_proto_init() {
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_proto_crypto_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PriceRequest); i {
|
||||
switch v := v.(*Article); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -527,7 +742,7 @@ func file_proto_crypto_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PriceResponse); i {
|
||||
switch v := v.(*NewsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -539,7 +754,7 @@ func file_proto_crypto_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QuoteRequest); i {
|
||||
switch v := v.(*NewsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -551,7 +766,7 @@ func file_proto_crypto_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QuoteResponse); i {
|
||||
switch v := v.(*PriceRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -563,7 +778,7 @@ func file_proto_crypto_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HistoryRequest); i {
|
||||
switch v := v.(*PriceResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -575,6 +790,42 @@ func file_proto_crypto_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QuoteRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*QuoteResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HistoryRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_crypto_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HistoryResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -593,7 +844,7 @@ func file_proto_crypto_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_crypto_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -42,6 +42,7 @@ func NewCryptoEndpoints() []*api.Endpoint {
|
||||
// Client API for Crypto service
|
||||
|
||||
type CryptoService interface {
|
||||
News(ctx context.Context, in *NewsRequest, opts ...client.CallOption) (*NewsResponse, error)
|
||||
Quote(ctx context.Context, in *QuoteRequest, opts ...client.CallOption) (*QuoteResponse, error)
|
||||
Price(ctx context.Context, in *PriceRequest, opts ...client.CallOption) (*PriceResponse, error)
|
||||
History(ctx context.Context, in *HistoryRequest, opts ...client.CallOption) (*HistoryResponse, error)
|
||||
@@ -59,6 +60,16 @@ func NewCryptoService(name string, c client.Client) CryptoService {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cryptoService) News(ctx context.Context, in *NewsRequest, opts ...client.CallOption) (*NewsResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Crypto.News", in)
|
||||
out := new(NewsResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *cryptoService) Quote(ctx context.Context, in *QuoteRequest, opts ...client.CallOption) (*QuoteResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Crypto.Quote", in)
|
||||
out := new(QuoteResponse)
|
||||
@@ -92,6 +103,7 @@ func (c *cryptoService) History(ctx context.Context, in *HistoryRequest, opts ..
|
||||
// Server API for Crypto service
|
||||
|
||||
type CryptoHandler interface {
|
||||
News(context.Context, *NewsRequest, *NewsResponse) error
|
||||
Quote(context.Context, *QuoteRequest, *QuoteResponse) error
|
||||
Price(context.Context, *PriceRequest, *PriceResponse) error
|
||||
History(context.Context, *HistoryRequest, *HistoryResponse) error
|
||||
@@ -99,6 +111,7 @@ type CryptoHandler interface {
|
||||
|
||||
func RegisterCryptoHandler(s server.Server, hdlr CryptoHandler, opts ...server.HandlerOption) error {
|
||||
type crypto interface {
|
||||
News(ctx context.Context, in *NewsRequest, out *NewsResponse) error
|
||||
Quote(ctx context.Context, in *QuoteRequest, out *QuoteResponse) error
|
||||
Price(ctx context.Context, in *PriceRequest, out *PriceResponse) error
|
||||
History(ctx context.Context, in *HistoryRequest, out *HistoryResponse) error
|
||||
@@ -114,6 +127,10 @@ type cryptoHandler struct {
|
||||
CryptoHandler
|
||||
}
|
||||
|
||||
func (h *cryptoHandler) News(ctx context.Context, in *NewsRequest, out *NewsResponse) error {
|
||||
return h.CryptoHandler.News(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *cryptoHandler) Quote(ctx context.Context, in *QuoteRequest, out *QuoteResponse) error {
|
||||
return h.CryptoHandler.Quote(ctx, in, out)
|
||||
}
|
||||
|
||||
@@ -5,11 +5,38 @@ package crypto;
|
||||
option go_package = "./proto;crypto";
|
||||
|
||||
service Crypto {
|
||||
rpc News(NewsRequest) returns (NewsResponse) {}
|
||||
rpc Quote(QuoteRequest) returns (QuoteResponse) {}
|
||||
rpc Price(PriceRequest) returns (PriceResponse) {}
|
||||
rpc History(HistoryRequest) returns (HistoryResponse) {}
|
||||
}
|
||||
|
||||
message Article {
|
||||
// title of the article
|
||||
string title = 1;
|
||||
// its description
|
||||
string description = 2;
|
||||
// the source url
|
||||
string url = 3;
|
||||
// the date published
|
||||
string date = 4;
|
||||
// the source
|
||||
string source = 5;
|
||||
}
|
||||
|
||||
// Get news related to a currency
|
||||
message NewsRequest {
|
||||
// cryptocurrency ticker to request news for e.g BTC
|
||||
string symbol = 1;
|
||||
}
|
||||
|
||||
message NewsResponse {
|
||||
// symbol requested for
|
||||
string symbol = 1;
|
||||
// list of articles
|
||||
repeated Article articles = 2;
|
||||
}
|
||||
|
||||
// Get the last price for a given crypto ticker
|
||||
message PriceRequest {
|
||||
// crypto symbol e.g BTCUSD
|
||||
|
||||
Reference in New Issue
Block a user