adminservices

package
v0.0.0-...-c239401 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package adminservices is a generated protocol buffer package.

It is generated from these files:

rpc/adminservices/service.proto

It has these top-level messages:

Post

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

It is generated from these files:

rpc/adminservices/service.proto

Index

Constants

View Source
const BlogAdminPathPrefix = "/twirp/com.rynop.twirpl.adminservices.BlogAdmin/"

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

type BlogAdmin interface {
	// CreatePost creates a blog post
	CreatePost(context.Context, *Post) (*Post, error)
}

Service to manage my blog

func NewBlogAdminJSONClient

func NewBlogAdminJSONClient(addr string, client HTTPClient) BlogAdmin

NewBlogAdminJSONClient creates a JSON client that implements the BlogAdmin interface. It communicates using JSON requests and responses instead of protobuf messages.

func NewBlogAdminProtobufClient

func NewBlogAdminProtobufClient(addr string, client HTTPClient) BlogAdmin

NewBlogAdminProtobufClient creates a Protobuf client that implements the BlogAdmin interface. It communicates using protobuf messages and can be configured with a custom http.Client.

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 Post

type Post struct {
	Id    string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
	Body  string `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"`
}

Blog post

func (*Post) Descriptor

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

func (*Post) GetBody

func (m *Post) GetBody() string

func (*Post) GetId

func (m *Post) GetId() string

func (*Post) GetTitle

func (m *Post) GetTitle() string

func (*Post) ProtoMessage

func (*Post) ProtoMessage()

func (*Post) Reset

func (m *Post) Reset()

func (*Post) String

func (m *Post) String() string

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 NewBlogAdminServer

func NewBlogAdminServer(svc BlogAdmin, hooks *twirp.ServerHooks) TwirpServer

Jump to

Keyboard shortcuts

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