Documentation ¶
Overview ¶
Package pb 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:
article.proto
Index ¶
- Constants
- func WriteError(resp http.ResponseWriter, err error)
- type Article
- func (*Article) Descriptor() ([]byte, []int)
- func (m *Article) GetBody() string
- func (m *Article) GetCreatedAt() *timestamp.Timestamp
- func (m *Article) GetId() string
- func (m *Article) GetTitle() string
- func (m *Article) GetUpdatedAt() *timestamp.Timestamp
- func (*Article) ProtoMessage()
- func (m *Article) Reset()
- func (m *Article) String() string
- func (m *Article) XXX_DiscardUnknown()
- func (m *Article) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Article) XXX_Merge(src proto.Message)
- func (m *Article) XXX_Size() int
- func (m *Article) XXX_Unmarshal(b []byte) error
- type ArticleService
- type ArticleServiceCreateRequest
- func (*ArticleServiceCreateRequest) Descriptor() ([]byte, []int)
- func (m *ArticleServiceCreateRequest) GetBody() string
- func (m *ArticleServiceCreateRequest) GetTitle() string
- func (*ArticleServiceCreateRequest) ProtoMessage()
- func (m *ArticleServiceCreateRequest) Reset()
- func (m *ArticleServiceCreateRequest) String() string
- func (m *ArticleServiceCreateRequest) XXX_DiscardUnknown()
- func (m *ArticleServiceCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ArticleServiceCreateRequest) XXX_Merge(src proto.Message)
- func (m *ArticleServiceCreateRequest) XXX_Size() int
- func (m *ArticleServiceCreateRequest) XXX_Unmarshal(b []byte) error
- type ArticleServiceCreateResponsee
- func (*ArticleServiceCreateResponsee) Descriptor() ([]byte, []int)
- func (m *ArticleServiceCreateResponsee) GetArticle() *Article
- func (*ArticleServiceCreateResponsee) ProtoMessage()
- func (m *ArticleServiceCreateResponsee) Reset()
- func (m *ArticleServiceCreateResponsee) String() string
- func (m *ArticleServiceCreateResponsee) XXX_DiscardUnknown()
- func (m *ArticleServiceCreateResponsee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ArticleServiceCreateResponsee) XXX_Merge(src proto.Message)
- func (m *ArticleServiceCreateResponsee) XXX_Size() int
- func (m *ArticleServiceCreateResponsee) XXX_Unmarshal(b []byte) error
- type HTTPClient
- type TwirpServer
Constants ¶
const ArticleServicePathPrefix = "/twirp/article.ArticleService/"
ArticleServicePathPrefix is used for all URL paths on a twirp ArticleService server. Requests are always: POST ArticleServicePathPrefix/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 Article ¶
type Article struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` CreatedAt *timestamp.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt *timestamp.Timestamp `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Article) Descriptor ¶
func (*Article) GetCreatedAt ¶
func (*Article) GetUpdatedAt ¶
func (*Article) ProtoMessage ¶
func (*Article) ProtoMessage()
func (*Article) XXX_DiscardUnknown ¶
func (m *Article) XXX_DiscardUnknown()
func (*Article) XXX_Marshal ¶
func (*Article) XXX_Unmarshal ¶
type ArticleService ¶
type ArticleService interface {
Create(context.Context, *ArticleServiceCreateRequest) (*ArticleServiceCreateResponsee, error)
}
func NewArticleServiceJSONClient ¶
func NewArticleServiceJSONClient(addr string, client HTTPClient) ArticleService
NewArticleServiceJSONClient creates a JSON client that implements the ArticleService interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewArticleServiceProtobufClient ¶
func NewArticleServiceProtobufClient(addr string, client HTTPClient) ArticleService
NewArticleServiceProtobufClient creates a Protobuf client that implements the ArticleService interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type ArticleServiceCreateRequest ¶
type ArticleServiceCreateRequest struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ArticleServiceCreateRequest) Descriptor ¶
func (*ArticleServiceCreateRequest) Descriptor() ([]byte, []int)
func (*ArticleServiceCreateRequest) GetBody ¶
func (m *ArticleServiceCreateRequest) GetBody() string
func (*ArticleServiceCreateRequest) GetTitle ¶
func (m *ArticleServiceCreateRequest) GetTitle() string
func (*ArticleServiceCreateRequest) ProtoMessage ¶
func (*ArticleServiceCreateRequest) ProtoMessage()
func (*ArticleServiceCreateRequest) Reset ¶
func (m *ArticleServiceCreateRequest) Reset()
func (*ArticleServiceCreateRequest) String ¶
func (m *ArticleServiceCreateRequest) String() string
func (*ArticleServiceCreateRequest) XXX_DiscardUnknown ¶
func (m *ArticleServiceCreateRequest) XXX_DiscardUnknown()
func (*ArticleServiceCreateRequest) XXX_Marshal ¶
func (m *ArticleServiceCreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ArticleServiceCreateRequest) XXX_Merge ¶
func (dst *ArticleServiceCreateRequest) XXX_Merge(src proto.Message)
func (*ArticleServiceCreateRequest) XXX_Size ¶
func (m *ArticleServiceCreateRequest) XXX_Size() int
func (*ArticleServiceCreateRequest) XXX_Unmarshal ¶
func (m *ArticleServiceCreateRequest) XXX_Unmarshal(b []byte) error
type ArticleServiceCreateResponsee ¶
type ArticleServiceCreateResponsee struct { Article *Article `protobuf:"bytes,1,opt,name=article,proto3" json:"article,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ArticleServiceCreateResponsee) Descriptor ¶
func (*ArticleServiceCreateResponsee) Descriptor() ([]byte, []int)
func (*ArticleServiceCreateResponsee) GetArticle ¶
func (m *ArticleServiceCreateResponsee) GetArticle() *Article
func (*ArticleServiceCreateResponsee) ProtoMessage ¶
func (*ArticleServiceCreateResponsee) ProtoMessage()
func (*ArticleServiceCreateResponsee) Reset ¶
func (m *ArticleServiceCreateResponsee) Reset()
func (*ArticleServiceCreateResponsee) String ¶
func (m *ArticleServiceCreateResponsee) String() string
func (*ArticleServiceCreateResponsee) XXX_DiscardUnknown ¶
func (m *ArticleServiceCreateResponsee) XXX_DiscardUnknown()
func (*ArticleServiceCreateResponsee) XXX_Marshal ¶
func (m *ArticleServiceCreateResponsee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ArticleServiceCreateResponsee) XXX_Merge ¶
func (dst *ArticleServiceCreateResponsee) XXX_Merge(src proto.Message)
func (*ArticleServiceCreateResponsee) XXX_Size ¶
func (m *ArticleServiceCreateResponsee) XXX_Size() int
func (*ArticleServiceCreateResponsee) XXX_Unmarshal ¶
func (m *ArticleServiceCreateResponsee) XXX_Unmarshal(b []byte) error
type HTTPClient ¶
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 NewArticleServiceServer ¶
func NewArticleServiceServer(svc ArticleService, hooks *twirp.ServerHooks) TwirpServer