Documentation ¶
Overview ¶
Package articles is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterArticlesServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterArticlesServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ArticlesServiceClient) error
- func RegisterArticlesServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterArticlesServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ArticlesServiceServer) error
- func RegisterArticlesServiceServer(s *grpc.Server, srv ArticlesServiceServer)
- type Article
- func (*Article) Descriptor() ([]byte, []int)deprecated
- func (x *Article) GetContent() []byte
- func (x *Article) GetContentSha256() string
- func (x *Article) GetCreateTime() *timestamp.Timestamp
- func (x *Article) GetFeedId() *wrappers.StringValue
- func (x *Article) GetId() string
- func (x *Article) GetIsRead() bool
- func (x *Article) GetTitle() string
- func (x *Article) GetUrl() string
- func (x *Article) GetUserId() string
- func (*Article) ProtoMessage()
- func (x *Article) ProtoReflect() protoreflect.Message
- func (x *Article) Reset()
- func (x *Article) String() string
- type ArticleView
- func (ArticleView) Descriptor() protoreflect.EnumDescriptor
- func (x ArticleView) Enum() *ArticleView
- func (ArticleView) EnumDescriptor() ([]byte, []int)deprecated
- func (x ArticleView) Number() protoreflect.EnumNumber
- func (x ArticleView) String() string
- func (ArticleView) Type() protoreflect.EnumType
- type ArticlesServiceClient
- type ArticlesServiceServer
- type DeleteArticleRequest
- func (*DeleteArticleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteArticleRequest) GetId() string
- func (*DeleteArticleRequest) ProtoMessage()
- func (x *DeleteArticleRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteArticleRequest) Reset()
- func (x *DeleteArticleRequest) String() string
- type GetArticleRequest
- func (*GetArticleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetArticleRequest) GetId() string
- func (x *GetArticleRequest) GetView() ArticleView
- func (*GetArticleRequest) ProtoMessage()
- func (x *GetArticleRequest) ProtoReflect() protoreflect.Message
- func (x *GetArticleRequest) Reset()
- func (x *GetArticleRequest) String() string
- type ListArticlesRequest
- func (*ListArticlesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListArticlesRequest) GetFeedIdEq() *wrappers.StringValue
- func (x *ListArticlesRequest) GetIsReadEq() *wrappers.BoolValue
- func (x *ListArticlesRequest) GetPageSize() int64
- func (x *ListArticlesRequest) GetPageToken() string
- func (x *ListArticlesRequest) GetTitleContains() *wrappers.StringValue
- 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 UnimplementedArticlesServiceServer
- func (*UnimplementedArticlesServiceServer) DeleteArticle(context.Context, *DeleteArticleRequest) (*empty.Empty, error)
- func (*UnimplementedArticlesServiceServer) GetArticle(context.Context, *GetArticleRequest) (*Article, error)
- func (*UnimplementedArticlesServiceServer) ListArticles(context.Context, *ListArticlesRequest) (*ListArticlesResponse, error)
- func (*UnimplementedArticlesServiceServer) UpdateArticle(context.Context, *UpdateArticleRequest) (*Article, error)
- type UpdateArticleRequest
- func (*UpdateArticleRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateArticleRequest) GetArticle() *Article
- func (x *UpdateArticleRequest) GetUpdateMask() *field_mask.FieldMask
- func (*UpdateArticleRequest) ProtoMessage()
- func (x *UpdateArticleRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateArticleRequest) Reset()
- func (x *UpdateArticleRequest) String() string
Constants ¶
This section is empty.
Variables ¶
var ( ArticleView_name = map[int32]string{ 0: "ARTICLE_VIEW_UNSPECIFIED", 1: "ARTICLE_VIEW_BASIC", 2: "ARTICLE_VIEW_FULL", } ArticleView_value = map[string]int32{ "ARTICLE_VIEW_UNSPECIFIED": 0, "ARTICLE_VIEW_BASIC": 1, "ARTICLE_VIEW_FULL": 2, } )
Enum value maps for ArticleView.
var File_articles_v1_articles_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterArticlesServiceHandler ¶
func RegisterArticlesServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterArticlesServiceHandler registers the http handlers for service ArticlesService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterArticlesServiceHandlerClient ¶
func RegisterArticlesServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ArticlesServiceClient) error
RegisterArticlesServiceHandlerClient registers the http handlers for service ArticlesService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ArticlesServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ArticlesServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ArticlesServiceClient" to call the correct interceptors.
func RegisterArticlesServiceHandlerFromEndpoint ¶
func RegisterArticlesServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterArticlesServiceHandlerFromEndpoint is same as RegisterArticlesServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterArticlesServiceHandlerServer ¶
func RegisterArticlesServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ArticlesServiceServer) error
RegisterArticlesServiceHandlerServer registers the http handlers for service ArticlesService to "mux". UnaryRPC :call ArticlesServiceServer 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 RegisterArticlesServiceHandlerFromEndpoint instead.
func RegisterArticlesServiceServer ¶
func RegisterArticlesServiceServer(s *grpc.Server, srv ArticlesServiceServer)
Types ¶
type Article ¶
type Article struct { // Id of the article. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Id of the user who owns the article. UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Url of the article. Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"` // Title of the article. Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"` // Time when article was added. CreateTime *timestamp.Timestamp `protobuf:"bytes,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // Readable content of the article. Content []byte `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` // SHA256 sum of the content. ContentSha256 string `protobuf:"bytes,7,opt,name=content_sha256,json=contentSha256,proto3" json:"content_sha256,omitempty"` // Mark the article as read. IsRead bool `protobuf:"varint,8,opt,name=is_read,json=isRead,proto3" json:"is_read,omitempty"` // Feed id, if article belogs to a feed. FeedId *wrappers.StringValue `protobuf:"bytes,9,opt,name=feed_id,json=feedId,proto3" json:"feed_id,omitempty"` // contains filtered or unexported fields }
func (*Article) Descriptor
deprecated
func (*Article) GetContent ¶
func (*Article) GetContentSha256 ¶
func (*Article) GetCreateTime ¶
func (*Article) GetFeedId ¶
func (x *Article) GetFeedId() *wrappers.StringValue
func (*Article) ProtoMessage ¶
func (*Article) ProtoMessage()
func (*Article) ProtoReflect ¶
func (x *Article) ProtoReflect() protoreflect.Message
type ArticleView ¶
type ArticleView int32
const ( // Not specified, equivalent to BASIC. ArticleView_ARTICLE_VIEW_UNSPECIFIED ArticleView = 0 // Server response does not include content field. // Default value. ArticleView_ARTICLE_VIEW_BASIC ArticleView = 1 // Service response includes article's content. ArticleView_ARTICLE_VIEW_FULL ArticleView = 2 )
func (ArticleView) Descriptor ¶
func (ArticleView) Descriptor() protoreflect.EnumDescriptor
func (ArticleView) Enum ¶
func (x ArticleView) Enum() *ArticleView
func (ArticleView) EnumDescriptor
deprecated
func (ArticleView) EnumDescriptor() ([]byte, []int)
Deprecated: Use ArticleView.Descriptor instead.
func (ArticleView) Number ¶
func (x ArticleView) Number() protoreflect.EnumNumber
func (ArticleView) String ¶
func (x ArticleView) String() string
func (ArticleView) Type ¶
func (ArticleView) Type() protoreflect.EnumType
type ArticlesServiceClient ¶
type ArticlesServiceClient interface { // List articles // // An endpoint to list the user's articles. ListArticles(ctx context.Context, in *ListArticlesRequest, opts ...grpc.CallOption) (*ListArticlesResponse, error) // Update article // // An endpoint to update the article. UpdateArticle(ctx context.Context, in *UpdateArticleRequest, opts ...grpc.CallOption) (*Article, error) // Get article // // An endpoint to get an article by id. GetArticle(ctx context.Context, in *GetArticleRequest, opts ...grpc.CallOption) (*Article, error) // Delete article // // An endpoint to delete an article by id. DeleteArticle(ctx context.Context, in *DeleteArticleRequest, opts ...grpc.CallOption) (*empty.Empty, error) }
ArticlesServiceClient is the client API for ArticlesService 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 NewArticlesServiceClient ¶
func NewArticlesServiceClient(cc grpc.ClientConnInterface) ArticlesServiceClient
type ArticlesServiceServer ¶
type ArticlesServiceServer interface { // List articles // // An endpoint to list the user's articles. ListArticles(context.Context, *ListArticlesRequest) (*ListArticlesResponse, error) // Update article // // An endpoint to update the article. UpdateArticle(context.Context, *UpdateArticleRequest) (*Article, error) // Get article // // An endpoint to get an article by id. GetArticle(context.Context, *GetArticleRequest) (*Article, error) // Delete article // // An endpoint to delete an article by id. DeleteArticle(context.Context, *DeleteArticleRequest) (*empty.Empty, error) }
ArticlesServiceServer is the server API for ArticlesService service.
type DeleteArticleRequest ¶
type DeleteArticleRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*DeleteArticleRequest) Descriptor
deprecated
func (*DeleteArticleRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteArticleRequest.ProtoReflect.Descriptor instead.
func (*DeleteArticleRequest) GetId ¶
func (x *DeleteArticleRequest) GetId() string
func (*DeleteArticleRequest) ProtoMessage ¶
func (*DeleteArticleRequest) ProtoMessage()
func (*DeleteArticleRequest) ProtoReflect ¶
func (x *DeleteArticleRequest) ProtoReflect() protoreflect.Message
func (*DeleteArticleRequest) Reset ¶
func (x *DeleteArticleRequest) Reset()
func (*DeleteArticleRequest) String ¶
func (x *DeleteArticleRequest) String() string
type GetArticleRequest ¶
type GetArticleRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Specifies which parts of the article resource should be returned // in the response. View ArticleView `protobuf:"varint,2,opt,name=view,proto3,enum=miniboard.articles.v1.ArticleView" json:"view,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) GetView ¶
func (x *GetArticleRequest) GetView() ArticleView
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 maximum number of articles to return. PageSize int64 `protobuf:"varint,1,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,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // Filter by is_read field. IsReadEq *wrappers.BoolValue `protobuf:"bytes,3,opt,name=is_read_eq,json=isReadEq,proto3" json:"is_read_eq,omitempty"` // Filter by title field. TitleContains *wrappers.StringValue `protobuf:"bytes,4,opt,name=title_contains,json=titleContains,proto3" json:"title_contains,omitempty"` // Id of feed of the article. FeedIdEq *wrappers.StringValue `protobuf:"bytes,5,opt,name=feed_id_eq,json=feedIdEq,proto3" json:"feed_id_eq,omitempty"` // contains filtered or unexported fields }
func (*ListArticlesRequest) Descriptor
deprecated
func (*ListArticlesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListArticlesRequest.ProtoReflect.Descriptor instead.
func (*ListArticlesRequest) GetFeedIdEq ¶
func (x *ListArticlesRequest) GetFeedIdEq() *wrappers.StringValue
func (*ListArticlesRequest) GetIsReadEq ¶
func (x *ListArticlesRequest) GetIsReadEq() *wrappers.BoolValue
func (*ListArticlesRequest) GetPageSize ¶
func (x *ListArticlesRequest) GetPageSize() int64
func (*ListArticlesRequest) GetPageToken ¶
func (x *ListArticlesRequest) GetPageToken() string
func (*ListArticlesRequest) GetTitleContains ¶
func (x *ListArticlesRequest) GetTitleContains() *wrappers.StringValue
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 { // There will be a maximum number of articles returned based on the page_size field int the request. Articles []*Article `protobuf:"bytes,1,rep,name=articles,proto3" json:"articles,omitempty"` // Token to retrieve the next page of results, or empty if there are no more results in the list. 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 UnimplementedArticlesServiceServer ¶
type UnimplementedArticlesServiceServer struct { }
UnimplementedArticlesServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedArticlesServiceServer) DeleteArticle ¶
func (*UnimplementedArticlesServiceServer) DeleteArticle(context.Context, *DeleteArticleRequest) (*empty.Empty, error)
func (*UnimplementedArticlesServiceServer) GetArticle ¶
func (*UnimplementedArticlesServiceServer) GetArticle(context.Context, *GetArticleRequest) (*Article, error)
func (*UnimplementedArticlesServiceServer) ListArticles ¶
func (*UnimplementedArticlesServiceServer) ListArticles(context.Context, *ListArticlesRequest) (*ListArticlesResponse, error)
func (*UnimplementedArticlesServiceServer) UpdateArticle ¶
func (*UnimplementedArticlesServiceServer) UpdateArticle(context.Context, *UpdateArticleRequest) (*Article, error)
type UpdateArticleRequest ¶
type UpdateArticleRequest struct { // The article resource which replaces the resource on the server. Article *Article `protobuf:"bytes,1,opt,name=article,proto3" json:"article,omitempty"` // FieldMask of fields to update. // see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` // contains filtered or unexported fields }
func (*UpdateArticleRequest) Descriptor
deprecated
func (*UpdateArticleRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateArticleRequest.ProtoReflect.Descriptor instead.
func (*UpdateArticleRequest) GetArticle ¶
func (x *UpdateArticleRequest) GetArticle() *Article
func (*UpdateArticleRequest) GetUpdateMask ¶
func (x *UpdateArticleRequest) GetUpdateMask() *field_mask.FieldMask
func (*UpdateArticleRequest) ProtoMessage ¶
func (*UpdateArticleRequest) ProtoMessage()
func (*UpdateArticleRequest) ProtoReflect ¶
func (x *UpdateArticleRequest) ProtoReflect() protoreflect.Message
func (*UpdateArticleRequest) Reset ¶
func (x *UpdateArticleRequest) Reset()
func (*UpdateArticleRequest) String ¶
func (x *UpdateArticleRequest) String() string