Documentation
¶
Overview ¶
newsapi implements an API client for NewsAPI (https://newsapi.org/docs)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Article ¶
type Article struct {
Source Source `json:"source"`
Title string `json:"title"`
Author string `json:"author,omitempty"`
Description string `json:"description,omitempty"`
Url string `json:"url,omitempty"`
ImageUrl string `json:"urlToImage,omitempty"`
PublishedAt time.Time `json:"publishedAt,omitempty"`
Content string `json:"content,omitempty"`
}
type ArticlesRequest ¶ added in v0.1.0
type ArticlesRequest struct {
Query string `json:"q,omitempty" jsonschema:"Search keywords or phrases"`
SearchIn string `` /* 143-byte string literal not displayed */
Sources string `` /* 140-byte string literal not displayed */
Domains string `` /* 130-byte string literal not displayed */
ExcludeDomains string `json:"excludeDomains,omitempty" jsonschema:"A comma-separated string of domains to remove from the results"`
From string `` /* 148-byte string literal not displayed */
To string `json:"to,omitempty" jsonschema:"A date and optional time for the newest article allowed. ISO 8601 format"`
Language string `json:"language,omitempty" jsonschema:"The 2-letter ISO-639-1 code of the language you want to get articles for"`
SortBy string `json:"sortBy,omitempty" jsonschema:"The order to sort the articles in. Possible options: relevancy, popularity, publishedAt"`
PageSize int `json:"pageSize,omitempty" jsonschema:"The number of results to return per page (max 100)"`
Page int `json:"page,omitempty" jsonschema:"Use this to page through the results"`
}
func (*ArticlesRequest) Values ¶ added in v0.1.0
func (r *ArticlesRequest) Values() url.Values
type Client ¶
type HeadlinesRequest ¶ added in v0.1.0
type HeadlinesRequest struct {
Query string `json:"q,omitempty" jsonschema:"Keywords or phrases to search for in the article title and body"`
Category string `` /* 170-byte string literal not displayed */
Country string `json:"country,omitempty" jsonschema:"The 2-letter ISO 3166-1 code of the country you want to get headlines for"`
Sources string `` /* 184-byte string literal not displayed */
Language string `json:"language,omitempty" jsonschema:"The 2-letter ISO-639-1 code of the language you want to get headlines for"`
PageSize int `json:"pageSize,omitempty" jsonschema:"The number of results to return per page (max 100)"`
Page int `json:"page,omitempty" jsonschema:"Use this to page through the results"`
}
func (*HeadlinesRequest) Values ¶ added in v0.1.0
func (r *HeadlinesRequest) Values() url.Values
type SourcesRequest ¶ added in v0.1.0
type SourcesRequest struct {
Category string `` /* 168-byte string literal not displayed */
Language string `json:"language,omitempty" jsonschema:"The 2-letter ISO-639-1 code of the language you want to get sources for"`
Country string `json:"country,omitempty" jsonschema:"The 2-letter ISO 3166-1 code of the country you want to get sources for"`
}
func (*SourcesRequest) Values ¶ added in v0.1.0
func (r *SourcesRequest) Values() url.Values
Click to show internal directories.
Click to hide internal directories.