fbcrawl-colly 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,7 @@ const _ = grpc.SupportPackageIsVersion6
19
19
  type GrpcClient interface {
20
20
  // Sends a greeting
21
21
  Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
22
+ FetchMyGroups(ctx context.Context, in *FetchMyGroupsRequest, opts ...grpc.CallOption) (*FacebookGroupList, error)
22
23
  FetchGroupInfo(ctx context.Context, in *FetchGroupInfoRequest, opts ...grpc.CallOption) (*FacebookGroup, error)
23
24
  FetchUserInfo(ctx context.Context, in *FetchUserInfoRequest, opts ...grpc.CallOption) (*FacebookUser, error)
24
25
  FetchGroupFeed(ctx context.Context, in *FetchGroupFeedRequest, opts ...grpc.CallOption) (*FacebookPostList, error)
@@ -44,6 +45,15 @@ func (c *grpcClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.C
44
45
  return out, nil
45
46
  }
46
47
 
48
+ func (c *grpcClient) FetchMyGroups(ctx context.Context, in *FetchMyGroupsRequest, opts ...grpc.CallOption) (*FacebookGroupList, error) {
49
+ out := new(FacebookGroupList)
50
+ err := c.cc.Invoke(ctx, "/fbcrawl_colly.Grpc/FetchMyGroups", in, out, opts...)
51
+ if err != nil {
52
+ return nil, err
53
+ }
54
+ return out, nil
55
+ }
56
+
47
57
  func (c *grpcClient) FetchGroupInfo(ctx context.Context, in *FetchGroupInfoRequest, opts ...grpc.CallOption) (*FacebookGroup, error) {
48
58
  out := new(FacebookGroup)
49
59
  err := c.cc.Invoke(ctx, "/fbcrawl_colly.Grpc/FetchGroupInfo", in, out, opts...)
@@ -104,6 +114,7 @@ func (c *grpcClient) FetchImageUrl(ctx context.Context, in *FetchImageUrlRequest
104
114
  type GrpcServer interface {
105
115
  // Sends a greeting
106
116
  Login(context.Context, *LoginRequest) (*LoginResponse, error)
117
+ FetchMyGroups(context.Context, *FetchMyGroupsRequest) (*FacebookGroupList, error)
107
118
  FetchGroupInfo(context.Context, *FetchGroupInfoRequest) (*FacebookGroup, error)
108
119
  FetchUserInfo(context.Context, *FetchUserInfoRequest) (*FacebookUser, error)
109
120
  FetchGroupFeed(context.Context, *FetchGroupFeedRequest) (*FacebookPostList, error)
@@ -120,6 +131,9 @@ type UnimplementedGrpcServer struct {
120
131
  func (*UnimplementedGrpcServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {
121
132
  return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
122
133
  }
134
+ func (*UnimplementedGrpcServer) FetchMyGroups(context.Context, *FetchMyGroupsRequest) (*FacebookGroupList, error) {
135
+ return nil, status.Errorf(codes.Unimplemented, "method FetchMyGroups not implemented")
136
+ }
123
137
  func (*UnimplementedGrpcServer) FetchGroupInfo(context.Context, *FetchGroupInfoRequest) (*FacebookGroup, error) {
124
138
  return nil, status.Errorf(codes.Unimplemented, "method FetchGroupInfo not implemented")
125
139
  }
@@ -162,6 +176,24 @@ func _Grpc_Login_Handler(srv interface{}, ctx context.Context, dec func(interfac
162
176
  return interceptor(ctx, in, info, handler)
163
177
  }
164
178
 
179
+ func _Grpc_FetchMyGroups_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
180
+ in := new(FetchMyGroupsRequest)
181
+ if err := dec(in); err != nil {
182
+ return nil, err
183
+ }
184
+ if interceptor == nil {
185
+ return srv.(GrpcServer).FetchMyGroups(ctx, in)
186
+ }
187
+ info := &grpc.UnaryServerInfo{
188
+ Server: srv,
189
+ FullMethod: "/fbcrawl_colly.Grpc/FetchMyGroups",
190
+ }
191
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
192
+ return srv.(GrpcServer).FetchMyGroups(ctx, req.(*FetchMyGroupsRequest))
193
+ }
194
+ return interceptor(ctx, in, info, handler)
195
+ }
196
+
165
197
  func _Grpc_FetchGroupInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
166
198
  in := new(FetchGroupInfoRequest)
167
199
  if err := dec(in); err != nil {
@@ -278,6 +310,10 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{
278
310
  MethodName: "Login",
279
311
  Handler: _Grpc_Login_Handler,
280
312
  },
313
+ {
314
+ MethodName: "FetchMyGroups",
315
+ Handler: _Grpc_FetchMyGroups_Handler,
316
+ },
281
317
  {
282
318
  MethodName: "FetchGroupInfo",
283
319
  Handler: _Grpc_FetchGroupInfo_Handler,
@@ -21,6 +21,10 @@ module FbcrawlColly
21
21
  s = @client.fetch_user_info(FbcrawlColly::FetchUserInfoRequest.new(context: @context, username: username))
22
22
  end
23
23
 
24
+ def fetch_my_groups
25
+ s = @client.fetch_my_groups(FbcrawlColly::FetchMyGroupsRequest.new(context: @context))
26
+ end
27
+
24
28
  def fetch_group_info(group_id_or_username)
25
29
  s = @client.fetch_group_info(FbcrawlColly::FetchGroupInfoRequest.new(context: @context, group_username: group_id_or_username))
26
30
  end
@@ -1,3 +1,3 @@
1
1
  module FbcrawlColly
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -5,8 +5,6 @@ require 'google/protobuf'
5
5
 
6
6
  Google::Protobuf::DescriptorPool.generated_pool.build do
7
7
  add_file("fbcrawl.proto", :syntax => :proto3) do
8
- add_message "fbcrawl_colly.Empty" do
9
- end
10
8
  add_message "fbcrawl_colly.Context" do
11
9
  optional :cookies, :string, 1
12
10
  end
@@ -21,6 +19,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
21
19
  add_message "fbcrawl_colly.LoginWithCookiesRequest" do
22
20
  optional :cookies, :string, 1
23
21
  end
22
+ add_message "fbcrawl_colly.FetchMyGroupsRequest" do
23
+ optional :context, :message, 1, "fbcrawl_colly.Context"
24
+ end
24
25
  add_message "fbcrawl_colly.FetchGroupInfoRequest" do
25
26
  optional :context, :message, 1, "fbcrawl_colly.Context"
26
27
  optional :group_username, :string, 2
@@ -49,6 +50,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
49
50
  optional :context, :message, 1, "fbcrawl_colly.Context"
50
51
  optional :image_id, :int64, 2
51
52
  end
53
+ add_message "fbcrawl_colly.FacebookGroupList" do
54
+ repeated :groups, :message, 1, "fbcrawl_colly.FacebookGroup"
55
+ end
52
56
  add_message "fbcrawl_colly.FacebookGroup" do
53
57
  optional :id, :int64, 1
54
58
  optional :name, :string, 2
@@ -100,17 +104,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
100
104
  end
101
105
 
102
106
  module FbcrawlColly
103
- Empty = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.Empty").msgclass
104
107
  Context = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.Context").msgclass
105
108
  LoginRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.LoginRequest").msgclass
106
109
  LoginResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.LoginResponse").msgclass
107
110
  LoginWithCookiesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.LoginWithCookiesRequest").msgclass
111
+ FetchMyGroupsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchMyGroupsRequest").msgclass
108
112
  FetchGroupInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchGroupInfoRequest").msgclass
109
113
  FetchUserInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchUserInfoRequest").msgclass
110
114
  FetchGroupFeedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchGroupFeedRequest").msgclass
111
115
  FetchPostRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchPostRequest").msgclass
112
116
  FetchContentImagesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchContentImagesRequest").msgclass
113
117
  FetchImageUrlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FetchImageUrlRequest").msgclass
118
+ FacebookGroupList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FacebookGroupList").msgclass
114
119
  FacebookGroup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FacebookGroup").msgclass
115
120
  FacebookUser = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FacebookUser").msgclass
116
121
  FacebookPost = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("fbcrawl_colly.FacebookPost").msgclass
@@ -16,6 +16,7 @@ module FbcrawlColly
16
16
 
17
17
  # Sends a greeting
18
18
  rpc :Login, FbcrawlColly::LoginRequest, FbcrawlColly::LoginResponse
19
+ rpc :FetchMyGroups, FbcrawlColly::FetchMyGroupsRequest, FbcrawlColly::FacebookGroupList
19
20
  rpc :FetchGroupInfo, FbcrawlColly::FetchGroupInfoRequest, FbcrawlColly::FacebookGroup
20
21
  rpc :FetchUserInfo, FbcrawlColly::FetchUserInfoRequest, FbcrawlColly::FacebookUser
21
22
  rpc :FetchGroupFeed, FbcrawlColly::FetchGroupFeedRequest, FbcrawlColly::FacebookPostList
data/main.go CHANGED
@@ -46,6 +46,12 @@ func (s server) Login(ctx context.Context, request *pb.LoginRequest) (*pb.LoginR
46
46
  return nil, err
47
47
  }
48
48
 
49
+ func (s server) FetchMyGroups(ctx context.Context, request *pb.FetchMyGroupsRequest) (*pb.FacebookGroupList, error) {
50
+ p := getColly(request.Context)
51
+ err, groupInfo := p.FetchMyGroups()
52
+ return groupInfo, err
53
+ }
54
+
49
55
  func (s server) FetchGroupInfo(ctx context.Context, request *pb.FetchGroupInfoRequest) (*pb.FacebookGroup, error) {
50
56
  p := getColly(request.Context)
51
57
  err, groupInfo := p.FetchGroupInfo(request.GroupUsername)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbcrawl-colly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duy Le
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-18 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf