twitterarchive

package
v0.0.0-...-cce5203 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package twitterarchive is a generated protocol buffer package.

It is generated from these files:

twitterarchive.proto

It has these top-level messages:

CreateRequest
CreateResponse

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

It is generated from these files:

twitterarchive.proto

Index

Constants

View Source
const TwitterArchivePathPrefix = "/twirp/twitterarchive.TwitterArchive/"

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

type CreateRequest struct {
	Name    string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
}

func (*CreateRequest) Descriptor

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

func (*CreateRequest) GetMessage

func (m *CreateRequest) GetMessage() string

func (*CreateRequest) GetName

func (m *CreateRequest) GetName() string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) Reset

func (m *CreateRequest) Reset()

func (*CreateRequest) String

func (m *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {
	Sequence string `protobuf:"bytes,1,opt,name=sequence" json:"sequence,omitempty"`
	Shard    string `protobuf:"bytes,2,opt,name=shard" json:"shard,omitempty"`
}

func (*CreateResponse) Descriptor

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

func (*CreateResponse) GetSequence

func (m *CreateResponse) GetSequence() string

func (*CreateResponse) GetShard

func (m *CreateResponse) GetShard() string

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) Reset

func (m *CreateResponse) Reset()

func (*CreateResponse) String

func (m *CreateResponse) String() string

type Server

type Server struct {
	KinesisService    *kinesis.Kinesis
	KinesisStreamName string
}

Server implements the RPC methods required for archiving Tweets

func New

func New(region string, streamName string) *Server

New instantiates a new instance of a server that implements the RPC methods required for archiving tweets

func (*Server) Create

func (t *Server) Create(ctx context.Context, req *CreateRequest) (*CreateResponse, error)

Create receives a Tweet, and archives it to an Amazon Kinesis Stream.

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
	// unmarshaled 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 NewTwitterArchiveServer

func NewTwitterArchiveServer(svc TwitterArchive, hooks *twirp.ServerHooks) TwirpServer

type TwitterArchive

type TwitterArchive interface {
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
}

func NewTwitterArchiveJSONClient

func NewTwitterArchiveJSONClient(addr string, client *http.Client) TwitterArchive

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

func NewTwitterArchiveProtobufClient

func NewTwitterArchiveProtobufClient(addr string, client *http.Client) TwitterArchive

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

Jump to

Keyboard shortcuts

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