Documentation ¶
Overview ¶
Package e2e is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.10.1.
It is generated from these files:
service.proto
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type BreadReq
- type BreadResp
- func (*BreadResp) Descriptor() ([]byte, []int)deprecated
- func (m *BreadResp) GetAnswer() isBreadResp_Answer
- func (x *BreadResp) GetName() string
- func (x *BreadResp) GetToasted() bool
- func (*BreadResp) ProtoMessage()
- func (x *BreadResp) ProtoReflect() protoreflect.Message
- func (x *BreadResp) Reset()
- func (x *BreadResp) String() string
- type BreadResp_Name
- type BreadResp_Toasted
- type ChangeMeReq
- func (*ChangeMeReq) Descriptor() ([]byte, []int)deprecated
- func (x *ChangeMeReq) GetName() string
- func (x *ChangeMeReq) GetPrevious() map[string]*ChangeMeResp
- func (*ChangeMeReq) ProtoMessage()
- func (x *ChangeMeReq) ProtoReflect() protoreflect.Message
- func (x *ChangeMeReq) Reset()
- func (x *ChangeMeReq) String() string
- type ChangeMeResp
- func (*ChangeMeResp) Descriptor() ([]byte, []int)deprecated
- func (m *ChangeMeResp) GetAnswer() isChangeMeResp_Answer
- func (x *ChangeMeResp) GetChanged() bool
- func (x *ChangeMeResp) GetName() string
- func (x *ChangeMeResp) GetNewName() string
- func (x *ChangeMeResp) GetPrevious() map[string]*ChangeMeResp
- func (*ChangeMeResp) ProtoMessage()
- func (x *ChangeMeResp) ProtoReflect() protoreflect.Message
- func (x *ChangeMeResp) Reset()
- func (x *ChangeMeResp) String() string
- type ChangeMeResp_Changed
- type ChangeMeResp_NewName
- type HTTPClient
- type HelloReq
- type HelloResp
- type PaintersReq
- type PaintersResp
- func (*PaintersResp) Descriptor() ([]byte, []int)deprecated
- func (x *PaintersResp) GetAllPainters() []string
- func (x *PaintersResp) GetBestPainter() *painters.Painter
- func (*PaintersResp) ProtoMessage()
- func (x *PaintersResp) ProtoReflect() protoreflect.Message
- func (x *PaintersResp) Reset()
- func (x *PaintersResp) String() string
- type Service
- type TrafficJamReq
- func (*TrafficJamReq) Descriptor() ([]byte, []int)deprecated
- func (x *TrafficJamReq) GetColor() TrafficLight
- func (x *TrafficJamReq) GetTrafficLights() []TrafficLight
- func (*TrafficJamReq) ProtoMessage()
- func (x *TrafficJamReq) ProtoReflect() protoreflect.Message
- func (x *TrafficJamReq) Reset()
- func (x *TrafficJamReq) String() string
- type TrafficJamResp
- type TrafficLight
- func (TrafficLight) Descriptor() protoreflect.EnumDescriptor
- func (x TrafficLight) Enum() *TrafficLight
- func (TrafficLight) EnumDescriptor() ([]byte, []int)deprecated
- func (x TrafficLight) Number() protoreflect.EnumNumber
- func (x TrafficLight) String() string
- func (TrafficLight) Type() protoreflect.EnumType
- type TranslateReq
- type TranslateResp
- type TwirpServer
- type Word
Constants ¶
const ServicePathPrefix = "/twirp/e2e.Service/"
ServicePathPrefix is used for all URL paths on a twirp Service server. Requests are always: POST ServicePathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
var ( TrafficLight_name = map[int32]string{ 0: "RED", 1: "YELLOW", 2: "GREEN", } TrafficLight_value = map[string]int32{ "RED": 0, "YELLOW": 1, "GREEN": 2, } )
Enum value maps for TrafficLight.
var File_service_proto protoreflect.FileDescriptor
Functions ¶
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 BreadReq ¶
type BreadReq struct { Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` // contains filtered or unexported fields }
func (*BreadReq) Descriptor
deprecated
func (*BreadReq) ProtoMessage ¶
func (*BreadReq) ProtoMessage()
func (*BreadReq) ProtoReflect ¶
func (x *BreadReq) ProtoReflect() protoreflect.Message
type BreadResp ¶
type BreadResp struct { // Types that are assignable to Answer: // *BreadResp_Name // *BreadResp_Toasted Answer isBreadResp_Answer `protobuf_oneof:"answer"` // contains filtered or unexported fields }
func (*BreadResp) Descriptor
deprecated
func (*BreadResp) GetToasted ¶
func (*BreadResp) ProtoMessage ¶
func (*BreadResp) ProtoMessage()
func (*BreadResp) ProtoReflect ¶
func (x *BreadResp) ProtoReflect() protoreflect.Message
type BreadResp_Name ¶
type BreadResp_Name struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3,oneof"`
}
type BreadResp_Toasted ¶
type BreadResp_Toasted struct {
Toasted bool `protobuf:"varint,2,opt,name=toasted,proto3,oneof"`
}
type ChangeMeReq ¶
type ChangeMeReq struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Previous map[string]*ChangeMeResp `` /* 157-byte string literal not displayed */ // contains filtered or unexported fields }
func (*ChangeMeReq) Descriptor
deprecated
func (*ChangeMeReq) Descriptor() ([]byte, []int)
Deprecated: Use ChangeMeReq.ProtoReflect.Descriptor instead.
func (*ChangeMeReq) GetName ¶
func (x *ChangeMeReq) GetName() string
func (*ChangeMeReq) GetPrevious ¶
func (x *ChangeMeReq) GetPrevious() map[string]*ChangeMeResp
func (*ChangeMeReq) ProtoMessage ¶
func (*ChangeMeReq) ProtoMessage()
func (*ChangeMeReq) ProtoReflect ¶
func (x *ChangeMeReq) ProtoReflect() protoreflect.Message
func (*ChangeMeReq) Reset ¶
func (x *ChangeMeReq) Reset()
func (*ChangeMeReq) String ¶
func (x *ChangeMeReq) String() string
type ChangeMeResp ¶
type ChangeMeResp struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to Answer: // *ChangeMeResp_NewName // *ChangeMeResp_Changed Answer isChangeMeResp_Answer `protobuf_oneof:"answer"` Previous map[string]*ChangeMeResp `` /* 157-byte string literal not displayed */ // contains filtered or unexported fields }
func (*ChangeMeResp) Descriptor
deprecated
func (*ChangeMeResp) Descriptor() ([]byte, []int)
Deprecated: Use ChangeMeResp.ProtoReflect.Descriptor instead.
func (*ChangeMeResp) GetAnswer ¶
func (m *ChangeMeResp) GetAnswer() isChangeMeResp_Answer
func (*ChangeMeResp) GetChanged ¶
func (x *ChangeMeResp) GetChanged() bool
func (*ChangeMeResp) GetName ¶
func (x *ChangeMeResp) GetName() string
func (*ChangeMeResp) GetNewName ¶
func (x *ChangeMeResp) GetNewName() string
func (*ChangeMeResp) GetPrevious ¶
func (x *ChangeMeResp) GetPrevious() map[string]*ChangeMeResp
func (*ChangeMeResp) ProtoMessage ¶
func (*ChangeMeResp) ProtoMessage()
func (*ChangeMeResp) ProtoReflect ¶
func (x *ChangeMeResp) ProtoReflect() protoreflect.Message
func (*ChangeMeResp) Reset ¶
func (x *ChangeMeResp) Reset()
func (*ChangeMeResp) String ¶
func (x *ChangeMeResp) String() string
type ChangeMeResp_Changed ¶
type ChangeMeResp_Changed struct {
Changed bool `protobuf:"varint,3,opt,name=changed,proto3,oneof"`
}
type ChangeMeResp_NewName ¶
type ChangeMeResp_NewName struct {
NewName string `protobuf:"bytes,2,opt,name=newName,proto3,oneof"`
}
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 HelloReq ¶
type HelloReq struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*HelloReq) Descriptor
deprecated
func (*HelloReq) ProtoMessage ¶
func (*HelloReq) ProtoMessage()
func (*HelloReq) ProtoReflect ¶
func (x *HelloReq) ProtoReflect() protoreflect.Message
type HelloResp ¶
type HelloResp struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` // contains filtered or unexported fields }
func (*HelloResp) Descriptor
deprecated
func (*HelloResp) ProtoMessage ¶
func (*HelloResp) ProtoMessage()
func (*HelloResp) ProtoReflect ¶
func (x *HelloResp) ProtoReflect() protoreflect.Message
type PaintersReq ¶
type PaintersReq struct {
// contains filtered or unexported fields
}
func (*PaintersReq) Descriptor
deprecated
func (*PaintersReq) Descriptor() ([]byte, []int)
Deprecated: Use PaintersReq.ProtoReflect.Descriptor instead.
func (*PaintersReq) ProtoMessage ¶
func (*PaintersReq) ProtoMessage()
func (*PaintersReq) ProtoReflect ¶
func (x *PaintersReq) ProtoReflect() protoreflect.Message
func (*PaintersReq) Reset ¶
func (x *PaintersReq) Reset()
func (*PaintersReq) String ¶
func (x *PaintersReq) String() string
type PaintersResp ¶
type PaintersResp struct { BestPainter *painters.Painter `protobuf:"bytes,1,opt,name=bestPainter,proto3" json:"bestPainter,omitempty"` AllPainters []string `protobuf:"bytes,2,rep,name=allPainters,proto3" json:"allPainters,omitempty"` // contains filtered or unexported fields }
func (*PaintersResp) Descriptor
deprecated
func (*PaintersResp) Descriptor() ([]byte, []int)
Deprecated: Use PaintersResp.ProtoReflect.Descriptor instead.
func (*PaintersResp) GetAllPainters ¶
func (x *PaintersResp) GetAllPainters() []string
func (*PaintersResp) GetBestPainter ¶
func (x *PaintersResp) GetBestPainter() *painters.Painter
func (*PaintersResp) ProtoMessage ¶
func (*PaintersResp) ProtoMessage()
func (*PaintersResp) ProtoReflect ¶
func (x *PaintersResp) ProtoReflect() protoreflect.Message
func (*PaintersResp) Reset ¶
func (x *PaintersResp) Reset()
func (*PaintersResp) String ¶
func (x *PaintersResp) String() string
type Service ¶
type Service interface { Hello(context.Context, *HelloReq) (*HelloResp, error) TrafficJam(context.Context, *TrafficJamReq) (*TrafficJamResp, error) GetPainters(context.Context, *PaintersReq) (*PaintersResp, error) Translate(context.Context, *TranslateReq) (*TranslateResp, error) Bread(context.Context, *BreadReq) (*BreadResp, error) ChangeMe(context.Context, *ChangeMeReq) (*ChangeMeResp, error) }
func NewServiceJSONClient ¶
func NewServiceJSONClient(addr string, client HTTPClient, opts ...twirp.ClientOption) Service
NewServiceJSONClient creates a JSON client that implements the Service interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewServiceProtobufClient ¶
func NewServiceProtobufClient(addr string, client HTTPClient, opts ...twirp.ClientOption) Service
NewServiceProtobufClient creates a Protobuf client that implements the Service interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type TrafficJamReq ¶
type TrafficJamReq struct { Color TrafficLight `protobuf:"varint,1,opt,name=color,proto3,enum=e2e.TrafficLight" json:"color,omitempty"` TrafficLights []TrafficLight `protobuf:"varint,2,rep,packed,name=trafficLights,proto3,enum=e2e.TrafficLight" json:"trafficLights,omitempty"` // contains filtered or unexported fields }
func (*TrafficJamReq) Descriptor
deprecated
func (*TrafficJamReq) Descriptor() ([]byte, []int)
Deprecated: Use TrafficJamReq.ProtoReflect.Descriptor instead.
func (*TrafficJamReq) GetColor ¶
func (x *TrafficJamReq) GetColor() TrafficLight
func (*TrafficJamReq) GetTrafficLights ¶
func (x *TrafficJamReq) GetTrafficLights() []TrafficLight
func (*TrafficJamReq) ProtoMessage ¶
func (*TrafficJamReq) ProtoMessage()
func (*TrafficJamReq) ProtoReflect ¶
func (x *TrafficJamReq) ProtoReflect() protoreflect.Message
func (*TrafficJamReq) Reset ¶
func (x *TrafficJamReq) Reset()
func (*TrafficJamReq) String ¶
func (x *TrafficJamReq) String() string
type TrafficJamResp ¶
type TrafficJamResp struct { Next TrafficLight `protobuf:"varint,1,opt,name=next,proto3,enum=e2e.TrafficLight" json:"next,omitempty"` // contains filtered or unexported fields }
func (*TrafficJamResp) Descriptor
deprecated
func (*TrafficJamResp) Descriptor() ([]byte, []int)
Deprecated: Use TrafficJamResp.ProtoReflect.Descriptor instead.
func (*TrafficJamResp) GetNext ¶
func (x *TrafficJamResp) GetNext() TrafficLight
func (*TrafficJamResp) ProtoMessage ¶
func (*TrafficJamResp) ProtoMessage()
func (*TrafficJamResp) ProtoReflect ¶
func (x *TrafficJamResp) ProtoReflect() protoreflect.Message
func (*TrafficJamResp) Reset ¶
func (x *TrafficJamResp) Reset()
func (*TrafficJamResp) String ¶
func (x *TrafficJamResp) String() string
type TrafficLight ¶
type TrafficLight int32
const ( TrafficLight_RED TrafficLight = 0 TrafficLight_YELLOW TrafficLight = 1 TrafficLight_GREEN TrafficLight = 2 )
func (TrafficLight) Descriptor ¶
func (TrafficLight) Descriptor() protoreflect.EnumDescriptor
func (TrafficLight) Enum ¶
func (x TrafficLight) Enum() *TrafficLight
func (TrafficLight) EnumDescriptor
deprecated
func (TrafficLight) EnumDescriptor() ([]byte, []int)
Deprecated: Use TrafficLight.Descriptor instead.
func (TrafficLight) Number ¶
func (x TrafficLight) Number() protoreflect.EnumNumber
func (TrafficLight) String ¶
func (x TrafficLight) String() string
func (TrafficLight) Type ¶
func (TrafficLight) Type() protoreflect.EnumType
type TranslateReq ¶
type TranslateReq struct { Words map[string]*Word `` /* 151-byte string literal not displayed */ // contains filtered or unexported fields }
func (*TranslateReq) Descriptor
deprecated
func (*TranslateReq) Descriptor() ([]byte, []int)
Deprecated: Use TranslateReq.ProtoReflect.Descriptor instead.
func (*TranslateReq) GetWords ¶
func (x *TranslateReq) GetWords() map[string]*Word
func (*TranslateReq) ProtoMessage ¶
func (*TranslateReq) ProtoMessage()
func (*TranslateReq) ProtoReflect ¶
func (x *TranslateReq) ProtoReflect() protoreflect.Message
func (*TranslateReq) Reset ¶
func (x *TranslateReq) Reset()
func (*TranslateReq) String ¶
func (x *TranslateReq) String() string
type TranslateResp ¶
type TranslateResp struct { Translations map[string]*Word `` /* 165-byte string literal not displayed */ // contains filtered or unexported fields }
func (*TranslateResp) Descriptor
deprecated
func (*TranslateResp) Descriptor() ([]byte, []int)
Deprecated: Use TranslateResp.ProtoReflect.Descriptor instead.
func (*TranslateResp) GetTranslations ¶
func (x *TranslateResp) GetTranslations() map[string]*Word
func (*TranslateResp) ProtoMessage ¶
func (*TranslateResp) ProtoMessage()
func (*TranslateResp) ProtoReflect ¶
func (x *TranslateResp) ProtoReflect() protoreflect.Message
func (*TranslateResp) Reset ¶
func (x *TranslateResp) Reset()
func (*TranslateResp) String ¶
func (x *TranslateResp) 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 // alongside non-twirp requests on one HTTP listener. 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 NewServiceServer ¶
func NewServiceServer(svc Service, hooks *twirp.ServerHooks) TwirpServer
type Word ¶
type Word struct { Word string `protobuf:"bytes,1,opt,name=word,proto3" json:"word,omitempty"` Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"` // contains filtered or unexported fields }
func (*Word) Descriptor
deprecated
func (*Word) GetLanguage ¶
func (*Word) ProtoMessage ¶
func (*Word) ProtoMessage()
func (*Word) ProtoReflect ¶
func (x *Word) ProtoReflect() protoreflect.Message