Documentation
¶
Overview ¶
Package blogpb is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v7.1.0.
It is generated from these files:
blog/blogpb/blog.proto
Index ¶
- Constants
- Variables
- func RegisterBlogServiceServer(s *grpc.Server, srv BlogServiceServer)
- func WriteError(resp http.ResponseWriter, err error)
- type Blog
- func (*Blog) Descriptor() ([]byte, []int)deprecated
- func (x *Blog) GetAuthorID() string
- func (x *Blog) GetContent() string
- func (x *Blog) GetID() string
- func (x *Blog) GetTitle() string
- func (*Blog) ProtoMessage()
- func (x *Blog) ProtoReflect() protoreflect.Message
- func (x *Blog) Reset()
- func (x *Blog) String() string
- type BlogService
- type BlogServiceClient
- type BlogServiceServer
- type CreateBlogRequest
- type CreateBlogResponse
- type HTTPClient
- type ReadBlogRequest
- type ReadBlogResponse
- type TwirpServer
- type UnimplementedBlogServiceServer
Constants ¶
const BlogServicePathPrefix = "/twirp/blog.BlogService/"
BlogServicePathPrefix is a convenience constant that could used to identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, that add a "/twirp" prefix by default, and use CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html
Variables ¶
var File_blog_blogpb_blog_proto protoreflect.FileDescriptor
Functions ¶
func RegisterBlogServiceServer ¶
func RegisterBlogServiceServer(s *grpc.Server, srv BlogServiceServer)
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type Blog ¶
type Blog struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` AuthorID string `protobuf:"bytes,2,opt,name=AuthorID,proto3" json:"AuthorID,omitempty"` Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` Content string `protobuf:"bytes,4,opt,name=Content,proto3" json:"Content,omitempty"` // contains filtered or unexported fields }
func (*Blog) Descriptor
deprecated
func (*Blog) GetAuthorID ¶
func (*Blog) GetContent ¶
func (*Blog) ProtoMessage ¶
func (*Blog) ProtoMessage()
func (*Blog) ProtoReflect ¶
func (x *Blog) ProtoReflect() protoreflect.Message
type BlogService ¶
type BlogService interface { CreateBlog(context.Context, *CreateBlogRequest) (*CreateBlogResponse, error) ReadBlog(context.Context, *ReadBlogRequest) (*ReadBlogResponse, error) }
func NewBlogServiceJSONClient ¶
func NewBlogServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) BlogService
NewBlogServiceJSONClient creates a JSON client that implements the BlogService interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewBlogServiceProtobufClient ¶
func NewBlogServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) BlogService
NewBlogServiceProtobufClient creates a Protobuf client that implements the BlogService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type BlogServiceClient ¶
type BlogServiceClient interface { CreateBlog(ctx context.Context, in *CreateBlogRequest, opts ...grpc.CallOption) (*CreateBlogResponse, error) ReadBlog(ctx context.Context, in *ReadBlogRequest, opts ...grpc.CallOption) (*ReadBlogResponse, error) }
BlogServiceClient is the client API for BlogService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewBlogServiceClient ¶
func NewBlogServiceClient(cc grpc.ClientConnInterface) BlogServiceClient
type BlogServiceServer ¶
type BlogServiceServer interface { CreateBlog(context.Context, *CreateBlogRequest) (*CreateBlogResponse, error) ReadBlog(context.Context, *ReadBlogRequest) (*ReadBlogResponse, error) }
BlogServiceServer is the server API for BlogService service.
type CreateBlogRequest ¶
type CreateBlogRequest struct { Blog *Blog `protobuf:"bytes,1,opt,name=blog,proto3" json:"blog,omitempty"` // contains filtered or unexported fields }
func (*CreateBlogRequest) Descriptor
deprecated
func (*CreateBlogRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateBlogRequest.ProtoReflect.Descriptor instead.
func (*CreateBlogRequest) GetBlog ¶
func (x *CreateBlogRequest) GetBlog() *Blog
func (*CreateBlogRequest) ProtoMessage ¶
func (*CreateBlogRequest) ProtoMessage()
func (*CreateBlogRequest) ProtoReflect ¶
func (x *CreateBlogRequest) ProtoReflect() protoreflect.Message
func (*CreateBlogRequest) Reset ¶
func (x *CreateBlogRequest) Reset()
func (*CreateBlogRequest) String ¶
func (x *CreateBlogRequest) String() string
type CreateBlogResponse ¶
type CreateBlogResponse struct { Blog *Blog `protobuf:"bytes,1,opt,name=blog,proto3" json:"blog,omitempty"` // contains filtered or unexported fields }
func (*CreateBlogResponse) Descriptor
deprecated
func (*CreateBlogResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateBlogResponse.ProtoReflect.Descriptor instead.
func (*CreateBlogResponse) GetBlog ¶
func (x *CreateBlogResponse) GetBlog() *Blog
func (*CreateBlogResponse) ProtoMessage ¶
func (*CreateBlogResponse) ProtoMessage()
func (*CreateBlogResponse) ProtoReflect ¶
func (x *CreateBlogResponse) ProtoReflect() protoreflect.Message
func (*CreateBlogResponse) Reset ¶
func (x *CreateBlogResponse) Reset()
func (*CreateBlogResponse) String ¶
func (x *CreateBlogResponse) String() string
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type ReadBlogRequest ¶
type ReadBlogRequest struct { BlogID string `protobuf:"bytes,1,opt,name=blogID,proto3" json:"blogID,omitempty"` // contains filtered or unexported fields }
func (*ReadBlogRequest) Descriptor
deprecated
func (*ReadBlogRequest) Descriptor() ([]byte, []int)
Deprecated: Use ReadBlogRequest.ProtoReflect.Descriptor instead.
func (*ReadBlogRequest) GetBlogID ¶
func (x *ReadBlogRequest) GetBlogID() string
func (*ReadBlogRequest) ProtoMessage ¶
func (*ReadBlogRequest) ProtoMessage()
func (*ReadBlogRequest) ProtoReflect ¶
func (x *ReadBlogRequest) ProtoReflect() protoreflect.Message
func (*ReadBlogRequest) Reset ¶
func (x *ReadBlogRequest) Reset()
func (*ReadBlogRequest) String ¶
func (x *ReadBlogRequest) String() string
type ReadBlogResponse ¶
type ReadBlogResponse struct { Blog *Blog `protobuf:"bytes,1,opt,name=blog,proto3" json:"blog,omitempty"` // contains filtered or unexported fields }
func (*ReadBlogResponse) Descriptor
deprecated
func (*ReadBlogResponse) Descriptor() ([]byte, []int)
Deprecated: Use ReadBlogResponse.ProtoReflect.Descriptor instead.
func (*ReadBlogResponse) GetBlog ¶
func (x *ReadBlogResponse) GetBlog() *Blog
func (*ReadBlogResponse) ProtoMessage ¶
func (*ReadBlogResponse) ProtoMessage()
func (*ReadBlogResponse) ProtoReflect ¶
func (x *ReadBlogResponse) ProtoReflect() protoreflect.Message
func (*ReadBlogResponse) Reset ¶
func (x *ReadBlogResponse) Reset()
func (*ReadBlogResponse) String ¶
func (x *ReadBlogResponse) String() string
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string // PathPrefix returns the HTTP URL path prefix for all methods handled by this // service. This can be used with an HTTP mux to route Twirp requests. // The path prefix is in the form: "/<prefix>/<package>.<Service>/" // that is, everything in a Twirp route except for the <Method> at the end. PathPrefix() string }
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewBlogServiceServer ¶
func NewBlogServiceServer(svc BlogService, opts ...interface{}) TwirpServer
NewBlogServiceServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).
type UnimplementedBlogServiceServer ¶
type UnimplementedBlogServiceServer struct { }
UnimplementedBlogServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedBlogServiceServer) CreateBlog ¶
func (*UnimplementedBlogServiceServer) CreateBlog(context.Context, *CreateBlogRequest) (*CreateBlogResponse, error)
func (*UnimplementedBlogServiceServer) ReadBlog ¶
func (*UnimplementedBlogServiceServer) ReadBlog(context.Context, *ReadBlogRequest) (*ReadBlogResponse, error)