mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
add twitter trends
This commit is contained in:
@@ -151,3 +151,23 @@ func (t *Twitter) User(ctx context.Context, req *pb.UserRequest, rsp *pb.UserRes
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Twitter) Trends(ctx context.Context, req *pb.TrendsRequest, rsp *pb.TrendsResponse) error {
|
||||
trendRsp, _, err := t.Client.Trends.Place(1, &twitter.TrendsPlaceParams{WOEID: 1})
|
||||
if err != nil {
|
||||
logger.Errorf("Failed to retrieve trends: %v", err)
|
||||
return errors.InternalServerError("twitter.trends", "Failed to retrieve trends")
|
||||
}
|
||||
|
||||
for _, list := range trendRsp {
|
||||
for _, trend := range list.Trends {
|
||||
rsp.Trends = append(rsp.Trends, &pb.Trend{
|
||||
Name: trend.Name,
|
||||
Url: trend.URL,
|
||||
TweetVolume: trend.TweetVolume,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -242,6 +242,72 @@ func (x *Profile) GetImageUrl() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type Trend struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// name of the trend
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// the twitter url
|
||||
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
|
||||
// the volume of tweets in last 24 hours
|
||||
TweetVolume int64 `protobuf:"varint,3,opt,name=tweet_volume,json=tweetVolume,proto3" json:"tweet_volume,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Trend) Reset() {
|
||||
*x = Trend{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Trend) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Trend) ProtoMessage() {}
|
||||
|
||||
func (x *Trend) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_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 Trend.ProtoReflect.Descriptor instead.
|
||||
func (*Trend) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *Trend) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Trend) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Trend) GetTweetVolume() int64 {
|
||||
if x != nil {
|
||||
return x.TweetVolume
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Get the timeline for a given user
|
||||
type TimelineRequest struct {
|
||||
state protoimpl.MessageState
|
||||
@@ -257,7 +323,7 @@ type TimelineRequest struct {
|
||||
func (x *TimelineRequest) Reset() {
|
||||
*x = TimelineRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[2]
|
||||
mi := &file_proto_twitter_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -270,7 +336,7 @@ func (x *TimelineRequest) String() string {
|
||||
func (*TimelineRequest) ProtoMessage() {}
|
||||
|
||||
func (x *TimelineRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[2]
|
||||
mi := &file_proto_twitter_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -283,7 +349,7 @@ func (x *TimelineRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use TimelineRequest.ProtoReflect.Descriptor instead.
|
||||
func (*TimelineRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{2}
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *TimelineRequest) GetUsername() string {
|
||||
@@ -312,7 +378,7 @@ type TimelineResponse struct {
|
||||
func (x *TimelineResponse) Reset() {
|
||||
*x = TimelineResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[3]
|
||||
mi := &file_proto_twitter_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -325,7 +391,7 @@ func (x *TimelineResponse) String() string {
|
||||
func (*TimelineResponse) ProtoMessage() {}
|
||||
|
||||
func (x *TimelineResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[3]
|
||||
mi := &file_proto_twitter_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -338,7 +404,7 @@ func (x *TimelineResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use TimelineResponse.ProtoReflect.Descriptor instead.
|
||||
func (*TimelineResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{3}
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *TimelineResponse) GetTweets() []*Tweet {
|
||||
@@ -363,7 +429,7 @@ type SearchRequest struct {
|
||||
func (x *SearchRequest) Reset() {
|
||||
*x = SearchRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[4]
|
||||
mi := &file_proto_twitter_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -376,7 +442,7 @@ func (x *SearchRequest) String() string {
|
||||
func (*SearchRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SearchRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[4]
|
||||
mi := &file_proto_twitter_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -389,7 +455,7 @@ func (x *SearchRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SearchRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{4}
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *SearchRequest) GetQuery() string {
|
||||
@@ -418,7 +484,7 @@ type SearchResponse struct {
|
||||
func (x *SearchResponse) Reset() {
|
||||
*x = SearchResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[5]
|
||||
mi := &file_proto_twitter_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -431,7 +497,7 @@ func (x *SearchResponse) String() string {
|
||||
func (*SearchResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SearchResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[5]
|
||||
mi := &file_proto_twitter_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -444,7 +510,7 @@ func (x *SearchResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SearchResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{5}
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *SearchResponse) GetTweets() []*Tweet {
|
||||
@@ -467,7 +533,7 @@ type UserRequest struct {
|
||||
func (x *UserRequest) Reset() {
|
||||
*x = UserRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[6]
|
||||
mi := &file_proto_twitter_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -480,7 +546,7 @@ func (x *UserRequest) String() string {
|
||||
func (*UserRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UserRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[6]
|
||||
mi := &file_proto_twitter_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -493,7 +559,7 @@ func (x *UserRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use UserRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UserRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{6}
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *UserRequest) GetUsername() string {
|
||||
@@ -517,7 +583,7 @@ type UserResponse struct {
|
||||
func (x *UserResponse) Reset() {
|
||||
*x = UserResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[7]
|
||||
mi := &file_proto_twitter_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -530,7 +596,7 @@ func (x *UserResponse) String() string {
|
||||
func (*UserResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UserResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[7]
|
||||
mi := &file_proto_twitter_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -543,7 +609,7 @@ func (x *UserResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use UserResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UserResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{7}
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UserResponse) GetStatus() *Tweet {
|
||||
@@ -560,6 +626,93 @@ func (x *UserResponse) GetProfile() *Profile {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get the current global trending topics
|
||||
type TrendsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *TrendsRequest) Reset() {
|
||||
*x = TrendsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TrendsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TrendsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *TrendsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[9]
|
||||
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 TrendsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*TrendsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
type TrendsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// a list of trending topics
|
||||
Trends []*Trend `protobuf:"bytes,1,rep,name=trends,proto3" json:"trends,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TrendsResponse) Reset() {
|
||||
*x = TrendsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_twitter_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TrendsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TrendsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *TrendsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_twitter_proto_msgTypes[10]
|
||||
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 TrendsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*TrendsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_twitter_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *TrendsResponse) GetTrends() []*Trend {
|
||||
if x != nil {
|
||||
return x.Trends
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_proto_twitter_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_twitter_proto_rawDesc = []byte{
|
||||
@@ -594,45 +747,59 @@ var file_proto_twitter_proto_rawDesc = []byte{
|
||||
0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
|
||||
0x76, 0x65, 0x72, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67,
|
||||
0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x61,
|
||||
0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x43, 0x0a, 0x0f, 0x54, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6e,
|
||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26,
|
||||
0x0a, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e,
|
||||
0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x77, 0x65, 0x65, 0x74, 0x52, 0x06,
|
||||
0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69,
|
||||
0x6d, 0x69, 0x74, 0x22, 0x38, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x18,
|
||||
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e,
|
||||
0x54, 0x77, 0x65, 0x65, 0x74, 0x52, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x22, 0x29, 0x0a,
|
||||
0x0b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x62, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74,
|
||||
0x65, 0x72, 0x2e, 0x54, 0x77, 0x65, 0x65, 0x74, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x10, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x32, 0xc0, 0x01, 0x0a,
|
||||
0x07, 0x54, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x6c, 0x69, 0x6e, 0x65, 0x12, 0x18, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
|
||||
0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6e,
|
||||
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53,
|
||||
0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e,
|
||||
0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
||||
0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72,
|
||||
0x12, 0x14, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72,
|
||||
0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
|
||||
0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x74, 0x77, 0x69, 0x74, 0x74,
|
||||
0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x50, 0x0a, 0x05, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x75, 0x72, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x77, 0x65, 0x65, 0x74, 0x5f, 0x76, 0x6f,
|
||||
0x6c, 0x75, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x77, 0x65, 0x65,
|
||||
0x74, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x22, 0x43, 0x0a, 0x0f, 0x54, 0x69, 0x6d, 0x65, 0x6c,
|
||||
0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73,
|
||||
0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73,
|
||||
0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x3a, 0x0a, 0x10,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x26, 0x0a, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0e, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x77, 0x65, 0x65, 0x74,
|
||||
0x52, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x53, 0x65, 0x61, 0x72,
|
||||
0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65,
|
||||
0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
|
||||
0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x38, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74,
|
||||
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65,
|
||||
0x72, 0x2e, 0x54, 0x77, 0x65, 0x65, 0x74, 0x52, 0x06, 0x74, 0x77, 0x65, 0x65, 0x74, 0x73, 0x22,
|
||||
0x29, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x62, 0x0a, 0x0c, 0x55, 0x73,
|
||||
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x73, 0x74,
|
||||
0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x77, 0x69,
|
||||
0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x77, 0x65, 0x65, 0x74, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
|
||||
0x75, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x50, 0x72,
|
||||
0x6f, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x0f,
|
||||
0x0a, 0x0d, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
|
||||
0x38, 0x0a, 0x0e, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x26, 0x0a, 0x06, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x65, 0x6e,
|
||||
0x64, 0x52, 0x06, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x32, 0xfd, 0x01, 0x0a, 0x07, 0x54, 0x77,
|
||||
0x69, 0x74, 0x74, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6e,
|
||||
0x65, 0x12, 0x18, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x74, 0x77,
|
||||
0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72,
|
||||
0x63, 0x68, 0x12, 0x16, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x61,
|
||||
0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x74, 0x77, 0x69,
|
||||
0x74, 0x74, 0x65, 0x72, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x2e,
|
||||
0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x55, 0x73,
|
||||
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x06,
|
||||
0x54, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x12, 0x16, 0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72,
|
||||
0x2e, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17,
|
||||
0x2e, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x11, 0x5a, 0x0f, 0x2e, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x74, 0x77, 0x69, 0x74, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -647,33 +814,39 @@ func file_proto_twitter_proto_rawDescGZIP() []byte {
|
||||
return file_proto_twitter_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_twitter_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_proto_twitter_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_proto_twitter_proto_goTypes = []interface{}{
|
||||
(*Tweet)(nil), // 0: twitter.Tweet
|
||||
(*Profile)(nil), // 1: twitter.Profile
|
||||
(*TimelineRequest)(nil), // 2: twitter.TimelineRequest
|
||||
(*TimelineResponse)(nil), // 3: twitter.TimelineResponse
|
||||
(*SearchRequest)(nil), // 4: twitter.SearchRequest
|
||||
(*SearchResponse)(nil), // 5: twitter.SearchResponse
|
||||
(*UserRequest)(nil), // 6: twitter.UserRequest
|
||||
(*UserResponse)(nil), // 7: twitter.UserResponse
|
||||
(*Trend)(nil), // 2: twitter.Trend
|
||||
(*TimelineRequest)(nil), // 3: twitter.TimelineRequest
|
||||
(*TimelineResponse)(nil), // 4: twitter.TimelineResponse
|
||||
(*SearchRequest)(nil), // 5: twitter.SearchRequest
|
||||
(*SearchResponse)(nil), // 6: twitter.SearchResponse
|
||||
(*UserRequest)(nil), // 7: twitter.UserRequest
|
||||
(*UserResponse)(nil), // 8: twitter.UserResponse
|
||||
(*TrendsRequest)(nil), // 9: twitter.TrendsRequest
|
||||
(*TrendsResponse)(nil), // 10: twitter.TrendsResponse
|
||||
}
|
||||
var file_proto_twitter_proto_depIdxs = []int32{
|
||||
0, // 0: twitter.TimelineResponse.tweets:type_name -> twitter.Tweet
|
||||
0, // 1: twitter.SearchResponse.tweets:type_name -> twitter.Tweet
|
||||
0, // 2: twitter.UserResponse.status:type_name -> twitter.Tweet
|
||||
1, // 3: twitter.UserResponse.profile:type_name -> twitter.Profile
|
||||
2, // 4: twitter.Twitter.Timeline:input_type -> twitter.TimelineRequest
|
||||
4, // 5: twitter.Twitter.Search:input_type -> twitter.SearchRequest
|
||||
6, // 6: twitter.Twitter.User:input_type -> twitter.UserRequest
|
||||
3, // 7: twitter.Twitter.Timeline:output_type -> twitter.TimelineResponse
|
||||
5, // 8: twitter.Twitter.Search:output_type -> twitter.SearchResponse
|
||||
7, // 9: twitter.Twitter.User:output_type -> twitter.UserResponse
|
||||
7, // [7:10] is the sub-list for method output_type
|
||||
4, // [4:7] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
2, // 4: twitter.TrendsResponse.trends:type_name -> twitter.Trend
|
||||
3, // 5: twitter.Twitter.Timeline:input_type -> twitter.TimelineRequest
|
||||
5, // 6: twitter.Twitter.Search:input_type -> twitter.SearchRequest
|
||||
7, // 7: twitter.Twitter.User:input_type -> twitter.UserRequest
|
||||
9, // 8: twitter.Twitter.Trends:input_type -> twitter.TrendsRequest
|
||||
4, // 9: twitter.Twitter.Timeline:output_type -> twitter.TimelineResponse
|
||||
6, // 10: twitter.Twitter.Search:output_type -> twitter.SearchResponse
|
||||
8, // 11: twitter.Twitter.User:output_type -> twitter.UserResponse
|
||||
10, // 12: twitter.Twitter.Trends:output_type -> twitter.TrendsResponse
|
||||
9, // [9:13] is the sub-list for method output_type
|
||||
5, // [5:9] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_twitter_proto_init() }
|
||||
@@ -707,7 +880,7 @@ func file_proto_twitter_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TimelineRequest); i {
|
||||
switch v := v.(*Trend); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -719,7 +892,7 @@ func file_proto_twitter_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TimelineResponse); i {
|
||||
switch v := v.(*TimelineRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -731,7 +904,7 @@ func file_proto_twitter_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SearchRequest); i {
|
||||
switch v := v.(*TimelineResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -743,7 +916,7 @@ func file_proto_twitter_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SearchResponse); i {
|
||||
switch v := v.(*SearchRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -755,7 +928,7 @@ func file_proto_twitter_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserRequest); i {
|
||||
switch v := v.(*SearchResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -767,6 +940,18 @@ func file_proto_twitter_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -778,6 +963,30 @@ func file_proto_twitter_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TrendsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_twitter_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TrendsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@@ -785,7 +994,7 @@ func file_proto_twitter_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_twitter_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -45,6 +45,7 @@ type TwitterService interface {
|
||||
Timeline(ctx context.Context, in *TimelineRequest, opts ...client.CallOption) (*TimelineResponse, error)
|
||||
Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error)
|
||||
User(ctx context.Context, in *UserRequest, opts ...client.CallOption) (*UserResponse, error)
|
||||
Trends(ctx context.Context, in *TrendsRequest, opts ...client.CallOption) (*TrendsResponse, error)
|
||||
}
|
||||
|
||||
type twitterService struct {
|
||||
@@ -89,12 +90,23 @@ func (c *twitterService) User(ctx context.Context, in *UserRequest, opts ...clie
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *twitterService) Trends(ctx context.Context, in *TrendsRequest, opts ...client.CallOption) (*TrendsResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Twitter.Trends", in)
|
||||
out := new(TrendsResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Twitter service
|
||||
|
||||
type TwitterHandler interface {
|
||||
Timeline(context.Context, *TimelineRequest, *TimelineResponse) error
|
||||
Search(context.Context, *SearchRequest, *SearchResponse) error
|
||||
User(context.Context, *UserRequest, *UserResponse) error
|
||||
Trends(context.Context, *TrendsRequest, *TrendsResponse) error
|
||||
}
|
||||
|
||||
func RegisterTwitterHandler(s server.Server, hdlr TwitterHandler, opts ...server.HandlerOption) error {
|
||||
@@ -102,6 +114,7 @@ func RegisterTwitterHandler(s server.Server, hdlr TwitterHandler, opts ...server
|
||||
Timeline(ctx context.Context, in *TimelineRequest, out *TimelineResponse) error
|
||||
Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error
|
||||
User(ctx context.Context, in *UserRequest, out *UserResponse) error
|
||||
Trends(ctx context.Context, in *TrendsRequest, out *TrendsResponse) error
|
||||
}
|
||||
type Twitter struct {
|
||||
twitter
|
||||
@@ -125,3 +138,7 @@ func (h *twitterHandler) Search(ctx context.Context, in *SearchRequest, out *Sea
|
||||
func (h *twitterHandler) User(ctx context.Context, in *UserRequest, out *UserResponse) error {
|
||||
return h.TwitterHandler.User(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *twitterHandler) Trends(ctx context.Context, in *TrendsRequest, out *TrendsResponse) error {
|
||||
return h.TwitterHandler.Trends(ctx, in, out)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ service Twitter {
|
||||
rpc Timeline(TimelineRequest) returns (TimelineResponse) {}
|
||||
rpc Search(SearchRequest) returns (SearchResponse) {}
|
||||
rpc User(UserRequest) returns (UserResponse) {}
|
||||
rpc Trends(TrendsRequest) returns (TrendsResponse) {}
|
||||
}
|
||||
|
||||
message Tweet {
|
||||
@@ -48,6 +49,15 @@ message Profile {
|
||||
string image_url = 10;
|
||||
}
|
||||
|
||||
message Trend {
|
||||
// name of the trend
|
||||
string name = 1;
|
||||
// the twitter url
|
||||
string url = 2;
|
||||
// the volume of tweets in last 24 hours
|
||||
int64 tweet_volume = 3;
|
||||
}
|
||||
|
||||
// Get the timeline for a given user
|
||||
message TimelineRequest {
|
||||
// the username to request the timeline for
|
||||
@@ -86,3 +96,12 @@ message UserResponse {
|
||||
// The requested user profile
|
||||
Profile profile = 2;
|
||||
}
|
||||
|
||||
// Get the current global trending topics
|
||||
message TrendsRequest {
|
||||
}
|
||||
|
||||
message TrendsResponse {
|
||||
// a list of trending topics
|
||||
repeated Trend trends = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user