proto

package
v0.0.0-...-817ee16 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 15 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.10.1.

It is generated from these files:

service.proto

Index

Constants

View Source
const BookServicePathPrefix = "/twirp/yiplee.twirp.gateway.service.BookService/"

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

type Book struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Cover                string   `protobuf:"bytes,3,opt,name=cover,proto3" json:"cover,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Book) Descriptor

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

func (*Book) GetCover

func (m *Book) GetCover() string

func (*Book) GetId

func (m *Book) GetId() string

func (*Book) GetName

func (m *Book) GetName() string

func (*Book) ProtoMessage

func (*Book) ProtoMessage()

func (*Book) Reset

func (m *Book) Reset()

func (*Book) String

func (m *Book) String() string

func (*Book) XXX_DiscardUnknown

func (m *Book) XXX_DiscardUnknown()

func (*Book) XXX_Marshal

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

func (*Book) XXX_Merge

func (m *Book) XXX_Merge(src proto.Message)

func (*Book) XXX_Size

func (m *Book) XXX_Size() int

func (*Book) XXX_Unmarshal

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

type BookService

type BookService interface {
	// Create a new book
	Create(context.Context, *BookServiceReq_Create) (*Book, error)

	// Find a book by book id
	Find(context.Context, *BookServiceReq_Find) (*Book, error)
}

func NewBookServiceJSONClient

func NewBookServiceJSONClient(addr string, client HTTPClient, opts ...twirp.ClientOption) BookService

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

func NewBookServiceProtobufClient

func NewBookServiceProtobufClient(addr string, client HTTPClient, opts ...twirp.ClientOption) BookService

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

type BookServiceReq

type BookServiceReq struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BookServiceReq) Descriptor

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

func (*BookServiceReq) ProtoMessage

func (*BookServiceReq) ProtoMessage()

func (*BookServiceReq) Reset

func (m *BookServiceReq) Reset()

func (*BookServiceReq) String

func (m *BookServiceReq) String() string

func (*BookServiceReq) XXX_DiscardUnknown

func (m *BookServiceReq) XXX_DiscardUnknown()

func (*BookServiceReq) XXX_Marshal

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

func (*BookServiceReq) XXX_Merge

func (m *BookServiceReq) XXX_Merge(src proto.Message)

func (*BookServiceReq) XXX_Size

func (m *BookServiceReq) XXX_Size() int

func (*BookServiceReq) XXX_Unmarshal

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

type BookServiceReq_Create

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

func (*BookServiceReq_Create) Descriptor

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

func (*BookServiceReq_Create) GetCover

func (m *BookServiceReq_Create) GetCover() string

func (*BookServiceReq_Create) GetName

func (m *BookServiceReq_Create) GetName() string

func (*BookServiceReq_Create) ProtoMessage

func (*BookServiceReq_Create) ProtoMessage()

func (*BookServiceReq_Create) Reset

func (m *BookServiceReq_Create) Reset()

func (*BookServiceReq_Create) String

func (m *BookServiceReq_Create) String() string

func (*BookServiceReq_Create) XXX_DiscardUnknown

func (m *BookServiceReq_Create) XXX_DiscardUnknown()

func (*BookServiceReq_Create) XXX_Marshal

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

func (*BookServiceReq_Create) XXX_Merge

func (m *BookServiceReq_Create) XXX_Merge(src proto.Message)

func (*BookServiceReq_Create) XXX_Size

func (m *BookServiceReq_Create) XXX_Size() int

func (*BookServiceReq_Create) XXX_Unmarshal

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

type BookServiceReq_Find

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

func (*BookServiceReq_Find) Descriptor

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

func (*BookServiceReq_Find) GetId

func (m *BookServiceReq_Find) GetId() string

func (*BookServiceReq_Find) ProtoMessage

func (*BookServiceReq_Find) ProtoMessage()

func (*BookServiceReq_Find) Reset

func (m *BookServiceReq_Find) Reset()

func (*BookServiceReq_Find) String

func (m *BookServiceReq_Find) String() string

func (*BookServiceReq_Find) XXX_DiscardUnknown

func (m *BookServiceReq_Find) XXX_DiscardUnknown()

func (*BookServiceReq_Find) XXX_Marshal

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

func (*BookServiceReq_Find) XXX_Merge

func (m *BookServiceReq_Find) XXX_Merge(src proto.Message)

func (*BookServiceReq_Find) XXX_Size

func (m *BookServiceReq_Find) XXX_Size() int

func (*BookServiceReq_Find) XXX_Unmarshal

func (m *BookServiceReq_Find) 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 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
	// 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
	// alongside non-twirp requests on one HTTP listener.
	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 NewBookServiceServer

func NewBookServiceServer(svc BookService, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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