proto

package
v0.0.0-...-e2a0c4b Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package proto is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.4.2.

It is generated from these files:

test.proto

Index

Constants

View Source
const HelloWorldPathPrefix = "/twirp/us.xeserv.api.HelloWorld/"

HelloWorldPathPrefix is used for all URL paths on a twirp HelloWorld server. Requests are always: POST HelloWorldPathPrefix/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 HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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 HelloWorld

type HelloWorld interface {
	Speak(context.Context, *Words) (*Words, error)
}

func NewHelloWorldAnalytics

func NewHelloWorldAnalytics(next HelloWorld, client analytics.Client) HelloWorld

func NewHelloWorldJSONClient

func NewHelloWorldJSONClient(addr string, client HTTPClient) HelloWorld

NewHelloWorldJSONClient creates a JSON client that implements the HelloWorld interface. It communicates using JSON and can be configured with a custom HTTPClient.

func NewHelloWorldLogging

func NewHelloWorldLogging(next HelloWorld) HelloWorld

func NewHelloWorldMetrics

func NewHelloWorldMetrics(next HelloWorld, prov provider.Provider) HelloWorld

func NewHelloWorldProtobufClient

func NewHelloWorldProtobufClient(addr string, client HTTPClient) HelloWorld

NewHelloWorldProtobufClient creates a Protobuf client that implements the HelloWorld interface. It communicates using Protobuf and can be configured with a custom HTTPClient.

type HelloWorldAnalytics

type HelloWorldAnalytics struct {
	Next HelloWorld
	// contains filtered or unexported fields
}

HelloWorldAnalytics is a middleware for HelloWorld that collects timing and error rate data for servers.

func (HelloWorldAnalytics) Speak

func (i HelloWorldAnalytics) Speak(ctx context.Context, input *Words) (result *Words, err error)

type HelloWorldLogging

type HelloWorldLogging struct {
	// contains filtered or unexported fields
}

HelloWorldLogging is a middleware for HelloWorld that logs all usage of the methods

func (HelloWorldLogging) Speak

func (i HelloWorldLogging) Speak(ctx context.Context, input *Words) (result *Words, err error)

type HelloWorldMetrics

type HelloWorldMetrics struct {
	Next            HelloWorld
	SpeakErrorCount metrics.Counter
	SpeakDurationNS metrics.Histogram
}

HelloWorldMetrics is a middleware for HelloWorld that collects timing and error rate data for servers.

func (HelloWorldMetrics) Speak

func (i HelloWorldMetrics) Speak(ctx context.Context, input *Words) (result *Words, err error)

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 NewHelloWorldServer

func NewHelloWorldServer(svc HelloWorld, hooks *twirp.ServerHooks) TwirpServer

type Words

type Words struct {
	Message              string   `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Words) Descriptor

func (*Words) Descriptor() ([]byte, []int)

func (Words) F

func (i Words) F() ln.F

F ields for logging.

func (*Words) GetMessage

func (m *Words) GetMessage() string

func (*Words) ProtoMessage

func (*Words) ProtoMessage()

func (*Words) Reset

func (m *Words) Reset()

func (*Words) String

func (m *Words) String() string

func (*Words) XXX_DiscardUnknown

func (m *Words) XXX_DiscardUnknown()

func (*Words) XXX_Marshal

func (m *Words) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Words) XXX_Merge

func (dst *Words) XXX_Merge(src proto.Message)

func (*Words) XXX_Size

func (m *Words) XXX_Size() int

func (*Words) XXX_Unmarshal

func (m *Words) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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