pdefs

package
v0.0.0-...-ba8b10c Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package pdefs 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:

protobuf/pdefs/bye.proto
protobuf/pdefs/hello.proto
protobuf/pdefs/service.proto

Index

Constants

View Source
const AwesomeTwirpServicePathPrefix = "/twirp/pdefs.AwesomeTwirpService/"

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

type AwesomeTwirpService interface {
	SayHello(context.Context, *ReqHello) (*ResHello, error)
}

func NewAwesomeTwirpServiceJSONClient

func NewAwesomeTwirpServiceJSONClient(addr string, client HTTPClient) AwesomeTwirpService

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

func NewAwesomeTwirpServiceProtobufClient

func NewAwesomeTwirpServiceProtobufClient(addr string, client HTTPClient) AwesomeTwirpService

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

type GoodBye

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

func (*GoodBye) Descriptor

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

func (*GoodBye) GetMessage

func (m *GoodBye) GetMessage() string

func (*GoodBye) GetUserID

func (m *GoodBye) GetUserID() string

func (*GoodBye) ProtoMessage

func (*GoodBye) ProtoMessage()

func (*GoodBye) Reset

func (m *GoodBye) Reset()

func (*GoodBye) String

func (m *GoodBye) String() string

func (*GoodBye) XXX_DiscardUnknown

func (m *GoodBye) XXX_DiscardUnknown()

func (*GoodBye) XXX_Marshal

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

func (*GoodBye) XXX_Merge

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

func (*GoodBye) XXX_Size

func (m *GoodBye) XXX_Size() int

func (*GoodBye) XXX_Unmarshal

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

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 Hello

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

func (*Hello) Descriptor

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

func (*Hello) GetMessage

func (m *Hello) GetMessage() string

func (*Hello) GetUserID

func (m *Hello) GetUserID() string

func (*Hello) ProtoMessage

func (*Hello) ProtoMessage()

func (*Hello) Reset

func (m *Hello) Reset()

func (*Hello) String

func (m *Hello) String() string

func (*Hello) XXX_DiscardUnknown

func (m *Hello) XXX_DiscardUnknown()

func (*Hello) XXX_Marshal

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

func (*Hello) XXX_Merge

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

func (*Hello) XXX_Size

func (m *Hello) XXX_Size() int

func (*Hello) XXX_Unmarshal

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

type ReqHello

type ReqHello struct {
	Hello                *Hello   `protobuf:"bytes,1,opt,name=Hello" json:"Hello,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReqHello) Descriptor

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

func (*ReqHello) GetHello

func (m *ReqHello) GetHello() *Hello

func (*ReqHello) ProtoMessage

func (*ReqHello) ProtoMessage()

func (*ReqHello) Reset

func (m *ReqHello) Reset()

func (*ReqHello) String

func (m *ReqHello) String() string

func (*ReqHello) XXX_DiscardUnknown

func (m *ReqHello) XXX_DiscardUnknown()

func (*ReqHello) XXX_Marshal

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

func (*ReqHello) XXX_Merge

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

func (*ReqHello) XXX_Size

func (m *ReqHello) XXX_Size() int

func (*ReqHello) XXX_Unmarshal

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

type ResHello

type ResHello struct {
	GoodBye              *GoodBye `protobuf:"bytes,1,opt,name=GoodBye" json:"GoodBye,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ResHello) Descriptor

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

func (*ResHello) GetGoodBye

func (m *ResHello) GetGoodBye() *GoodBye

func (*ResHello) ProtoMessage

func (*ResHello) ProtoMessage()

func (*ResHello) Reset

func (m *ResHello) Reset()

func (*ResHello) String

func (m *ResHello) String() string

func (*ResHello) XXX_DiscardUnknown

func (m *ResHello) XXX_DiscardUnknown()

func (*ResHello) XXX_Marshal

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

func (*ResHello) XXX_Merge

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

func (*ResHello) XXX_Size

func (m *ResHello) XXX_Size() int

func (*ResHello) XXX_Unmarshal

func (m *ResHello) XXX_Unmarshal(b []byte) 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 NewAwesomeTwirpServiceServer

func NewAwesomeTwirpServiceServer(svc AwesomeTwirpService, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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