v1

package
v0.0.0-...-d41d60b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2021 License: MIT Imports: 17 Imported by: 55

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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)

View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Article.ProtoReflect.Descriptor instead.

func (*Article) GetContent

func (x *Article) GetContent() string

func (*Article) GetId

func (x *Article) GetId() string

func (*Article) GetTitle

func (x *Article) GetTitle() string

func (*Article) GetUpdateTime

func (x *Article) GetUpdateTime() *timestamppb.Timestamp

func (*Article) GetWebsiteDomain

func (x *Article) GetWebsiteDomain() string

func (*Article) GetWebsiteId

func (x *Article) GetWebsiteId() string

func (*Article) GetWebsiteTitle

func (x *Article) GetWebsiteTitle() string

func (*Article) ProtoMessage

func (*Article) ProtoMessage()

func (*Article) ProtoReflect

func (x *Article) ProtoReflect() protoreflect.Message

func (*Article) Reset

func (x *Article) Reset()

func (*Article) String

func (x *Article) String() string

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) ListArticles

func (UnimplementedFetchNewsServer) SearchArticles

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL