postspb

package
v0.0.0-...-9fe20ad Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package postspb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_post_api_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use EmptyData.ProtoReflect.Descriptor instead.

func (*EmptyData) ProtoMessage

func (*EmptyData) ProtoMessage()

func (*EmptyData) ProtoReflect

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

func (*EmptyData) Reset

func (x *EmptyData) Reset()

func (*EmptyData) String

func (x *EmptyData) String() string

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

Deprecated: Use Post.ProtoReflect.Descriptor instead.

func (*Post) GetAuthor

func (x *Post) GetAuthor() *User

func (*Post) GetChildren

func (x *Post) GetChildren() []*Post

func (*Post) GetCreated

func (x *Post) GetCreated() int64

func (*Post) GetId

func (x *Post) GetId() int64

func (*Post) GetLiked

func (x *Post) GetLiked() bool

func (*Post) GetLikes

func (x *Post) GetLikes() int64

func (*Post) GetMedia

func (x *Post) GetMedia() string

func (*Post) GetParentid

func (x *Post) GetParentid() int64

func (*Post) GetRezweet

func (x *Post) GetRezweet() *Post

func (*Post) GetText

func (x *Post) GetText() string

func (*Post) ProtoMessage

func (*Post) ProtoMessage()

func (*Post) ProtoReflect

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

func (*Post) Reset

func (x *Post) Reset()

func (*Post) String

func (x *Post) String() string

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.

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

func (UnimplementedPostsServiceServer) GetPostChilds

func (UnimplementedPostsServiceServer) GetPosts

func (UnimplementedPostsServiceServer) LikePost

func (UnimplementedPostsServiceServer) Rezweet

func (UnimplementedPostsServiceServer) SayHello

func (UnimplementedPostsServiceServer) UserFeed

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetId

func (x *User) GetId() int64

func (*User) GetUsername

func (x *User) GetUsername() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

Jump to

Keyboard shortcuts

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