Documentation
¶
Index ¶
- Variables
- func NewNewsEndpoints() []*api.Endpoint
- func RegisterNewsHandler(s server.Server, hdlr NewsHandler, opts ...server.HandlerOption) error
- type Article
- func (*Article) Descriptor() ([]byte, []int)deprecated
- func (x *Article) GetCategories() []string
- func (x *Article) GetDescription() string
- func (x *Article) GetId() string
- func (x *Article) GetImageUrl() string
- func (x *Article) GetKeywords() string
- func (x *Article) GetLanguage() string
- func (x *Article) GetLocale() string
- func (x *Article) GetPublishedAt() string
- func (x *Article) GetSnippet() string
- func (x *Article) GetSource() string
- func (x *Article) GetTitle() string
- func (x *Article) GetUrl() string
- func (*Article) ProtoMessage()
- func (x *Article) ProtoReflect() protoreflect.Message
- func (x *Article) Reset()
- func (x *Article) String() string
- type HeadlinesRequest
- func (*HeadlinesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HeadlinesRequest) GetDate() string
- func (x *HeadlinesRequest) GetLanguage() string
- func (x *HeadlinesRequest) GetLocale() string
- func (*HeadlinesRequest) ProtoMessage()
- func (x *HeadlinesRequest) ProtoReflect() protoreflect.Message
- func (x *HeadlinesRequest) Reset()
- func (x *HeadlinesRequest) String() string
- type HeadlinesResponse
- func (*HeadlinesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HeadlinesResponse) GetArticles() []*Article
- func (*HeadlinesResponse) ProtoMessage()
- func (x *HeadlinesResponse) ProtoReflect() protoreflect.Message
- func (x *HeadlinesResponse) Reset()
- func (x *HeadlinesResponse) String() string
- type NewsHandler
- type NewsService
- type TopStoriesRequest
- func (*TopStoriesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *TopStoriesRequest) GetDate() string
- func (x *TopStoriesRequest) GetLanguage() string
- func (x *TopStoriesRequest) GetLocale() string
- func (*TopStoriesRequest) ProtoMessage()
- func (x *TopStoriesRequest) ProtoReflect() protoreflect.Message
- func (x *TopStoriesRequest) Reset()
- func (x *TopStoriesRequest) String() string
- type TopStoriesResponse
- func (*TopStoriesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *TopStoriesResponse) GetArticles() []*Article
- func (*TopStoriesResponse) ProtoMessage()
- func (x *TopStoriesResponse) ProtoReflect() protoreflect.Message
- func (x *TopStoriesResponse) Reset()
- func (x *TopStoriesResponse) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var File_proto_news_proto protoreflect.FileDescriptor
Functions ¶
func NewNewsEndpoints ¶
func RegisterNewsHandler ¶
func RegisterNewsHandler(s server.Server, hdlr NewsHandler, opts ...server.HandlerOption) error
Types ¶
type Article ¶
type Article struct { // article id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // article title Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` // article description Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // related keywords Keywords string `protobuf:"bytes,4,opt,name=keywords,proto3" json:"keywords,omitempty"` // first 60 characters of article body Snippet string `protobuf:"bytes,5,opt,name=snippet,proto3" json:"snippet,omitempty"` // url of the article Url string `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"` // image url ImageUrl string `protobuf:"bytes,7,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` // time it was published PublishedAt string `protobuf:"bytes,8,opt,name=published_at,json=publishedAt,proto3" json:"published_at,omitempty"` // source of news Source string `protobuf:"bytes,9,opt,name=source,proto3" json:"source,omitempty"` // categories Categories []string `protobuf:"bytes,10,rep,name=categories,proto3" json:"categories,omitempty"` // the article language Language string `protobuf:"bytes,11,opt,name=language,proto3" json:"language,omitempty"` // the locale Locale string `protobuf:"bytes,12,opt,name=locale,proto3" json:"locale,omitempty"` // contains filtered or unexported fields }
func (*Article) Descriptor
deprecated
func (*Article) GetCategories ¶
func (*Article) GetDescription ¶
func (*Article) GetImageUrl ¶
func (*Article) GetKeywords ¶
func (*Article) GetLanguage ¶
func (*Article) GetPublishedAt ¶
func (*Article) GetSnippet ¶
func (*Article) ProtoMessage ¶
func (*Article) ProtoMessage()
func (*Article) ProtoReflect ¶
func (x *Article) ProtoReflect() protoreflect.Message
type HeadlinesRequest ¶
type HeadlinesRequest struct { // comma separated list of languages to retrieve in e.g en,es Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"` // comma separated list of countries to include e.g us,ca Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"` // date published on in YYYY-MM-DD format Date string `protobuf:"bytes,3,opt,name=date,proto3" json:"date,omitempty"` // contains filtered or unexported fields }
Get the latest news headlines
func (*HeadlinesRequest) Descriptor
deprecated
func (*HeadlinesRequest) Descriptor() ([]byte, []int)
Deprecated: Use HeadlinesRequest.ProtoReflect.Descriptor instead.
func (*HeadlinesRequest) GetDate ¶
func (x *HeadlinesRequest) GetDate() string
func (*HeadlinesRequest) GetLanguage ¶
func (x *HeadlinesRequest) GetLanguage() string
func (*HeadlinesRequest) GetLocale ¶
func (x *HeadlinesRequest) GetLocale() string
func (*HeadlinesRequest) ProtoMessage ¶
func (*HeadlinesRequest) ProtoMessage()
func (*HeadlinesRequest) ProtoReflect ¶
func (x *HeadlinesRequest) ProtoReflect() protoreflect.Message
func (*HeadlinesRequest) Reset ¶
func (x *HeadlinesRequest) Reset()
func (*HeadlinesRequest) String ¶
func (x *HeadlinesRequest) String() string
type HeadlinesResponse ¶
type HeadlinesResponse struct { Articles []*Article `protobuf:"bytes,1,rep,name=articles,proto3" json:"articles,omitempty"` // contains filtered or unexported fields }
func (*HeadlinesResponse) Descriptor
deprecated
func (*HeadlinesResponse) Descriptor() ([]byte, []int)
Deprecated: Use HeadlinesResponse.ProtoReflect.Descriptor instead.
func (*HeadlinesResponse) GetArticles ¶
func (x *HeadlinesResponse) GetArticles() []*Article
func (*HeadlinesResponse) ProtoMessage ¶
func (*HeadlinesResponse) ProtoMessage()
func (*HeadlinesResponse) ProtoReflect ¶
func (x *HeadlinesResponse) ProtoReflect() protoreflect.Message
func (*HeadlinesResponse) Reset ¶
func (x *HeadlinesResponse) Reset()
func (*HeadlinesResponse) String ¶
func (x *HeadlinesResponse) String() string
type NewsHandler ¶
type NewsHandler interface { Headlines(context.Context, *HeadlinesRequest, *HeadlinesResponse) error TopStories(context.Context, *TopStoriesRequest, *TopStoriesResponse) error }
type NewsService ¶
type NewsService interface { Headlines(ctx context.Context, in *HeadlinesRequest, opts ...client.CallOption) (*HeadlinesResponse, error) TopStories(ctx context.Context, in *TopStoriesRequest, opts ...client.CallOption) (*TopStoriesResponse, error) }
func NewNewsService ¶
func NewNewsService(name string, c client.Client) NewsService
type TopStoriesRequest ¶ added in v1.4.0
type TopStoriesRequest struct { // comma separated list of languages to retrieve in e.g en,es Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"` // comma separated list of countries to include e.g us,ca Locale string `protobuf:"bytes,2,opt,name=locale,proto3" json:"locale,omitempty"` // date published on in YYYY-MM-DD format Date string `protobuf:"bytes,3,opt,name=date,proto3" json:"date,omitempty"` // contains filtered or unexported fields }
Get the top stories
func (*TopStoriesRequest) Descriptor
deprecated
added in
v1.4.0
func (*TopStoriesRequest) Descriptor() ([]byte, []int)
Deprecated: Use TopStoriesRequest.ProtoReflect.Descriptor instead.
func (*TopStoriesRequest) GetDate ¶ added in v1.4.0
func (x *TopStoriesRequest) GetDate() string
func (*TopStoriesRequest) GetLanguage ¶ added in v1.4.0
func (x *TopStoriesRequest) GetLanguage() string
func (*TopStoriesRequest) GetLocale ¶ added in v1.4.0
func (x *TopStoriesRequest) GetLocale() string
func (*TopStoriesRequest) ProtoMessage ¶ added in v1.4.0
func (*TopStoriesRequest) ProtoMessage()
func (*TopStoriesRequest) ProtoReflect ¶ added in v1.4.0
func (x *TopStoriesRequest) ProtoReflect() protoreflect.Message
func (*TopStoriesRequest) Reset ¶ added in v1.4.0
func (x *TopStoriesRequest) Reset()
func (*TopStoriesRequest) String ¶ added in v1.4.0
func (x *TopStoriesRequest) String() string
type TopStoriesResponse ¶ added in v1.4.0
type TopStoriesResponse struct { Articles []*Article `protobuf:"bytes,1,rep,name=articles,proto3" json:"articles,omitempty"` // contains filtered or unexported fields }
func (*TopStoriesResponse) Descriptor
deprecated
added in
v1.4.0
func (*TopStoriesResponse) Descriptor() ([]byte, []int)
Deprecated: Use TopStoriesResponse.ProtoReflect.Descriptor instead.
func (*TopStoriesResponse) GetArticles ¶ added in v1.4.0
func (x *TopStoriesResponse) GetArticles() []*Article
func (*TopStoriesResponse) ProtoMessage ¶ added in v1.4.0
func (*TopStoriesResponse) ProtoMessage()
func (*TopStoriesResponse) ProtoReflect ¶ added in v1.4.0
func (x *TopStoriesResponse) ProtoReflect() protoreflect.Message
func (*TopStoriesResponse) Reset ¶ added in v1.4.0
func (x *TopStoriesResponse) Reset()
func (*TopStoriesResponse) String ¶ added in v1.4.0
func (x *TopStoriesResponse) String() string
Click to show internal directories.
Click to hide internal directories.