greeter

package
v0.0.0-...-ea3c94a Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

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

It is generated from these files:

rpc/greeter/greeter.proto

Index

Constants

View Source
const GreeterServicePathPrefix = "/twirp/greeter.GreeterService/"

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

type GreetRequest struct {
	Greeting             string   `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GreetRequest) Descriptor

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

func (*GreetRequest) GetGreeting

func (m *GreetRequest) GetGreeting() string

func (*GreetRequest) GetName

func (m *GreetRequest) GetName() string

func (*GreetRequest) ProtoMessage

func (*GreetRequest) ProtoMessage()

func (*GreetRequest) Reset

func (m *GreetRequest) Reset()

func (*GreetRequest) String

func (m *GreetRequest) String() string

func (*GreetRequest) XXX_DiscardUnknown

func (m *GreetRequest) XXX_DiscardUnknown()

func (*GreetRequest) XXX_Marshal

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

func (*GreetRequest) XXX_Merge

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

func (*GreetRequest) XXX_Size

func (m *GreetRequest) XXX_Size() int

func (*GreetRequest) XXX_Unmarshal

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

type GreetResponse

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

func (*GreetResponse) Descriptor

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

func (*GreetResponse) GetResponse

func (m *GreetResponse) GetResponse() string

func (*GreetResponse) ProtoMessage

func (*GreetResponse) ProtoMessage()

func (*GreetResponse) Reset

func (m *GreetResponse) Reset()

func (*GreetResponse) String

func (m *GreetResponse) String() string

func (*GreetResponse) XXX_DiscardUnknown

func (m *GreetResponse) XXX_DiscardUnknown()

func (*GreetResponse) XXX_Marshal

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

func (*GreetResponse) XXX_Merge

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

func (*GreetResponse) XXX_Size

func (m *GreetResponse) XXX_Size() int

func (*GreetResponse) XXX_Unmarshal

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

type GreeterService

type GreeterService interface {
	Greet(context.Context, *GreetRequest) (*GreetResponse, error)
}

func NewGreeterServiceJSONClient

func NewGreeterServiceJSONClient(addr string, client HTTPClient) GreeterService

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

func NewGreeterServiceProtobufClient

func NewGreeterServiceProtobufClient(addr string, client HTTPClient) GreeterService

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

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 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 NewGreeterServiceServer

func NewGreeterServiceServer(svc GreeterService, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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