Documentation ¶
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type HTTPClient
- type IndexRequest
- func (*IndexRequest) Descriptor() ([]byte, []int)deprecated
- func (x *IndexRequest) GetAdditionalCopies() uint64
- func (x *IndexRequest) GetPosition() Position
- func (x *IndexRequest) GetResult() *Result
- func (*IndexRequest) ProtoMessage()
- func (x *IndexRequest) ProtoReflect() protoreflect.Message
- func (x *IndexRequest) Reset()
- func (x *IndexRequest) String() string
- type IndexResponse
- type MapRequest
- func (*MapRequest) Descriptor() ([]byte, []int)deprecated
- func (x *MapRequest) GetSint64String() map[int64]string
- func (x *MapRequest) GetStringInt32() map[string]int32
- func (x *MapRequest) GetStringRepeatedString() map[string]*MapRequest_RepeatedString
- func (x *MapRequest) GetStringString() map[string]string
- func (*MapRequest) ProtoMessage()
- func (x *MapRequest) ProtoReflect() protoreflect.Message
- func (x *MapRequest) Reset()
- func (x *MapRequest) String() string
- type MapRequest_RepeatedString
- func (*MapRequest_RepeatedString) Descriptor() ([]byte, []int)deprecated
- func (x *MapRequest_RepeatedString) GetValue() []string
- func (*MapRequest_RepeatedString) ProtoMessage()
- func (x *MapRequest_RepeatedString) ProtoReflect() protoreflect.Message
- func (x *MapRequest_RepeatedString) Reset()
- func (x *MapRequest_RepeatedString) String() string
- type Message
- type Position
- type Quirks
- type RepeatedRequest
- func (*RepeatedRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RepeatedRequest) GetEnum() []RepeatedRequest_Enum
- func (x *RepeatedRequest) GetInt32() []int32
- func (x *RepeatedRequest) GetMessage() []*Message
- func (x *RepeatedRequest) GetString_() []string
- func (*RepeatedRequest) ProtoMessage()
- func (x *RepeatedRequest) ProtoReflect() protoreflect.Message
- func (x *RepeatedRequest) Reset()
- func (x *RepeatedRequest) String() string
- type RepeatedRequest_Enum
- func (RepeatedRequest_Enum) Descriptor() protoreflect.EnumDescriptor
- func (x RepeatedRequest_Enum) Enum() *RepeatedRequest_Enum
- func (RepeatedRequest_Enum) EnumDescriptor() ([]byte, []int)deprecated
- func (x RepeatedRequest_Enum) Number() protoreflect.EnumNumber
- func (x RepeatedRequest_Enum) String() string
- func (RepeatedRequest_Enum) Type() protoreflect.EnumType
- type Result
- func (*Result) Descriptor() ([]byte, []int)deprecated
- func (x *Result) GetIsAd() bool
- func (x *Result) GetSnippets() []string
- func (x *Result) GetTitle() string
- func (x *Result) GetUrl() string
- func (*Result) ProtoMessage()
- func (x *Result) ProtoReflect() protoreflect.Message
- func (x *Result) Reset()
- func (x *Result) String() string
- type SearchRequest
- func (*SearchRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SearchRequest) GetPageNumber() int32
- func (x *SearchRequest) GetQuery() string
- func (x *SearchRequest) GetResultPerPage() int32
- func (*SearchRequest) ProtoMessage()
- func (x *SearchRequest) ProtoReflect() protoreflect.Message
- func (x *SearchRequest) Reset()
- func (x *SearchRequest) String() string
- type SearchResponse
- type SearchService
- type TwirpServer
- type TypesRequest
- func (*TypesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TypesRequest) GetBool() bool
- func (x *TypesRequest) GetTimestamp() *timestamppb.Timestamp
- func (*TypesRequest) ProtoMessage()
- func (x *TypesRequest) ProtoReflect() protoreflect.Message
- func (x *TypesRequest) Reset()
- func (x *TypesRequest) String() string
- type Void
Constants ¶
const QuirksPathPrefix = "/twirp/quirks.v1.Quirks/"
QuirksPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html
const SearchServicePathPrefix = "/twirp/SearchService/"
SearchServicePathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html
Variables ¶
var ( RepeatedRequest_Enum_name = map[int32]string{ 0: "KEY_0", 1: "KEY_1", } RepeatedRequest_Enum_value = map[string]int32{ "KEY_0": 0, "KEY_1": 1, } )
Enum value maps for RepeatedRequest_Enum.
var ( Position_name = map[int32]string{ 0: "POSITION_TOP", 1: "POSITION_BOTTOM", } Position_value = map[string]int32{ "POSITION_TOP": 0, "POSITION_BOTTOM": 1, } )
Enum value maps for Position.
var File_quirks_proto protoreflect.FileDescriptor
var File_search_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 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 IndexRequest ¶
type IndexRequest struct { Result *Result `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` Position Position `protobuf:"varint,2,opt,name=position,proto3,enum=Position" json:"position,omitempty"` AdditionalCopies uint64 `protobuf:"varint,3,opt,name=additional_copies,json=additionalCopies,proto3" json:"additional_copies,omitempty"` // contains filtered or unexported fields }
func (*IndexRequest) Descriptor
deprecated
func (*IndexRequest) Descriptor() ([]byte, []int)
Deprecated: Use IndexRequest.ProtoReflect.Descriptor instead.
func (*IndexRequest) GetAdditionalCopies ¶
func (x *IndexRequest) GetAdditionalCopies() uint64
func (*IndexRequest) GetPosition ¶
func (x *IndexRequest) GetPosition() Position
func (*IndexRequest) GetResult ¶
func (x *IndexRequest) GetResult() *Result
func (*IndexRequest) ProtoMessage ¶
func (*IndexRequest) ProtoMessage()
func (*IndexRequest) ProtoReflect ¶
func (x *IndexRequest) ProtoReflect() protoreflect.Message
func (*IndexRequest) Reset ¶
func (x *IndexRequest) Reset()
func (*IndexRequest) String ¶
func (x *IndexRequest) String() string
type IndexResponse ¶
type IndexResponse struct { Result *Result `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` // contains filtered or unexported fields }
func (*IndexResponse) Descriptor
deprecated
func (*IndexResponse) Descriptor() ([]byte, []int)
Deprecated: Use IndexResponse.ProtoReflect.Descriptor instead.
func (*IndexResponse) GetResult ¶
func (x *IndexResponse) GetResult() *Result
func (*IndexResponse) ProtoMessage ¶
func (*IndexResponse) ProtoMessage()
func (*IndexResponse) ProtoReflect ¶
func (x *IndexResponse) ProtoReflect() protoreflect.Message
func (*IndexResponse) Reset ¶
func (x *IndexResponse) Reset()
func (*IndexResponse) String ¶
func (x *IndexResponse) String() string
type MapRequest ¶
type MapRequest struct { StringString map[string]string `` /* 185-byte string literal not displayed */ StringInt32 map[string]int32 `` /* 183-byte string literal not displayed */ Sint64String map[int64]string `` /* 188-byte string literal not displayed */ StringRepeatedString map[string]*MapRequest_RepeatedString `` /* 211-byte string literal not displayed */ // contains filtered or unexported fields }
func (*MapRequest) Descriptor
deprecated
func (*MapRequest) Descriptor() ([]byte, []int)
Deprecated: Use MapRequest.ProtoReflect.Descriptor instead.
func (*MapRequest) GetSint64String ¶
func (x *MapRequest) GetSint64String() map[int64]string
func (*MapRequest) GetStringInt32 ¶
func (x *MapRequest) GetStringInt32() map[string]int32
func (*MapRequest) GetStringRepeatedString ¶
func (x *MapRequest) GetStringRepeatedString() map[string]*MapRequest_RepeatedString
func (*MapRequest) GetStringString ¶
func (x *MapRequest) GetStringString() map[string]string
func (*MapRequest) ProtoMessage ¶
func (*MapRequest) ProtoMessage()
func (*MapRequest) ProtoReflect ¶
func (x *MapRequest) ProtoReflect() protoreflect.Message
func (*MapRequest) Reset ¶
func (x *MapRequest) Reset()
func (*MapRequest) String ¶
func (x *MapRequest) String() string
type MapRequest_RepeatedString ¶
type MapRequest_RepeatedString struct { Value []string `protobuf:"bytes,1,rep,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*MapRequest_RepeatedString) Descriptor
deprecated
func (*MapRequest_RepeatedString) Descriptor() ([]byte, []int)
Deprecated: Use MapRequest_RepeatedString.ProtoReflect.Descriptor instead.
func (*MapRequest_RepeatedString) GetValue ¶
func (x *MapRequest_RepeatedString) GetValue() []string
func (*MapRequest_RepeatedString) ProtoMessage ¶
func (*MapRequest_RepeatedString) ProtoMessage()
func (*MapRequest_RepeatedString) ProtoReflect ¶
func (x *MapRequest_RepeatedString) ProtoReflect() protoreflect.Message
func (*MapRequest_RepeatedString) Reset ¶
func (x *MapRequest_RepeatedString) Reset()
func (*MapRequest_RepeatedString) String ¶
func (x *MapRequest_RepeatedString) String() string
type Message ¶
type Message struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*Message) Descriptor
deprecated
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type Position ¶
type Position int32
func (Position) Descriptor ¶
func (Position) Descriptor() protoreflect.EnumDescriptor
func (Position) EnumDescriptor
deprecated
func (Position) Number ¶
func (x Position) Number() protoreflect.EnumNumber
func (Position) Type ¶
func (Position) Type() protoreflect.EnumType
type Quirks ¶
type Quirks interface { GetAuthentication(context.Context, *Void) (*Message, error) Map(context.Context, *MapRequest) (*MapRequest, error) MethodWithAReallyLongNameGmthggupcbmnphflnnvu(context.Context, *Void) (*Message, error) Panic(context.Context, *Void) (*Message, error) Repeated(context.Context, *RepeatedRequest) (*RepeatedRequest, error) Types(context.Context, *TypesRequest) (*TypesRequest, error) }
func NewQuirksJSONClient ¶
func NewQuirksJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Quirks
NewQuirksJSONClient creates a JSON client that implements the Quirks interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewQuirksProtobufClient ¶
func NewQuirksProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) Quirks
NewQuirksProtobufClient creates a Protobuf client that implements the Quirks interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type RepeatedRequest ¶
type RepeatedRequest struct { String_ []string `protobuf:"bytes,1,rep,name=string,proto3" json:"string,omitempty"` Int32 []int32 `protobuf:"varint,2,rep,packed,name=int32,proto3" json:"int32,omitempty"` Enum []RepeatedRequest_Enum `protobuf:"varint,3,rep,packed,name=enum,proto3,enum=quirks.v1.RepeatedRequest_Enum" json:"enum,omitempty"` Message []*Message `protobuf:"bytes,4,rep,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*RepeatedRequest) Descriptor
deprecated
func (*RepeatedRequest) Descriptor() ([]byte, []int)
Deprecated: Use RepeatedRequest.ProtoReflect.Descriptor instead.
func (*RepeatedRequest) GetEnum ¶
func (x *RepeatedRequest) GetEnum() []RepeatedRequest_Enum
func (*RepeatedRequest) GetInt32 ¶
func (x *RepeatedRequest) GetInt32() []int32
func (*RepeatedRequest) GetMessage ¶
func (x *RepeatedRequest) GetMessage() []*Message
func (*RepeatedRequest) GetString_ ¶
func (x *RepeatedRequest) GetString_() []string
func (*RepeatedRequest) ProtoMessage ¶
func (*RepeatedRequest) ProtoMessage()
func (*RepeatedRequest) ProtoReflect ¶
func (x *RepeatedRequest) ProtoReflect() protoreflect.Message
func (*RepeatedRequest) Reset ¶
func (x *RepeatedRequest) Reset()
func (*RepeatedRequest) String ¶
func (x *RepeatedRequest) String() string
type RepeatedRequest_Enum ¶
type RepeatedRequest_Enum int32
const ( RepeatedRequest_KEY_0 RepeatedRequest_Enum = 0 RepeatedRequest_KEY_1 RepeatedRequest_Enum = 1 )
func (RepeatedRequest_Enum) Descriptor ¶
func (RepeatedRequest_Enum) Descriptor() protoreflect.EnumDescriptor
func (RepeatedRequest_Enum) Enum ¶
func (x RepeatedRequest_Enum) Enum() *RepeatedRequest_Enum
func (RepeatedRequest_Enum) EnumDescriptor
deprecated
func (RepeatedRequest_Enum) EnumDescriptor() ([]byte, []int)
Deprecated: Use RepeatedRequest_Enum.Descriptor instead.
func (RepeatedRequest_Enum) Number ¶
func (x RepeatedRequest_Enum) Number() protoreflect.EnumNumber
func (RepeatedRequest_Enum) String ¶
func (x RepeatedRequest_Enum) String() string
func (RepeatedRequest_Enum) Type ¶
func (RepeatedRequest_Enum) Type() protoreflect.EnumType
type Result ¶
type Result struct { Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` Snippets []string `protobuf:"bytes,3,rep,name=snippets,proto3" json:"snippets,omitempty"` IsAd bool `protobuf:"varint,4,opt,name=is_ad,json=isAd,proto3" json:"is_ad,omitempty"` // contains filtered or unexported fields }
func (*Result) Descriptor
deprecated
func (*Result) GetSnippets ¶
func (*Result) ProtoMessage ¶
func (*Result) ProtoMessage()
func (*Result) ProtoReflect ¶
func (x *Result) ProtoReflect() protoreflect.Message
type SearchRequest ¶
type SearchRequest struct { Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` PageNumber int32 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` ResultPerPage int32 `protobuf:"varint,3,opt,name=result_per_page,json=resultPerPage,proto3" json:"result_per_page,omitempty"` // contains filtered or unexported fields }
func (*SearchRequest) Descriptor
deprecated
func (*SearchRequest) Descriptor() ([]byte, []int)
Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.
func (*SearchRequest) GetPageNumber ¶
func (x *SearchRequest) GetPageNumber() int32
func (*SearchRequest) GetQuery ¶
func (x *SearchRequest) GetQuery() string
func (*SearchRequest) GetResultPerPage ¶
func (x *SearchRequest) GetResultPerPage() int32
func (*SearchRequest) ProtoMessage ¶
func (*SearchRequest) ProtoMessage()
func (*SearchRequest) ProtoReflect ¶
func (x *SearchRequest) ProtoReflect() protoreflect.Message
func (*SearchRequest) Reset ¶
func (x *SearchRequest) Reset()
func (*SearchRequest) String ¶
func (x *SearchRequest) String() string
type SearchResponse ¶
type SearchResponse struct { Results []*Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` // contains filtered or unexported fields }
func (*SearchResponse) Descriptor
deprecated
func (*SearchResponse) Descriptor() ([]byte, []int)
Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.
func (*SearchResponse) GetResults ¶
func (x *SearchResponse) GetResults() []*Result
func (*SearchResponse) ProtoMessage ¶
func (*SearchResponse) ProtoMessage()
func (*SearchResponse) ProtoReflect ¶
func (x *SearchResponse) ProtoReflect() protoreflect.Message
func (*SearchResponse) Reset ¶
func (x *SearchResponse) Reset()
func (*SearchResponse) String ¶
func (x *SearchResponse) String() string
type SearchService ¶
type SearchService interface { Search(context.Context, *SearchRequest) (*SearchResponse, error) Index(context.Context, *IndexRequest) (*IndexResponse, error) }
func NewSearchServiceJSONClient ¶
func NewSearchServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) SearchService
NewSearchServiceJSONClient creates a JSON client that implements the SearchService interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewSearchServiceProtobufClient ¶
func NewSearchServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) SearchService
NewSearchServiceProtobufClient creates a Protobuf client that implements the SearchService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
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 // google.golang.org/protobuf/types/descriptorpb.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 NewQuirksServer ¶
func NewQuirksServer(svc Quirks, opts ...interface{}) TwirpServer
NewQuirksServer 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).
func NewSearchServiceServer ¶
func NewSearchServiceServer(svc SearchService, opts ...interface{}) TwirpServer
NewSearchServiceServer 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 TypesRequest ¶
type TypesRequest struct { Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` Bool bool `protobuf:"varint,2,opt,name=bool,proto3" json:"bool,omitempty"` // contains filtered or unexported fields }
func (*TypesRequest) Descriptor
deprecated
func (*TypesRequest) Descriptor() ([]byte, []int)
Deprecated: Use TypesRequest.ProtoReflect.Descriptor instead.
func (*TypesRequest) GetBool ¶
func (x *TypesRequest) GetBool() bool
func (*TypesRequest) GetTimestamp ¶
func (x *TypesRequest) GetTimestamp() *timestamppb.Timestamp
func (*TypesRequest) ProtoMessage ¶
func (*TypesRequest) ProtoMessage()
func (*TypesRequest) ProtoReflect ¶
func (x *TypesRequest) ProtoReflect() protoreflect.Message
func (*TypesRequest) Reset ¶
func (x *TypesRequest) Reset()
func (*TypesRequest) String ¶
func (x *TypesRequest) String() string
type Void ¶
type Void struct {
// contains filtered or unexported fields
}
func (*Void) Descriptor
deprecated
func (*Void) ProtoMessage ¶
func (*Void) ProtoMessage()
func (*Void) ProtoReflect ¶
func (x *Void) ProtoReflect() protoreflect.Message