Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterFetchNewsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterFetchNewsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FetchNewsClient) error
- func RegisterFetchNewsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterFetchNewsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FetchNewsServer) error
- func RegisterFetchNewsServer(s grpc.ServiceRegistrar, srv FetchNewsServer)
- type Article
- func (*Article) Descriptor() ([]byte, []int)deprecated
- func (x *Article) GetContent() string
- func (x *Article) GetId() string
- func (x *Article) GetTitle() string
- func (x *Article) GetUpdateTime() *timestamppb.Timestamp
- func (x *Article) GetWebsiteDomain() string
- func (x *Article) GetWebsiteId() string
- func (x *Article) GetWebsiteTitle() string
- func (*Article) ProtoMessage()
- func (x *Article) ProtoReflect() protoreflect.Message
- func (x *Article) Reset()
- func (x *Article) String() string
- type FetchNewsClient
- type FetchNewsServer
- type GetArticleRequest
- type ListArticlesRequest
- func (*ListArticlesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListArticlesRequest) GetPageSize() int32
- func (x *ListArticlesRequest) GetPageToken() string
- func (x *ListArticlesRequest) GetParent() string
- func (*ListArticlesRequest) ProtoMessage()
- func (x *ListArticlesRequest) ProtoReflect() protoreflect.Message
- func (x *ListArticlesRequest) Reset()
- func (x *ListArticlesRequest) String() string
- type ListArticlesResponse
- func (*ListArticlesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListArticlesResponse) GetArticles() []*Article
- func (x *ListArticlesResponse) GetNextPageToken() string
- func (*ListArticlesResponse) ProtoMessage()
- func (x *ListArticlesResponse) ProtoReflect() protoreflect.Message
- func (x *ListArticlesResponse) Reset()
- func (x *ListArticlesResponse) String() string
- type SearchArticlesRequest
- func (*SearchArticlesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SearchArticlesRequest) GetKeyword() string
- func (*SearchArticlesRequest) ProtoMessage()
- func (x *SearchArticlesRequest) ProtoReflect() protoreflect.Message
- func (x *SearchArticlesRequest) Reset()
- func (x *SearchArticlesRequest) String() string
- type SearchArticlesResponse
- func (*SearchArticlesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *SearchArticlesResponse) GetArticles() []*Article
- func (x *SearchArticlesResponse) GetNextPageToken() string
- func (*SearchArticlesResponse) ProtoMessage()
- func (x *SearchArticlesResponse) ProtoReflect() protoreflect.Message
- func (x *SearchArticlesResponse) Reset()
- func (x *SearchArticlesResponse) String() string
- type UnimplementedFetchNewsServer
- func (UnimplementedFetchNewsServer) GetArticle(context.Context, *GetArticleRequest) (*Article, error)
- func (UnimplementedFetchNewsServer) ListArticles(context.Context, *ListArticlesRequest) (*ListArticlesResponse, error)
- func (UnimplementedFetchNewsServer) SearchArticles(context.Context, *SearchArticlesRequest) (*SearchArticlesResponse, error)
- type UnsafeFetchNewsServer
Constants ¶
This section is empty.
Variables ¶
var FetchNews_ServiceDesc = grpc.ServiceDesc{ ServiceName: "fetchnews.v1.FetchNews", HandlerType: (*FetchNewsServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ListArticles", Handler: _FetchNews_ListArticles_Handler, }, { MethodName: "GetArticle", Handler: _FetchNews_GetArticle_Handler, }, { MethodName: "SearchArticles", Handler: _FetchNews_SearchArticles_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/v1/fetchnews.proto", }
FetchNews_ServiceDesc is the grpc.ServiceDesc for FetchNews service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_proto_v1_fetchnews_proto protoreflect.FileDescriptor
Functions ¶
func RegisterFetchNewsHandler ¶
func RegisterFetchNewsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterFetchNewsHandler registers the http handlers for service FetchNews to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterFetchNewsHandlerClient ¶
func RegisterFetchNewsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FetchNewsClient) error
RegisterFetchNewsHandlerClient registers the http handlers for service FetchNews to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FetchNewsClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FetchNewsClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "FetchNewsClient" to call the correct interceptors.
func RegisterFetchNewsHandlerFromEndpoint ¶
func RegisterFetchNewsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterFetchNewsHandlerFromEndpoint is same as RegisterFetchNewsHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterFetchNewsHandlerServer ¶
func RegisterFetchNewsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FetchNewsServer) error
RegisterFetchNewsHandlerServer registers the http handlers for service FetchNews to "mux". UnaryRPC :call FetchNewsServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFetchNewsHandlerFromEndpoint instead.
func RegisterFetchNewsServer ¶
func RegisterFetchNewsServer(s grpc.ServiceRegistrar, srv FetchNewsServer)
Types ¶
type Article ¶
type Article struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` UpdateTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"` WebsiteId string `protobuf:"bytes,5,opt,name=website_id,json=websiteId,proto3" json:"website_id,omitempty"` WebsiteDomain string `protobuf:"bytes,6,opt,name=website_domain,json=websiteDomain,proto3" json:"website_domain,omitempty"` WebsiteTitle string `protobuf:"bytes,7,opt,name=website_title,json=websiteTitle,proto3" json:"website_title,omitempty"` // contains filtered or unexported fields }
func (*Article) Descriptor
deprecated
func (*Article) GetContent ¶
func (*Article) GetUpdateTime ¶
func (x *Article) GetUpdateTime() *timestamppb.Timestamp
func (*Article) GetWebsiteDomain ¶
func (*Article) GetWebsiteId ¶
func (*Article) GetWebsiteTitle ¶
func (*Article) ProtoMessage ¶
func (*Article) ProtoMessage()
func (*Article) ProtoReflect ¶
func (x *Article) ProtoReflect() protoreflect.Message
type FetchNewsClient ¶
type FetchNewsClient interface { ListArticles(ctx context.Context, in *ListArticlesRequest, opts ...grpc.CallOption) (*ListArticlesResponse, error) GetArticle(ctx context.Context, in *GetArticleRequest, opts ...grpc.CallOption) (*Article, error) SearchArticles(ctx context.Context, in *SearchArticlesRequest, opts ...grpc.CallOption) (*SearchArticlesResponse, error) }
FetchNewsClient is the client API for FetchNews service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewFetchNewsClient ¶
func NewFetchNewsClient(cc grpc.ClientConnInterface) FetchNewsClient
type FetchNewsServer ¶
type FetchNewsServer interface { ListArticles(context.Context, *ListArticlesRequest) (*ListArticlesResponse, error) GetArticle(context.Context, *GetArticleRequest) (*Article, error) SearchArticles(context.Context, *SearchArticlesRequest) (*SearchArticlesResponse, error) // contains filtered or unexported methods }
FetchNewsServer is the server API for FetchNews service. All implementations must embed UnimplementedFetchNewsServer for forward compatibility
type GetArticleRequest ¶
type GetArticleRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetArticleRequest) Descriptor
deprecated
func (*GetArticleRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetArticleRequest.ProtoReflect.Descriptor instead.
func (*GetArticleRequest) GetId ¶
func (x *GetArticleRequest) GetId() string
func (*GetArticleRequest) ProtoMessage ¶
func (*GetArticleRequest) ProtoMessage()
func (*GetArticleRequest) ProtoReflect ¶
func (x *GetArticleRequest) ProtoReflect() protoreflect.Message
func (*GetArticleRequest) Reset ¶
func (x *GetArticleRequest) Reset()
func (*GetArticleRequest) String ¶
func (x *GetArticleRequest) String() string
type ListArticlesRequest ¶
type ListArticlesRequest struct { // The parent resource name Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` // The maximum number of items to return. PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // The next_page_token value returned from a previous List request, if any. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // contains filtered or unexported fields }
func (*ListArticlesRequest) Descriptor
deprecated
func (*ListArticlesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListArticlesRequest.ProtoReflect.Descriptor instead.
func (*ListArticlesRequest) GetPageSize ¶
func (x *ListArticlesRequest) GetPageSize() int32
func (*ListArticlesRequest) GetPageToken ¶
func (x *ListArticlesRequest) GetPageToken() string
func (*ListArticlesRequest) GetParent ¶
func (x *ListArticlesRequest) GetParent() string
func (*ListArticlesRequest) ProtoMessage ¶
func (*ListArticlesRequest) ProtoMessage()
func (*ListArticlesRequest) ProtoReflect ¶
func (x *ListArticlesRequest) ProtoReflect() protoreflect.Message
func (*ListArticlesRequest) Reset ¶
func (x *ListArticlesRequest) Reset()
func (*ListArticlesRequest) String ¶
func (x *ListArticlesRequest) String() string
type ListArticlesResponse ¶
type ListArticlesResponse struct { Articles []*Article `protobuf:"bytes,1,rep,name=articles,proto3" json:"articles,omitempty"` NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` // contains filtered or unexported fields }
func (*ListArticlesResponse) Descriptor
deprecated
func (*ListArticlesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListArticlesResponse.ProtoReflect.Descriptor instead.
func (*ListArticlesResponse) GetArticles ¶
func (x *ListArticlesResponse) GetArticles() []*Article
func (*ListArticlesResponse) GetNextPageToken ¶
func (x *ListArticlesResponse) GetNextPageToken() string
func (*ListArticlesResponse) ProtoMessage ¶
func (*ListArticlesResponse) ProtoMessage()
func (*ListArticlesResponse) ProtoReflect ¶
func (x *ListArticlesResponse) ProtoReflect() protoreflect.Message
func (*ListArticlesResponse) Reset ¶
func (x *ListArticlesResponse) Reset()
func (*ListArticlesResponse) String ¶
func (x *ListArticlesResponse) String() string
type SearchArticlesRequest ¶
type SearchArticlesRequest struct { Keyword string `protobuf:"bytes,1,opt,name=keyword,proto3" json:"keyword,omitempty"` // contains filtered or unexported fields }
func (*SearchArticlesRequest) Descriptor
deprecated
func (*SearchArticlesRequest) Descriptor() ([]byte, []int)
Deprecated: Use SearchArticlesRequest.ProtoReflect.Descriptor instead.
func (*SearchArticlesRequest) GetKeyword ¶
func (x *SearchArticlesRequest) GetKeyword() string
func (*SearchArticlesRequest) ProtoMessage ¶
func (*SearchArticlesRequest) ProtoMessage()
func (*SearchArticlesRequest) ProtoReflect ¶
func (x *SearchArticlesRequest) ProtoReflect() protoreflect.Message
func (*SearchArticlesRequest) Reset ¶
func (x *SearchArticlesRequest) Reset()
func (*SearchArticlesRequest) String ¶
func (x *SearchArticlesRequest) String() string
type SearchArticlesResponse ¶
type SearchArticlesResponse struct { Articles []*Article `protobuf:"bytes,1,rep,name=articles,proto3" json:"articles,omitempty"` NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` // contains filtered or unexported fields }
func (*SearchArticlesResponse) Descriptor
deprecated
func (*SearchArticlesResponse) Descriptor() ([]byte, []int)
Deprecated: Use SearchArticlesResponse.ProtoReflect.Descriptor instead.
func (*SearchArticlesResponse) GetArticles ¶
func (x *SearchArticlesResponse) GetArticles() []*Article
func (*SearchArticlesResponse) GetNextPageToken ¶
func (x *SearchArticlesResponse) GetNextPageToken() string
func (*SearchArticlesResponse) ProtoMessage ¶
func (*SearchArticlesResponse) ProtoMessage()
func (*SearchArticlesResponse) ProtoReflect ¶
func (x *SearchArticlesResponse) ProtoReflect() protoreflect.Message
func (*SearchArticlesResponse) Reset ¶
func (x *SearchArticlesResponse) Reset()
func (*SearchArticlesResponse) String ¶
func (x *SearchArticlesResponse) String() string
type UnimplementedFetchNewsServer ¶
type UnimplementedFetchNewsServer struct { }
UnimplementedFetchNewsServer must be embedded to have forward compatible implementations.
func (UnimplementedFetchNewsServer) GetArticle ¶
func (UnimplementedFetchNewsServer) GetArticle(context.Context, *GetArticleRequest) (*Article, error)
func (UnimplementedFetchNewsServer) ListArticles ¶
func (UnimplementedFetchNewsServer) ListArticles(context.Context, *ListArticlesRequest) (*ListArticlesResponse, error)
func (UnimplementedFetchNewsServer) SearchArticles ¶
func (UnimplementedFetchNewsServer) SearchArticles(context.Context, *SearchArticlesRequest) (*SearchArticlesResponse, error)
type UnsafeFetchNewsServer ¶
type UnsafeFetchNewsServer interface {
// contains filtered or unexported methods
}
UnsafeFetchNewsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to FetchNewsServer will result in compilation errors.