Documentation ¶
Overview ¶
Package publicservices is a generated protocol buffer package.
It is generated from these files:
rpc/publicservices/service.proto
It has these top-level messages:
User Search Giphy
Package publicservices is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.1.0.
It is generated from these files:
rpc/publicservices/service.proto
Index ¶
Constants ¶
const BlogPathPrefix = "/twirp/com.rynop.twirpl.publicservices.Blog/"
BlogPathPrefix is used for all URL paths on a twirp Blog server. Requests are always: POST BlogPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
const ImagePathPrefix = "/twirp/com.rynop.twirpl.publicservices.Image/"
ImagePathPrefix is used for all URL paths on a twirp Image server. Requests are always: POST ImagePathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type Blog ¶
type Blog interface { // Subscribe creates a blog subscription for user Subscribe(context.Context, *User) (*User, error) }
Blog service to manage subscribers of my blog
func NewBlogJSONClient ¶
func NewBlogJSONClient(addr string, client HTTPClient) Blog
NewBlogJSONClient creates a JSON client that implements the Blog interface. It communicates using JSON requests and responses instead of protobuf messages.
func NewBlogProtobufClient ¶
func NewBlogProtobufClient(addr string, client HTTPClient) Blog
NewBlogProtobufClient creates a Protobuf client that implements the Blog interface. It communicates using protobuf messages and can be configured with a custom http.Client.
type Giphy ¶
type Giphy struct {
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
}
Giphy that was found for search
func (*Giphy) Descriptor ¶
func (*Giphy) ProtoMessage ¶
func (*Giphy) ProtoMessage()
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 Image ¶
type Image interface { // CreateGiphy produces a Giphy from a search term CreateGiphy(context.Context, *Search) (*Giphy, error) }
Service to get Images
func NewImageJSONClient ¶
func NewImageJSONClient(addr string, client HTTPClient) Image
NewImageJSONClient creates a JSON client that implements the Image interface. It communicates using JSON requests and responses instead of protobuf messages.
func NewImageProtobufClient ¶
func NewImageProtobufClient(addr string, client HTTPClient) Image
NewImageProtobufClient creates a Protobuf client that implements the Image interface. It communicates using protobuf messages and can be configured with a custom http.Client.
type Search ¶
type Search struct {
Term string `protobuf:"bytes,1,opt,name=term" json:"term,omitempty"`
}
Ways to search for a Giphy
func (*Search) Descriptor ¶
func (*Search) ProtoMessage ¶
func (*Search) ProtoMessage()
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 }
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 NewBlogServer ¶
func NewBlogServer(svc Blog, hooks *twirp.ServerHooks) TwirpServer
func NewImageServer ¶
func NewImageServer(svc Image, hooks *twirp.ServerHooks) TwirpServer
type User ¶
type User struct { Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` Email string `protobuf:"bytes,2,opt,name=email" json:"email,omitempty"` Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` }
User subscribing to my blog
func (*User) Descriptor ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()