pb

package
v0.0.0-...-a52efcf Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package pb is a generated protocol buffer package.

It is generated from these files:

services/qr/transport/pb/qr.proto

It has these top-level messages:

GenerateRequest
GenerateResponse

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

It is generated from these files:

services/qr/transport/pb/qr.proto

Index

Constants

View Source
const QRPathPrefix = "/twirp/pb.QR/"

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

func RegisterQRServer(s *grpc.Server, srv QRServer)

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 GenerateRequest

type GenerateRequest struct {
	Data  string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
	Level int32  `protobuf:"varint,2,opt,name=level" json:"level,omitempty"`
	Size  int32  `protobuf:"varint,3,opt,name=size" json:"size,omitempty"`
}

func (*GenerateRequest) Descriptor

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

func (*GenerateRequest) GetData

func (m *GenerateRequest) GetData() string

func (*GenerateRequest) GetLevel

func (m *GenerateRequest) GetLevel() int32

func (*GenerateRequest) GetSize

func (m *GenerateRequest) GetSize() int32

func (*GenerateRequest) ProtoMessage

func (*GenerateRequest) ProtoMessage()

func (*GenerateRequest) Reset

func (m *GenerateRequest) Reset()

func (*GenerateRequest) String

func (m *GenerateRequest) String() string

type GenerateResponse

type GenerateResponse struct {
	Image []byte `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
}

func (*GenerateResponse) Descriptor

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

func (*GenerateResponse) GetImage

func (m *GenerateResponse) GetImage() []byte

func (*GenerateResponse) ProtoMessage

func (*GenerateResponse) ProtoMessage()

func (*GenerateResponse) Reset

func (m *GenerateResponse) Reset()

func (*GenerateResponse) String

func (m *GenerateResponse) String() string

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 QR

type QR interface {
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)
}

func NewQRJSONClient

func NewQRJSONClient(addr string, client HTTPClient) QR

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

func NewQRProtobufClient

func NewQRProtobufClient(addr string, client HTTPClient) QR

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

type QRClient

type QRClient interface {
	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error)
}

func NewQRClient

func NewQRClient(cc *grpc.ClientConn) QRClient

type QRServer

type QRServer interface {
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, 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 NewQRServer

func NewQRServer(svc QR, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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