Documentation
¶
Overview ¶
Package postspb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterPostsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterPostsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PostsServiceClient) error
- func RegisterPostsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterPostsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PostsServiceServer) error
- func RegisterPostsServiceServer(s grpc.ServiceRegistrar, srv PostsServiceServer)
- type CreatePostRequest
- func (*CreatePostRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreatePostRequest) GetMedia() string
- func (x *CreatePostRequest) GetParentid() int64
- func (x *CreatePostRequest) GetText() string
- func (*CreatePostRequest) ProtoMessage()
- func (x *CreatePostRequest) ProtoReflect() protoreflect.Message
- func (x *CreatePostRequest) Reset()
- func (x *CreatePostRequest) String() string
- type CreatePostResponse
- type EmptyData
- type GetPostRequest
- type GetPostResponse
- type GetPostsRequest
- type GetPostsResponse
- type LikeRequest
- type PingMessage
- type Post
- func (*Post) Descriptor() ([]byte, []int)deprecated
- func (x *Post) GetAuthor() *User
- func (x *Post) GetChildren() []*Post
- func (x *Post) GetCreated() int64
- func (x *Post) GetId() int64
- func (x *Post) GetLiked() bool
- func (x *Post) GetLikes() int64
- func (x *Post) GetMedia() string
- func (x *Post) GetParentid() int64
- func (x *Post) GetRezweet() *Post
- func (x *Post) GetText() string
- func (*Post) ProtoMessage()
- func (x *Post) ProtoReflect() protoreflect.Message
- func (x *Post) Reset()
- func (x *Post) String() string
- type PostsServiceClient
- type PostsServiceServer
- type RezweetRequest
- func (*RezweetRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RezweetRequest) GetRezweetId() int64
- func (x *RezweetRequest) GetText() string
- func (*RezweetRequest) ProtoMessage()
- func (x *RezweetRequest) ProtoReflect() protoreflect.Message
- func (x *RezweetRequest) Reset()
- func (x *RezweetRequest) String() string
- type UnimplementedPostsServiceServer
- func (UnimplementedPostsServiceServer) CreatePost(context.Context, *CreatePostRequest) (*CreatePostResponse, error)
- func (UnimplementedPostsServiceServer) GetPost(context.Context, *GetPostRequest) (*GetPostResponse, error)
- func (UnimplementedPostsServiceServer) GetPostChilds(context.Context, *GetPostRequest) (*GetPostsResponse, error)
- func (UnimplementedPostsServiceServer) GetPosts(context.Context, *GetPostsRequest) (*GetPostsResponse, error)
- func (UnimplementedPostsServiceServer) LikePost(context.Context, *LikeRequest) (*EmptyData, error)
- func (UnimplementedPostsServiceServer) Rezweet(context.Context, *RezweetRequest) (*CreatePostResponse, error)
- func (UnimplementedPostsServiceServer) SayHello(context.Context, *PingMessage) (*PingMessage, error)
- func (UnimplementedPostsServiceServer) UserFeed(context.Context, *EmptyData) (*GetPostsResponse, error)
- type UnsafePostsServiceServer
- type User
Constants ¶
This section is empty.
Variables ¶
var File_post_api_proto protoreflect.FileDescriptor
var PostsService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "postspb.PostsService", HandlerType: (*PostsServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SayHello", Handler: _PostsService_SayHello_Handler, }, { MethodName: "CreatePost", Handler: _PostsService_CreatePost_Handler, }, { MethodName: "GetPosts", Handler: _PostsService_GetPosts_Handler, }, { MethodName: "UserFeed", Handler: _PostsService_UserFeed_Handler, }, { MethodName: "GetPost", Handler: _PostsService_GetPost_Handler, }, { MethodName: "GetPostChilds", Handler: _PostsService_GetPostChilds_Handler, }, { MethodName: "LikePost", Handler: _PostsService_LikePost_Handler, }, { MethodName: "Rezweet", Handler: _PostsService_Rezweet_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "post_api.proto", }
PostsService_ServiceDesc is the grpc.ServiceDesc for PostsService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterPostsServiceHandler ¶
func RegisterPostsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterPostsServiceHandler registers the http handlers for service PostsService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterPostsServiceHandlerClient ¶
func RegisterPostsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PostsServiceClient) error
RegisterPostsServiceHandlerClient registers the http handlers for service PostsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PostsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PostsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PostsServiceClient" to call the correct interceptors.
func RegisterPostsServiceHandlerFromEndpoint ¶
func RegisterPostsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterPostsServiceHandlerFromEndpoint is same as RegisterPostsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterPostsServiceHandlerServer ¶
func RegisterPostsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PostsServiceServer) error
RegisterPostsServiceHandlerServer registers the http handlers for service PostsService to "mux". UnaryRPC :call PostsServiceServer 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 RegisterPostsServiceHandlerFromEndpoint instead.
func RegisterPostsServiceServer ¶
func RegisterPostsServiceServer(s grpc.ServiceRegistrar, srv PostsServiceServer)
Types ¶
type CreatePostRequest ¶
type CreatePostRequest struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` Parentid int64 `protobuf:"varint,2,opt,name=parentid,proto3" json:"parentid,omitempty"` Media string `protobuf:"bytes,3,opt,name=media,proto3" json:"media,omitempty"` // contains filtered or unexported fields }
func (*CreatePostRequest) Descriptor
deprecated
func (*CreatePostRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreatePostRequest.ProtoReflect.Descriptor instead.
func (*CreatePostRequest) GetMedia ¶
func (x *CreatePostRequest) GetMedia() string
func (*CreatePostRequest) GetParentid ¶
func (x *CreatePostRequest) GetParentid() int64
func (*CreatePostRequest) GetText ¶
func (x *CreatePostRequest) GetText() string
func (*CreatePostRequest) ProtoMessage ¶
func (*CreatePostRequest) ProtoMessage()
func (*CreatePostRequest) ProtoReflect ¶
func (x *CreatePostRequest) ProtoReflect() protoreflect.Message
func (*CreatePostRequest) Reset ¶
func (x *CreatePostRequest) Reset()
func (*CreatePostRequest) String ¶
func (x *CreatePostRequest) String() string
type CreatePostResponse ¶
type CreatePostResponse struct { Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"` // contains filtered or unexported fields }
func (*CreatePostResponse) Descriptor
deprecated
func (*CreatePostResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreatePostResponse.ProtoReflect.Descriptor instead.
func (*CreatePostResponse) GetPost ¶
func (x *CreatePostResponse) GetPost() *Post
func (*CreatePostResponse) ProtoMessage ¶
func (*CreatePostResponse) ProtoMessage()
func (*CreatePostResponse) ProtoReflect ¶
func (x *CreatePostResponse) ProtoReflect() protoreflect.Message
func (*CreatePostResponse) Reset ¶
func (x *CreatePostResponse) Reset()
func (*CreatePostResponse) String ¶
func (x *CreatePostResponse) String() string
type EmptyData ¶
type EmptyData struct {
// contains filtered or unexported fields
}
func (*EmptyData) Descriptor
deprecated
func (*EmptyData) ProtoMessage ¶
func (*EmptyData) ProtoMessage()
func (*EmptyData) ProtoReflect ¶
func (x *EmptyData) ProtoReflect() protoreflect.Message
type GetPostRequest ¶
type GetPostRequest struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*GetPostRequest) Descriptor
deprecated
func (*GetPostRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetPostRequest.ProtoReflect.Descriptor instead.
func (*GetPostRequest) GetId ¶
func (x *GetPostRequest) GetId() int64
func (*GetPostRequest) ProtoMessage ¶
func (*GetPostRequest) ProtoMessage()
func (*GetPostRequest) ProtoReflect ¶
func (x *GetPostRequest) ProtoReflect() protoreflect.Message
func (*GetPostRequest) Reset ¶
func (x *GetPostRequest) Reset()
func (*GetPostRequest) String ¶
func (x *GetPostRequest) String() string
type GetPostResponse ¶
type GetPostResponse struct { Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"` // contains filtered or unexported fields }
func (*GetPostResponse) Descriptor
deprecated
func (*GetPostResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetPostResponse.ProtoReflect.Descriptor instead.
func (*GetPostResponse) GetPost ¶
func (x *GetPostResponse) GetPost() *Post
func (*GetPostResponse) ProtoMessage ¶
func (*GetPostResponse) ProtoMessage()
func (*GetPostResponse) ProtoReflect ¶
func (x *GetPostResponse) ProtoReflect() protoreflect.Message
func (*GetPostResponse) Reset ¶
func (x *GetPostResponse) Reset()
func (*GetPostResponse) String ¶
func (x *GetPostResponse) String() string
type GetPostsRequest ¶
type GetPostsRequest struct { Author int64 `protobuf:"varint,1,opt,name=author,proto3" json:"author,omitempty"` // contains filtered or unexported fields }
func (*GetPostsRequest) Descriptor
deprecated
func (*GetPostsRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetPostsRequest.ProtoReflect.Descriptor instead.
func (*GetPostsRequest) GetAuthor ¶
func (x *GetPostsRequest) GetAuthor() int64
func (*GetPostsRequest) ProtoMessage ¶
func (*GetPostsRequest) ProtoMessage()
func (*GetPostsRequest) ProtoReflect ¶
func (x *GetPostsRequest) ProtoReflect() protoreflect.Message
func (*GetPostsRequest) Reset ¶
func (x *GetPostsRequest) Reset()
func (*GetPostsRequest) String ¶
func (x *GetPostsRequest) String() string
type GetPostsResponse ¶
type GetPostsResponse struct { Posts []*Post `protobuf:"bytes,1,rep,name=posts,proto3" json:"posts,omitempty"` // contains filtered or unexported fields }
func (*GetPostsResponse) Descriptor
deprecated
func (*GetPostsResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetPostsResponse.ProtoReflect.Descriptor instead.
func (*GetPostsResponse) GetPosts ¶
func (x *GetPostsResponse) GetPosts() []*Post
func (*GetPostsResponse) ProtoMessage ¶
func (*GetPostsResponse) ProtoMessage()
func (*GetPostsResponse) ProtoReflect ¶
func (x *GetPostsResponse) ProtoReflect() protoreflect.Message
func (*GetPostsResponse) Reset ¶
func (x *GetPostsResponse) Reset()
func (*GetPostsResponse) String ¶
func (x *GetPostsResponse) String() string
type LikeRequest ¶
type LikeRequest struct { Post int64 `protobuf:"varint,1,opt,name=post,proto3" json:"post,omitempty"` // contains filtered or unexported fields }
func (*LikeRequest) Descriptor
deprecated
func (*LikeRequest) Descriptor() ([]byte, []int)
Deprecated: Use LikeRequest.ProtoReflect.Descriptor instead.
func (*LikeRequest) GetPost ¶
func (x *LikeRequest) GetPost() int64
func (*LikeRequest) ProtoMessage ¶
func (*LikeRequest) ProtoMessage()
func (*LikeRequest) ProtoReflect ¶
func (x *LikeRequest) ProtoReflect() protoreflect.Message
func (*LikeRequest) Reset ¶
func (x *LikeRequest) Reset()
func (*LikeRequest) String ¶
func (x *LikeRequest) String() string
type PingMessage ¶
type PingMessage struct { Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"` // contains filtered or unexported fields }
func (*PingMessage) Descriptor
deprecated
func (*PingMessage) Descriptor() ([]byte, []int)
Deprecated: Use PingMessage.ProtoReflect.Descriptor instead.
func (*PingMessage) GetGreeting ¶
func (x *PingMessage) GetGreeting() string
func (*PingMessage) ProtoMessage ¶
func (*PingMessage) ProtoMessage()
func (*PingMessage) ProtoReflect ¶
func (x *PingMessage) ProtoReflect() protoreflect.Message
func (*PingMessage) Reset ¶
func (x *PingMessage) Reset()
func (*PingMessage) String ¶
func (x *PingMessage) String() string
type Post ¶
type Post struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` Created int64 `protobuf:"varint,3,opt,name=created,proto3" json:"created,omitempty"` Author *User `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"` Parentid int64 `protobuf:"varint,5,opt,name=parentid,proto3" json:"parentid,omitempty"` Children []*Post `protobuf:"bytes,6,rep,name=children,proto3" json:"children,omitempty"` Likes int64 `protobuf:"varint,7,opt,name=likes,proto3" json:"likes,omitempty"` Liked bool `protobuf:"varint,8,opt,name=liked,proto3" json:"liked,omitempty"` Media string `protobuf:"bytes,9,opt,name=media,proto3" json:"media,omitempty"` Rezweet *Post `protobuf:"bytes,10,opt,name=rezweet,proto3" json:"rezweet,omitempty"` // contains filtered or unexported fields }
func (*Post) Descriptor
deprecated
func (*Post) GetChildren ¶
func (*Post) GetCreated ¶
func (*Post) GetParentid ¶
func (*Post) GetRezweet ¶
func (*Post) ProtoMessage ¶
func (*Post) ProtoMessage()
func (*Post) ProtoReflect ¶
func (x *Post) ProtoReflect() protoreflect.Message
type PostsServiceClient ¶
type PostsServiceClient interface { SayHello(ctx context.Context, in *PingMessage, opts ...grpc.CallOption) (*PingMessage, error) CreatePost(ctx context.Context, in *CreatePostRequest, opts ...grpc.CallOption) (*CreatePostResponse, error) GetPosts(ctx context.Context, in *GetPostsRequest, opts ...grpc.CallOption) (*GetPostsResponse, error) UserFeed(ctx context.Context, in *EmptyData, opts ...grpc.CallOption) (*GetPostsResponse, error) GetPost(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*GetPostResponse, error) GetPostChilds(ctx context.Context, in *GetPostRequest, opts ...grpc.CallOption) (*GetPostsResponse, error) LikePost(ctx context.Context, in *LikeRequest, opts ...grpc.CallOption) (*EmptyData, error) Rezweet(ctx context.Context, in *RezweetRequest, opts ...grpc.CallOption) (*CreatePostResponse, error) }
PostsServiceClient is the client API for PostsService 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 NewPostsServiceClient ¶
func NewPostsServiceClient(cc grpc.ClientConnInterface) PostsServiceClient
type PostsServiceServer ¶
type PostsServiceServer interface { SayHello(context.Context, *PingMessage) (*PingMessage, error) CreatePost(context.Context, *CreatePostRequest) (*CreatePostResponse, error) GetPosts(context.Context, *GetPostsRequest) (*GetPostsResponse, error) UserFeed(context.Context, *EmptyData) (*GetPostsResponse, error) GetPost(context.Context, *GetPostRequest) (*GetPostResponse, error) GetPostChilds(context.Context, *GetPostRequest) (*GetPostsResponse, error) LikePost(context.Context, *LikeRequest) (*EmptyData, error) Rezweet(context.Context, *RezweetRequest) (*CreatePostResponse, error) // contains filtered or unexported methods }
PostsServiceServer is the server API for PostsService service. All implementations must embed UnimplementedPostsServiceServer for forward compatibility
type RezweetRequest ¶
type RezweetRequest struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` RezweetId int64 `protobuf:"varint,4,opt,name=rezweetId,proto3" json:"rezweetId,omitempty"` // contains filtered or unexported fields }
func (*RezweetRequest) Descriptor
deprecated
func (*RezweetRequest) Descriptor() ([]byte, []int)
Deprecated: Use RezweetRequest.ProtoReflect.Descriptor instead.
func (*RezweetRequest) GetRezweetId ¶
func (x *RezweetRequest) GetRezweetId() int64
func (*RezweetRequest) GetText ¶
func (x *RezweetRequest) GetText() string
func (*RezweetRequest) ProtoMessage ¶
func (*RezweetRequest) ProtoMessage()
func (*RezweetRequest) ProtoReflect ¶
func (x *RezweetRequest) ProtoReflect() protoreflect.Message
func (*RezweetRequest) Reset ¶
func (x *RezweetRequest) Reset()
func (*RezweetRequest) String ¶
func (x *RezweetRequest) String() string
type UnimplementedPostsServiceServer ¶
type UnimplementedPostsServiceServer struct { }
UnimplementedPostsServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedPostsServiceServer) CreatePost ¶
func (UnimplementedPostsServiceServer) CreatePost(context.Context, *CreatePostRequest) (*CreatePostResponse, error)
func (UnimplementedPostsServiceServer) GetPost ¶
func (UnimplementedPostsServiceServer) GetPost(context.Context, *GetPostRequest) (*GetPostResponse, error)
func (UnimplementedPostsServiceServer) GetPostChilds ¶
func (UnimplementedPostsServiceServer) GetPostChilds(context.Context, *GetPostRequest) (*GetPostsResponse, error)
func (UnimplementedPostsServiceServer) GetPosts ¶
func (UnimplementedPostsServiceServer) GetPosts(context.Context, *GetPostsRequest) (*GetPostsResponse, error)
func (UnimplementedPostsServiceServer) LikePost ¶
func (UnimplementedPostsServiceServer) LikePost(context.Context, *LikeRequest) (*EmptyData, error)
func (UnimplementedPostsServiceServer) Rezweet ¶
func (UnimplementedPostsServiceServer) Rezweet(context.Context, *RezweetRequest) (*CreatePostResponse, error)
func (UnimplementedPostsServiceServer) SayHello ¶
func (UnimplementedPostsServiceServer) SayHello(context.Context, *PingMessage) (*PingMessage, error)
func (UnimplementedPostsServiceServer) UserFeed ¶
func (UnimplementedPostsServiceServer) UserFeed(context.Context, *EmptyData) (*GetPostsResponse, error)
type UnsafePostsServiceServer ¶
type UnsafePostsServiceServer interface {
// contains filtered or unexported methods
}
UnsafePostsServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PostsServiceServer will result in compilation errors.
type User ¶
type User struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"` // contains filtered or unexported fields }
func (*User) Descriptor
deprecated
func (*User) GetUsername ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message