Documentation
¶
Index ¶
- Constants
- Variables
- func WriteError(resp http.ResponseWriter, err error)
- type DeleteFeedRequest
- type DeleteFeedResponse
- type ExceptionRule
- func (*ExceptionRule) Descriptor() ([]byte, []int)deprecated
- func (x *ExceptionRule) GetHasCategory() string
- func (x *ExceptionRule) GetTitlePattern() string
- func (*ExceptionRule) ProtoMessage()
- func (x *ExceptionRule) ProtoReflect() protoreflect.Message
- func (x *ExceptionRule) Reset()
- func (x *ExceptionRule) String() string
- type Feed
- func (*Feed) Descriptor() ([]byte, []int)deprecated
- func (x *Feed) GetLanguage() string
- func (x *Feed) GetLastChecked() string
- func (x *Feed) GetLastPublication() string
- func (x *Feed) GetRefreshInterval() int64
- func (x *Feed) GetSectionCode() string
- func (x *Feed) GetTitle() string
- func (x *Feed) GetType() FeedType
- func (x *Feed) GetTypeExceptions() []*ExceptionRule
- func (x *Feed) GetUrl() string
- func (x *Feed) GetUuid() string
- func (*Feed) ProtoMessage()
- func (x *Feed) ProtoReflect() protoreflect.Message
- func (x *Feed) Reset()
- func (x *Feed) String() string
- type FeedType
- type GetAllFeedsRequest
- func (*GetAllFeedsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetAllFeedsRequest) GetPage() int64
- func (x *GetAllFeedsRequest) GetPageSize() int64
- func (*GetAllFeedsRequest) ProtoMessage()
- func (x *GetAllFeedsRequest) ProtoReflect() protoreflect.Message
- func (x *GetAllFeedsRequest) Reset()
- func (x *GetAllFeedsRequest) String() string
- type GetAllFeedsResponse
- func (*GetAllFeedsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetAllFeedsResponse) GetFeeds() []*Feed
- func (x *GetAllFeedsResponse) GetNextPage() int64
- func (x *GetAllFeedsResponse) GetPage() int64
- func (*GetAllFeedsResponse) ProtoMessage()
- func (x *GetAllFeedsResponse) ProtoReflect() protoreflect.Message
- func (x *GetAllFeedsResponse) Reset()
- func (x *GetAllFeedsResponse) String() string
- type HTTPClient
- type RssFeed
- type TwirpServer
- type UpdateFeedRequest
- type UpdateFeedResponse
Constants ¶
const RssFeedPathPrefix = "/twirp/ttab.wires.RssFeed/"
RssFeedPathPrefix is a convenience constant that may identify URL paths. Should be used with caution, it only matches routes generated by Twirp Go clients, with the default "/twirp" prefix and default CamelCase service and method names. More info: https://twitchtv.github.io/twirp/docs/routing.html
Variables ¶
var ( FeedType_name = map[int32]string{ 0: "TYPE_UNKNOWN", 1: "TYPE_ARTICLE", 2: "TYPE_PRESSRELEASE", } FeedType_value = map[string]int32{ "TYPE_UNKNOWN": 0, "TYPE_ARTICLE": 1, "TYPE_PRESSRELEASE": 2, } )
Enum value maps for FeedType.
var File_wires_service_proto protoreflect.FileDescriptor
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 DeleteFeedRequest ¶
type DeleteFeedRequest struct {
// UUIDv5 of the feed, created by using the url.
Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
// contains filtered or unexported fields
}
func (*DeleteFeedRequest) Descriptor
deprecated
func (*DeleteFeedRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteFeedRequest.ProtoReflect.Descriptor instead.
func (*DeleteFeedRequest) GetUuid ¶
func (x *DeleteFeedRequest) GetUuid() string
func (*DeleteFeedRequest) ProtoMessage ¶
func (*DeleteFeedRequest) ProtoMessage()
func (*DeleteFeedRequest) ProtoReflect ¶
func (x *DeleteFeedRequest) ProtoReflect() protoreflect.Message
func (*DeleteFeedRequest) Reset ¶
func (x *DeleteFeedRequest) Reset()
func (*DeleteFeedRequest) String ¶
func (x *DeleteFeedRequest) String() string
type DeleteFeedResponse ¶
type DeleteFeedResponse struct {
// contains filtered or unexported fields
}
func (*DeleteFeedResponse) Descriptor
deprecated
func (*DeleteFeedResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteFeedResponse.ProtoReflect.Descriptor instead.
func (*DeleteFeedResponse) ProtoMessage ¶
func (*DeleteFeedResponse) ProtoMessage()
func (*DeleteFeedResponse) ProtoReflect ¶
func (x *DeleteFeedResponse) ProtoReflect() protoreflect.Message
func (*DeleteFeedResponse) Reset ¶
func (x *DeleteFeedResponse) Reset()
func (*DeleteFeedResponse) String ¶
func (x *DeleteFeedResponse) String() string
type ExceptionRule ¶
type ExceptionRule struct {
// A regex pattern to match against feed item titles.
// Example: "^PRESS:" to match titles starting with "PRESS:".
TitlePattern string `protobuf:"bytes,1,opt,name=title_pattern,json=titlePattern,proto3" json:"title_pattern,omitempty"`
// A category to associate with feed items that match the title pattern.
// Example: "Pressmeddelande" or "Pressrelease".
HasCategory string `protobuf:"bytes,2,opt,name=has_category,json=hasCategory,proto3" json:"has_category,omitempty"`
// contains filtered or unexported fields
}
One or both fileds can be used in a rule. If one of the fields in a rule matches a feed item, the exception is applied (logical OR).
func (*ExceptionRule) Descriptor
deprecated
func (*ExceptionRule) Descriptor() ([]byte, []int)
Deprecated: Use ExceptionRule.ProtoReflect.Descriptor instead.
func (*ExceptionRule) GetHasCategory ¶
func (x *ExceptionRule) GetHasCategory() string
func (*ExceptionRule) GetTitlePattern ¶
func (x *ExceptionRule) GetTitlePattern() string
func (*ExceptionRule) ProtoMessage ¶
func (*ExceptionRule) ProtoMessage()
func (*ExceptionRule) ProtoReflect ¶
func (x *ExceptionRule) ProtoReflect() protoreflect.Message
func (*ExceptionRule) Reset ¶
func (x *ExceptionRule) Reset()
func (*ExceptionRule) String ¶
func (x *ExceptionRule) String() string
type Feed ¶
type Feed struct {
// UUIDv5 of the feed, created by using the url.
Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
// The human-readable title of the feed.
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
// The URL from which the feed is sourced.
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
// Feed type enum. "TYPE_ARTICLE" (default) and "TYPE_PRESSRELEASE".
// Use "TYPE_ARTICLE" and "type_exceptions" field for feeds with mixed types.
Type FeedType `protobuf:"varint,4,opt,name=type,proto3,enum=ttab.wires.FeedType" json:"type,omitempty"`
// A list of exceptions for fine-grained type categorization of feed items.
// Primarily used for feeds with mixed content types.
TypeExceptions []*ExceptionRule `protobuf:"bytes,10,rep,name=type_exceptions,json=typeExceptions,proto3" json:"type_exceptions,omitempty"`
// Code representing the section of the feed.
// Possible values: ["inr", "utr", "eko", "spt", "nojkul"].
SectionCode string `protobuf:"bytes,5,opt,name=section_code,json=sectionCode,proto3" json:"section_code,omitempty"`
// Time interval (in seconds) specifying how frequently the feed should be refreshed/imported.
RefreshInterval int64 `protobuf:"varint,6,opt,name=refresh_interval,json=refreshInterval,proto3" json:"refresh_interval,omitempty"`
// Language used in the feed. (BCP 47 standard)
Language string `protobuf:"bytes,7,opt,name=language,proto3" json:"language,omitempty"`
// The timestamp (ISO 8601 format) of the last time the feed was checked for updates.
// This field is managed internally by the system and is not settable by clients in update requests.
LastChecked string `protobuf:"bytes,8,opt,name=last_checked,json=lastChecked,proto3" json:"last_checked,omitempty"`
// The timestamp (ISO 8601 format) of the most recent publication detected in the feed.
// This field is managed internally by the system and is not settable by clients in update requests.
LastPublication string `protobuf:"bytes,9,opt,name=last_publication,json=lastPublication,proto3" json:"last_publication,omitempty"`
// contains filtered or unexported fields
}
func (*Feed) Descriptor
deprecated
func (*Feed) GetLanguage ¶
func (*Feed) GetLastChecked ¶
func (*Feed) GetLastPublication ¶
func (*Feed) GetRefreshInterval ¶
func (*Feed) GetSectionCode ¶
func (*Feed) GetTypeExceptions ¶
func (x *Feed) GetTypeExceptions() []*ExceptionRule
func (*Feed) ProtoMessage ¶
func (*Feed) ProtoMessage()
func (*Feed) ProtoReflect ¶
func (x *Feed) ProtoReflect() protoreflect.Message
type FeedType ¶
type FeedType int32
func (FeedType) Descriptor ¶
func (FeedType) Descriptor() protoreflect.EnumDescriptor
func (FeedType) EnumDescriptor
deprecated
func (FeedType) Number ¶
func (x FeedType) Number() protoreflect.EnumNumber
func (FeedType) Type ¶
func (FeedType) Type() protoreflect.EnumType
type GetAllFeedsRequest ¶
type GetAllFeedsRequest struct {
// The page number to retrieve.
// Defaults to 0 if not specified, representing the first page.
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
// The number of items to include in each page of results.
// Defaults to 10 if not specified.
PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
// contains filtered or unexported fields
}
func (*GetAllFeedsRequest) Descriptor
deprecated
func (*GetAllFeedsRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetAllFeedsRequest.ProtoReflect.Descriptor instead.
func (*GetAllFeedsRequest) GetPage ¶
func (x *GetAllFeedsRequest) GetPage() int64
func (*GetAllFeedsRequest) GetPageSize ¶
func (x *GetAllFeedsRequest) GetPageSize() int64
func (*GetAllFeedsRequest) ProtoMessage ¶
func (*GetAllFeedsRequest) ProtoMessage()
func (*GetAllFeedsRequest) ProtoReflect ¶
func (x *GetAllFeedsRequest) ProtoReflect() protoreflect.Message
func (*GetAllFeedsRequest) Reset ¶
func (x *GetAllFeedsRequest) Reset()
func (*GetAllFeedsRequest) String ¶
func (x *GetAllFeedsRequest) String() string
type GetAllFeedsResponse ¶
type GetAllFeedsResponse struct {
// The current page number of the results being returned.
// Reflects the "page" value from the request.
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
// The page number of the next set of results, or -1 if there are no more pages.
NextPage int64 `protobuf:"varint,2,opt,name=next_page,json=nextPage,proto3" json:"next_page,omitempty"`
// The list of feeds available on the current page sorted by title.
Feeds []*Feed `protobuf:"bytes,3,rep,name=feeds,proto3" json:"feeds,omitempty"`
// contains filtered or unexported fields
}
func (*GetAllFeedsResponse) Descriptor
deprecated
func (*GetAllFeedsResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetAllFeedsResponse.ProtoReflect.Descriptor instead.
func (*GetAllFeedsResponse) GetFeeds ¶
func (x *GetAllFeedsResponse) GetFeeds() []*Feed
func (*GetAllFeedsResponse) GetNextPage ¶
func (x *GetAllFeedsResponse) GetNextPage() int64
func (*GetAllFeedsResponse) GetPage ¶
func (x *GetAllFeedsResponse) GetPage() int64
func (*GetAllFeedsResponse) ProtoMessage ¶
func (*GetAllFeedsResponse) ProtoMessage()
func (*GetAllFeedsResponse) ProtoReflect ¶
func (x *GetAllFeedsResponse) ProtoReflect() protoreflect.Message
func (*GetAllFeedsResponse) Reset ¶
func (x *GetAllFeedsResponse) Reset()
func (*GetAllFeedsResponse) String ¶
func (x *GetAllFeedsResponse) String() string
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 RssFeed ¶
type RssFeed interface {
GetAllFeeds(context.Context, *GetAllFeedsRequest) (*GetAllFeedsResponse, error)
UpdateFeed(context.Context, *UpdateFeedRequest) (*UpdateFeedResponse, error)
DeleteFeed(context.Context, *DeleteFeedRequest) (*DeleteFeedResponse, error)
}
func NewRssFeedJSONClient ¶
func NewRssFeedJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) RssFeed
NewRssFeedJSONClient creates a JSON client that implements the RssFeed interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewRssFeedProtobufClient ¶
func NewRssFeedProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) RssFeed
NewRssFeedProtobufClient creates a Protobuf client that implements the RssFeed interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
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
// google.golang.org/protobuf/types/descriptorpb.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.
// The path prefix is in the form: "/<prefix>/<package>.<Service>/"
// that is, everything in a Twirp route except for the <Method> at the end.
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 NewRssFeedServer ¶
func NewRssFeedServer(svc RssFeed, opts ...interface{}) TwirpServer
NewRssFeedServer builds a TwirpServer that can be used as an http.Handler to handle HTTP requests that are routed to the right method in the provided svc implementation. The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks).
type UpdateFeedRequest ¶
type UpdateFeedRequest struct {
// The feed object containing the updated data.
// All fields must be set except intenally mangaged fields.
Feed *Feed `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed,omitempty"`
// contains filtered or unexported fields
}
func (*UpdateFeedRequest) Descriptor
deprecated
func (*UpdateFeedRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateFeedRequest.ProtoReflect.Descriptor instead.
func (*UpdateFeedRequest) GetFeed ¶
func (x *UpdateFeedRequest) GetFeed() *Feed
func (*UpdateFeedRequest) ProtoMessage ¶
func (*UpdateFeedRequest) ProtoMessage()
func (*UpdateFeedRequest) ProtoReflect ¶
func (x *UpdateFeedRequest) ProtoReflect() protoreflect.Message
func (*UpdateFeedRequest) Reset ¶
func (x *UpdateFeedRequest) Reset()
func (*UpdateFeedRequest) String ¶
func (x *UpdateFeedRequest) String() string
type UpdateFeedResponse ¶
type UpdateFeedResponse struct {
// contains filtered or unexported fields
}
func (*UpdateFeedResponse) Descriptor
deprecated
func (*UpdateFeedResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateFeedResponse.ProtoReflect.Descriptor instead.
func (*UpdateFeedResponse) ProtoMessage ¶
func (*UpdateFeedResponse) ProtoMessage()
func (*UpdateFeedResponse) ProtoReflect ¶
func (x *UpdateFeedResponse) ProtoReflect() protoreflect.Message
func (*UpdateFeedResponse) Reset ¶
func (x *UpdateFeedResponse) Reset()
func (*UpdateFeedResponse) String ¶
func (x *UpdateFeedResponse) String() string